Skip to content

Give wall patches their own nut condition - #110

Merged
tihiera merged 2 commits into
developfrom
fix/wall-patch-nut
Nov 28, 2026
Merged

tihiera merged 2 commits into
developfrom
fix/wall-patch-nut

Conversation

@tihiera

@tihiera tihiera commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

A wall patch whose nut condition is not a wall function takes that condition, as OpenFOAM's correctNut evaluates it, instead of a wall function's value. Examples are a slip ground with nut calculated or zeroGradient, and a low-Re wall with nut fixedValue 0.

OpenFOAM: nut on any patch, a wall's included, is what that patch's own nut condition evaluates in correctNut (nut_.correctBoundaryConditions()). A wall function is one nut condition among others (nutkWallFunction, nutUSpaldingWallFunction, ...).

  • A calculated wall takes the model's expression of the patch values (kEpsilon: Cmu k^2/epsilon).
  • A zeroGradient or slip wall takes the cell's nut.
  • A fixedValue wall takes its value.

brae before: the device driver marked every wall-typed patch as a wall-function patch, and every nut evaluation took "not a wall" to mean "not of type wall". So a slip ground or a low-Re wall ran with a wall function's nut on its faces, and with the wrong nuEff there. Under SpalartAllmaras such a wall was refused at start-up ("the SA path writes its wall function on every wall face").

Change:

  • The reader marks the patches whose nut condition is a nut wall function (DeviceSimpleControls::nutWallFnPatch, a wall patch with an isNutWallFnType condition).
  • The driver writes the wall function only on those faces. Every other patch's nut, a wall's included, takes its own condition through the existing per-face evaluation: calculated, fixedValue, the cell's value, the inletOutlet family.
  • guardNonWallNut now also refuses, by name, a type it does not evaluate on such a wall.
  • The SpalartAllmaras refusal of a plain nut on a wall is lifted. Its two tests (sa_wallfunction_refusals arm 5, regex_patchkey_guards arm 3) now check that the run proceeds and writes the wall's own fixedValue 0, where the shipped nutUSpaldingWallFunction writes a nonzero wall nut.
  • Control: BRAE_CONTROL_WALL_NUT_BY_PATCH_TYPE=1.

Gate: new tests/pimple_wall_nut_vs_openfoam.sh (label slow): incompressible/pimpleFoam/RAS/pitzDaily at a fixed deltaT 1e-4, three steps from rest, every solve tight. lowerWall keeps its wall functions throughout. Every entry of p, U and the turbulence fields, and phi, at steps 1-3 within 1e-8:

Arm Staging Before (develop 43ce161c) After
G1 kEpsilon; upperWall a slip ground (U slip, k and epsilon zeroGradient, nut calculated) 1.0 (nut upperWall), phi 4.2e-02 2.4e-10, phi 1.4e-11
G2 G1 with upperWall's nut zeroGradient 4.6e-01 2.4e-10, phi 1.4e-11
G3 SpalartAllmaras; upperWall a low-Re wall (nuTilda and nut fixedValue 0), lowerWall nutUSpaldingWallFunction refused at start-up 3.5e-10, phi 6.8e-12
  • Premise: OpenFOAM's upperWall nut calculated differs from its nutkWallFunction by 1.0.
  • Control: red on G1 (1.0) and G3.
  • phi is held entry by entry on its own scale, except an entry whose scale is round-off of the field's (below 1e-12 of its largest), which is held on the field's. That is the slip wall's flux, 6.8e-22 in OpenFOAM.
  • The bound was set to 1e-8 after the registered run, which ran at the 1e-6 first written. Every measured entry sits below 3.5e-10.

Regressions (one GH200; this branch against develop 43ce161c, built and run on the same node, one tree at a time):

  • The new gate as registered passes on this branch. On develop's binaries G1 and G2 are red, and G3 is refused.
  • 60 focused tests on each tree: every SpalartAllmaras, nut, wall-function, wall-distance, airFoil2D, regex-key and pimpleFoam test, plus the registration and audit tests. The same 5 are red on both: three bump2D tutorials, and two turbulentFlatPlate tutorials whose OpenFOAM reference does not finish on that node (0.6 s on both trees). sa_wallfunction_refusals and regex_patchkey_guards pass with their new arms.
  • 592 tests on each tree (every registered test but interFoam, rhoCentralFoam and the multi-GPU ones), run on this change before the SpalartAllmaras lift: the same 13 are red on both. The only extra red is the new gate, whose G3 staging in that version lacked wallDist, so OpenFOAM stopped. The gate as committed passes, above.

Not covered: the turbulentFlatPlate tutorials, whose topWall is this case, cannot be compared on that node. Their OpenFOAM reference stops before the run.

No tolerance was loosened.

@tihiera
tihiera merged commit e4c6753 into develop Nov 28, 2026
6 checks passed
@tihiera
tihiera deleted the fix/wall-patch-nut branch November 28, 2026 10:57
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