Boundary Conditions¶
Last changes: Documentation changelog
Boundary conditions select the magnetostatic Green problem. They are part of the physical realization and the numerical operator, not a cosmetic mesh option. This chapter documents the outer closure for the shared-domain FEM Poisson realization and contrasts it with the FDM open-boundary convolution. The complete Poisson solve, field recovery, and energy reduction are documented in FEM Poisson airbox demagnetization; this page owns the boundary operator and its provenance.
1. Physical problem and boundary partition¶
Let \(\Omega_m\) be the magnetic region, \(\Omega_a\) the conforming magnetic-plus-air FEM domain, and \(\Gamma_a\) the selected outer airbox boundary. In the unbounded physical problem the scalar potential decays at infinity. A finite FEM domain must replace that condition by an explicit operator on \(\Gamma_a\).
The mesh does not make every boundary face an outer airbox face. Each boundary face carries a
marker. The resolved poisson_boundary_marker selects the marker that represents
\(\Gamma_a\). Interface faces between magnetic and air elements, periodic seam faces, and unrelated
boundary markers must not be accidentally included in the outer boundary operator.
The FDM realization has no FEM boundary marker, boundary mass matrix, or essential true-DOF list. Its open boundary is represented by the finite convolution embedding and zero padding; periodic FDM uses a different image or spectral policy. Consequently, a FEM marker error cannot be repaired by changing an FDM parameter.
2. Governing equations¶
The ideal open-boundary condition is
The two finite-airbox closures are different mathematical problems.
Dirichlet closure¶
The selected outer boundary is assigned a prescribed potential:
The value is enforced as an essential condition. In the discrete MFEM system, the corresponding essential true degrees of freedom are discovered from the selected boundary marker and eliminated from the sparse operator. The operator is not merely relabelled; its rows and columns are changed.
Robin closure¶
The selected outer boundary uses a first-order open-boundary approximation:
Here \(\partial_n\) is the outward normal derivative. Integrating the Poisson equation by parts adds a boundary mass contribution to the volume stiffness operator:
Its discrete operator is
\(K\) is assembled from the volume stiffness integrator and \(B_{\Gamma_a}\) is assembled from a boundary mass integrator on the selected marker only. The Robin surface contribution is therefore an operator contribution, not an additional post-processing energy term.
3. Robin coefficient and resolved geometry¶
The current runtime derives \(\beta\) from a dimensionless coefficient \(c\) and a reference radius \(R_\star\):
\(\mathcal A_{\mathrm open}\) contains the non-periodic coordinate axes. If the mesh has periodic node-pair metadata, the planner excludes the corresponding axes from this extent calculation. If no open axis is found, the implementation uses the largest mesh extent as the fallback reference scale and records that resolved policy. The fallback is not a claim that a fully periodic problem has become an open-boundary problem.
The runtime policy can select the dimensionless coefficient by mode:
the default policy uses the configured
robin_beta_factor;mode
1forces \(c=1\);mode
2forces \(c=2\);an invalid boundary marker fails before the matrix is accepted.
The effective \(\beta\) is a resolved value derived from the actual mesh. The current public Python
API selects variant="robin" but does not expose \(c\) or \(\beta\) as independent user
parameters. They must therefore be reported from runtime/provenance diagnostics, not reconstructed
from the Python request alone.
4. Exact implementation sequence¶
For FEM CPU the boundary module is called after the volume Poisson bilinear form exists:
determine whether the resolved realization is Robin or Dirichlet;
inspect the mesh boundary-attribute range;
validate that
poisson_boundary_markeris a valid marker;for Robin, build a zero/nonzero marker array with only the selected outer marker enabled;
remove periodic seam markers from that Robin marker array;
assemble and finalize the boundary mass matrix \(B_{\Gamma_a}\);
form \(A_{\mathrm R}=K+\beta B_{\Gamma_a}\) and clear the essential-DOF list;
for Dirichlet, discover essential true DOFs on the selected marker;
reject an empty essential-DOF list;
eliminate the Dirichlet rows and columns from the sparse operator;
pass the boundary-conditioned operator to the configured CG/GMRES and preconditioner path.
The boundary module does not assemble the magnetic right-hand side, solve the potential, recover \(\mathbf H_{\mathrm d}\), or reduce \(E_{\mathrm d}\). Those ownership boundaries are deliberate so that the same field and energy contract is used for Dirichlet and Robin.
5. Symbols and SI units¶
Symbol |
Definition |
SI unit |
|---|---|---|
\(u\) |
magnetic scalar potential |
\(\mathrm{A}\) |
\(\mathbf n\) |
outward unit normal on \(\Gamma_a\) |
\(1\) |
\(\partial_n u\) |
outward normal derivative of the scalar potential |
\(\mathrm{A\,m^{-1}}\) |
\(\beta\) |
Robin boundary coefficient |
\(\mathrm{m^{-1}}\) |
\(c\) |
dimensionless Robin coefficient selected by runtime policy |
\(1\) |
\(R_\star\) |
mesh reference radius for Robin scaling |
\(\mathrm{m}\) |
\(\Omega_m\) |
magnetic subdomain |
\(\mathrm{m^3}\) |
\(\Omega_a\) |
complete magnetic-plus-air FEM domain |
\(\mathrm{m^3}\) |
\(\Gamma_a\) |
selected outer airbox boundary |
\(\mathrm{m^2}\) |
\(\mathcal A_{\mathrm open}\) |
set of non-periodic coordinate axes |
\(1\) |
\(\mathbf M\) |
magnetization field in the magnetic subdomain |
\(\mathrm{A\,m^{-1}}\) |
\(V\) |
FEM trial/test-function space |
\(1\) |
\(K\) |
assembled volume stiffness matrix |
\(\mathrm{m}\) |
\(B_{\Gamma_a}\) |
assembled boundary mass matrix on \(\Gamma_a\) |
\(\mathrm{m^2}\) |
\(A_{\mathrm R}\) |
Robin-conditioned sparse operator |
\(\mathrm{m}\) |
\(v\) |
FEM test function |
\(1\) |
\(x_{d,\max},x_{d,\min}\) |
mesh extrema on open axis \(d\) |
\(\mathrm{m}\) |
\(\mathrm{marker}\) |
integer physical boundary attribute |
\(1\) |
6. Assumptions and validity limits¶
Robin is an approximation to the exterior Dirichlet-to-Neumann map. Its error depends on the airbox shape, distance, mesh resolution, selected coefficient, and unresolved multipole content. Dirichlet is also a finite-domain truncation; \(u=0\) on a nearby boundary is not the exact condition at infinity.
The following comparisons are invalid:
comparing Dirichlet and Robin as if they were two tolerances of one operator;
changing \(\beta\) while changing airbox distance and calling the difference solver error;
including periodic seam faces in the open Robin mass matrix;
accepting a Dirichlet solve with no selected essential true DOFs;
treating a low Krylov residual as proof that the airbox truncation error is small;
claiming FDM/FEM parity without matching the physical boundary problem.
Convergence must vary airbox distance, airbox mesh size, magnetic mesh size, boundary variant, and linear-solver tolerances independently. A production report must include the resolved marker, \(\beta\), open-axis set, periodic seam set, matrix policy, and solver convergence telemetry.
8. ProblemIR and provenance¶
The Python-to-IR normalization is:
Python request |
Canonical |
Boundary meaning |
|---|---|---|
|
|
Default finite-airbox Robin closure. |
|
|
Explicit auto request normalized to Robin. |
|
|
Robin boundary mass contribution. |
|
|
Essential true-DOF elimination. |
Requested intent must retain the original model and variant. Resolved execution must additionally record the FEM lane, mesh identity, outer marker and source of that marker, periodic seam markers, open-axis set, Robin mode/factor, effective \(\beta\), solver/preconditioner, tolerances, iteration limit, convergence state, and runtime/device identity.
9. Round-trip and failure semantics¶
Canonical Python export reproduces the requested model and variant, not merely the resolved
marker or \(\beta\). The following are constructor validation errors:
supplying
variantwithoutmodel;supplying a
varianttobem,fredkin_koehler, orfmm;using an unknown model or airbox variant;
combining the new
modelAPI with legacyrealization.
Unsupported combinations include a boundary variant on bem, fredkin_koehler, or fmm, a
variant without model, and simultaneous use of model and legacy realization. The
planner/runtime rejects a missing shared-domain airbox mesh, a marker absent from
mesh.bdr_attributes, a marker outside the attribute range, and a Dirichlet selection that
produces no essential true DOFs. These are fail-closed errors. The planner must not silently
replace Robin with Dirichlet, remove the airbox, include periodic seams, or switch to FDM.
10. Discrete realization by lane¶
FEM CPU¶
MFEM assembles the selected boundary operator on the host. Robin creates a boundary mass form and adds it to the copied sparse stiffness matrix. Dirichlet discovers essential true DOFs and eliminates rows and columns. The resulting operator is passed to the native Hypre solver policy.
FEM GPU¶
The device Poisson lane receives the resolved boundary policy and must preserve the same marker, periodic seam exclusion, Robin coefficient, operator identity, and solver stopping semantics. Device CSR/operator setup and device Hypre execution are separate qualification claims; a host assembly or source compilation does not prove executed-device parity.
FDM CPU and GPU¶
Neither FDM lane constructs \(B_{\Gamma_a}\) or essential true DOFs. Open FDM uses the cell-averaged tensor and its finite convolution embedding. Periodic FDM uses the selected periodic image/spectral policy. These lanes are not alternate implementations of the FEM airbox boundary operator.
11. Implementation mapping¶
The boundary operator ownership is:
Python
Demagvalidates and normalizes the requested model/variant;FEM planning resolves the shared-domain mesh, marker, periodic seams and Robin policy;
the native boundary module constructs the operator;
the linear-solver module consumes the conditioned operator;
recovery and energy modules consume only the solved potential/field.
12. Validation and qualification¶
Validation |
Required evidence |
|---|---|
Dirichlet marker |
Marker is in the mesh attribute range and produces non-empty essential true DOFs. |
Robin marker |
Only the selected marker contributes to \(B_{\Gamma_a}\). |
Periodic seams |
Every periodic seam marker is excluded from the Robin mass selection. |
Robin scaling |
Resolved \(c\), \(R_\star\), open-axis set, and \(\beta=c/R_\star\) are recorded. |
Operator identity |
Robin uses \(A_{\mathrm R}=K+\beta B_{\Gamma_a}\); Dirichlet uses essential elimination. |
Solver convergence |
|
Airbox convergence |
Vary distance and mesh independently for each boundary variant. |
CPU/GPU parity |
Same mesh, marker, boundary policy, precision, solver policy and executed-device identity. |
Contract tests cover marker import, Robin mode/factor propagation, Dirichlet/Robin selection, and operator construction. Runtime qualification must additionally show field and energy convergence; source-level contract success alone is not a production numerical proof.
13. Limitations¶
Neither finite Dirichlet nor finite Robin is exact at a finite airbox distance. The current public API does not expose arbitrary \(\beta\) or a direct boundary-marker argument; those resolved values come from the mesh/planner/runtime contract. A GPU source path is not reported as qualified without executed-device evidence.
14. Scientific bibliography¶
Fredkin, D. R. and Koehler, T. R., “A finite element method for computing demagnetizing fields in ferromagnetic materials,” IEEE Transactions on Magnetics 26 (1990).
Brown, W. F., Micromagnetics, Wiley, 1963.
FullMag internal reference:
docs/physics/0520-fem-robin-airbox-demag-bootstrap-reference.md.
15. Source-code index¶
Repository path |
Stable symbol |
Responsibility |
Lane |
|---|---|---|---|
|
|
Boundary variant validation and IR normalization. |
Public API |
|
|
FEM realization and capability resolution. |
FEM planner |
|
|
Certified outer-boundary marker selection. |
FEM planner |
|
|
Robin/Dirichlet operator construction, periodic seam exclusion and marker checks. |
FEM CPU |
|
|
Consumes the conditioned operator under solver policy. |
FEM CPU |
|
|
Device CSR operator upload and boundary-policy transfer. |
FEM GPU |
|
|
FDM open/periodic convolution realization. |
FDM CPU |
|
|
FDM device convolution state; no FEM boundary matrix. |
FDM GPU |
Control Room crosswalk¶
Use Model Explorer -> Objects -> <object> -> Physics when PhysicsInteractionPanel exposes the interaction. Status: partial. frontend support is not implemented applies to physical parameters without a matching control. See {doc}/frontend/capability-register; do not infer UI support from backend or Python availability.
Python/API crosswalk¶
The linked Python API page is authoritative for exact functions, arguments, units, and failure semantics. If this page is a foundation or category overview, runnable Python is ot applicable here and must be taken from the terminal API page.
Bibliography and source scope¶
Use the scientific bibliography and source-code index on the linked terminal page. This block adds no new equation or unverified implementation claim.
Source-code index¶
Public Python and lowering sources are linked by the applicable terminal API page. Runtime realization is in the relevant
backends/fdmorbackends/femlane; frontend ownership isapps/control-room/src/modules/inspector/panels/PhysicsInteractionPanel.tsxwhere a live control exists.