Repository navigation
IBM: take halo-cell momentum in the moving-wall force term from the exchanged primitives - #2340
Conversation
…xchanged primitives The body-frame force of a moving wall removes the face momentum times the wall's normal velocity, with the face momentum the mean of the fluid and body cell momenta read from q_cons. The RHS exchanges only the primitive halos, so q_cons momentum in a halo cell (rank seam, periodic edge) was never filled and read as zero where the neighbor holds rho*V. The force of a body on a seam therefore depended on the decomposition. Read halo cells from rho*u of the primitives. Adds a 2-rank test with the body on the seam moving across it.
|
Claude Code Review Head SHA: b9ce2d0 Files changed:
Findings: |
Lines of Code
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2340 +/- ##
=======================================
Coverage 65.68% 65.69%
=======================================
Files 111 111
Lines 30258 30269 +11
Branches 4616 4617 +1
=======================================
+ Hits 19875 19885 +10
+ Misses 6670 6669 -1
- Partials 3713 3715 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Tested on one node of MI250X (Cray compiler, OpenACC), applying this branch alone to the base it was cut from (cd2180c).
This comment was made with Claude Code (AI). |
|
Independent NVIDIA verification of current
The 2-rank seam test matches its golden with both ranks on one GPU and on two GPUs. Not run: chemistry tests, OpenMP-offload build, CPU build, any NVHPC other than 25.5, before/after timing of the changes. AI-assisted (Claude Code). |
Contribution Policy
All contributions are expected to demonstrate:
If these expectations are not met, we would prefer to implement the changes ourselves rather than spend time reviewing low-effort submissions.
Summary
The body-frame force of a moving wall (added in #2208) removes the face momentum times the wall's normal velocity, with the face momentum taken as the mean of the fluid-cell and body-cell momenta read from
q_cons. The RHS exchanges only the primitive halos (q_prim_qp), never theq_consmomentum halos, so at a rank seam or a periodic edge the halo cell'sq_consmomentum was never filled. It read as zero where the neighbour holds the body-cell momentum (rho V). A moving body touching a seam therefore got a force that depended on the decomposition. Earlier 1- and 2-rank verification could not see this: the term is proportional to the wall velocity normal to the seam, needs a body cell in the halo, and the test bodies moved along their seams or sat away from them.This reads halo cells from rho*u of the exchanged primitives (new
f_ib_cell_momentum; interior cells still readq_cons, so interior values are unchanged).s_accumulate_ib_face_fluxeshas no otherq_consread at a halo cell; I did not audit other IB routines.Evidence
Measured at step 0 with a temporary print (8 ranks, 2D, a circle on the seam, wall velocity 0.6): the halo
q_consmomentum is exactly 0.0 where rho*u from the primitives is 0.6. The same stale zero appears with one rank at a periodic edge (32 cells printed with 1 rank, 35 with 8), so the fix can also change 1-rank results for bodies crossing a periodic boundary.Periodic 2D box, 128x128 cells, 8 circles with prescribed velocity (
moving_ibm = 1) or two-way (moving_ibm = 2), 300 steps, force history inib_forces.datagainst 1 rank (CPU build, Cray CCE, MI250X node):moving_ibm = 2, 2/4/8 ranksmoving_ibm = 1, 2/4/8 ranksStatic bodies in a uniform stream already agreed to 2e-16 at 4 and 8 ranks before the change.
Tests
New test
IBM -> Translating Circle -> 2 MPI Ranks -> Body-Frame Force(9C0CAF25): the existing translating circle on the rank seam, now also moving in y (0.6) so a wall normal velocity exists at the seam whichever way the 2 ranks split. Golden from the fixed build; it fails on the unfixed build (D/ib_forces.datvariable 563: -0.6018 against -0.6099, 1.3e-2 relative, tolerance 1e-10) and its force history agrees with the 1-rank golden of the existing translating-circle test to 2e-16. The existing 1-rank body-frame tests also setvel(2) = 0, the default. All 114 existing IBM tests pass against their unchanged goldens (CPU, Cray CCE), so no existing golden changes../mfc.sh precheckpasses.Limitations
moving_ibm = 1and two prescribed bodies that overlap (bodies 3 and 4 of the 8-body case from t = 2.9) the 1- and 8-rank force histories differ by up to 0.8. That is outside this change and is not investigated here; two-way and non-overlapping prescribed bodies agree.q_conshalos are exchanged, soq_consis still read.This PR was made with Claude Code (AI).