Explicit per-fluid equation-of-state selector#1664
Closed
fahnab666 wants to merge 1 commit into
Closed
Conversation
Introduce fluid_pp(:)%eos, a stable five-value enumeration (stiffened_gas, ideal_gas_mixture, mie_gruneisen, jwl, table) replacing implicit backend selection. Only stiffened_gas (default) and ideal_gas_mixture (chemistry, Pyrometheus) are backed by an adapter; the remaining values are reserved and rejected explicitly. The default resolves from the compile-time chemistry flag so all existing goldens stay bit-identical, and no runtime dispatch enters the hot per-cell path. Case files accept readable names; the integer representation stays internal. Checkers (Fortran and Python) reject unsupported values, ideal_gas_mixture without a chemistry build, and intra-cell EOS mixing (every fluid must share one family). The five enum constants are hand-written in m_constants.fpp; the constant generator now skips compound registry keys so the per-fluid CONSTRAINTS entries drive only readable-name resolution and validation.
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces an explicit per-fluid equation-of-state (EOS) selector (fluid_pp(i)%eos) to replace scattered boolean selection, while keeping current behavior unchanged by default and rejecting unsupported EOS options in both Python and Fortran validation layers.
Changes:
- Add
fluid_pp(:)%eosto the Fortran physical-parameters type and initialize it consistently across pre_process/simulation/post_process. - Extend the Python parameter registry and static validator to accept readable EOS names and reject unsupported
(eos, chemistry)combinations with documented guidance. - Prevent auto-generation of invalid Fortran enum identifiers for compound keys, and define EOS enum constants centrally in
m_constants.fpp.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| toolchain/mfc/params/generators/fortran_gen.py | Skips enum-constant emission for compound/indexed keys that can’t form valid Fortran identifiers. |
| toolchain/mfc/params/descriptions.py | Adds a description entry for fluid_pp(i)%eos. |
| toolchain/mfc/params/definitions.py | Registers fluid_pp(i)%eos with name→int mapping and value labels for toolchain parsing/validation. |
| toolchain/mfc/case_validator.py | Adds check_eos plus documentation entry and wires it into common validation. |
| src/simulation/m_global_parameters.fpp | Initializes fluid_pp(i)%eos default based on chemistry. |
| src/pre_process/m_global_parameters.fpp | Initializes fluid_pp(i)%eos default based on chemistry. |
| src/post_process/m_global_parameters.fpp | Initializes fluid_pp(i)%eos default based on chemistry. |
| src/common/m_global_parameters_common.fpp | Re-exports EOS enum constants needed for defaults/checks. |
| src/common/m_derived_types.fpp | Adds eos field to physical_parameters type. |
| src/common/m_constants.fpp | Defines stable EOS enum constants (eos_*). |
| src/common/m_checker_common.fpp | Adds Fortran-side runtime check s_check_eos and calls it from common input checking. |
| docs/documentation/case.md | Documents the new fluid_pp(i)%%eos parameter and current supported options. |
This was referenced Jul 21, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1664 +/- ##
==========================================
+ Coverage 59.46% 59.47% +0.01%
==========================================
Files 83 83
Lines 21170 21178 +8
Branches 3135 3135
==========================================
+ Hits 12588 12596 +8
Misses 6476 6476
Partials 2106 2106 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
sbryngelson
marked this pull request as draft
July 21, 2026 12:32
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.
Description
Second step of the incremental multi-equation-of-state (EOS) interface: an explicit, stable per-fluid EOS selector in place of scattered booleans. Each fluid carries an integer
fluid_pp(i)%eosdrawn from a five-value enumeration:stiffened_gasideal_gas_mixturemie_gruneisenjwltableOnly the already-supported backends are exposed: stiffened gas stays the default, and
ideal_gas_mixture(Pyrometheus) is used whenchemistry = T. The remaining three values are defined for forward compatibility but explicitly rejected at validation, so no unsupported combination can be selected. Case files use readable names, e.g."fluid_pp(1)%eos": "stiffened_gas"; the integer representation is internal.No hot-path change:
%eosis written as a default and read only in validation, never in a flux / Riemann / pressure / RHS path. The defaultmerge(eos_ideal_gas_mixture, eos_stiffened_gas, chemistry)reproduces prior solver assumptions exactly, so results are unchanged.Unsupported
(eos, feature)combinations are rejected in both layers, correctly placed: the shared Fortran runtime checker (s_check_eosinm_checker_common.fpp) and the Python static validator (check_eosincase_validator.py, with aPHYSICS_DOCSentry). The toolchain auto-generation is preserved, including a compound-key skip ingenerate_constants_fppso thefluid_pp(1)%eoskey does not emit an invalid Fortran identifier.Type of change
Testing
Full golden suite bit-identical across all three targets (pre_process, simulation, post_process) on gfortran; no golden files changed, since
%eosnever enters a numerical path. Validation behavior: unsupported(eos, feature)pairs are rejected with a clear message, readable names resolve to the enum, and a chemistry case resolves toideal_gas_mixture.This PR is independent of #1663 (central thermodynamics interface): the branch sits directly on
master, shares no symbols with that PR, and the two touchm_global_parameters_common.fpponly in disjoint regions, so they can be reviewed and merged in either order.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.