Repository navigation
Conversation
…del) fluid_pp(i)%visc_model = 1 gives fluid i a shear viscosity mu_i(T) = exp(C_i + D_i/T) (visc_c, visc_d), evaluated at the thermal-equilibrium mixture temperature from f_mixture_temperature, the closure heat conduction uses. It overrides Re_L(1)/Re_R(1) on the HLL and HLLC (5- and 6-equation) Riemann states and Re(1) in the time-step and stability-criterion paths. The exponent is capped at 50. The validator requires viscous, model_eqns 2/3, riemann_solver 1/2, cv > 0 and nonzero visc_d, and rejects non_newtonian, cyl_coord, bubbles_euler, ib, igr and chemistry. Adds golden test 6D29F444 (Viscous -> visc_model=1) and validator unit tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VtsGVvCfsDJz5dmtSk9dKt
Plane Couette flow between a cold fixed wall and a hot sliding wall with Arrhenius mu(T), validated against the exact steady solution of the coupled momentum/energy BVP. Uses upstream k_therm conduction with isothermal no-slip walls. Observed L2 velocity order 2.00 over Ny = 33, 65, 97. Skipped in the example test sweep: its analytic density IC needs a case-specific pre_process build; mu(T) is covered by golden 6D29F444. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VtsGVvCfsDJz5dmtSk9dKt
|
Claude Code Review Head SHA: 0191d97 Files changed:
Findings:
|
nvfortran 25.5 crashes (fort2 signal 11) inlining a seq GPU routine that itself calls the inlined f_mixture_temperature into the m_data_output and m_time_steppers kernels under --case-optimization --gpu acc/mp. Callers now compute T with f_mixture_temperature and pass it in, so the routine has no nested inlined call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VtsGVvCfsDJz5dmtSk9dKt
Without it MFC_CASE_OPTIMIZATION keeps its CMake default (False) in this
module, so an amdflang --case-optimization build declared the alpha dummy
dimension(3) while HLL/HLLC pass dimension(num_fluids) actuals, which
amdflang rejects ("Actual argument array has fewer elements (2) than dummy
argument 'alpha=' array (3)", Frontier AMD case-opt gpu-omp). Other
compilers' preprocessed output is unchanged apart from comments.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VtsGVvCfsDJz5dmtSk9dKt
Lines of Code
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2101 +/- ##
==========================================
- Coverage 61.89% 61.88% -0.01%
==========================================
Files 86 87 +1
Lines 22888 22927 +39
Branches 3372 3378 +6
==========================================
+ Hits 14166 14188 +22
- Misses 6220 6234 +14
- Partials 2502 2505 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
sbryngelson
marked this pull request as draft
October 24, 2026 02:54
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.
Adds a per-fluid temperature-dependent shear viscosity, the Arrhenius (Andrade) liquid law
selected with
fluid_pp(i)%visc_model = 1and coefficientsfluid_pp(i)%visc_c,fluid_pp(i)%visc_d. The defaultvisc_model = 0leaves the constant-Re(1)path untouched; no existing golden changes.Approach
f_mixture_temperature(m_eos), the same closure heat conduction (Fourier heat conduction in the energy equation #1906) uses. No new temperature model; likek_thermit requirescv > 0on every fluid.s_compute_interface_reynoldsfillsRe_L/Re_R,Re_L(1)/Re_R(1)are replaced by1/Σ α_i μ_i(T_L/R). Fluids that are not Arrhenius keep1/Re_i(1)in the sum. Everything downstream (theRe_avg_rs*_vfface average, the viscous source flux) is unchanged, so the face viscosity follows the reconstructed temperature.Re(1)befores_compute_dt_from_cfl(m_time_steppers) and in both stability-criterion paths inm_data_output, so the viscous CFL limit sees the local μ(T) rather than the unused placeholderRe(1).C + D/Tis capped at 50 (visc_exp_arg_capinm_constants) andTis floored atsgm_eps, so μ stays finite in a transient or under-resolved cold state.Why this layout (Herschel-Bulkley, #1545)
The parameter plumbing follows HB: per-fluid
fluid_ppfields, gathered at init into device arrays (visc_models,visc_cs,visc_ds) and anany_arrhenius_viscflag that areGPU_DECLARE/GPU_UPDATEd next to HB's, with a matching single@:DEALLOCATE. The μ evaluation is aGPU_ROUTINE(seq)function in its own module,m_arrhenius_viscosity, likem_hb_function.visc_modelis an enum parameter withCONSTRAINTSnames, generatingvisc_model_constant/visc_model_arrhenius.The hook point differs from HB on purpose. HB's μ depends on the strain rate, which only exists in
m_viscous, so HB overrides there. μ(T) is a pointwise function of each Riemann state, so it overrides whereRe_L/Re_Rare formed. That reuses the existing face averaging and viscous flux with no new gradient code. For the time step, HB substitutes its boundedmu_max; here the cell value of μ(T) is exact, so that is what's used.Verification
Analytic:
examples/2D_Couette_Variable_ViscosityPlane Couette flow between a fixed cold wall (300 K) and a sliding hot wall (400 K), with μ(T0)/μ(T1) ≈ 3.5, Re ≈ 20, Ma ≈ 0.1, Pr = 1, Br ≈ 0.014. The reference is the exact steady solution of the coupled momentum/energy BVP (
scipy.solve_bvp, ~1e-10). MFC runs withmodel_eqns = 3, HLLC, upstreamk_thermconduction and isothermal no-slip walls (bc_y = -16). It starts from rest, so the curved profile is not baked into the initial condition. Single rank, gfortran 15.2.The observed L2 order in velocity is 2.003. Mid-gap velocity is u(H/2) = 0.3519 U, versus 0.5 U for constant μ. That ~30% deficit is the μ(T) signal.
This feature was first developed on a fork with its own conduction implementation. Against that version's results:
The temperature difference is an absolute 8e-9 of ΔT at the coarsest grid, and it vanishes with refinement. That is consistent with the switch to #1906's conduction discretization. Velocity, the quantity μ(T) acts on, is unaffected.
python3 validate.pywrites the profile, convergence and pointwise-error figures andsummary.json. The example is incasesToSkip: its analytic density initial condition compiles intopre_process, so it needs a case-specific build. Test-suite coverage comes from the golden below.Golden test
New
6D29F444("Viscous -> visc_model=1"): 1D,model_eqns = 2, HLLC. The patches start at T = 2.5, 2.5, 2.0, so μ spans e9–e10 around the base1/Re(1) = 1e4. The golden was generated with gfortran 15.2; an ifx build of the same case agrees to a maximum relative difference of 2e-14.Suite and toolchain
./mfc.sh test --select-enforce(CPU, gfortran 15.2, localmpirun): 723 passed, 0 failed, 39 skipped (762 total). Coverage selection picked the full suite because macro and codegen inputs changed. All 71 Viscous and conduction tests pass, and no existing golden was modified.TestArrheniusViscosityvalidator tests pass.test_fluid_pp_parameter_set_unchangedis updated for the three newfluid_ppfields../mfc.sh precheck: 7/7 pass.Notes for reviewers
Validator (
check_visc_model). It requires all of:viscous = Tmodel_eqns = 2or3riemann_solver = 1or2cv > 0on every fluidvisc_cset, andvisc_dset and nonzeroIt rejects
visc_c/visc_dwithoutvisc_model = 1, and rejects the model combined withnon_newtonian,cyl_coord,bubbles_euler,ib,igrorchemistry.Re(1)must still be set for an Arrhenius fluid, becauseviscousrequires it, as it does fornon_newtonian. Its value is unused for that fluid's shear viscosity.Re(2)(bulk) stays constant.weno_Re_flux = Fin the example. It is explained in its README. For a single fluid with smooth μ,weno_Re_fluxleaves the 2Δy mode of the wall-normal velocity gradient undamped, and with no advection nothing else damps it. The compact central gradient does.run_suite.shis force-added past theexamples/**/*.shignore rule, asexamples/1D_convergence/submitJobs.shis.Known limitations
Twall. This is documented incase.md; the Couette case still converges at second order.non_newtonian: both models would ownRe(1).cyl_coord: the cylindrical viscous source inm_riemann_stateforms its ownRe_s, and it is not overridden or validated here.cvwould drop out of the heat capacity and bias T high. The validator requirescvon every fluid instead.GPU_*macros and follows the HB device-array pattern.Size
About 200 lines of source, toolchain and docs. The physics is the 52-line
m_arrhenius_viscositymodule plus five 2–4 line call sites. The rest is plumbing the toolchain requires:fluid_ppfields in three targets' defaults and the parameter registrycase.mdrows and paragraphTests (validator unit tests, golden) and the example are additional.
Contribution Policy
Written with Claude Code. The physics is verified against a closed-form solution, as above. It is a port of a feature developed and validated on a fork, rebuilt onto upstream conduction (#1906).
Acknowledgement
🤖 Generated with Claude Code
https://claude.ai/code/session_01VtsGVvCfsDJz5dmtSk9dKt