11.4 Porting a legacy session

A session written for the legacy CompressibleFlowSolver will usually run under the redesign without complaint and give quietly wrong answers, because several inputs are now read from different places. Each case below leaves the session valid, the solver silent apart from a warning, and the physics changed. Work through them in order.

Gas properties move to <EquationOfState>

Gamma and GasConstant are no longer read from <PARAMETERS>:

1<EquationOfState> 
2  <Type> IdealGas </Type> 
3  <Parameters> 
4    <Gamma>       Gamma       </Gamma> 
5    <GasConstant> GasConstant </GasConstant> 
6  </Parameters> 
7</EquationOfState>

The values may reference existing <PARAMETERS> entries by name, as above, and leaving those parameters in place is harmless: the session reader warns that the equation-of-state definition wins. The block itself is not optional. Without it the operator key resolves with an empty equation-of-state suffix and creation fails with a misleading

No such operator: AdvDiffTraceFluxCFERoeSerial

which looks like a missing Riemann solver and is not.

Transport properties move to <ReferenceValues>

A <ReferenceValues> section carries everything else the legacy solver read as a parameter; the values and their defaults are listed under Section 11.3 above.

This is the case that bites. The legacy solver read the viscosity as the parameter mu; the redesign reads the reference value Viscosity. A session that sets mu = rhoInf*L*uInf/Re therefore gives the legacy solver whatever that evaluates to and the redesign the built-in default – a factor of thousands apart in a typical case – with nothing failing. State every value the case depends on, even where the default happens to match, since a default that is right today is still a silent dependency on a number defined elsewhere.

Read the startup warnings

Every fallback to a default is announced, one line per missing value, among a good deal of other output. Treat any of them as a porting error rather than as noise:

CompressibleFlowSolverRedesign case.xml 2>&1 | grep "Setting␣default␣value"

A correctly ported viscous case prints none.

Schemes and forcings the redesign does not have

Euler/Forward is not registered; use RungeKutta of order 1, which is the same scheme. That one announces itself, failing with No such operator.

A <FORCING> block does not. Forcing types are registered separately from the solver, and a session naming one the redesign does not implement runs to completion with the forcing simply absent, without a warning. The signature is a partial disagreement: the quantities the forcing drives are wrong while everything else matches. Check the block against the registered forcings, and if the forcing is unavailable, delete it from the session rather than leave it implying support that is not there.

Porting a regression test

The interior-penalty diffusion of the redesign is not a different discretisation from the legacy solver’s, so the expectation is that a ported case reproduces the legacy numbers to the legacy tolerances. Keep the legacy metrics until you have proved you cannot: a gap of a few percent looks like an acceptable discretisation difference and is more often a porting error or a bug, and writing the redesign’s own value into the .tst freezes that bug in as the expected answer. If the numbers genuinely cannot be matched, say which operator differs and why, rather than quoting a percentage.

Agreement with the legacy solver is not by itself evidence that either is right. Where the case has an analytic handle, check it – a wall heat flux against k dT∕dn with k = μcp∕Pr, for instance. That check is what exposes a viscosity read from the wrong place, which is otherwise self-consistent: the wrong viscosity enters both sides. Confirm too that the test can fail, by running it with the feature under test disabled and checking that the error moves by decades.

Re-mesh when the case has outgrown its mesh, and hold two things fixed when you do. Keep the element mix: a mesh of one element type is a weaker test, because the boundary storage, the trace gathers and the interpolation between differently shaped faces all vary with element type. And re-verify against the legacy solver on the new mesh, since the reference values belong to the mesh rather than to the case.

Finally, assert the handedness of any mesh you generate. Nektar++ does not reject an element whose local axes are left-handed: it runs, it converges, and it is quietly wrong. The reference prism runs ξ1 along v0 →v1, ξ2 along v0 →v3 and ξ3 along v0 →v4, so (e1 ×e2) ⋅e3 must be positive; splitting a hexahedral cell into two prisms on a diagonal and extruding, the obvious anticlockwise winding gives exactly the wrong sign. The symptom is subtle rather than catastrophic, so give the case a quantity that is exactly zero by symmetry to check against.