Ask a 2D FEA tool for the force on an iron region and it will integrate the vacuum Maxwell stress tensor over a shell around that region. Ask it for the force on an iron region that is touching another iron region — a closed relay, a magnetic latch, a pole shoe against a yoke — and most tools will refuse, or worse, answer. Both responses deserve an explanation.
Why the usual method needs air
The implemented method integrates the vacuum Maxwell stress tensor
Tᵢⱼ = (Bᵢ Bⱼ − ½ δᵢⱼ |B|²) / μ₀
over a one-element shell surrounding the region. That tensor is divergence-free only where the material is vacuum or air and free of current. Inside permeable material its divergence is not zero: there is a distributed magnetic body force wherever μ varies with position, and wherever the material is nonlinear.
A shell that passes through iron therefore picks up spurious contributions, and the result becomes arbitrary — it depends on exactly where inside the iron you happened to draw the shell. That is the real reason FEMM and every other stress-tensor-based tool requires the integration region to be surrounded by air. It is not a limitation of the implementation; it is a property of the tensor.
What is well defined, and what is not
This distinction is worth stating precisely, because it is where most confusion lives.
For a body fully surrounded by air, the total electromagnetic force is unique, and every correct method agrees on it. This is the comfortable case, and it is most of engineering practice.
For two magnetic bodies in direct contact, the pair invariant is still unique: the total force on the connected assembly, computed with an air shell around the whole assembly, is well defined. But the split of the interface force between the two touching bodies is not determined by Maxwell's equations alone. It depends on the magnetic stress model you adopt — Korteweg–Helmholtz and Kelvin, among others, distribute force differently between volume and interface, and magnetostriction is a further term normally neglected altogether. All the models agree again the moment the bodies are separated by even an infinitesimal air layer.
So a tool that silently hands you a number for the force on one of two touching parts is not answering a question that has one answer. The honest position is to compute a specific, named, reproducible convention, and to say which one.
The coenergy (Korteweg–Helmholtz) tensor
The convention worth adopting is the one already behind the “virtual work” force in commercial FEM codes. Keep the eggshell machinery and replace only the tensor evaluated in the shell elements:
Tᵢⱼ = Hᵢ Bⱼ − δᵢⱼ · w_co w_co = ∫₀ᴸ B(Hʹ)·dHʹ (magnetic coenergy density)
Three properties make this the right choice rather than merely a possible one:
-
In air,
B = μ₀Handw_co = ½μ₀|H|², soTreduces exactly to the vacuum Maxwell stress tensor. One code path, and the existing air-surrounded behaviour is bit-identical — no regression to argue about. -
In linear material,
w_co = ½H·Bin closed form; no BH curve needed. - In nonlinear material, the coenergy comes from integrating the material's own BH curve — which is precisely the Coulomb virtual-work method recast in eggshell form, equivalent to differentiating coenergy with respect to a virtual displacement of the region.
Because this tensor's divergence correctly accounts for the body-force density inside homogeneous material, a shell drawn inside the neighbouring iron gives a position-insensitive result — which is the property the vacuum tensor lacked, and the one you can test directly by moving the shell and re-running.
The invariant to check
There is one sanity check that costs a single extra evaluation and should be run every time you compute a contact-pair force:
F(region A) + F(region B) = air-eggshell force on the merged assembly
The right-hand side is the unambiguous quantity. If the split does not add up to it, the split is wrong, whatever convention it claims to follow. If it does add up, you have a reproducible division of a well-defined total — which is what the physics permits, and all it permits.
Practical guidance
If you can put air between the parts, do — even a nominal gap. The answer is then unique and every method agrees, and a real assembly has a real gap anyway, set by surface finish. Where the contact is genuinely the case of interest — a latch holding closed, a relay at the end of its stroke, a clamped stack — take the coenergy force, record that it is the virtual-work convention, and check the pair sum. Report it as what it is, and the number will survive review.
Force on regions surrounded by air works in every edition, including the free one. The magnet-latch and solenoid-actuator example models are the quickest way to see the method on a real geometry.
Related: far-field boundaries for open-boundary actuator models, and the post-processing chapter of the manual.