Structural cages
A "cage" wraps a field and exposes a transformed view such that a physical invariant holds for every input and every parameter setting, to floating-point round-off. Cages replace soft penalty terms — and the failure modes that come with them.
The problem with soft penalties
A standard PINN imposes div u = 0 as a penalty λ·‖div u‖². That introduces:
- a hand-tuned weight
λ, - competing loss terms and an ill-conditioned optimization,
- an invariant that holds only approximately, even at convergence.
The cage approach
Enforce the invariant structurally instead.
2-D incompressibility (streamfunction)
u = ∂_y ψ, v = -∂_x ψ ⇒ ∂_x u + ∂_y v ≡ 0
from omnibias.pinn.torch import cage
field = cage.StreamfunctionField(base_field) # div u = 0 by construction
3-D incompressibility (vector potential)
u = curl(A) ⇒ div u ≡ 0
field = cage.VectorPotentialField(base_field)
Energy-conserving advection
The skew-symmetric advection form conserves kinetic energy exactly even when the predicted field is not perfectly divergence-free.
Why cages keep the fast path
Every higher-order derivative of the caged field reduces to mixed partials of the underlying potential, which the closed-form tower computes directly. So you get the invariant and the speed — the cage does not push you back onto nested autodiff.
Measured impact
On a 3-D Navier–Stokes PINN, the vector-potential cage cut training time by roughly 3× versus the soft-incompressibility baseline at the same forecast horizon — simply by removing one source of ill-conditioning from the objective.
Best practice
If an invariant can be written as a differential identity (a curl, a divergence, a conservation law), prefer a cage. You remove a hyperparameter, remove a failure mode, and keep your derivatives closed form.