Repository navigation
AMR: fine post-RK hook order and moving-body stage pose - #2249
sbryngelson wants to merge 2 commits into
Conversation
The coarse stage applies the body force and then the 6-equation pressure relaxation; the fine hooks did the reverse. The relaxation's internal-energy correction reads the momentum and total energy the body force changes, so the two orders differ. Swap them and add an AMR 6-eq + body-force test.
The fine moving-body rebuild and ghost-cell correction ran inside the fine stage, before s_propagate_immersed_boundaries moved the body to the stage's pose, so fine blocks used the previous stage's pose. Split the pose update out (s_advance_ib_pose) and, under AMR, call it before the fine stage, refreshing the rotation matrices (s_update_ib_rotation_matrices, factored from s_update_mib) and the host copy that the fine containment check reads. Nothing between the two points reads the pose, so level 0 is unchanged; amr = F keeps its order. Regenerate the two moving-body AMR goldens.
Lines of Code
|
|
Claude Code Review Head SHA: 0f0af60 Files changed:
Findings:
Notes (no action needed; checked and consistent):
|
|
Independent GPU check: Frontier (OLCF), branch head 0f0af60
NVHPC 26.9 (OpenACC + OpenMP builds, OpenACC suite on an A100 node) is running now; results will follow in another comment. Run and posted with Claude Code. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2249 +/- ##
==========================================
+ Coverage 63.71% 65.15% +1.44%
==========================================
Files 90 110 +20
Lines 24569 29562 +4993
Branches 3584 4478 +894
==========================================
+ Hits 15653 19261 +3608
- Misses 6135 6742 +607
- Partials 2781 3559 +778 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Independent GPU check: NVHPC 26.9 on wingtip (NVIDIA A100)
Result: all tests passed. 865 passed, 0 failed, 39 skipped (904 total), in 304 minutes.
Run and posted with AI assistance (Claude Code). |
Description
Two consistency fixes for the AMR fine-level advance, found while planning the #2117 follow-ups (#2247). Both make the fine blocks do what the coarse grid already does; level-0 results and
amr = Fresults are unchanged.1. Fine post-RK hooks ran pressure relaxation before the body force. The coarse stage applies the body force and then relaxes (6-equation model,
m_time_steppers.fpp); the fine hooks (s_amr_batch_post_rk_hooks) did the opposite, although their comment says they follow the coarse order. The two do not commute: the body force changes momentum and total energy, and the relaxation's internal-energy correction reads both. Fix: swap the two calls.2. Fine immersed-boundary markers lagged the body by one RK stage.
s_amr_update_mib_fine(fine post-RK hook) ran insides_amr_stage_fine, befores_propagate_immersed_boundariesmoved the body to the stage's pose. So every fine block rebuilt its markers and corrected its ghost cells at the previous stage's pose, while the coarse grid used the current one. Fix: split the pose update out ofs_propagate_immersed_boundaries(nows_advance_ib_pose; the marker rebuilds_update_mibstays where it was) and, under AMR only, advance the pose before the fine stage. Nothing between the two points reads the pose (forces come from the coarse RHS face sums, collisions from the unchanged coarse markers), so the coarse grid sees the same forces, poses and markers as before, bitwise. The fine containment check reads the pose and rotation matrix on the host, so the AMR branch also refreshes the rotation matrices (loop factored out ofs_update_mibintos_update_ib_rotation_matrices) and syncspatch_ibto the host. Withamr = Fthe sequence of operations is unchanged.Also checked and not changed (no effect on results; details in #2247):
s_compute_fd_gradientapplies the domain-boundary one-sided closure at fine-block edges, but under AMR its output is read only by the cylindrical-axis stress, which AMR rejects. Before/after runs were bitwise identical at 1 and 2 ranks.amr_xchg_coarse_ghostsmargin uses+ 1where the quartic patch reaches 2 cells, but the fill gathers every patch cell from rank interiors point-to-point, so the flag only gates a redundant halo exchange.Type of change
Testing
Frontier, amdflang OpenMP offload (
-c famd -m g), MI250X:Full suite on Frontier GPU (4 shards,
-a): 862 passed, 3 failed before regeneration, all expected: the two moving-body AMR goldens and the new test's missing golden. The spinning-circle AMR case (7CA4FC48) is unchanged, since a circle rotating in place keeps the same markers.Goldens regenerated:
AMR -> 2D -> moving IBM circle(13945217, max change 2.4e-4) and... -> two bodies(43AF9F25, max change 6.0e-3); both cases, the new test and 7CA4FC48 then pass. No other golden changes; level-0 andamr = Fresults are unchanged.New test:
AMR -> 1D -> two-fluid -> 6eq -> body force(EC935FC5)../mfc.sh precheckpasses.This PR was drafted with Claude Code.