Repository navigation
HLLC: opt-in smoothing of the tangential interface velocity in the viscous work (ib_smooth_contact) - #2211
Merged
sbryngelson merged 3 commits intoNov 14, 2026
Conversation
…scous work (ib_smooth_contact) The viscous work of the HLLC solver uses the tangential interface velocity xi_M u_L + xi_P u_R, with xi_M = 0.5 + sign(0.5, s_S). At a face between a fluid cell and an immersed-boundary ghost cell the contact speed s_S is round-off while u_L and u_R differ by O(U), so the sign, and with it the viscous work, depended on the build, the device and the rank decomposition. ib_smooth_contact = T blends the two states linearly over |s_S| < 0.01 c instead. Faces away from s_S = 0 are unchanged, and the default F changes no result.
|
Claude Code Review Head SHA: 05987e2 Files changed:
Findings: |
sbryngelson
marked this pull request as ready for review
November 12, 2026 20:32
sbryngelson
requested review from
danieljvickers
and removed request for
a team
November 12, 2026 20:32
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2211 +/- ##
==========================================
+ Coverage 63.71% 65.15% +1.44%
==========================================
Files 90 110 +20
Lines 24569 29565 +4996
Branches 3584 4477 +893
==========================================
+ Hits 15653 19262 +3609
- Misses 6135 6746 +611
- Partials 2781 3557 +776 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Lines of Code
|
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.
Branch
feat/ib-smooth-contact, one commit onorigin/master9649d50. DefaultF: no existing result moves. Adds four tests (viscous IB circle and sphere, one and two fluids).Summary
The viscous work in the HLLC solver uses the tangential interface velocity
xi_M u_L + xi_P u_R, withxi_M = 0.5 + sign(0.5, s_S). At a face between a fluid cell and animmersed-boundary ghost cell the contact speed
s_Scan be round-off (equal pressures on both sides, a transverse velocity that is zero up to round-off), whileu_Landu_Rdiffer by O(U)across the ghost mirror. The sign of
s_Sthen decides whether the viscous work sees the fluid or the ghost velocity, and it is decided by round-off, so the answer depends on the compiler,the device and the rank decomposition.
ib_smooth_contact = Treplaces the step by a linear ramp of half-widthcontact_ramp * c(contact_ramp = 0.01): the weight on the left state ismin(max(1/2 + s_S / (2 * 0.01 c), 0), 1). Faces with|s_S| > 0.01 cget exactly the old value, so the change is confined to faces next to a ghost cell whose contact speed isnegligible. It applies to the
model_eqns = 2HLLC path;case_validator.pyrequiresib,viscousandriemann_solver = 2. It does not requireweno_Re_flux: the viscous work reads the same interface velocity either way.Code:
f_contact_weightinm_riemann_state.fpp, the blend after the existingvel_srcloop inm_riemann_solver_hllc.fpp, the constant inm_constants.fpp, the parameterplumbing (
definitions.py,descriptions.py,fortran_gen.pyfor the device copy, the device update next to the other IB flags inm_ibm.fpp), docs and four tests.Evidence: cross-platform and cross-decomposition agreement
3D viscous sphere in a uniform stream: Mach 0.3, Re = U D / nu = 100, 20 cells/D, box [-2.5, 5] x [-2.5, 2.5]^2 (150 x 100 x 100 cells), WENO5 + HLLC + RK3,
weno_Re_flux = T,ghost-extrapolation boundaries, fixed
dt = 0.25 dx / (c + U), two steps, double precision. The sphere is centred on a cell corner, so the transverse velocity is round-off exactly wherethe problem sits. Saved conservative variables compared; "cells" counts values that differ by more than 1e-10 of the variable's maximum (1.5e6 values each).
A100 (nvfortran 25.11, OpenACC) against MI300A (amdflang AFAR, OpenMP offload), 2 ranks each, master and the branch:
ib_smooth_contact = T: max rel. differenceOne rank against two and four (A100, a rank boundary cuts the sphere,
ib_wall_order = 2), sorted values compared because the cell order differs:ib_smooth_contact = T: 1 vs 2(The 1e-14 level is summation order.) So without the option the two-step answer differs by up to 8e-3 of the maximum between two machines and up to 3.7e-3 between rank counts on one
machine; with it the answers agree to round-off. On the same machine the option changes the master answer by up to 1.2e-2 of the maximum (z momentum, 1.2e4 cells) after two steps:
the old answer at those faces was a coin toss, not a better or worse approximation.
Does it change accuracy? Not on master's default path: with
ib_smooth_contact = Tthe annulus (L2, torques), the channel (L2 and flow rate, 8 to 64 cells across) and the cylinder (Cd, wake length) change byat most 0.5 % of the error (cylinder: identical to the digits printed). It does reduce the largest density excursion in the flat channel, from 3.0e-2 to 1.2e-2 of the mean at 32 cells across (wall on a face).
Together with the companion
ib_visc_compactPR the annulus and cylinder are again unchanged, but the channel at 32 and 64 cells across improves by 13 % and 19 % in L2 (5.0e-2 to 4.3e-2 and 2.2e-2 to 1.8e-2),because it removes part of the near-wall density excursion described in that PR.
Tests
Default
Fleaves every existing golden unchanged: on a local tree with this commit plus the two companion commits the fullIBMlabel, the fullViscouslabel and the eleven viscous-IB examplespass against master's goldens on both machines. New tests (viscous IB circle 2D one and two fluids, sphere 3D one and two fluids,
ib_smooth_contact = T, goldens generated on the A100, checked on the MI300A):--gpu acc, 2 GPUs--gpu mp--gpu acc(The label runs are on the tree with all three changes and all twelve new tests; the new tests of this PR are four of the twelve. Two
--onlylabels intersect, so each label was run on its own.)Examples with a viscous IB and
weno_Re_flux: 2D ibm, mibm_cylinder_in_cross_flow, mibm_particle_cloud, mibm_shock_cylinder, tumbling_rectangle, 3D ibm_flapping_plate, rotating_sphere, and thechemistry ones ibm_burning_grain, ibm_flameholder, ibm_lumped_wall, ibm_reacting_surface: all 11 pass on the MI300A and on the A100 (7 and 4 in two runs).
./mfc.sh formatand./mfc.sh precheckpass on the commit.Limitations
0.01 cis the value I used and tested (not tuned); I did not scan it, and the ramp averages the tangential velocity of the two sides, which iswhat the step already did on average over the ill-defined faces.
model_eqns = 2path only. The 6-equation path (model_eqns = 3) and the hypoelastic star-state branch were not exercised with the option on (the validator allows them).s_Sat fluid/ghost faces) is inferred, not measured: I did not logs_S. What I measured is that the option removes the cross-machine and cross-decompositiondifferences, which a sign flip of the viscous-work weight explains.
This PR was made with Claude Code (AI).