Residuals in NF2 and PINNs
A residual is the leftover error when a predicted field is substituted into an equation it is supposed to satisfy.
Small residual means the equation is nearly satisfied. Large residual means the model is violating the intended physics.
Residual versus residual loss
The residual is usually a vector or scalar field. A residual loss is a one-number summary used for optimisation or diagnostics.
For an equation written schematically as:
the residual of the model prediction is:
A common scalar loss is an L2/MSE-style average:
So the residual is the local equation error; the loss is the averaged penalty.
NF2 / NLFFF examples
The NLFFF target equations are:
and:
The force-free residual is:
It measures departure from magnetic force balance. If it is small, the current density is nearly parallel to the magnetic field.
The divergence residual is:
It measures violation of solenoidality. Large divergence means the model is creating artificial magnetic sources or sinks.
The boundary residual is closer to ordinary supervised error:
It measures mismatch between the learned bottom boundary and the observed photospheric magnetogram.
Why it matters
A field can look visually plausible while failing the governing equations. Residuals are the basic check that the model is not just drawing smooth loops.
For NF2/PINN training, the loss often has the form:
The individual terms should be monitored separately because the model can trade one objective against another. For example, it may fit the magnetogram better while becoming less divergence-free, or reduce force-free error while drifting away from the observed boundary.