PINNeAPPle Request a quote

Thermodynamics

The more accurate surrogate was the one breaking thermodynamics

Two families of surrogate for CO₂ near the critical point, on the same data and the same training budget. The direct network is more accurate and violates the c_v identity by 1,100%. The potential one errs more and, with input convexity, keeps all six identities below 0.002%.

A neural network that returns pressure, entropy, heat capacity and speed of sound, each from its own output, can be very accurate and still useless: nothing in the training forces the derivatives that link those quantities to keep holding. Near the critical point, where properties vary fast, that difference decides whether the result can go into a solver.

The experiment

Same data (CoolProp over the Span & Wagner equation), same training steps, same seeds. Three models: a direct network, one output per property; a potential network, which learns the Helmholtz energy and takes every property as a derivative; and the input-convex version (ICNN, Amos and others, 2017). Evaluation covers the training region, two extrapolations (hotter and denser) and six thermodynamic identities.

The number that separates them

RMS error normalised by the property's standard deviation, in the training region: 0.0995 for the direct network, 1.61 for the potential one and 1.24 for the convex version. The direct one is about 16 times more accurate, on a sixth of the training time (21 s per seed, against 85 s and 213 s).

On the identities, the result inverts. Relative violation at the 95th percentile: the direct network violates the Maxwell relation by 41%, the density dependence of c_v by 1,100% and the Mayer relation by 240%. The potential one sits at 0.0028% on Maxwell and 0.0003% on the c_v one. The exception is the speed of sound, where the potential network without convexity is worse than the direct one, 540% against 88%, and that is exactly what the convex version fixes: 0.001%.

Relative violation of the thermodynamic identities, per model
Relative violation of the six thermodynamic identities, 95th percentile, on a log scale from 10⁻⁷ to 10. Red, direct network; blue, potential; green, potential with convexity. The blue speed-of-sound bar is the exception the text discusses, and the green one shows what convexity fixes.
Property error across the three evaluation regions
The other side of the coin: property error across the three regions. Where the direct network is more accurate, and it is by an order of magnitude.

Why error is not the criterion

A solver handed heat capacity and speed of sound from sources that do not agree with each other either fails to converge or converges to something it should not. The direct network optimises each property against the data, and nothing in the training stops the derivatives from contradicting one another: that is why it gets every number right and the relation between them wrong. In the potential network every property comes from the same function, so the identities hold by construction, and what is left is the fit residual.

The price is on the other side, and it is fair to state it. The potential trains four to ten times slower, and outside the domain it destabilises: in the hotter extrapolation only 33% of the points stayed stable, against 100% for the direct network. With triple the steps, and more seeds, the error gap in the training region stops being significant, which suggests the direct network's advantage is one of budget, not of architecture.

Isotherms near the critical point for the three models
Isotherms near the critical point, which is where a 1% error in density becomes a large error in pressure. It is also the region where the two kinds of surrogate drift furthest apart.

What this decides

To interpolate properties in post-processing, where nobody will differentiate anything, the direct network is the choice. To feed a CFD solver, the potential one, with the error stated beside it. The experiment crowns no winner: it puts a price on each, which is what was missing in order to choose.

1,100%violation of the c_v identity in the direct surrogate, against 0.0021% in the convex potential one
What was not proven: The target is an equation of state (Span & Wagner, 1996), not a test: what is measured is fidelity to the reference model, not to real CO₂. The domain is supercritical CO₂ near the critical point, with 5 seeds and 95% intervals. In the hotter extrapolation the potential network (MLP) was stable on 33% of the points, against 100% for the direct one, and at 9,000 training steps the error gap in the training region stops being significant. The potential costs four to ten times more training time.

Let's build your solution

Your engineering challenge could be our next project.

Talk to our team about Physics AI consulting or explore PINNeAPPle Studio for modeling and verification workflows.

Talk to an engineer