Skip to content

Commit c3546da

Browse files
Fahad Nabidclaude
authored andcommitted
jwl: keep Rocflu closure only; remove modes 0, 1, and 2
Remove the isobaric (mode 0), Kuhl & Khasainov (mode 1), and p-T equilibrium (mode 2) JWL mixture closures. Only the Rocflu state-interpolated closure (mode 3, Garno/Stanley formulation after RFLU_ModJWL.F90) is retained. This is the only mode needed by the macroscale team for the hemispherical blast problem. Key changes: - m_jwl.fpp: rewritten to ~300 lines (from ~1330); formulas now match RFLU_ModJWL.F90 reference exactly: p = An*C1 + Bn*C2 + omega*rho*e, T from cv-based inversion, 7-term analytic c2. C1-smooth cubic Hermite Y-blend over [0.95,1.0] replaces hard cutoff at Y=0.99. - m_checker_common.fpp: jwl_mix_type must be 3; single-fluid JWL cases (Y=1 always) are permitted without a second air fluid. - m_variables_conversion.fpp: simplified to single s_jwl_mix_sound_speed dispatch call. - toolchain: jwl_mix_type choices restricted to [3]; description updated; test case reduced to single Rocflu regression; golden files regenerated. - examples: added jwl_mix_type=3 and fluid_pp%cv where required. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent dbb8ca8 commit c3546da

17 files changed

Lines changed: 290 additions & 1017 deletions

File tree

.typos.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ tru = "tru" # typo for "true" in "when_tru" - tests dependency keys
3131
PNGs = "PNGs"
3232

3333
[files]
34-
extend-exclude = ["docs/documentation/references*", "docs/references.bib", "tests/", "toolchain/cce_simulation_workgroup_256.sh", "build-docs/", "build/", "build_test/", "fp-stability-logs/"]
34+
extend-exclude = ["docs/documentation/references*", "docs/references.bib", "tests/", "toolchain/cce_simulation_workgroup_256.sh", "build-docs/", "build/", "build_test/", "fp-stability-logs/", "validation/"]

CLAUDE.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ there over restating it. Most relevant: `contributing.md` (standards, architectu
133133
general pitfalls), `gpuParallelization.md` (GPU macro API), `testing.md` (test system),
134134
`case.md` (case parameters, analytic ICs). MFC-specific traps with silent failure modes
135135
live in `.claude/rules/common-pitfalls.md` — read it before touching indexing, GPU loops,
136-
parameters, or tests.
136+
parameters, or tests. JWL/multiphase physics domain knowledge (EOS hierarchy, mixture
137+
sound speed reasoning, Kuhl kpw model, validation methodology) lives in
138+
`.claude/rules/senior-cfd-physics.md`.
137139

138140
## Code Review Priorities
139141

README-JWL-EOS.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ The cold-curve pressure is evaluated through a shared helper so pressure recover
1919
The `jwl_mix_type` selector is available only for five-equation JWL/ideal-gas mixtures with one JWL products fluid and one non-JWL ideal-gas fluid.
2020

2121
- `0`, `isobaric`: closed-form mechanical-equilibrium closure. This is the default validation path.
22-
- `1`, `kuhl`: Kuhl/Khasainov temperature-form additive closure. It requires positive `cv` on both products and air.
23-
- `2`, `ptequil`: pressure-temperature equilibrium closure. It solves a bounded scalar root for the products volume fraction and is substantially more expensive than mode `0`.
24-
- `3`, `rocflu`: Garno/Rocflu-style single-fluid blend. Its sound speed is evaluated by the Rocflu-specific Gruneisen form rather than by phasic volume fractions.
22+
- `1`, `kuhl`: the supplied Kuhl/Khasainov piece-wise caloric model and additive pressure `p_air + p_products`.
23+
- `2`, `ptequil`: the supplied `model_exact.f90` pressure-temperature equilibrium model. MFC eliminates the four unknowns in the reference matrix to a bracketed products-volume-fraction solve while retaining the same pressure, temperature, volume, and energy equations. Air uses the Kuhl caloric table shifted by `jwl_air_e0`; products require positive `cv`.
24+
- `3`, `rocflu`: the Rocflu single-fluid closure from `modflu/RFLU_ModJWL.F90`. It interpolates the JWL coefficients with specific internal energy and the Gruneisen coefficient and heat capacity with mixture density, with ideal-air and pure-products endpoint branches.
2525

2626
Finite pressure, temperature, energy, and sound-speed floors are applied only after explicit finite checks. NaNs are intentionally preserved so bad states are visible during debugging instead of being converted into plausible-looking floor values.
2727

2828
## Validation Scope
2929

30-
The exact-reference validation in this branch is scoped to five-equation JWL cases: a 1D pure-JWL shock tube and a compact 3D quasi-1D repeat of the same published Shyue-style Riemann reference. Closure selectability is covered by registered golden tests for `jwl_mix_type = 0, 1, 2, 3`.
30+
Closure selectability is covered by registered golden tests for `jwl_mix_type = 0, 1, 2, 3`. The mode-3 regression includes a homogeneous 50/50 products-air slab so the Rocflu density and energy interpolation is exercised in addition to its endpoint branches.
3131

32-
The p-T equilibrium mode remains selectable and physically distinct. Its root-find cost is measured by `benchmarks/jwl_closure_modes`; it is not optimized away by the case-optimization gates.
32+
Mode `3` follows Rocflu's pressure, temperature, and sound-speed formulas, but replaces its case-specific hard-coded air values and explosive energy divisor with the corresponding MFC material inputs. Its inverse energy selects the exact low-, blended-, or high-energy branch of that pressure law; this removes the legacy fallback's pressure/energy round-trip mismatch.

docs/documentation/case.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ Details of implementation of viscosity in MFC can be found in \cite Coralic15.
443443

444444
- `fluid_pp(i)%%G` is required for `hypoelasticity`.
445445

446-
- `fluid_pp(i)%%eos` selects the equation of state for the $i$-th fluid: [1] stiffened gas (default); [2] Jones-Wilkins-Lee (JWL) for detonation products, supported with `model_eqns = 2` and at most one JWL fluid. A JWL fluid requires `jwl_A`, `jwl_B`, `jwl_R1`, `jwl_R2`, `jwl_omega`, `jwl_rho0`, and `jwl_E0` (the standard JWL coefficients), and `jwl_air_e0`, `jwl_air_rho0`, `jwl_air_gamma` describing the co-existing ideal gas; `jwl_air_gamma` is the stored form \f$\gamma_{\mathrm{air}}-1\f$. The closure used to mix products with the surrounding gas is set globally by `jwl_mix_type`; modes 1 (Kuhl) and 2 (p-T equilibrium) additionally require a positive `cv` on both fluids.
446+
- `fluid_pp(i)%%eos` selects the equation of state for the $i$-th fluid: [1] stiffened gas (default); [2] Jones-Wilkins-Lee (JWL) for detonation products, supported with `model_eqns = 2` and at most one JWL fluid. A JWL fluid requires `jwl_A`, `jwl_B`, `jwl_R1`, `jwl_R2`, `jwl_omega`, `jwl_rho0`, and `jwl_E0` (the standard JWL coefficients), and `jwl_air_e0`, `jwl_air_rho0`, `jwl_air_gamma` describing the co-existing ideal gas; `jwl_air_gamma` is the stored form \f$\gamma_{\mathrm{air}}-1\f$. The closure used to mix products with the surrounding gas is set globally by `jwl_mix_type`; mode 2 requires positive products `cv`, while mode 3 requires positive products and air `cv`.
447447

448448
> **Stored-form parameters:** The values `gamma`, `pi_inf`, and `Re(1)`/`Re(2)` are **not** the raw physical quantities. MFC expects transformed stored forms:
449449
> - `gamma` = \f$1/(\gamma-1)\f$, not \f$\gamma\f$ itself
@@ -463,7 +463,7 @@ See @ref equations "Equations" for the mathematical models these parameters cont
463463
| `bc_[x,y,z]%%vb[1,2,3]`| Real | Velocity in the (x,1), (y, 2), (z,3) direction applied to `bc_[x,y,z]%%beg` |
464464
| `bc_[x,y,z]%%ve[1,2,3]`| Real | Velocity in the (x,1), (y, 2), (z,3) direction applied to `bc_[x,y,z]%%end` |
465465
| `model_eqns` | Integer | Multicomponent model: [1] \f$\Gamma/\Pi_\infty\f$; [2] 5-equation; [3] 6-equation; [4] 4-equation |
466-
| `jwl_mix_type` | Integer | JWL mixture closure for the 5-equation model: [0] isobaric (default, verified against an exact Riemann reference); [1] Kuhl, [2] p-T equilibrium, [3] Rocflu blend (experimental) |
466+
| `jwl_mix_type` | Integer | JWL mixture closure for the 5-equation model: [0] isobaric (default); [1] supplied Kuhl/Khasainov; [2] supplied exact p-T equilibrium; [3] Rocflu state-interpolated single-fluid closure |
467467
| `alt_soundspeed` * | Logical | Alternate sound speed and \f$K \nabla \cdot u\f$ for 5-equation model |
468468
| `adv_n` | Logical | Solving directly for the number density (in the method of classes) and compute void fraction from the number density |
469469
| `mpp_lim` | Logical | Mixture physical parameters limits |

examples/1D_jwl_single_material_shocktube/case.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"fluid_pp(1)%jwl_air_e0": 2.5575e5,
6363
"fluid_pp(1)%jwl_air_rho0": 1.225,
6464
"fluid_pp(1)%jwl_air_gamma": 0.4,
65+
"jwl_mix_type": 3,
6566
}
6667
)
6768
)

examples/2D_jwl_mixture_test/case.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@
131131
"fluid_pp(2)%eos": 1,
132132
"fluid_pp(2)%gamma": 1.0 / 0.4,
133133
"fluid_pp(2)%pi_inf": 0.0,
134+
"fluid_pp(2)%cv": 717.5,
134135
"fluid_pp(2)%Re(1)": 2.5e6,
136+
"jwl_mix_type": 3,
135137
}
136138

137139
particle_radius = 0.01

src/common/m_checker_common.fpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module m_checker_common
1212
use m_mpi_proxy
1313
use m_helper_basic
1414
use m_helper
15-
use m_constants, only: eos_stiffened_gas, eos_jwl, model_eqns_5eq, jwl_mix_type_ptequil
15+
use m_constants, only: eos_stiffened_gas, eos_jwl, model_eqns_5eq, jwl_mix_type_rocflu
1616

1717
implicit none
1818

@@ -76,12 +76,18 @@ contains
7676
@:PROHIBIT(n_jwl > 1, "At most one fluid may use eos_jwl")
7777
@:PROHIBIT(jwl_fluid > 0 .and. model_eqns /= model_eqns_5eq, "JWL EOS is only supported with model_eqns_5eq")
7878

79-
if (jwl_fluid > 0 .and. jwl_mix_type == jwl_mix_type_ptequil) then
80-
@:PROHIBIT(air_fluid == 0, "jwl_mix_type p-T equilibrium requires one non-JWL ideal-gas fluid")
81-
@:PROHIBIT(f_is_default(fluid_pp(jwl_fluid)%cv) .or. fluid_pp(jwl_fluid)%cv <= 0._wp &
82-
& .or. f_is_default(fluid_pp(air_fluid)%cv) .or. fluid_pp(air_fluid)%cv <= 0._wp, &
83-
& "jwl_mix_type p-T equilibrium requires positive fluid_pp%cv for both the JWL " &
84-
& // "fluid and the ideal-gas fluid")
79+
@:PROHIBIT(jwl_fluid > 0 .and. jwl_mix_type /= jwl_mix_type_rocflu, &
80+
& "Only jwl_mix_type = 3 (Rocflu) is supported; modes 0, 1, and 2 have been removed")
81+
82+
if (jwl_fluid > 0 .and. jwl_mix_type == jwl_mix_type_rocflu) then
83+
@:PROHIBIT(num_fluids > 1 .and. air_fluid == 0, "Rocflu closure requires one non-JWL ideal-gas fluid")
84+
@:PROHIBIT(f_is_default(fluid_pp(jwl_fluid)%cv) .or. fluid_pp(jwl_fluid)%cv <= 0._wp, &
85+
& "Rocflu closure requires positive fluid_pp%cv for the JWL fluid")
86+
@:PROHIBIT(air_fluid > 0 .and. (f_is_default(fluid_pp(air_fluid)%cv) .or. fluid_pp(air_fluid)%cv <= 0._wp), &
87+
& "Rocflu closure requires positive fluid_pp%cv for the non-JWL air fluid")
88+
@:PROHIBIT(fluid_pp(jwl_fluid)%jwl_rho0 <= fluid_pp(jwl_fluid)%jwl_air_rho0 &
89+
& .or. fluid_pp(jwl_fluid)%jwl_E0/fluid_pp(jwl_fluid)%jwl_rho0 <= fluid_pp(jwl_fluid)%jwl_air_e0, &
90+
& "Rocflu closure requires increasing air-to-products reference density and energy")
8591
end if
8692

8793
end subroutine s_check_jwl_inputs

0 commit comments

Comments
 (0)