Skip to content

Update simpleFoam's boundaries at OpenFOAM's points - #111

Merged
tihiera merged 4 commits into
developfrom
fix/steady-update-points
Nov 28, 2026
Merged

tihiera merged 4 commits into
developfrom
fix/steady-update-points

Conversation

@tihiera

@tihiera tihiera commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

simpleFoam's steady step now updates its boundaries where OpenFOAM's simpleFoam does, as pimpleFoam's step already did. It also relaxes totalPressure's patch value with p, and takes the first pressure pass's non-orthogonal gradient after that update.

OpenFOAM: each boundary condition updates in the constructor or evaluate of its own field's equation (fvMatrix.C:396, fvPatchField.C:336-344). simpleFoam's order (simpleFoam.C:112-117) is pimpleFoam's with one outer and one inner corrector:

  • totalPressure and p inletOutlet update at the pressure assembly (pEqn.H), from U's patch values and the flux as they stand;
  • pressureInletOutletVelocity updates after the momentum solve and after the velocity correction;
  • the turbulence fields' inletOutlet and turbulent inlets update at their equations in turbulence->correct(), from U's and k's patch values;
  • p.relax() blends p's patch values with prevIter as well as its cells (GeometricField::relax). A totalPressure face then holds the relaxed value until the next pressure assembly sets it again, and U = HbyA - rAtU*grad(p) and the next momentum assembly read it;
  • the pressure laplacian's explicit non-orthogonal correction takes fvc::grad(p) inside fvm::laplacian, after that constructor's updateCoeffs. totalPressure's updateCoeffs writes its face value at once (operator==).

brae before: the steady step made every one of those updates at the momentum assembly, from the flux the iteration started with, and the turbulent inlets from U's refValue. totalPressure's value was written unrelaxed.

Change (one fix per commit):

  1. step() takes pimpleStep's update points through enterOpenFoamUpdatePoints(); the flag pimpleUpdatePoints_ is renamed ofUpdatePoints_. rhoSimpleStep keeps its points: nothing there is witnessed yet. Control BRAE_CONTROL_STEADY_UPDATE_POINTS_LEGACY=1.
  2. totalPressure's value is relaxed with p after each solve (deviceRelaxTotalPressure), with prevIter stored where freestream's is. Control BRAE_CONTROL_TOTAL_PRESSURE_UNRELAXED=1.
  3. The first pressure corrector's pass 0 takes grad(p) again once totalPressure has been updated, instead of reusing the momentum predictor's, which read the stored values. This also reaches pimpleFoam on a non-orthogonal mesh with totalPressure. Control BRAE_CONTROL_PASS0_GRAD_BEFORE_TOTAL_PRESSURE=1.
  4. The gate.

Gate: new tests/simple_update_points_vs_openfoam.sh (label slow).

  • Case: incompressible/simpleFoam/windAroundBuildings (totalPressure and pressureInletOutletVelocity outlet, inletOutlet k and epsilon), meshed as the tutorial does. OpenFOAM runs it to iteration 20 with the tutorial's own settings. Both codes then continue for three iterations, every solve pinned.
  • Hold: every entry of p, U, k, epsilon and nut, and phi, at 21-23 within 1e-9.
Arm Before (develop e4c67534) After
W1, p relaxation 1 (the update points) 1.3e-03 (U outlet) 5.3e-11
W2, as shipped, p relaxation 0.3 4.1 (p outlet: 0 written where OpenFOAM's p.relax() leaves 0.7 × −0.231) 1.9e-11
  • Floor: OpenFOAM's own run with p on PCG rather than GAMG is 9.4e-11 from its GAMG run.
  • Controls: 1.3e-03, 1.0 and 3.4e-07, each red.
  • Localisation of the last one: with commits 1 and 2 only, W1 stood at 3.4e-07. OpenFOAM's dumpSimpleFoam against brae's stage dumps put HbyA and phiHbyA at 1.6e-15 and the pressure system's coefficients at 1.7e-16, with the solved p 1.5e-08 off. The iteration was exact once the two outlet faces' stored values (relaxed leftovers on faces that had turned to outflow) were zeroed. That named the pass-0 gradient.

Also measured (not held here):

  • simpleFoam/squareBend from rest, with commit 1: nut on the inlet 3.4 → 4.2e-04 at iteration 1. The rest is the turbulence equations' Euler time derivative, which this step drops and a follow-up carries.
  • pitzDaily, which has none of these patches: unchanged to the bit.

Regressions (one node, four GH200, against develop e4c67534, each tree built and run on the same node, one tree at a time):

  • Both gates as committed pass on this change and the next one together. On develop's binaries every arm is red (W1 1.3e-03, W2 4.1).
  • 594 tests on each tree with the first commit alone (every registered test but interFoam, rhoCentralFoam and the multi-GPU ones): 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). Nothing else is red.
  • 595 tests with this change and the next one on top: the same 13 are red on both trees. The two new gates were also red, because that run carried earlier drafts of their scripts; the scripts as committed pass, above. 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.

No tolerance was loosened.

@tihiera
tihiera merged commit ca61ed2 into develop Nov 28, 2026
6 checks passed
@tihiera
tihiera deleted the fix/steady-update-points branch November 28, 2026 14:53
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