Repository navigation
IBM: force of a moving body in the body frame (subtract the wall-normal momentum carried across the moving face) - #2208
Open
sbryngelson wants to merge 7 commits into
Open
sbryngelson wants to merge 7 commits into
sbryngelson wants to merge 7 commits into
Conversation
The lab-frame momentum flux through a grid face also carries the momentum of the gas crossing it. For a body with moving_ibm > 0, subtract V_b f_m (wall velocity V + omega x r at the face times the face mass flux) from the momentum flux used for the force and torque, so the force no longer depends on the body's velocity through the grid. Fixed bodies are unchanged. Add two prescribed-translation tests that record ib_forces.dat.
Regenerated on Tuolumne (--gpu mp): 09FDDC81 (Adaptive dt) and AA49A8BC (mibm_sphere_head_on_collision), whose two-way bodies feel the corrected force. New: 997E2B0E and 540C72F1, a prescribed translating and a translating spinning circle with ib_force_wrt.
|
Claude Code Review Head SHA: f50674f Files changed:
Findings: |
…-step force differs by 5% there)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2208 +/- ##
==========================================
+ Coverage 63.71% 64.90% +1.19%
==========================================
Files 90 110 +20
Lines 24569 29485 +4916
Branches 3584 4467 +883
==========================================
+ Hits 15653 19138 +3485
- Misses 6135 6809 +674
- Partials 2781 3538 +757 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…me correction uses the same flux set)
… velocity (not V_b times the face mass flux) A moving wall's force is the momentum flux through a face moving with it, (rho u_i)(u_n - V_n) + p n_i. The lab flux carries rho u_i u_n, so remove the face momentum density (mean of the fluid and body cell) times the wall normal velocity V_n. The previous V_b f_m used the discrete mass flux, which is not zero at a staircase wall, so it was wrong at low Mach and right after an impulsive start (1 to 35 percent at step 1).
…59123E, 09FDDC81, 997E2B0E, 540C72F1, AA49A8BC) Regenerated on MI300A (flang, --gpu mp); the A100 build (nvfortran, --gpu acc) passes them at the tests' tolerance.
Lines of Code
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four commits: the code and goldens of the first version, the merge of master (after #2206, the dual-pass hypoelastic force), and a rework of the correction with its regenerated goldens (below).
Summary
The force and torque an immersed boundary receives (
ib_force_wrt, two-way coupling) are summed from the fluid-body face fluxes. Those faces are fixed in the grid. When the body moves (moving_ibm > 0), the lab-frame momentum fluxrho u_i u_nthrough a face is not the flux through the moving wall,rho u_i (u_n - V_n), withV_nthe wall's normal velocity at the face (V_b = V + omega x r). The force then depends on the body's velocity through the grid, by a term of orderM^2.s_accumulate_ib_face_fluxesnow takesq_cons_vfand, formoving_ibm > 0, subtractsV_ntimes the momentum density of the face (the mean of its fluid cell and its body cell) from the momentum flux used for the force and torque. This is a state, not a flux. An earlier version of this PR subtractedV_b f_mwithf_mthe discrete face mass flux; that is zero for a rigid translation only if the staircase ghost-cell fill leaks no mass, which it does not, so it was off right after an impulsive start (1.3% in a hypoelastic HLLD case at V = 10, 35% at V = 100, 42% for plain HLLC at V = 50, at step 1) while the unmodified flux was within 1e-3 there. Pressure and viscous terms are unchanged. Fixed bodies (moving_ibm = 0) take the old path. The energy and mass fluxes of the lumped-body heat (ib_heat_wrt) are not changed.Test changes: two new tests (
IBM -> Translating CircleandIBM -> Translating Spinning Circle -> Body-Frame Force) recordib_forces.datof a prescribed translating (and turning) circle. Five goldens move because forces change (listed under Tests). The docs paragraph on the force history says what the force now is.AI disclosure: made with Claude Code.
Verification: Galilean twins
A body translating at
Uthrough gas at rest must feel the same force as the same body held in a uniform flow-U. Setup A/B: same grid and domain, case A hasmoving_ibm = 1,vel(1) = U, gas at rest; twin B has the gas at-Uand the body held (moving_ibm = 0; for the spin casesmoving_ibm = 1,vel = 0and the same spin). Metricrel = rms(F_A - F_B) / rms(F_B)over all steps. "master" has no correction, "merged" is this PR with theV_b f_mcorrection (master with #2206 merged), "fixed" is the present change. NVIDIA A100 node, nvfortran 25.11,--gpu acc, 1 rank, all three built from source and run on the same node.Developed flow: 2D periodic unit box, circle R = 0.1 at x = 0.8 (it crosses the periodic boundary at t = 0.4), rho = 1, p = 1/1.4 (c = 1), HLLC, WENO5, RK3, dt = 0.2 dx, to t = 1, no-slip, inviscid, 200 cells per unit length unless stated.
Translation plus spin 3 rad/s, M = 0.5, 200 cells (twin: same spin, body held):
Two-way bodies (
moving_ibm = 2, mass 5 times the displaced gas, M = 0.5; the twin is also two-way, starting from rest in gas moving at-U). Force mismatch, and the velocity gained at t = 1 (v_A - Uagainstv_B):The Mach-dependent error stays removed (M = 0.9: 72% to 3.8%), and the slip-wall error, the largest limitation of the previous version, falls from 23% to 5.5% because the state carries the slip velocity. Fixed does not beat merged in every row: Fx and Tz of the inviscid spinning case are 5.6e-2 and 4.4e-1 against 4.0e-2 and 3.9e-1, and 100 cells at M = 0.5 is equal (6.2e-2 against 6.0e-2). The floor of 2-6% that is present in all three builds at M = 0.1 is not removed.
Impulsive start: 64 x 32 periodic box, circle r = 0.2,
BA59123Efluid parameters (two fluids, pressure 1e5, dt = 1e-6) on a uniform state with G = 1e6 for the hypoelastic cases, 30 steps. Relative difference of Fx of A (body at V in gas at rest) from B (body fixed in gas at -V), (A - B)/B:Over the 30 steps the rms difference is 2.0e-3 / 1.3e-2 / 8.6e-4 (V = 10), 4.9e-2 / 3.9e-1 / 2.7e-2 (V = 100) and 5.0e-2 / 4.4e-1 / 3.2e-2 (plain, V = 50) for master / merged / fixed. At step 1 the fixed force matches the held body to the level of master (about 1e-4 to 1e-6); the later difference is not a force-correction error but the moving body crossing cells while the twin's does not. For plain HLLC at V = 50 the fixed step-29 difference equals master's (2.1e-2 against 2.2e-2) and the rms is 3.2e-2 against master's 5.0e-2.
Limitations
rho V_n V_bgave 1.97e-1 on the slip wall, so the mean was kept. I did not study a more principled face state.Fixed bodies unchanged
Fixed-body twins (
moving_ibm = 0; inviscid no-slip at 100 and 400 cells and slip at 200 cells), master against this branch on the same GPU: all 10 conservative-variable files of each run are byte-identical (cmp).Tests
./mfc.sh test --no-chemistrywith the existing goldens, A100 node, nvfortran 25.11,--gpu acc --mpi:pre_processexit code 132 and pass on a rerun (3 / 3)mibm_sphere_head_on_collision(golden moves);mibm_cylinder_in_cross_flow,mibm_shock_cylinder,mibm_particle_cloudpassThe five goldens that move, regenerated on an MI300A node (flang 24.0.0,
--gpu mp), and why:The two-way tests (09FDDC81, BA59123E, AA49A8BC) move because the body's acceleration is the corrected force; the two new tests move because their first entries are the impulsive-start force. I did not separate how much of each two-way move comes from the start and how much from later steps.
--gpu acc--gpu mpCI covers Frontier (Cray CCE); I did not run it by hand. The new force tests stay skipped under
--single.This PR was made with Claude Code (AI).