Skip to content

Carry Euler ddt in simpleFoam's steady turbulence equations - #112

Merged
tihiera merged 3 commits into
developfrom
fix/steady-turbulence-ddt
Nov 28, 2026
Merged

tihiera merged 3 commits into
developfrom
fix/steady-turbulence-ddt

Conversation

@tihiera

@tihiera tihiera commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

simpleFoam's turbulence equations now take the case's ddtSchemes default Euler, as OpenFOAM's do. Any other non-steady scheme on simpleFoam, Euler with a scalarTransport tracer on either steady solver's default path, and Euler with a RAS model on rhoSimpleFoam's default device path now stop at start-up by name.

OpenFOAM: simpleFoam's UEqn has no ddt. Its turbulence model's equations construct fvm::ddt(alpha, rho, k) and fvm::ddt(alpha, rho, epsilon|omega|nuTilda) whatever the solver (kEpsilon.C:254, 275, kOmegaSSTBase.C:572, 602, SpalartAllmarasBase.C:468).

  • Under Euler each is (psi − psi.oldTime())/deltaT, with deltaT simpleFoam's own time step.
  • The old level is the field as the iteration found it (GeometricField::storeOldTimes at its first write in the time step).
  • incompressible/simpleFoam/squareBend and lumpedPointMotion's two steady cases ship default Euler; so does rhoSimpleFoam's gasMixing/injectorPipe.

brae before: the steady step dropped both terms. The dispatcher's notice called the entry inert ("OpenFOAM's steady solvers construct no ddt term").

Change:

  • DeviceSimpleSolver::setSteadyTurbulenceDdt: on the steady step the closures' ScalarDdt bundles take Euler with controlDict's deltaT. That deltaT is required, as OpenFOAM requires it. step() takes the old levels at the start of the iteration. The momentum assembly takes no ddt.
  • gpuSimpleFoam reads ddtSchemes. It refuses by name:
    • any default other than steadyState or Euler;
    • a per-field ddt(...) entry;
    • Euler with the laminar Maxwell model.
  • rhoSimpleFoam's default device path refuses a non-steady default with a RAS model by name. It carries no ddt; the OF-mirror arms do, and the message names them. Every gasMixing/injectorPipe test runs a mirror arm.
  • A scalarTransport function object under a non-steady default is refused by name on simpleFoam and on rhoSimpleFoam's default path. OpenFOAM's tracer takes fvm::ddt(s) (scalarTransport.C:341) or fvm::ddt(rho, s) (:319), and neither steady path carries it for the tracer. No stock simpleFoam tutorial pairs the two.
  • The dispatcher's notice and tests/solver_dispatch.sh's comment are corrected; the test's assertion is unchanged.
  • Control BRAE_CONTROL_STEADY_TURBULENCE_DDT_IGNORED=1.

How it was found: OpenFOAM's own kEpsilon with writes added (tools/dumpKEpsilon) was compared with brae's term dump on squareBend at iteration 1. Production's inputs matched to 6.5e-11, and the k system's off-diagonals matched exactly. The assembled epsilon diagonal was 1.0·V above brae's in every interior cell: the Euler term at deltaT 1.

Gate: new tests/simple_turbulence_ddt_vs_openfoam.sh (label slow). squareBend from rest, three iterations, every solve pinned, every entry of p, U, k, epsilon and nut, and phi, within 1e-8:

Arm Term dropped (the control) Carried
S1, squareBend 6.7e-02 (nut internal) 5.1e-10
S2, the inlet's k and epsilon fixed at iteration 1's values 7.4e-02 (p internal) 2.5e-10
  • Premise: OpenFOAM under steadyState differs from its Euler run by 6.7e-02.
  • Four refusal arms:
    • default backward on simpleFoam;
    • Euler with a scalarTransport on simpleFoam;
    • on rhoSimpleFoam's default path, Euler with RAS;
    • on rhoSimpleFoam's default path, Euler with a scalarTransport on a laminar case.
  • U's convection is staged Gauss linearUpwind grad(U) in both codes. The tutorial's limitedLinearV 1 cannot be judged from rest: from a uniform start every face's limiter sits in NVDVTVDV's 1000-branch, whose sign round-off decides. From OpenFOAM's own iteration 20, as shipped, brae holds 3.0e-09 over three iterations. Before this change it was 4.7e-04, at the outlet.

This builds on the steady update points (#111): squareBend's turbulent inlets take OpenFOAM's update points there.

Not changed here: the OF-mirror arms' scalarTransport also solves the tracer without its ddt under Euler (rhoScalarTransportFO.cuh), and gasMixing/injectorPipe ships that pair. That is a follow-up.

Regressions (one node, against develop e4c67534, before #111; each tree built and run on the same node):

  • The gate as committed passes. On develop's binaries S1 (3.4) and S2 (7.4e-02) are red, and all four refusal arms fail.
  • 595 tests on each tree (every registered test but interFoam, rhoCentralFoam and the multi-GPU ones), this change on top of the previous one, before the scalarTransport refusals: the same 13 are red on both, all red on develop before these changes (the AMI rows and store tests, coupledinterfacescheme_vs_openfoam, four manifest-drift checks, three bump2D tutorials, motorBike and two turbulentFlatPlate tutorials). The two new gates were also red, because that run carried earlier drafts of their scripts. ctest_cache_selftest was also red on the candidate. It fails on develop's own build when rerun (7 of 7 runs; 9 of 10 on the candidates). Its data_changed arm rewrites a file at the same size straight after a touch, and the cache's (size, mtime) check does not see the rewrite on that filesystem. Not touched here.
  • With the scalarTransport refusals: the dispatch, refusal, tracer, gasMixing and default-audit tests (10) pass.

No tolerance was loosened.

@tihiera
tihiera merged commit ca5451a into develop Nov 28, 2026
6 checks passed
@tihiera
tihiera deleted the fix/steady-turbulence-ddt branch November 28, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant