Skip to content

JWL equation of state: single-material and multi-fluid mixture implementation#1586

Draft
fahnab666 wants to merge 3 commits into
MFlowCode:masterfrom
fahnab666:jwl-upstream-rebase
Draft

JWL equation of state: single-material and multi-fluid mixture implementation#1586
fahnab666 wants to merge 3 commits into
MFlowCode:masterfrom
fahnab666:jwl-upstream-rebase

Conversation

@fahnab666

Copy link
Copy Markdown

Description

Implements the Jones--Wilkins--Lee (JWL) equation of state in MFC for detonation-products modeling, including:

  • single-material JWL cases,

  • multi-fluid JWL/ideal-gas mixtures,

  • four mixture closures,

  • GPU-resident JWL parameter tables,

  • quantitative verification tests.

Closes #.

Type of change

  •  New feature


JWL EOS

The JWL pressure is implemented as a Mie--Gruneisen EOS with a two-exponential cold curve:

p = p_cold(rho) + omega*rho*e

where

p_cold(rho) =
    A*(1 - omega/(R1*V))*exp(-R1*V)
  + B*(1 - omega/(R2*V))*exp(-R2*V)

V = rho0/rho

The isentropic sound speed uses the Rocflu/Stanley form:

c^2 = dp_cold/drho + omega*(e + p/rho)

This requires only p and rho, with no explicit temperature evaluation, keeping the EOS inexpensive on the GPU hot path.


EOS selection

Each fluid selects its EOS using fluid_pp(i)%eos.

Value EOS Notes
1 Stiffened gas Default
2 JWL Requires fluid_pp(i)%jwl_* parameters

Sub-cold-curve states, where p < p_cold(rho), are intentionally skipped because the temperature floor clamps T = 0; therefore, exact round-trip identity is not expected.


Checklist

  •  I added or updated tests for new behavior.

  •  I updated documentation if user-facing behavior changed.

  •  GPU results match CPU results.

  •  Tested on NVIDIA GPU or AMD GPU.

Description

Implements the Jones--Wilkins--Lee (JWL) equation of state in MFC for detonation-products modeling, including:

  • single-material JWL cases,

  • multi-fluid JWL/ideal-gas mixtures,

  • four mixture closures,

  • GPU-resident JWL parameter tables,

  • quantitative verification tests.

Closes #.

Type of change

  •  New feature


JWL EOS

The JWL pressure is implemented as a Mie--Gruneisen EOS with a two-exponential cold curve:

p = p_cold(rho) + omega*rho*e

where

p_cold(rho) =
    A*(1 - omega/(R1*V))*exp(-R1*V)
  + B*(1 - omega/(R2*V))*exp(-R2*V)

V = rho0/rho

The isentropic sound speed uses the Rocflu/Stanley form:

c^2 = dp_cold/drho + omega*(e + p/rho)

This requires only p and rho, with no explicit temperature evaluation, keeping the EOS inexpensive on the GPU hot path.


EOS selection

Each fluid selects its EOS using fluid_pp(i)%eos.

Value EOS Notes
1 Stiffened gas Default
2 JWL Requires fluid_pp(i)%jwl_* parameters

Sub-cold-curve states, where p < p_cold(rho), are intentionally skipped because the temperature floor clamps T = 0; therefore, exact round-trip identity is not expected.


Checklist

  •  I added or updated tests for new behavior.

  •  I updated documentation if user-facing behavior changed.

  •  GPU results match CPU results.

  •  Tested on NVIDIA GPU or AMD GPU.

Add Jones-Wilkins-Lee equation of state with four mixture closures
(isobaric, Kuhl-Khasainov, p-T equilibrium, Rocflu blend) via
jwl_mix_type. New shared m_jwl module, per-fluid eos selector,
GPU-resident parameter arrays, example cases, and inverse-function
test suite.
@fahnab666

Copy link
Copy Markdown
Author

@claude full review

Fahad Nabid added 2 commits June 12, 2026 13:44
Without this, the device copy of jwl_mix_type was uninitialized; non-zero
mixture closures (Kuhl, p-T equil, Rocflu) silently executed the wrong
branch on GPU.
… rocflu fix

- s_initialize_jwl_module: add f_is_default sentinel checks on all JWL
  parameters, positivity checks on R1/R2/omega/rho0, n_jwl>1 guard;
  upgrade cv check with f_is_default; use local use statements
  (m_mpi_common, m_helper_basic) instead of module-level import
- s_jwl_sound_speed_squared: refactor to reuse s_jwl_pcold /
  s_jwl_dpcold_drho helpers instead of inlining the same algebra
- s_jwl_ptequil_pressure_er/energy_pr: add 1e-12 early-exit to both
  bisection loops; add bracket sign check in energy_pr fallback
- s_jwl_rocflu_pressure_er/energy_pr: widen high-Y guard to
  1-1e-4 (symmetric with low-Y guard) to close the 0.99 discontinuity
- m_variables_conversion: remove dead s_mpi_allreduce_integer_sum import
- tests: add golden files for jwl_single_material_shocktube,
  1D/2D jwl_mixture_test
@fahnab666 fahnab666 force-pushed the jwl-upstream-rebase branch from 73700a5 to d83068f Compare June 13, 2026 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant