Skip to content

Add generic Mie-Gruneisen equation-of-state core#1665

Closed
fahnab666 wants to merge 3 commits into
MFlowCode:masterfrom
fahnab666:feature/eos-mie-gruneisen
Closed

Add generic Mie-Gruneisen equation-of-state core#1665
fahnab666 wants to merge 3 commits into
MFlowCode:masterfrom
fahnab666:feature/eos-mie-gruneisen

Conversation

@fahnab666

@fahnab666 fahnab666 commented Jul 21, 2026

Copy link
Copy Markdown

What this PR does

Adds a generic Mie-Gruneisen equation-of-state core as a leaf module,
src/common/m_eos_mie_gruneisen.fpp. This is the clean second non-chemistry EOS that
sits between the existing stiffened gas and any explosives-branded path: JWL becomes a
particular Mie-Gruneisen reference curve rather than an unrelated special case. No solver
path selects it yet, and mie_gruneisen stays rejected at runtime; this PR lands the
verified thermodynamic core ahead of the reference curve (JWL principal isentrope) that
will consume it.

Structure: reference-curve provider plus generic assembler

A Mie-Gruneisen material obeys p = p_ref(rho) + Gamma*rho*(e - e_ref(rho)). The reference
pair (p_ref, e_ref) and its density derivatives are the only thing that distinguishes one
material from another, so the module follows the production hydrocode split (Arienti,
Morano and Shepherd, GALCIT FM99-8, 2004; LLNL singularity-eos): one provider returns the
reference curve, one curve-agnostic assembler consumes it. Stiffened gas, ideal gas, and
JWL then differ only in the provider.

Operation Entry point
Gruneisen coefficient, reference pressure/energy and their density derivatives s_mg_stiffened_reference
pressure p(rho, e) f_mg_pressure
energy inversion e(rho, p) f_mg_internal_energy
thermodynamic derivatives `dp/drho _e, dp/de
analytic sound speed c^2 (assembled from the two derivatives) f_mg_sound_speed_sq

Gamma is a constant scalar (the correct convention for detonation products and stiffened
gas), passed to the assembler, not the density-dependent rho*Gamma = const shock closure.

Sound speed

The frozen identity c^2 = dp/drho|_e + (p/rho^2) dp/de|_rho with dp/de|_rho = Gamma*rho
(Arienti et al. 2004 Eq. 12; Menikoff and Plohr 1989), written in terms of pressure so no
separate energy argument is needed:

c^2 = dp_ref - Gamma*rho*de_ref + ((1 + Gamma)*p - p_ref)/rho

The result can go negative outside the admissible domain, so it is returned as a value and
the caller tests it before taking a square root, matching the existing mixture_err /
f_validate_state pattern rather than aborting on the GPU device.

The stiffened-gas reference curve

The one concrete reference curve shipped here is stiffened gas expressed in Mie-Gruneisen
form: Gamma = gamma_s - 1, p_ref = -pi_inf, e_ref = pi_inf/rho. It is the template the
JWL isentrope follows, and it is also the manufactured verification oracle: the generic
assembler fed this curve must reproduce the existing stiffened-gas pressure and sound speed
exactly. Ideal gas is the pi_inf = 0 sub-case.

Verification

toolchain/mfc/test_mg_eos.py holds the manufactured tests. They run in CI on every PR
through the Toolchain Compatibility matrix (Python 3.9 to 3.14, via ./mfc.sh lint).
There is no golden case because the backend is not yet runtime-selectable; the runnable
golden lands with the JWL consumer PR. The tests mirror the Fortran formulas and check:

  • Reduction to stiffened gas across ideal-air, water, stiff-solid, and monatomic
    parameter sets: pressure, energy round-trip, and sound speed all match the analytic
    stiffened-gas oracle to machine precision (worst relative error 2e-16).
  • Analytic derivatives and sound speed vs central finite differences of p(rho, e)
    for a synthetic (non-calibrated) JWL-form isentrope reference, which exercises the
    density-dependent p_ref and its derivatives that stiffened gas alone cannot.
  • Isentrope self-consistency: both reference curves satisfy de_ref/drho = p_ref/rho^2
    (the density form of de = -p dv), the check that catches per-mass vs per-initial-volume
    scaling errors in e_ref.
  • Admissibility scan: c^2 > 0 over the synthetic envelope for admissible states.

Build: pre_process, simulation, and post_process all compile with the new module. The
golden suite is unaffected by construction, since nothing calls the module yet. format
and precheck pass; the module is registered in docs/module_categories.json.

Scope

Out of scope, by design: the enum dispatch and adapter registration (needs the PR1
thermodynamics interface), the JWL reference curve and its cases (PR4), and any reaction
source. This is the generic base only.

Related

Part of the incremental EOS ladder tracked in #1638. Ladder so far: PR 1 #1663 (central thermodynamics interface), PR 2 #1664 (explicit EOS selector), PR 3 #1665 (generic Mie-Gruneisen core); JWL follows as a Mie-Gruneisen reference curve. The three open PRs are independent and can be reviewed in parallel.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.39%. Comparing base (0857ace) to head (c6a5882).

Files with missing lines Patch % Lines
src/common/m_eos_mie_gruneisen.fpp 0.00% 22 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1665      +/-   ##
==========================================
- Coverage   59.46%   59.39%   -0.07%     
==========================================
  Files          83       84       +1     
  Lines       21170    21192      +22     
  Branches     3135     3135              
==========================================
  Hits        12588    12588              
- Misses       6476     6498      +22     
  Partials     2106     2106              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sbryngelson
sbryngelson marked this pull request as draft July 21, 2026 12:32
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.

3 participants