Exchange interaction¶
Review candidate
This is the first FullMag interaction page written against the implementation hierarchy. It is ready for scientific and editorial review, but it does not claim that every backend is qualified. In particular, current-revision executed-device proof is missing for FDM CUDA Exchange and for the newest mixed-element FEM CUDA path.
Physical problem¶
The exchange interaction penalizes spatial variation of the reduced magnetization (\mathbf m=\mathbf M/M_s). In the bulk micromagnetic model used by FullMag, the exchange stiffness (A>0) favors parallel neighboring magnetization and contributes both an energy (E_{\mathrm{ex}}) and an effective field (\mathbf H_{\mathrm{ex}}). The physical contract is shared, but its finite-difference and finite-element realizations are not interchangeable implementation details.
This page describes only bulk exchange on conforming magnetic domains. It does not silently fold surface exchange, RKKY/interlayer exchange, atomistic exchange, or nonconforming contact coupling into the bulk coefficient (A).
Governing equations¶
For magnetic domain (\Omega_m), the implemented continuum energy is
The effective field follows the FullMag SI convention
For constant (A), this becomes
The energy derivative and field must satisfy
The free-surface condition used by the implemented bulk operator is the natural zero-flux condition
Symbols and SI units¶
Symbol |
Definition |
SI unit |
|---|---|---|
(\mathbf M) |
magnetization |
A/m |
(M_s) |
saturation magnetization |
A/m |
(\mathbf m) |
reduced magnetization (\mathbf M/M_s) |
1 |
(m_q) |
Cartesian component of (\mathbf m) |
1 |
(A(\mathbf x)) |
bulk exchange stiffness |
J/m |
(\mu_0) |
vacuum permeability |
N/A² |
(E_{\mathrm{ex}}) |
exchange energy |
J |
(\mathbf H_{\mathrm{ex}}) |
exchange effective field |
A/m |
(\Omega_m) |
magnetic domain |
m³ as integration domain |
(\partial\Omega_m) |
magnetic boundary |
m² as integration surface |
(\mathbf n) |
outward unit normal |
1 |
(\boldsymbol\eta) |
admissible magnetization variation |
1 |
(i,j) |
discrete cell or node indices |
1 |
(N_6(i)) |
six Cartesian neighbors of FDM cell (i) |
1 |
(r_i) |
material-region index of cell (i) |
1 |
(A_{r_ir_j}) |
realized exchange coefficient of FDM link (i!\leftrightarrow!j) |
J/m |
(\Delta_{ij}) |
center-to-center grid spacing along link (i!\leftrightarrow!j) |
m |
(V_i) |
FDM cell volume |
m³ |
(\varphi_i) |
magnetic volume fraction of cell (i) |
1 |
(f_{i\to j}) |
directed magnetic face fraction |
1 |
(\delta_{i,d}) |
T1 boundary distance correction on side (d) |
m |
(\delta_{\min}) |
positive lower bound applied to T1 boundary distances |
m |
(\varphi_{\mathrm{floor}}) |
positive lower bound applied to magnetic volume fraction |
1 |
(\phi_i) |
scalar FEM basis function |
1 |
(K_A) |
exchange stiffness matrix |
J |
(M_V) |
geometric FEM mass matrix |
m³ |
(M_{M_s}) |
saturation-weighted FEM mass matrix |
A·m² |
(\mathbf q) |
consistent-mass projected exchange residual |
T |
(V_i^{\mathrm{lump}}) |
lumped nodal FEM volume |
m³ |
Assumptions and validity¶
Continuum micromagnetics is assumed; the mesh must resolve the relevant exchange length and magnetization variation.
Geometry coordinates are interpreted in metres. The Python authoring path emits SI geometry, but the native FEM mesh importer does not independently attach a unit tag to coordinates.
The reduced magnetization is expected to remain normalized by the surrounding solver contract.
The bulk free boundary is homogeneous Neumann. User-selected exchange Dirichlet data are not part of the current public
Exchange()term.A conforming FEM H1 space makes (\mathbf m) continuous across conforming material interfaces; the weak form implies normal flux continuity. This is not a model for discontinuous inter-body contact exchange.
FDM sub-cell corrections T0 and T1 are separate FP64 CUDA realizations. They must not be inferred for the CPU reference lane or FP32 CUDA lane.
Discrete realization by solver and device¶
FDM / CPU — double-precision reference lane¶
This lane is CpuReference; it is executable and useful as an oracle, but it is not FullMag’s
production FDM backend. The persistent runtime path uses a structure-of-arrays, six-neighbor,
uniform-material stencil:
Open or inactive neighbors are replaced by the center magnetization, which yields zero normal
exchange flux. Enabled periodic axes wrap the neighbor index. The hot runtime stencil uses f64.
The allocating reference accessor also contains a heterogeneous link form
That accessor does not establish heterogeneous production stepping: the persistent SoA path uses the scalar material values and does not consume explicit inter-region pair overrides. This is a documented implementation limitation, not a promised fallback.
FDM / GPU — native CUDA production implementation¶
The standard FP64 and FP32 kernels implement
The realized pair coefficient comes from the native exchange lookup table. A caller-supplied table is copied as supplied; FullMag does not infer a heterogeneous harmonic mean from per-region values inside the CUDA kernel. Open boundaries clamp to the center; periodic axes wrap for the standard stencil. FP64 uses double state and arithmetic. FP32 uses float state/field arithmetic while the energy reduction accumulates in FP64.
Each positive Cartesian link is counted once in the standard discrete energy:
FDM GPU T0 sub-cell correction — FP64 only¶
FDM GPU T1 sub-cell correction — FP64 only¶
For the positive-side link on axis (d), the exact implemented contribution is
T0/T1 do not consume periodic flags. FP32 rejects sub-cell correction rather than silently using a different model. The staged multilayer CUDA path is layer-local, supports FP64 and FP32 entry points, and presently has no cross-layer exchange, region LUT, or periodic exchange.
FEM / CPU — native MFEM implementation¶
FullMag uses one scalar continuous P1 H1 space for each Cartesian component and assembles the positive-semidefinite diffusion operator
Current production assembly is MFEM AssemblyLevel::LEGACY: a fully assembled sparse matrix, not
partial assembly and not a libCEED exchange operator. The default lumped projection is
The CPU-only consistent-mass option solves
The consistent solve uses MFEM conjugate gradients with relative tolerance (10^{-10}), zero absolute tolerance, and at most 200 iterations. Forms are restricted to magnetic elements; air-only nodes are zeroed. Periodicity is imposed by aggregating residual and mass over reduced-node equivalence classes and lifting the field back to full nodes.
FEM / GPU — MFEM assembly plus FullMag CUDA CSR kernels¶
FEM GPU Exchange is FP64. Setup assembles the legacy sparse operator through MFEM on the host, canonicalizes it as a symmetric graph Laplacian, and uploads CSR and mass data once. Accepted RK stages apply the operator with FullMag CUDA kernels:
The device energy is equivalent to the assembled quadratic form
The stage path is device-resident after setup and records exchange-specific transfer counters. Consistent-mass projection is not a GPU realization. libCEED can be present in the runtime bundle, but it is not the Exchange hot path.
Implementation mapping¶
The stable identity of each citation is repository path plus symbol. Links below are pinned to the
reviewed source revision a1f4dc0be9f53ece258b881d756db6f727ad5ecc; displayed line numbers may
be regenerated from the symbol when the code moves.
Validation status¶
Lane |
Evidence present in repository |
Honest status for this revision |
|---|---|---|
FDM CPU reference |
zero-field, second-difference, inactive-neighbor, periodic stencil, energy decrease and refinement tests |
Source/test mapped; no fresh run was performed for this review candidate. Heterogeneous allocating tests do not qualify heterogeneous SoA stepping. |
FDM GPU CUDA |
device-capable FP64 field/energy, CPU–GPU Tier A, FP64–FP32 Tier B and Heun parity tests |
Implemented; current-revision executed-device result and device identity were not found. Skip-success tests are not device proof. |
FEM CPU MFEM |
operator symmetry/PSD/nullspace, mixed P1 elements, magnetic-air masking, energy derivatives, spatial coefficients; managed sinusoidal energy-convergence CSV |
Strong historical energy/sign evidence; no fresh managed run tied to this review revision. Existing acceptance does not establish pointwise maximum-field convergence. |
FEM GPU CUDA |
MFEM/CUDA FP64 parity tests, device-residency and transfer-audit contracts; historical RTX 4080 SUPER runtime artifacts |
Historical tetrahedral runtime identity exists, but it predates the newest mixed-P1 implementation. Current mixed-P1 executed-device qualification remains open. |
The authoritative FEM runtime gate is just verify-fem-exchange-runtime. No command was executed
while preparing this review page because the existing recipe rewrites checked-in validation-result
files and the shared worktree contains unrelated user changes.
Known limitations and unresolved qualification¶
FDM CPU is a double-precision reference engine, not a native production backend.
The FDM CPU persistent SoA path does not establish per-cell or explicit pair-coupled heterogeneous exchange, despite richer allocating helper functions.
FDM GPU T0/T1 are FP64 and open-boundary only; FP32 fails closed for these corrections.
FDM staged multilayer exchange is layer-local and has no cross-layer exchange or periodicity.
FEM CPU currently uses legacy sparse MFEM assembly. It is not partial assembly, hypre, or libCEED exchange.
FEM GPU uses lumped projection only and FP64 CUDA CSR kernels; setup includes host assembly and one-time upload.
Bulk exchange does not implement RKKY, explicit surface exchange, pinned Dirichlet exchange, or nonconforming contact coupling.
Current source-bound executed-device qualification is missing for FDM GPU Exchange and newest mixed-P1 FEM GPU Exchange. This page therefore separates implementation availability from scientific qualification.
Scientific bibliography¶
W. F. Brown Jr., Micromagnetics, Interscience Publishers, New York, 1963. Bibliographic record.
M. J. Donahue and D. G. Porter, OOMMF User’s Guide, Version 1.0, NISTIR 6376, National Institute of Standards and Technology, 1999. doi:10.6028/NIST.IR.6376.
C. Abert, “Micromagnetics and spintronics: models and numerical methods,” European Physical Journal B 92, 120 (2019). doi:10.1140/epjb/e2019-90599-6.
T. Schrefl, G. Hrkac, S. Bance, D. Suess, O. Ertl, and J. Fidler, “Numerical methods in micromagnetics (finite element method),” in Handbook of Magnetism and Advanced Magnetic Materials, Wiley, 2007.
Source-code and test index¶
Topic |
Implementation symbol |
Test or evidence symbol |
Status |
|---|---|---|---|
FDM CPU standard field |
|
|
Test definitions present; not freshly executed here |
FDM CPU general accessor |
|
spatial (A,M_s) Taylor consistency tests |
Helper validated; runtime SoA equivalence not established |
FDM GPU FP64 |
|
|
Device-capable tests present; current device run absent |
FDM GPU FP32 |
|
|
Device-capable parity test present; current device run absent |
FDM GPU T0/T1 |
|
T0/T1 cases in |
Field/energy smoke present; derivative and geometry qualification incomplete |
FEM CPU |
|
|
Broad native contracts plus historical managed energy convergence |
FEM GPU |
|
CUDA/MFEM parity and transfer-audit cases in |
Historical device residency; current mixed-P1 qualification incomplete |
The implementation table above is the authoritative path-and-symbol map for this review candidate. The bibliography is scientific authority; the source index is implementation authority. Neither substitutes for an executed numerical qualification artifact.