The PINN Loss: Residual, Boundary, and Data Terms
How Kronos composes the physics residual, boundary conditions, and sparse measurements into a single differentiable loss for equilibrium and stability PINNs.
Composite loss
A PINN is trained by minimizing a weighted sum of a PDE-residual term, boundary/initial-condition terms, and (when available) a data-fit term against measurements. For the Grad-Shafranov solver the loss reads:
# total PINN loss
L = w_pde * L_pde + w_bc * L_bc + w_data * L_data
# 1) physics residual on N_f interior collocation points
L_pde = mean_i ( Delta_star(psi_theta)(x_i)
+ mu0 * R_i**2 * dp_dpsi(psi_theta(x_i))
+ F(psi) * dF_dpsi(psi_theta(x_i)) )**2
# 2) boundary condition on N_b edge points (e.g. psi = psi_bnd)
L_bc = mean_j ( psi_theta(x_j) - psi_bnd(x_j) )**2
# 3) data fit to L2-validated diagnostics (flux loops, Mirnov, MSE)
L_data = mean_k ( H(psi_theta)(x_k) - y_meas_k )**2
The differential operators inside L_pde are taken by automatic differentiation of the network, so no mesh is required. The data term H maps the flux field to what a diagnostic actually measures (a flux-loop integral, a line-integrated interferometer chord, a motional-Stark-effect pitch angle), which is how sparse, noisy measurements from L2 constrain the solution.
Weighting and conditioning
The weights w_pde, w_bc, w_data are not fixed. Kronos uses adaptive weighting (gradient-magnitude balancing) so no single term dominates the optimization and the boundary condition is not sacrificed to shrink an interior residual. Hard-constraint parameterizations, covered separately, remove the boundary term entirely by construction where possible, which improves conditioning.
The same template instantiates the MHD-stability PINN (residual = the linearized ideal-MHD eigenvalue operator) and the burner ambipolar-potential PINN (residual = the quasineutral Poisson-like balance for the mirror potential). One loss framework, three physics problems.