Physics simulators for shock-forming flows, such as gas dynamics, shallow water and traffic, are often almost right. The equations are known, but the grid is too coarse, or friction, viscosity and sub-grid effects are missing. A popular fix is to bolt a neural network onto the solver and train it to supply the missing piece. For these flows the bolt-on is dangerous. A correction learned from data can inject energy or destroy entropy (the second law of thermodynamics, run backwards). It may look fine on training trajectories and then blow up on a stronger shock it has never seen. The tools that make classical shock solvers trustworthy have not been carried over to learned corrections for systems of equations. The literature has done this only for single-equation (scalar) problems, and even there without proofs.
We propose to restrict where the neural network is allowed to act. Every learned term enters the solver in one of two forms. The first is a flux correction that is algebraically blind to entropy, because it is projected so that it produces zero entropy. The second is a dissipation term that is a positive semidefinite matrix times the jump in entropy variables. Entropy variables are a change of coordinates, the gradient of the physical entropy, in which compressible-flow equations become symmetric. With these two forms, the semi-discrete scheme satisfies a discrete entropy inequality for every possible setting of the network weights, on vector systems like the compressible Euler equations, and across shocks. The second law then acts as a global stability certificate for the learned nonlinear model. Unlike Lipschitz-based certificates, it does not degrade when gradients become unbounded at a shock.
Core Claim
Take a conservative finite-volume solver for a hyperbolic system $\partial_t U + \partial_x F(U) = 0$ with a strictly convex entropy $S(U)$ and entropy variables $V = \partial S/\partial U$. At each cell interface with left and right states $U_L, U_R$ and entropy-variable jump $[V] = V_R - V_L$, we use the learned numerical flux
$$ \hat F_\theta(U_L,U_R) = F_{EC}(U_L,U_R) + \Big(I - \tfrac{[V][V]^T}{\|[V]\|^2}\Big)\, g_\theta(U_L,U_R) - L_\theta(U_L,U_R)\,L_\theta(U_L,U_R)^T [V]. $$
Here $F_{EC}$ is a known two-point entropy-conservative flux, one satisfying Tadmor's condition $[V]^T F_{EC} = [\psi]$, where $\psi$ is the entropy potential. The vector network $g_\theta$ supplies a correction whose projection removes any component along $[V]$, so it cannot change entropy. The matrix network $L_\theta$ makes $L_\theta L_\theta^T$ positive semidefinite, so the last term can only remove entropy. For consistency, $g_\theta$ is built to vanish when $U_L = U_R$. One example is multiplying by $\|[V]\|$ and symmetrizing.
For unmodeled source physics such as bottom friction, we add a cell source $s_\theta(U)$ projected so that $V^T s_\theta \le 0$. Summing over cells under periodic or entropy-neutral boundaries gives
$$ \frac{d}{dt}\sum_i S(U_i)\,\Delta x = -\sum_{\text{interfaces}} [V]^T L_\theta L_\theta^T [V] + \sum_i V_i^T s_\theta(U_i)\,\Delta x \;\le\; 0, $$
independently of $\theta$. The claim we will test is practical as well as formal. Because the hard constraint holds outside the training distribution, these models should match unconstrained residual models in-distribution. They should also stay bounded and accurate on out-of-distribution shocks and long rollouts where unconstrained or softly penalized models fail.
Where This Sits
The architecture is taken from classical entropy-stable numerics. Interface fluxes there are split into an entropy-conservative part and dissipation acting on $[V]$. Symmetrization via entropy variables underpins the stability proofs for high-order Navier–Stokes discretizations in Discontinuous Galerkin method for Navier–Stokes equations using kinetic flux vector splitting. Entropy-variable degrees of freedom give entropy stability together with lake-at-rest preservation for shallow water in Entropy stability and well-balancedness of space-time DG for the shallow water equations with bottom topography. Kinetic-energy-preserving centered fluxes that remain entropy stable are built in Kinetic Energy Preserving and Entropy Stable Finite Volume Schemes for Compressible Euler and Navier-Stokes Equations. Dissipation scaled by entropy-consistent eigenvectors stabilizes under-resolved flows without hand-tuned viscosity in On the robustness and performance of entropy stable collocated discontinuous Galerkin methods. All of these design the dissipation by hand. We keep their entropy-conservative backbone and learn only the parts that the inequality leaves free.
Three neural lines motivate the gap. wPINNs put Kružkov entropy conditions into an adversarial weak-form loss and prove error bounds. They state that the method does not extend to systems, because systems lack the infinite family of Kružkov entropies, and they approximate the whole solution rather than correcting a solver. Our construction needs only the single physical entropy pair a system does have, and it enforces the inequality in the architecture rather than the loss. (U)NFV is the closest prior work: a CNN learns finite-volume fluxes and is observed to converge to entropy solutions on 1D scalar problems. It has no entropy-variable structure and no dissipation proof, and its authors list systems such as Euler as future work. We differ in two ways. Our learned flux is constrained so that entropy stability is a theorem rather than an observation, and our targets are vector systems. Efficiently Parameterized Neural Metriplectic Systems enforces energy conservation and entropy growth through orthogonal projections onto energy and entropy gradients. The idea is the same as our projection of $g_\theta$, but NMS is limited to lumped ODEs, and its authors name PDEs as open work. We transplant that projection idea to interface fluxes, where the relevant gradient is the jump $[V]$.
Two works constrain the design. Structure Preserving Neural Networks for Boltzmann entropy closure shows that entropy variables diverge near the boundary of physically realizable states, such as vacuum. Our guarantee therefore says nothing about positivity, and near-vacuum tests are a required stress case rather than an afterthought. APIC documents that physics parameters get distorted when trained jointly with a neural stream, and it uses gradient detachment as an empirical remedy. In our design the physics part, $F_{EC}$, has no trainable parameters, so it cannot be distorted.
On the nonlinear-guarantee side, Neural Closure Certificates verifies safety through Lipschitz margins, which become inconclusive at shocks. Imitation Learning with Stability and Safety Guarantees certifies stability only for linear time-invariant plants. In our setting the total entropy plays the role a Lyapunov function plays in control: it is a non-increasing functional valid for the nonlinear, discontinuous learned dynamics. This is how we interpret "generalization to nonlinear systems". Two things should hold beyond the training regime and beyond linear theory: the certificate holds by construction, and the empirical question is whether accuracy follows it.
Research Program
The first piece is a differentiable 1D and 2D finite-volume solver in JAX. It will use logarithmic-mean entropy-conservative fluxes for compressible Euler and shallow water, plus the scalar Burgers and Lighthill–Whitham–Richards (LWR) traffic equations. Time stepping will be a strong-stability-preserving Runge–Kutta method. The guarantee above is semi-discrete, so fully discrete entropy production will be measured rather than assumed. A relaxation-type time stepper is an optional extension if measured violations are non-negligible.
The networks are small multilayer perceptrons acting on interface states, expressed in entropy variables and normalized. They share weights across interfaces, so the model is local and grid-transferable. $L_\theta$ has a lower-triangular output with a softplus diagonal.
The residual task is the same throughout. Coarse-grid inviscid physics, possibly with a misspecified constitutive law, must reproduce downsampled reference data that contains physics the coarse model lacks. The reference data includes viscosity and heat conduction in compressible Navier–Stokes, bed friction in shallow water, and fine-grid resolution effects everywhere. Training uses multi-step differentiable rollouts with an L1 trajectory loss, chosen to avoid the smoothing that mean-squared error causes at shocks.
We will analyze three questions. First, does the learned $L_\theta L_\theta^T$ recover wave-selective dissipation, meaning strong on acoustic waves and weak on contacts, when inspected in the eigenbasis of the flux Jacobian? Second, how much of the correction lives in the entropy-neutral channel $g_\theta$ versus the dissipative one? Third, how does the model behave as states approach vacuum? There we will test whether a standard positivity limiter preserves the entropy guarantee, and we will report failures honestly.
Baselines
The naive reference point is the coarse physics model alone: the entropy-conservative flux with a classical Rusanov or eigenvector-scaled dissipation of the kind used by Rojas et al. It is run on the same grid with no learning. Any learned model must beat it on trajectory error to justify the learning at all. Beating it means a lower relative L1 error at the final rollout time across the test distribution.
The strongest existing learned competitor is an (U)NFV-style unconstrained neural flux, following (U)NFV. It uses the same stencil width and the same supervised rollout loss, extended in the obvious way to vector systems by outputting all flux components. On scalar LWR and Burgers that paper reports "up to 10x lower error than the standard Godunov method". This is the number our Burgers and LWR replication must reproduce before system comparisons mean anything. For learned residual corrections on compressible Euler or Navier–Stokes, no reported result was found on Lacuna, so we will establish that baseline ourselves.
For scalar Burgers we also compare against wPINNs, which reports relative errors "often below 2%", with 0.01 on the standing shock and 0.019 on the moving shock. Our constrained model should match these on the same initial data. The point of that comparison is parity on scalar problems, since only our method runs on systems.
An unconstrained additive neural network residual in the style of NNAP adds $f_\theta(U)$ to the right-hand side. A black-box operator, the Fourier neural operator as benchmarked in PDEBench, completes the learned baselines. Its exact table values are not in the file, so we rerun it on the same data.
Fairness rules apply to every learned model. All get the same training trajectories and the same parameter count within a factor of two. All get the same number of hyperparameter-search trials (we will fix 30) and the same GPU-hour budget.
The ablations isolate the key ingredient. One removes the projection on $g_\theta$, another replaces $L_\theta L_\theta^T$ with an unconstrained matrix, and a third keeps both unconstrained but adds a soft penalty on positive entropy production to the loss.
We count the proposal as beating the baselines only under two conditions. It must be within 10% of the best unconstrained model's error in-distribution. It must also be strictly better on out-of-distribution error and on blow-up rate.
Why not just…?
Why not just train a large black-box neural operator on lots of rollouts? APIC reports that structure-free models such as the 3D Fourier neural operator and ResNet need several times more data to match structured models on transonic flow. NMS reports that unconstrained models leak energy over long horizons. Neither result covers our out-of-distribution shock setting, so the black-box operator stays in the comparison. It will be judged on the stronger-shock and long-horizon splits, where we expect it to fail.
Why not just add an entropy-production penalty to the loss of an unconstrained residual? This is the most serious threat. In-distribution, a soft penalty may give nearly identical accuracy at lower cost. A penalty only controls entropy on states seen in training. Our out-of-distribution splits use larger pressure ratios, higher Mach numbers and longer horizons, and the soft-penalty ablation will be measured there on violation frequency and blow-up rate. If it shows no violations and matches accuracy everywhere, the honest conclusion is that the hard constraint buys a proof but not performance. We will report that outcome as such.
Why not just learn a single nonnegative viscosity coefficient multiplying a classical entropy-stable dissipation? This is also entropy stable by construction, and simpler. It may well suffice. It cannot dissipate one wave family more than another, and it cannot represent entropy-neutral corrections such as dispersive or sub-grid momentum effects. We include it as a full method, not a strawman. If it matches the matrix-plus-projection model, we will adopt the scalar version and treat the extra structure as unnecessary.
Why not just use APIC-style gradient detachment with a symbolic kernel? Detachment protects trainable physics parameters from being distorted, but our backbone has no trainable parameters. The issue it addresses therefore does not arise here, and detachment offers no entropy guarantee across shocks. We will not run it as a separate baseline, except on 2D shallow water, where its regular-grid assumption holds.
Proposed Experiments
The scalar sanity tier uses inviscid Burgers, with the standing shock, moving shock, rarefaction and sine-wave cases from wPINNs, and the six LWR variants from (U)NFV. The goal is to reproduce the cited baseline numbers and show the constraint costs nothing.
The main tier uses three settings. The first is PDEBench 1D compressible Navier–Stokes, with coarse inviscid Euler physics as the base model and with viscosity values held out between training and test. The second is PDEBench 2D shallow-water dam break, with a friction source added to generate reference data. The third is standard Riemann problems: Sod, Lax, and a double rarefaction near vacuum. Training draws from a band of initial-jump strengths, and testing uses jumps two to five times larger.
The metrics are relative L1 error at fixed horizons, PDEBench's conserved-quantity and Fourier-band errors, and the fraction of cell-timesteps with positive discrete entropy production. We also measure the fraction of rollouts that produce negative density or pressure or diverge within 10 times the training horizon.
The decisive check is a two-way split. Either the constrained model matches the unconstrained (U)NFV-style and soft-penalty models in-distribution and dominates them out-of-distribution on blow-up rate and error, or it does not. A secondary check inspects whether the learned dissipation matrix, rotated into the characteristic basis, aligns with the physical wave structure. A final stress test asks whether the near-vacuum double rarefaction breaks the method, as the Boltzmann closure results predict entropy-variable methods should be fragile there. If it does, we report how far a positivity limiter repairs it.
References
- Discontinuous Galerkin method for Navier–Stokes equations using kinetic flux vector splitting
- Entropy stability and well-balancedness of space-time DG for the shallow water equations with bottom topography
- Kinetic Energy Preserving and Entropy Stable Finite Volume Schemes for Compressible Euler and Navier-Stokes Equations
- On the robustness and performance of entropy stable collocated discontinuous Galerkin methods
- wPINNs: Weak Physics informed neural networks for approximating entropy solutions of hyperbolic conservation laws
- (U)NFV: (Un)Supervised Neural Finite Volume Methods for Solving Hyperbolic PDEs
- Efficiently Parameterized Neural Metriplectic Systems
- Structure Preserving Neural Networks: A Case Study in the Entropy Closure of the Boltzmann Equation
- APIC: Orthogonalized Neuro-Symbolic Modeling for Nonlinear Dissipative Dynamics
- Neural Closure Certificates
- Imitation Learning With Stability and Safety Guarantees
- Neural Network Augmented Physics Models for Systems with Partially Unknown Dynamics: Application to Slider-Crank Mechanism
- PDEBench: An Extensive Benchmark for Scientific Machine Learning