betaFeedback

WorksComputer Science

Structure-preserving fidelity diagnostics for partial differential equations

Abstract

Machine learning surrogates of partial differential equations (PDEs) are commonly trained on data generated by numerical solvers. Therefore, the training data obey not the PDE but the modified equation of the numerical scheme, and the test loss, computed on data from the same solver, cannot distinguish a model that learned the physics from one that learned the discretization error. Here, we show that the difference is nevertheless visible in the trained model. We propose a suite of structure-preserving fidelity diagnostics, simple scores that measure whether a learned model respects one known property of the physics, such as a conserved quantity, a symmetry or a Hamiltonian structure, without access to the training data or the governing equation. Over five systems, the diagnostics track the error with respect to the true dynamics with a rank correlation of up to 0.940.94, while the test loss is uncorrelated or anti-correlated with it. For the Burgers, Korteweg-de Vries and Navier-Stokes equations, the diagnostics separate numerical schemes that the test loss ranks as equivalent, including schemes of the same order. order.

Introduction

Machine learning models of physical systems described by partial differential equations (PDEs) have become a standard tool, either as fast surrogates of the solution [1, 2, 3] or as a means to discover the governing equation from data [4, 5]. Since experimental data are scarce, such models are in most cases trained on data generated by numerical solvers. A numerical solver, however, only approximates the PDE. In fact, a consistent scheme of order qq on a grid of spacing hh solves exactly a slightly different equation, the modified equation of the scheme [6, 7], which differs from the PDE by terms of order hqh^q. For example, first-order upwinding of the Burgers equation adds an artificial viscosity proportional to hh. Consequently, a model that fits the training data well learns the modified equation rather than the PDE. For time integrators of ordinary differential equations this effect has been observed and corrected for when the scheme is known [8, 9].

In practice, however, the scheme is often not known to the user of a trained model, and the standard validation of a machine learning model, the test loss, cannot reveal it: the test data are generated by the same solver as the training data, so the test loss measures how well the model reproduces the solver, not the physics. As we show in § 2 B, three models of the Burgers equation trained on data from three different solvers have test losses within a factor of 1.7 of each other, while their errors with respect to the true dynamics differ by a factor of 71. The test loss ranks a model that learned an artificial viscosity as good as the model that learned the physics. Alternatively, checks that compare the model with the governing equation require the equation and all its coefficients, which are not available in most applications of learned surrogates.

We postulate that the information is nevertheless stored in the trained model. Numerical schemes typically break some structural property of the physics, such as a conserved quantity, a symmetry or a Hamiltonian structure, at the order of their discretization error. A model that learned the modified equation inherits this violation, while a model that learned the physics does not. To this end, we propose fidelity diagnostics, simple scores D[fθ]D[f_\theta] of a trained model fθf_\theta that are zero if the model respects a given structural property and positive otherwise. The diagnostics require only the name of the property, not the governing equation, and are evaluated on the trained model alone, without the training data and in most cases without a rollout. We collect them in a diagnostic suite, Table I, which lists for each diagnostic what it requires and what it detects, and which can be applied to other learned models in the same way.

We test the diagnostics on the viscous Burgers equation, the Korteweg–de Vries (KdV) equation and two-dimensional (2D) Navier–Stokes flow, each discretized by several schemes that generate the training data of otherwise identical models. We show that the test loss fails to indicate the error of the models while the diagnostics track it, that the learned models reproduce the discretization error of their solver quantitatively, and that different diagnostics detect different schemes. Furthermore, we show which diagnostics cannot work: linear conserved quantities and self-consistency checks of learned time-steppers, including the recently proposed semigroup consistency [10]. Finally, we report a case in which the diagnostics do not indicate the rollout error.

First, we discuss related work in § 1.1. We introduce the modified equation, the learned models and the diagnostics in Section III. In § 2 the experiments and results are presented. The paper finishes with a discussion of the limitations and a summary. The appendix contains the derivations, the details of the experimental setup and additional results.

Related work and motivation

Learned surrogates. Neural operators and related architectures [2, 11, 12] are trained and evaluated on data from numerical solvers, as are the standard benchmarks [13], and comparisons are often made against weak numerical baselines [14]. Here we address a complementary issue: even a perfect fit to solver data reproduces the solver, and an evaluation on data from the same solver cannot detect it.

Physics-informed learning. Physical knowledge is often imposed during training, as a penalty on the PDE residual [1, 15] or through the architecture [16], which requires the equation or fixes the structure by construction. In contrast, we test structural properties after training.

Modified equation

The modified equation is a standard tool for the analysis of numerical schemes [6, 7]. For ordinary differential equations learned from time series, it has been shown that the learned vector field approximates the modified equation of the integration scheme used in training, and that this can be corrected when the scheme is known [8, 9]. Similarly, sparse regression methods for equation discovery [4, 5] recover the modified equation when the data are simulated. Our setting differs in two respects: the scheme is not known, and the question is asked of the trained model alone.

Self-consistency. Learned time-steppers can be checked without labels by testing whether they compose correctly over time, used as a training constraint [17] and recently as a diagnostic for learned simulators [10]. We show in § 2 E that such checks cannot detect a discretization error.

Background and method

Modified equation

Consider a PDE ut=N[u]u_t = \mathcal{N}[u] and a numerical scheme with grid spacing hh. Taylor expansion of the discrete operator gives the modified equation [6]

ut=Nh[u]=N[u]+hqR[u]+O(hq+1),(1)u_t = \mathcal{N}_h[u] = \mathcal{N}[u] + h^q R[u] + O(h^{q+1}), \tag*{(1)}

where qq is the order of the scheme and RR is the leading error term. For example, for the Burgers equation ut+uux=νuxxu_t + u u_x = \nu u_{xx} with second-order central differences, R=−16uuxxx+ν12uxxxxR = -\frac{1}{6}u u_{xxx} + \frac{\nu}{12}u_{xxxx}, a dispersive error. A solution computed with the scheme satisfies Eq. (1) more accurately than the PDE. Hence, training data generated by the scheme are samples of Nh\mathcal{N}_h, and a learned model fθf_\theta that minimizes the training loss approximates Nh\mathcal{N}_h. The same holds for time integrators, where the step size Δt\Delta t takes the role of hh [7].

Learned models

Each model fθf_\theta maps a state uu to its time derivative utu_t and is trained by minimizing the mean squared error on pairs (u,ut)(u,u_t), with utu_t estimated from snapshots by a fourth-order finite difference in time. Every scheme is observed identically: the same snapshot interval, number of samples and observation noise. The models are stencils with polynomial terms in uu, linear in their parameters and fitted in closed form, so that no optimizer variance enters the comparison. Each model class contains the modified equation of every compared scheme; schemes outside the class are reported but excluded from the claims (Appendix C).

Fidelity diagnostics

A fidelity diagnostic measures the violation of one structural property PP of the physics by the trained model,

DP[fθ]=⟨∥rP(fθ,u)∥2⟩⟨∥sP(fθ,u)∥2⟩,(2)D_P[f_\theta] = \frac{\left\langle\lVert r_P(f_\theta,u)\rVert^2 \right\rangle}{\left\langle\lVert s_P(f_\theta,u)\rVert^2 \right\rangle}, \tag*{(2)}

where rPr_P is a residual that vanishes if PP holds, sPs_P a normalization of the same size as the terms entering rPr_P, and ⟨⋅⟩\langle\cdot\rangle the average over probe states uu that are drawn independently of the training data.

The diagnostic suite is summarized in Table I. It consists of three families. The conservation diagnostic Da[Q]D_a[Q] measures whether the model changes a quantity QQ at the rate prescribed by the physics, for example zero for a conserved momentum or −ν∫ux2 dx-\nu\int u_x^2\,\mathrm{d}x for the energy of a viscous flow; the drift diagnostic Ddrift[Q]D_{\mathrm{drift}}[Q] measures the same along a rollout of the model. The symmetry diagnostic Dc[g]D_c[g] measures whether the model commutes with a symmetry gg of the physics, for example a Galilean boost or time reversal. The structure diagnostic DjD_j measures whether the Jacobian of the model has the form required by the physics, for example the symmetry implied by a Hamiltonian structure, and the recovery diagnostic DdD_d fits a sparse equation to the model’s own output and measures the terms that do not belong to the physics. Each diagnostic requires only the property it tests, and all except DdriftD_{\mathrm{drift}} are evaluated without a rollout. If a scheme violates the property at order hqh^q, then DP[Nh]=O(h2q)D_P[\mathcal{N}_h] = O(h^{2q}) while DP[N]=0D_P[\mathcal{N}] = 0. Whether a learned model inherits this value is the question we test.

To evaluate the diagnostics, every model is also scored by its transfer error EtrE_{\mathrm{tr}}, the root-mean-square relative deviation of a rollout of the model from an accurate reference solution of the PDE over a time horizon TT. The transfer error is available here only because the data are synthetic. It is the quantity a diagnostic should indicate in practice, where the true solution is unknown.

Limits of detection

Not every structural property is broken by a numerical scheme. Two simple observations determine in advance which diagnostics can respond; derivations are given in Appendix B.

Linear conserved quantities. If a quantity that is linear in the state, such as the total mass ∫u dx\int u\,\mathrm{d}x, is conserved by the PDE, it is conserved exactly by every Runge–Kutta time integrator and by every spatial scheme in flux form. Consequently, the corresponding diagnostic is zero for every scheme and cannot separate them. We use such diagnostics as negative controls, which must not separate the models. Quadratic quantities, such as energy, are in general not preserved [7], and their diagnostics can respond.

Self-consistency. A learned time-stepper Gθ(u,τ)G_\theta(u,\tau), which advances a state by a time τ\tau, can be checked for self-consistency without any knowledge of the physics. For instance, the semigroup error [10]

diagnostictests whether the modelrequiresrolloutdetects, spread across learned models
Conservation
Da[Q]D_a[Q]changes a quantity QQ at the rate of the physicsQQ and its ratenoartificial viscosity and dispersion, Burgers 9.0×1079.0 \times10^7; non-conservative forms, KdV 123; energy–enstrophy pair, Navier–Stokes 5.6; Euler schemes, oscillators 4.5×1034.5 \times10^3
Ddrift[Q]D_{\mathrm{drift}}[Q]keeps QQ along its own rolloutQQyesnon-symplectic schemes, oscillators 9.1×1039.1 \times10^3
Symmetry
Dc[g]D_c[g]commutes with a symmetry ggthe symmetry ggnodispersive error, Burgers 6.0×1036.0 \times10^3 (blind to viscosity); time reversal, oscillators 1.4×1031.4 \times10^3
Structure
DjD_jhas a Jacobian of the required form, e.g. Hamiltonianthe structurenonon-symplectic schemes, oscillators 8.4×1028.4 \times10^2–3.4×1033.4 \times10^3; KdV 3.9 (limited by the fit)
DdD_dcontains no terms outside a sparse equationcandidate termsnoBurgers 8.6×1028.6 \times10^2; spurious terms exactly zero except for Euler schemes, oscillators
Cannot detect a solver
Da[c⊤u]D_a[c^\top u]conserves a linear quantity (mass, circulation)QQnonegative control, silent: spread ≤4.5\le4.5
EsgE_{\mathrm{sg}} and other self-consistency checkscomposes consistently in timenothingnodetects invalid time-steppers, not solvers: spread 1.04–1.08 across solvers

Table 1. TABLE I. The diagnostic suite. Each diagnostic is computed from the trained model alone, Eq. (2), and requires only the listed property of the physics. Last column: what the diagnostic detects in this work, with its spread (largest over smallest value) across the learned models of each system. The last two rows are diagnostics that cannot detect a solver (Section III D).

Esg=∥Gθ(Gθ(u,s),t)−Gθ(u,s+t)∥∥Gθ(u,s+t)∥(3)E_{\mathrm{sg}} = \frac{\lVert G_\theta(G_\theta(u,s),t)-G_\theta(u,s+t)\rVert}{\lVert G_\theta(u,s+t)\rVert} \tag*{(3)}

measures whether two consecutive steps agree with a single step of the combined length. However, the one-step map of a numerical scheme is, to all orders in hh, the exact time-hh map of its modified equation [7]. A model that learned the modified equation therefore learned a valid time evolution, only of a different equation, and satisfies every self-consistency check as well as a model that learned the physics. Self-consistency checks thus test the learner, not the physics.

Experiments and results

Test loss and diagnostics

We first compare the test loss and the diagnostics over all systems, before discussing each system in turn. For every system, models are trained on data from several schemes of the same equation, and each model is scored by its test loss, its transfer error and the largest diagnostic of the suite. In addition to the three PDEs, we include the two Hamiltonian oscillators of Appendix D, where the error comes from the time integrator. Figure 1(a) shows that the test loss is nearly the same for all models of a system, within a factor of 2.9, while their transfer errors span more than two orders of magnitude. The rank correlation of the test loss with the transfer error lies between −0.70 and +0.13 (Figure 1(c)). It is even negative on four of the five systems, which we attribute to the reference scheme being the hardest one for a local model to fit (Appendix D). Consequently, the test loss does not indicate which models learned the physics. In contrast, the largest diagnostic grows with the transfer error (Figure 1(b)), with a rank correlation between 0.71 and 0.94 on Burgers, KdV and the two oscillators. The diagnostics thus expose the models that learned a solver artifact, while the test loss ranks them as equivalent. The exception is Navier–Stokes, where the diagnostic is anti-correlated with the transfer error (ρ=−0.62\rho= -0.62; § 2.D). Across schemes, the strongest diagnostic varies by factors between 5.6 (Navier–Stokes) and 9×1079 \times10^7 (Burgers), compared with at most 2.9 for the test loss.

Figure 1. Test loss against fidelity diagnostics. Each marker is one learned model (scheme and seed); both axes are relative to the model trained on the reference scheme (JAJ_A for Navier–Stokes). (a) Test loss and (b) the largest diagnostic of the suite against the transfer error. (c) Spearman rank correlation with the transfer error per system, for the test loss (open) and the diagnostic (filled). Navier–Stokes (grey) is discussed in § 2 D.

Burgers equation

We consider the viscous Burgers equation ut+uux=νuxxu_t + uu_x = \nu u_{xx} on a periodic domain with ν=0.04\nu= 0.04, n=192n = 192 grid points and smooth random initial conditions. The training data are generated by four schemes: a pseudo-spectral reference, which stands in for the physics; second-order central differences; central differences with an added artificial viscosity 12h∣u∣ux\frac{1}{2}h|u|u_x, a standard stabilization in shock-capturing schemes; and first-order upwinding, which adds an effective viscosity 12∣u∣h\frac{1}{2}|u|h. model is a stencil of radius 5, quadratic in uu. It contains the first three schemes exactly. The upwind scheme switches with the sign of uu and is outside the model class; it is shown for completeness only.

The test losses of the three representable models are 2.4×10−82.4 \times10^{-8}, 1.8×10−81.8 \times10^{-8} and 3.0×10−83.0 \times10^{-8}, while their transfer errors are 2.4×10−42.4 \times10^{-4}, 4.6×10−44.6 \times10^{-4} and 1.7×10−21.7 \times10^{-2}: the model trained with artificial viscosity fits its data as well as the reference model and predicts the true dynamics 71 times worse.

The trained model shows why. Linearizing fθf_\theta around a uniform state uˉ\bar{u} gives, for each wavenumber kk, an effective viscosity νeff(k)\nu_{\mathrm{eff}}(k) and a phase speed c(k)c(k). For the PDE, νeff=ν\nu_{\mathrm{eff}}=\nu and c=uˉc=\bar{u}. For central differences, νeff=ν(2−2cos⁡kh)/(kh)2\nu_{\mathrm{eff}}=\nu(2-2\cos kh)/(kh)^2 and c=uˉsin⁡(kh)/(kh)c=\bar{u}\sin(kh)/(kh), and the artificial viscosity replaces ν\nu by ν+h/2\nu+h/2 (Appendix A). Figure 2 compares these analytic values with the learned models. Each learned model follows the scheme that generated its data, not the PDE. For k≤16k \le16 the learned effective viscosity deviates from that of its scheme by at most 1.5%, while the artificial viscosity raises it by 41% above the physical value; the learned phase speed deviates from that of its scheme by at most 0.04%, while the scheme deviates from the PDE by up to 4.5%. Reading the excess viscosity directly from the model gives νeff−ν=0.01631\nu_{\mathrm{eff}}-\nu=0.01631, compared with the analytic value h/2=0.01636h/2=0.01636, a ratio of 0.997 for each of the three training seeds. The model has learned the modified equation of its solver to within the accuracy of the fit. For the upwind scheme, which the model can only represent on average, the ratio to the averaged prediction 12⟨∣u∣⟩h\frac{1}{2}\langle|u| \rangle h varies between 0.77 and 1.45 over seeds.

Figure 2. Linearized learned Burgers models. (a) Effective viscosity at uˉ=0\bar{u}=0; (b) relative error of the phase speed at uˉ=0.6\bar{u}=0.6. Markers: learned models trained on data from each scheme (median over three seeds). Lines: analytic values of the scheme; dashed: the PDE. The upwind line (grey, dotted) is the averaged prediction ν+12⟨∣u∣⟩h\nu+\frac{1}{2}\langle|u| \rangle h. Shaded: wavenumbers at which the training data carry less than 10−610^{-6} of the peak power, so the model is not constrained by the data.

The diagnostics inherit this difference. The energy diagnostic DaD_a, which uses the energy decay rate of the PDE and thus requires ν\nu, separates the three representable models by a factor of 9.0×1079.0 \times10^7. The Galilean symmetry diagnostic DcD_c, which requires only the transformation u↦u+cu \mapsto u+c, x↦x−ctx \mapsto x-ct, separates them by 6.0×1036.0 \times10^3. However, DcD_c cannot distinguish the central scheme from its artificially viscous vari-

ant (3.33×10−63.33 \times10^{-6} and 3.34×10−63.34 \times10^{-6}), since a viscosity term is Galilean invariant while the dispersive error is not. Different diagnostics detect different schemes, so a single diagnostic is not sufficient.

Korteweg–de Vries equation

A diagnostic that only measured accuracy would rank schemes by their order. To test whether the diagnostics measure structure instead, we use the KdV equation ut=−(3u2)x−δ2uxxxu_t = -(3u^2)_x - \delta^2 u_{xxx} with δ2=0.05\delta^2 = 0.05 on N=127N = 127 grid points [18]. KdV conserves mass M=∫u dxM = \int u\,\mathrm{d}x, momentum P=∫u2 dxP = \int u^2\,\mathrm{d}x and the energy H=∫(u3−12δ2ux2) dxH = \int(u^3 - \frac{1}{2}\delta^2 u_x^2)\,\mathrm{d}x, and it is Hamiltonian, which implies a symmetry condition on the Jacobian of the right-hand side that DjD_j measures directly (Appendix A). The nonlinear term (3u2)x(3u^2)_x can be discretized with the same second-order central stencil in three forms: the flux form 3D(u2)3D(u^2), the advective form 6uDu6uDu, and the skew-symmetric combination of 2/3 flux and 1/3 advective form. All three conserve mass, but only the skew-symmetric form conserves momentum (Appendix A). We compare these three forms, a fourth-order skew-symmetric form and a pseudo-spectral reference.

Table II shows the diagnostics of the numerical operators. Mass is conserved by every scheme, as expected from Section III D, so Da[M]D_a[M] serves as a negative control. Momentum separates the three second-order forms completely, from round-off for the skew-symmetric form to 5.6×10−85.6 \times10^{-8} and 2.2×10−72.2 \times10^{-7} for the flux and advective forms. The structure diagnostic DjD_j is at round-off for the pseudo-spectral reference and between 10−1210^{-12} and 10−810^{-8} for the finite-difference schemes.

We train a quadratic stencil model of radius 5 on data from each scheme. The test losses of the five models are within a factor of 2.0 of each other, while their transfer errors differ by a factor of 61. The momentum diagnostic separates the learned models by a factor of 123, with the skew-symmetric form lowest (last column of Table II), and the energy diagnostic by a factor of 77. Thus, the diagnostics separate schemes of the same order, which differ only in structure, by two orders of magnitude.

Notably, DjD_j also revealed an error in our own reference solver. On a grid with an even number of points, the highest Fourier mode k=N/2k = N/2 is ambiguous, the quadratic term aliases into it, and the pseudo-spectral derivative is no longer exactly antisymmetric. DjD_j of the reference operator is 8.1×10−88.1 \times10^{-8} at N=64N = 64, compared with round-off at N=63N = 63. Therefore, we use an odd number of grid points throughout.

Two-dimensional Navier–Stokes flow

We consider 2D incompressible flow in vorticity form, ωt+J(ψ,ω)=ν∇2ω\omega_t + J(\psi,\omega) = \nu\nabla^2\omega with ∇2ψ=−ω\nabla^2\psi= -\omega, on a periodic 48×4848 \times48 grid with ν=0.05\nu= 0.05. The nonlinear term JJ has three second-order central discretizations, J1J_1 (advective form), J2J_2 (flux form in ω\omega) and J3J_3 (flux form in ψ\psi), which agree in the continuum but not on the grid. Their average JA=13(J1+J2+J3)J_A = \frac{1}{3}(J_1 + J_2 + J_3) conserves both energy E\mathcal{E} and enstrophy Z\mathcal{Z} [19]. The Poisson solve and the viscous term are spectral for every scheme, so the nonlinear term is the only difference. The model is a 3×33 \times3 stencil with terms quadratic in (ω,ψ)(\omega,\psi), which contains all four schemes.

Figure 3(a) shows the energy and enstrophy diagnostics of the four schemes. J2J_2 conserves only enstrophy, J3J_3 only energy, JAJ_A both and J1J_1 neither, in agreement with the classical result [19]. Importantly, neither diagnostic alone identifies the correct scheme: the energy diagnostic cannot distinguish JAJ_A from J3J_3, and the enstrophy diagnostic cannot distinguish it from J2J_2. Only the combination isolates it.

Figure 3(b) repeats the measurement on the learned models. The test losses of the four models are equal (1.0× spread). The pattern of panel (a) is preserved, but the separation shrinks from round-off against 10−710^{-7} to a factor of 5.6 for enstrophy and 3.3 for energy.

Figure 3. 2D Navier–Stokes, 48×4848 \times48, ν=0.05\nu= 0.05. (a) Energy and enstrophy diagnostics of the four second-order schemes and the spectral reference; values below 10−2710^{-27} (shaded) are round-off and shown at 10−3010^{-30}. (b) The same diagnostics for models trained on data from each scheme (median over three seeds). (c) Transfer error of the learned models against the rollout horizon TT. The model with the correct structure (JAJ_A, black) has the third-lowest error at every horizon.

On Navier–Stokes, unlike Burgers and KdV, the ranking of the diagnostics does not agree with that of the transfer error. The JAJ_A model has the lowest diagnostics but the third-lowest transfer error, at every horizon up to T=10T = 10 [Figure 3(c)]. Hence, in this viscous flow the diagnostics identify the scheme with the correct structure, but they do not indicate the rollout error.

Self-consistency checks

To test the second observation of Section III D, we compare the semigroup error, Eq. (3), with the fidelity diagnostics on the same learned time-steppers. The model is a time-stepper Gθ(u,τ)=u+∑m≥1τmgm(u)G_\theta(u,\tau) = u + \sum_{m\geq1}\tau^m g_m(u), which also provides the vector field g1g_1 for the fidelity diagnostics [17]. Fitting such a model with a polynomial library in the full state is only feasible in low dimensions, so this test uses two Hamiltonian oscillators, a coupled harmonic and an anharmonic one (Appendix D). We vary two factors independently: the solver that generates the data, for a fixed model class, and the model class, for fixed data.

Figure 4 shows the result for the harmonic system. Across solvers, the semigroup error changes by less than 4%, from 1.79×10−41.79 \times10^{-4} to 1.85×10−41.85 \times10^{-4}. Across model classes, it changes by a factor of 1.1×1031.1 \times10^3, so the measurement works and detects models that are not valid time-steppers. On the same models, the energy and structure diagnostics separate explicit Euler from the reference by 6.5×1046.5 \times10^4. The anharmonic system gives the same picture (semigroup error 1.08× across solvers, energy diagnostic 1.3×1041.3 \times10^4). For a linear system the statement is exact: the time-stepper that reproduces explicit Euler for a rotation with step 0.25 corresponds to a vector field that is 12% wrong, and has a semigroup error of 4×10−164 \times10^{-16} (Appendix B). Consequently, self-consistency checks and fidelity diagnostics are complementary: the former test the learner, the latter test the physics.

Figure 4. Semigroup error and fidelity diagnostics on the same learned time-steppers, coupled harmonic oscillators, median over three seeds. (a) Data from four solvers, one model class: the semigroup error is constant, while the energy diagnostic Da[H]D_a[H] and the structure diagnostic DjD_j separate explicit Euler by more than four orders of magnitude. (b) One data set, three model classes, of which only the first is a valid time-stepper: the semigroup error separates them.

Limitations

The diagnostics require one structural property of the physics, which must be known. On learned PDE models they are limited by the fit error of the model: separations of more than ten orders of magnitude between the numerical operators shrink to factors of 4 to 6 for the KdV structure diagnostic and the Navier–Stokes conservation diagnostics. Additionally, on

schemeDjD_jDa[M]D_a[M]Da[P]D_a[P]Da[H]D_a[H]Da[P]D_a[P] of the learned model
spectral<10−30<10^{-30}<10−30<10^{-30}<10−30<10^{-30}<10−30<10^{-30}7.7×10−97.7 \times10^{-9}
skew, 4th8.8×10−128.8 \times10^{-12}<10−30<10^{-30}<10−30<10^{-30}7.9×10−137.9 \times10^{-13}6.6×10−96.6 \times10^{-9}
skew, 2nd2.6×10−112.6 \times10^{-11}<10−30<10^{-30}<10−30<10^{-30}2.7×10−82.7 \times10^{-8}1.8×10−91.8 \times10^{-9}
flux, 2nd1.4×10−91.4 \times10^{-9}<10−30<10^{-30}5.6×10−85.6 \times10^{-8}2.0×10−92.0 \times10^{-9}5.6×10−85.6 \times10^{-8}
advective, 2nd7.3×10−97.3 \times10^{-9}<10−30<10^{-30}2.2×10−72.2 \times10^{-7}2.1×10−72.1 \times10^{-7}2.2×10−72.2 \times10^{-7}

Table 2. KdV, N=127N = 127. Diagnostics of the numerical operators for the structure (DjD_j), mass (MM), momentum (PP) and energy (HH), averaged over 16 probe states. Values below 10−3010^{-30} are round-off. Last column: momentum diagnostic of the model trained on data from each scheme (median over three seeds).

Navier–Stokes the diagnostics did not indicate the rollout error. The models used here are linear in their parameters, which isolates the effect of the solver from that of the optimization; deep networks, which add optimization error, remain to be tested. Finally, with five schemes per system the rank correlations describe orderings; a systematic variation of hh at fixed order is needed to measure the expected h2qh^{2q} scaling directly.

Summary and outlook

In this work we studied what a learned model of a PDE learns when its training data are generated by a numerical solver. Over five systems, the test loss, computed on data from the same solver, is uncorrelated or anti-correlated with the error with respect to the physics. We showed that the model learns the modified equation of the solver quantitatively, and that an artificial viscosity is recovered from a learned Burgers model to within 0.4%. We proposed a suite of fidelity diagnostics, Table I, which measure whether a trained model respects one structural property of the physics and require neither the training data nor the governing equation. The diagnostics track the error on four of the five systems and separate schemes of the same order for the KdV equation. For Navier–Stokes, they identify the scheme that conserves both energy and enstrophy, but they do not indicate the rollout error. Furthermore, we showed that linear conserved quantities and self-consistency checks, such as the semigroup error, cannot detect a solver.

Notably, different diagnostics detect different schemes, and already for Navier–Stokes a single property is not sufficient: only the combination of energy and enstrophy identifies the conservative scheme. More complex equations, for example turbulent or multi-physics flows, or PDEs whose invariants are not known in closed form, will therefore require more elaborate diagnostics, combining several properties, resolving them by scale, or deriving them from the symmetries of the equation. Developing such diagnostics, and testing them on deep neural surrogates, is the subject of future work. We anticipate that fidelity diagnostics can serve as a simple validation step for learned surrogates and discovered equations, in particular when the origin of the training data is not known.

References

Schemes and their errors

Burgers. With the central differences D1ui=(ui+1−ui−1)/2hD_1u_i=(u_{i+1}-u_{i-1})/2h and D2ui=(ui+1−2ui+ui−1)/h2D_2u_i=(u_{i+1}-2u_i+u_{i-1})/h^2, Taylor expansion gives D1u=ux+h26uxxx+O(h4)D_1u=u_x+\frac{h^2}{6}u_{xxx}+O(h^4) and D2u=uxx+h212uxxxx+O(h4)D_2u=u_{xx}+\frac{h^2}{12}u_{xxxx}+O(h^4), from which the error term RR in Section III follows. Inserting u=uˉ+ϵeikxu=\bar{u}+\epsilon e^{ikx} into −uD1u+νD2u-uD_1u+\nu D_2u and keeping terms linear in ϵ\epsilon gives the growth rate −iuˉsin⁡(kh)/h−ν(2−2cos⁡kh)/h2-i\bar{u}\sin(kh)/h-\nu(2-2\cos kh)/h^2, i.e. the phase speed and effective viscosity quoted in the text. The artificial viscosity replaces ν\nu by ν+h/2\nu+h/2 at every kk. Upwinding replaces D1D_1 by a one-sided difference in the direction of sign⁡(u)\operatorname{sign}(u), which adds 12∣u∣huxx\frac{1}{2}|u|h u_{xx} to leading order. A stencil with fixed coefficients can represent this only on average, ν→ν+12⟨∣u∣⟩h\nu\to\nu+\frac{1}{2}\langle|u|\rangle h.

KdV. Let DD be the central difference matrix, which is antisymmetric on a periodic grid, a⊤Db=−(Da)⊤ba^\top Db=-(Da)^\top b. The rate of change of the discrete momentum ∥u∥2\lVert u\rVert^2 due to the nonlinear term is −2u⊤F(u)-2u^\top F(u), where FF is the discretized term. With s=(u2)⊤Dus=(u^2)^\top Du one finds −2u⊤13D(u2)=6s-2u^\top\frac{1}{3}D(u^2)=6s for the flux form and −2u⊤(u∘Du)=−12s-2u^\top(u\circ Du)=-12s for the advective form. A combination with weight α\alpha on the flux form gives (18α−12)s(18\alpha-12)s, which vanishes for α=2/3\alpha=2/3, the skew-symmetric form. The dispersive term D3uD^3u is antisymmetric as well and conserves ∥u∥2\lVert u\rVert^2 for every form. Mass is conserved by every form, because each is a difference of fluxes, 1⊤D=01^\top D=0, and 1⊤(u∘Du)=u⊤Du=01^\top(u\circ Du)=u^\top Du=0.

The Hamiltonian structure of KdV, ut=−∂x(δH/δu)u_t=-\partial_x(\delta H/\delta u), implies that the Jacobian AA of the right-hand side satisfies: ∂x−1A\partial_x^{-1}A is symmetric on states with zero mean. DjD_j is the relative size of the antisymmetric part of ∂x−1A\partial_x^{-1}A, with ∂x−1\partial_x^{-1} applied in Fourier space.

Navier–Stokes. The three forms are J1=ψxωy−ψyωxJ_1=\psi_x\omega_y-\psi_y\omega_x, J2=(ψωy)x−(ψωx)yJ_2=(\psi\omega_y)_x-(\psi\omega_x)_y and J3=(ωψx)y−(ωψy)xJ_3=(\omega\psi_x)_y-(\omega\psi_y)_x, each discretized with central differences on the 3×33\times3 block, and JA=13(J1+J2+J3)J_A=\frac{1}{3}(J_1+J_2+J_3) [19]. The energy and enstrophy production of the nonlinear term alone, ∣⟨ψ,J⟩∣/(∥ψ∥∥J∥)\lvert\langle\psi,J\rangle\rvert/(\lVert\psi\rVert\lVert J\rVert) and ∣⟨ω,J⟩∣/(∥ω∥∥J∥)\lvert\langle\omega,J\rangle\rvert/(\lVert\omega\rVert\lVert J\rVert) (median over 16 probe states), is 3.0×10−43.0\times10^{-4} and 2.2×10−42.2\times10^{-4} for J1J_1, 3.2×10−43.2\times10^{-4} and 4.1×10−184.1\times10^{-18} for J2J_2, 3.6×10−183.6\times10^{-18} and 2.2×10−42.2\times10^{-4} for J3J_3, and 5.6×10−185.6\times10^{-18} and 4.9×10−184.9\times10^{-18} for JAJ_A.

Derivations

Linear conserved quantities. One step of a Runge–Kutta method is un+1=un+Δt∑ibikiu_{n+1}=u_n+\Delta t\sum_i b_i k_i, where each stage kik_i is an evaluation of the right-hand side ff at some state. If c⊤f(v)=0c^\top f(v)=0 for every state vv, then c⊤ki=0c^\top k_i=0 for every stage, and c⊤un+1=c⊤unc^\top u_{n+1}=c^\top u_n exactly. Since this holds for every step size, the modified equation conserves c⊤uc^\top u as well, and so does a model that learned it. For a quadratic quantity u⊤Cuu^\top C u the same argument fails, and only a special class of implicit methods conserves it [7].

Self-consistency. Let Φh\Phi_h be the one-step map of the scheme and f~\tilde{f} its modified vector field, so that Φh\Phi_h is the time-hh map of ut=f~(u)u_t=\tilde{f}(u) to all orders in hh [7]. A time-stepper trained on data from Φh\Phi_h at multiples of hh approximates the time-τ\tau map Φτ\Phi_\tau of f~\tilde{f}. Every time evolution satisfies Φs∘Φt=Φs+t\Phi_s\circ\Phi_t=\Phi_{s+t} and Φ−t∘Φt=id⁡\Phi_{-t}\circ\Phi_t=\operatorname{id}, so the semigroup error and the reversibility defect vanish for f~\tilde{f} exactly as for the true field ff. The remaining errors of a learned model come from its approximation of Φt\Phi_t, not from the choice of field. For a linear system ut=Auu_t=Au with explicit Euler, Φh=I+hA\Phi_h=I+hA and f~(u)=A~u\tilde{f}(u)=\tilde{A}u with A~=h−1log⁡(I+hA)\tilde{A}=h^{-1}\log(I+hA). For a rotation generator AA and h=0.25h=0.25, A~\tilde{A} deviates from AA by 12.3%12.3\%, while the semigroup error and the reversibility defect of exp⁡(τA~)\exp(\tau\tilde{A}) are 3.8×10−163.8\times10^{-16} and 5.6×10−175.6\times10^{-17}.

Experimental setup

Data. Snapshots of every scheme, including the reference, are recorded at the same interval and utu_t is estimated from them by a fourth-order central finite difference in time. Gaussian noise of relative size 10−510^{-5} (KdV) and 10−410^{-4} (Navier–Stokes) is added to the snapshots; the noise must remain below the discretization error, since at 10−310^{-3} the time differencing amplifies it above the KdV discretization error and all diagnostics read ∼10−6\sim10^{-6}. The Burgers data are noise free. The flows are resolved, with a cell Reynolds number umax⁡h/νu_{\max}h/\nu of order one; otherwise all schemes are inaccurate and the test loss separates them for that reason.

Models. Burgers: stencil of radius 5, quadratic in uu, ridge penalty 10−1010^{-10}. KdV: quadratic stencil of radius 5; a smaller radius cannot represent the nonlocal pseudo-spectral reference, which then fits worst (test-loss spread 4736×4736\times at radius 3 against 4×4\times at radius 5). Navier–Stokes: 3×33\times3 stencil with all quadratic terms in (ω,ψ)(\omega,\psi), with ψ\psi obtained from ω\omega by the spectral Poisson solve. The pseudo-spectral Navier–Stokes reference is not representable by a local stencil and is excluded from the comparison of the learned models.

Diagnostics. The diagnostics are averaged over 64 (Burgers) or 16 (KdV, Navier–Stokes) probe states drawn independently of the training data. The normalization in Eq. (2) is ∥∇Q∥/∥f∥\lVert\nabla Q\rVert/\lVert f\rVert for DaD_a, the size of the transformed output for DcD_c, and the norm of the Jacobian for DjD_j, which is computed by finite differences.

Transfer error. From eight probe states, the model is integrated with a fourth-order Runge–Kutta method with step ≤10−2\leq10^{-2}, and the PDE with the same method and a 20 times smaller step. The relative error ∥uθ−u∥/∥u∥\lVert u_\theta-u\rVert/\lVert u\rVert is averaged in the root-mean-square sense over steps and initial states up to the horizon TT. All reported values are medians over three seeds.

Controls. Diagnostics that must not separate the schemes, according to Section III D or by construction, are fixed in advance as negative controls: KdV mass and translation symmetry, and Navier–Stokes circulation, point inversion and reflection combined with ω↦−ω\omega\mapsto-\omega. All controls remain silent, with spreads across schemes between 1.07 and 4.5.

Hamiltonian oscillators

Setup. A coupled harmonic system (frequencies 1.0 and 1.7, coupling 0.4) and an anharmonic oscillator (quartic coefficient 0.6). The data are generated by a fine-step reference (Δt=2.5×10−4\Delta t = 2.5 \times10^{-4}) and by explicit Euler, second- and fourth-order Runge–Kutta and symplectic Euler at Δt=0.05\Delta t = 0.05. The models are polynomial in the state, with the degree of the true system, and the snapshots carry observation noise of relative size 10−310^{-3}.

Same-order schemes. Explicit and symplectic Euler are both first order. Their test losses are equal (ratio 0.90 and 0.35 for the two systems), their transfer errors differ by factors of 27 and 31, and the energy diagnostic differs only by factors of 1.9 and 2.9, since both schemes have an energy error of order Δt\Delta t per step. The structure diagnostic DjD_j, which tests the Hamiltonian form of the Jacobian, separates them by factors of 8.0×1028.0 \times10^{2} and 3.4×1033.4 \times10^{3}.

Time-steppers. The time-stepper of § 2 E is cubic in the state and in τ\tau, fitted at lags of one to three snapshot intervals without noise; the alternatives, linear in τ\tau and a fixed-step map, are not valid time-steppers. The reversibility defect and the equal-split semigroup error change by at most 1.27×1.27 \times across solvers on both systems.

Other metrics. On the two oscillators we compared 31 metrics by their mean absolute rank correlation with the transfer error: the energy diagnostic reaches 0.90, a metric that requires the full equation with its parameters 0.89, an ensemble of models 0.68, and every metric computed from held-out data at most 0.42 (test loss 0.19). We attribute the negative correlation of the test loss in Figure 1(c) to the fact that the reference is the hardest scheme for a local model to fit.

References

  1. [1]M. Raissi, P. Perdikaris, and G. E. Karniadakis, Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations, J. Comput. Phys. 378, 686 (2019).DOI
  2. [2]Z. Li, N. Kovachki, K. Azizzadenesheli, B. Liu, K. Bhattacharya, A. Stuart, and A. Anandkumar, Fourier neural operator for parametric partial differential equations, in International Conference on Learning Representations (ICLR) (2021) arXiv:2010.08895.arxiv.org/abs/2010.08895
  3. [3]D. Kochkov, J. A. Smith, A. Alieva, Q. Wang, M. P. Brenner, and S. Hoyer, Machine learning–accelerated computational fluid dynamics, Proc. Natl. Acad. Sci. U.S.A. 118, e2101784118 (2021).DOI
  4. [4]S. L. Brunton, J. L. Proctor, and J. N. Kutz, Discovering governing equations from data by sparse identification of nonlinear dynamical systems, Proc. Natl. Acad. Sci. U.S.A. 113, 3932 (2016).DOI
  5. [5]S. H. Rudy, S. L. Brunton, J. L. Proctor, and J. N. Kutz, Data-driven discovery of partial differential equations, Sci. Adv. 3, e1602614 (2017).
  6. [6]R. F. Warming and B. J. Hyett, The modified equation approach to the stability and accuracy analysis of finite-difference methods, J. Comput. Phys. 14, 159 (1974).DOI
  7. [7]E. Hairer, C. Lubich, and G. Wanner, Geometric Numerical Integration: Structure-Preserving Algorithms for Ordinary Differential Equations, 2nd ed., Springer Series in Computational Mathematics, Vol. 31 (Springer, Berlin, 2006).
  8. [8]A. Zhu, P. Jin, B. Zhu, and Y. Tang, Inverse modified differential equations for discovery of dynamics (2020), arXiv:2009.01058 [math.NA].arxiv.org/abs/2009.01058
  9. [9]R. T. Keller and Q. Du, Discovery of dynamics using linear multistep methods, SIAM J. Numer. Anal. 59, 429 (2021), arXiv:1912.12728.arxiv.org/abs/1912.12728
  10. [10]L. J. Shikhman, Semigroup consistency as a diagnostic for learned physics simulators (2026), AI4Physics Workshop at ICML 2026, arXiv:2605.26324.arxiv.org/abs/2605.26324
  11. [11]L. Lu, P. Jin, G. Pang, Z. Zhang, and G. E. Karniadakis, Learning nonlinear operators via DeepONet based on the universal approximation theorem of operators, Nat. Mach. Intell. 3, 218 (2021).
  12. [12]J. Brandstetter, D. E. Worrall, and M. Welling, Message passing neural PDE solvers, in International Conference on Learning Representations (ICLR) (2022) arXiv:2202.03376.arxiv.org/abs/2202.03376
  13. [13]M. Takamoto, T. Praditia, R. Leiteritz, D. MacKinlay, F. Alesiani, D. Pflüger, and M. Niepert, PDEBench: An extensive benchmark for scientific machine learning, in Advances in Neural Information Processing Systems 35, Datasets and Benchmarks Track (2022) arXiv:2210.07182.arxiv.org/abs/2210.07182
  14. [14]N. McGreivy and A. G. Kevrekidis, Weak baselines and reporting biases lead to overoptimism in machine learning for fluid-related partial differential equations, Nat. Mach. Intell. 6, 1256 (2024).DOI
  15. [15]G. E. Karniadakis, I. G. Kevrekidis, L. Lu, P. Perdikaris, S. Wang, and L. Yang, Physics-informed machine learning, Nat. Rev. Phys. 3, 422 (2021).DOI
  16. [16]S. Greydanus, M. Dzamba, and J. Yosinski, Hamiltonian neural networks, in Advances in Neural Information Processing Systems 32 (2019) arXiv:1906.01563.arxiv.org/abs/1906.01563
  17. [17]J. Chen and K. Wu, Deep-OSG: Deep learning of operators in semigroup, J. Comput. Phys. 493, 112498 (2023), arXiv:2302.03358.arxiv.org/abs/2302.03358
  18. [18]N. J. Zabusky and M. D. Kruskal, Interaction of “solitons” in a collisionless plasma and the recurrence of initial states, Phys. Rev. Lett. 15, 240 (1965).DOI
  19. [19]A. Arakawa, Computational design for long-term numerical integration of the equations of fluid motion: Two-dimensional incompressible flow. Part I, J. Comput. Phys. 1, 119 (1966).

Paper details

vlnc:W_79hntn2z
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC0-1.0
Usage

views · 4

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents