Repository navigation
Add chem_params%transport_dt: limit dt by the local chemistry transport #2082
Description
Summary
Adds chem_params%transport_dt (logical, default F).
With chemistry, the viscous fluxes use temperature-dependent μ and the diffusion step integrates λ and the mixture-averaged species diffusivities explicitly, but the adaptive dt only checks the viscous limit with the constant fluid_pp%Re (the thermal TCFL applies only to the non-chemistry heat_conduction model). Mixture transport grows steeply with temperature: in air with CO near an 1800 K wall the thermal diffusivity is ~30× and the largest species diffusivity (H) ~160× the 300 K kinematic viscosity that the current limit uses.
With transport_dt = T, s_compute_dt replaces Re in the viscous limit by 1/(d ρ D), D = max(μ/ρ [viscous], λ/(ρ c_p) and max_k D_k [chem diffusion]) and d the number of dimensions, from a new s_compute_transport_dt_re in m_chemistry. The existing VCFL branch is reused unchanged. The factor d is needed because explicit diffusion is stable only while the per-direction diffusion numbers D Δt/Δx² sum below the limit; an earlier version of this PR omitted it.
Not changed: run_time.inf's VCFL column still uses fluid_pp%Re; the routine that writes it has no temperature field.
Testing
- New case
1D -> Chemistry -> Dual Isothermal Wall Gradient -> Transport-Limited dt(88B73ED4): the existing isothermal-wall case on a 10 µm domain, where the H₂ diffusion limit (dt ≈ 2.2e-11 s) is tighter than the acoustic one (≈ 4.4e-11 s). All 40 steps report(VCFL). ./mfc.sh test --no-mpi -o Chemistry: 16 pass, unchanged (option off by default).- Validator:
TestChemistryTransportDt(requires chemistry,cfl_adap_dt/cfl_const_dt, andviscousorchem_params%diffusion). - Cost (rocprofv3, 41M cells, 4 MI300A, 13 steps): the
s_compute_dtkernel goes from 0.87 ms to 9.4 ms per call with the option on (mixture-averaged diffusivities in every cell), 0.16% → 1.6% of GPU time; time per step 0.950 s either way. No communication is added: still the one 5-entry allreduce per step. Off, the cost is a branch. - GPU (OpenMP offload, MI300A): a 2D Mach 1.5 reacting carbon rod runs 310 steps with the option on.
./mfc.sh lint passes except test_thermochem.py::test_precision_and_directives[dp-acc], which also fails without this change here (LLNL gfortran 13.3.1's nvptx offload lacks log10).
Tested on LLNL Tuolumne (CCE 19 CPU; OpenMP offload on MI300A).
Why d matters (2D): a Mach 2 shock driving a curtain of 38 hot, freely moving, reacting graphite particles diverged at t = 5.0 µs without transport_dt. With transport_dt and the limit Δx²/(2D) the same case runs to the end (11.5 µs), its step set by the transport limit (VCFL). The blowup is a checkerboard, odd–even in both space and time, in the gas next to a particle: the explicit-diffusion mode at its stability limit. In the hot, low-pressure wake (1300–1700 K, 0.3–0.5 bar) the largest diffusivity is H-atom diffusion, D ≈ 5e-3 m²/s. With Δx = 3.1 µm and the acoustic step dt = 8.9e-10 s, D·dt/Δx² ≈ 0.46 per direction (stable) but ≈ 0.93 summed over x and y (unstable). Without d the transport limit, ≈ 9.8e-10 s, would sit above the acoustic step and never activate; with d it is ≈ 4.9e-10 s.
The 1D test case and its golden are unaffected (d = 1); ./mfc.sh test -o Chemistry passes (16).
Status: a fix/implementation for this is already written, in a pull request that has been closed for queue management.
- Closed PR: Add chem_params%transport_dt: limit dt by the local chemistry transport #1953
- Branch:
chem-transport-dton thesbryngelsonfork, atd49b6a692f(branch retained, not deleted) - Size: +231/-20 across 15 files, 13 commits
- Where it sat: MERGEABLE; CI 19 checks queued (master was merged in today, so CI had not reported yet)
- Reopen with:
gh pr reopen 1953 -R MFlowCode/MFC
It was merge-clean and up to date with master. This change is also already running in a downstream campaign branch, where it has been exercised on real cases.
Tracked with pr-to-do. Filed with Claude Code.
Activity