FEM/BEM Fredkin–Koehler demagnetization¶
Last changes: Documentation changelog
Scope and purpose¶
The canonical interaction is owned by Demagnetization. Fredkin–Koehler is a body-only FEM realization: the magnetic volume is meshed with FEM, while the open exterior is represented by a dense boundary operator on the closed magnetic surface. It is not the airbox Poisson problem and it has no production GPU BEM lane in the current public contract.
Scientific and numerical model¶
The total potential is decomposed into an interior source potential and a harmonic correction:
The boundary trace of \(u_2\) is supplied by the dense Fredkin–Koehler map:
The scalar Neumann problem has an additive gauge. The implementation removes it by pinning a gauge degree of freedom before solving the sparse system. Boundary triangles contribute the dense operator, including the oriented solid-angle self term:
Symbols and SI units¶
Symbol |
Meaning |
SI unit |
|---|---|---|
\(u\) |
total scalar potential |
\(\mathrm{A}\) |
\(u_1\) |
interior Poisson potential |
\(\mathrm{A}\) |
\(u_2\) |
harmonic boundary correction |
\(\mathrm{A}\) |
\(\mathbf M\) |
magnetization field |
\(\mathrm{A\,m^{-1}}\) |
\(\mathbf H_{\mathrm d}\) |
demagnetizing field |
\(\mathrm{A\,m^{-1}}\) |
\(v\) |
FEM test function |
\(1\) |
\(\Omega_m\) |
magnetic volume |
\(\mathrm{m^3}\) |
\(\Gamma_m\) |
closed magnetic surface |
\(\mathrm{m^2}\) |
\(\gamma\) |
FEM trace operator |
\(1\) |
\(\mathcal B\) |
dense boundary-integral map |
\(1\) |
\(g_2\) |
boundary values for \(u_2\) |
\(\mathrm{A}\) |
\(\omega_T\) |
oriented solid angle of triangle \(T\) |
\(1\) |
\(T\) |
oriented boundary triangle |
\(\mathrm{m^2}\) |
\(i\) |
boundary-node index |
\(1\) |
\(E_{\mathrm d}\) |
demagnetization energy |
\(\mathrm{J}\) |
\(\mu_0\) |
vacuum permeability |
\(\mathrm{N\,A^{-2}}\) |
Assumptions and validity¶
The magnetic surface is closed and consistently oriented. Open or self-intersecting surface topology invalidates the dense operator.
The interior Neumann solve requires an explicit gauge treatment; a singular matrix is not a converged solve.
The dense boundary operator and sparse FEM solves have separate discretization and algebraic errors.
rtolapplies to sparse solves, not to the boundary quadrature.The method is body-only FEM/BEM. An airbox is not implicitly added.
Current public support is FEM CPU/reference. FEM GPU is unsupported here and must not be inferred from other GPU Poisson sources.
Python API¶
# %% Configure the body-only FEM/BEM demag stage
import fullmag as fm
nm = 1.0e-9
study = fm.study("fem_bem_demag")
study.engine("fem")
study.device("cpu", precision="double")
study.mode("strict")
study.universe(mode="manual", size=(700 * nm, 250 * nm, 250 * nm))
film = study.geometry(
fm.Box(size=(500 * nm, 125 * nm, 3 * nm), name="film"),
name="film",
)
film.Ms = 8.0e5
film.Aex = 1.3e-11
film.alpha = 0.02
film.m = fm.init.UniformMagnetization((1.0, 0.1, 0.0))
study.demag(model="fredkin_koehler")
study.fem_demag_solver(
solver="CG",
preconditioner="AMG",
rtol=1.0e-10,
max_iterations=500,
)
study.stages.add_relax(
stage_id="relax",
algorithm="llg_overdamped",
solver="rk45",
dt_initial=1.0e-15,
dt_min=1.0e-17,
dt_max=1.0e-14,
max_err=1.0e-7,
tolT=1.0e-6,
max_steps=50_000,
)
Parameters¶
Python parameter |
Type |
Default |
SI unit |
Validation |
Meaning |
Backend support |
ProblemIR |
|---|---|---|---|---|---|---|---|
|
|
|
\(1\) |
|
realization family |
FEM CPU; GPU unsupported |
|
|
|
|
\(1\) |
omitted for non-airbox models |
airbox-only selector, not BEM policy |
not applicable |
|
|
|
required |
\(1\) |
integer greater than or equal to \(1\) |
interior FE order |
FEM CPU |
|
|
|
required |
\(\mathrm{m}\) |
finite positive; |
body mesh size |
FEM CPU |
|
|
|
|
\(1\) |
|
sparse solver for \(u_1\) and \(u_2\) |
FEM CPU |
|
|
|
|
\(1\) |
|
sparse preconditioner |
FEM CPU |
|
|
|
|
\(1\) |
finite and positive |
algebraic tolerance for each sparse solve |
FEM CPU |
|
|
|
|
\(1\) |
integer greater than or equal to \(1\) |
solve iteration ceiling |
FEM CPU |
|
ProblemIR and provenance¶
The canonical request is a demag interaction with a body-only FEM/BEM realization:
{
"energy_terms": [{"kind": "demag", "realization": "fredkin_koehler"}],
"backend_policy": {
"discretization_hints": {
"fem": {"order": 1, "hmax": 2e-8,
"demag_solver_policy": {"solver": "CG", "preconditioner": "AMG", "rtol": 1e-10, "max_iterations": 500}}
}
}
}
Requested realization and resolved FEM CPU path remain separate. Provenance records the closed surface topology, triangle quadrature, gauge DOF, both sparse solves, residuals, iteration counts, precision and energy reduction.
Diagnostics and failure semantics¶
Script export preserves the stage-first study and BEM realization. Validation errors include an
unsupported model, non-airbox variant, invalid surface topology, gauge failure, invalid sparse
solver policy and non-positive tolerances. Unsupported combinations are explicit: FEM GPU is
unsupported for this page and cannot silently fall back from an explicit GPU request to CPU.
Requested intent and resolved execution are recorded separately; rtol success does not prove
surface quadrature or physical open-boundary convergence.
Discrete realization by lane¶
Solver |
Device |
Status |
Realization |
|---|---|---|---|
FEM |
CPU |
partial/source-backed |
interior FEM \(u_1\), dense surface map, harmonic \(u_2\), two sparse solves and field recovery |
FEM |
GPU |
unsupported |
no production GPU FEM/BEM lane is claimed |
FDM |
CPU |
not applicable |
use FDM convolution |
FDM |
GPU |
not applicable |
use FDM convolution CUDA |
Where this is implemented¶
Claim |
Repository path |
Stable symbol |
Responsibility |
Lane |
|---|---|---|---|---|
BEM RHS/gauge |
|
|
Neumann RHS and gauge pin |
FEM CPU |
Dense operator |
|
|
surface map and solid angles |
FEM CPU |
Sparse solve |
|
|
policy-controlled solves |
FEM CPU |
Boundary values |
|
|
injects \(g_2\) |
FEM CPU |
Orchestration |
|
|
full sequence and telemetry |
FEM CPU |
Potential |
|
|
forms \(u_1+u_2\) |
FEM CPU |
Field recovery |
|
|
recovers \(\mathbf H_{\mathrm d}\) from the total potential |
FEM CPU |
Energy reduction |
|
|
reduces \(E_{\mathrm d}\) from \(\mathbf M\) and \(\mathbf H_{\mathrm d}\) |
FEM CPU |
Validation¶
Validate closed-surface topology, solid-angle diagonal/self term, gauge removal, \(u_1/u_2\) solver residuals, sphere/ellipsoid demag factors, field/energy identity and CPU artifact provenance. No GPU parity claim follows from a CPU BEM result.
Limitations¶
The dense surface operator scales with boundary complexity and is not a production GPU path. The page does not claim equivalence with an airbox truncation or universal geometry convergence.
Scientific bibliography¶
A. J. Fredkin and T. R. Koehler, “A quasi-magnetostatic finite-element method,” IEEE Transactions on Magnetics 26 (1990), DOI: 10.1109/20.106342.
Canonical physics owner: FEM/BEM Fredkin–Koehler demagnetization.
Control Room workflow¶
Use Model Explorer -> Stages -> Add stage -> <stage kind> for stage-level controls when the terminal page identifies a matching field. The current editor is partial: only fields surfaced by the stage draft are authorable. Numerical parameters without a matching control are not implemented in the frontend. Do not infer frontend support from Python or backend availability. See {doc}/frontend/capability-register for the current register and exact source owner.
Source-code index¶
Claim |
Repository path |
Stable symbol |
Responsibility |
Lane |
Evidence |
|---|---|---|---|---|---|
Public realization |
|
|
model and IR |
public API |
Python tests |
Gauge RHS |
|
|
gauge-pinned source |
FEM CPU |
source contracts |
Dense operator |
|
|
boundary map |
FEM CPU |
source contracts |
Sparse solves |
|
|
\(u_1/u_2\) solves |
FEM CPU |
runtime telemetry |
Orchestration |
|
|
sequence and artifacts |
FEM CPU |
runtime tests |
Potential |
|
|
total potential |
FEM CPU |
source contracts |
Field recovery |
|
|
field recovery |
FEM CPU |
source contracts |
Energy reduction |
|
|
energy reduction |
FEM CPU |
source contracts |