Add a per-fluid equation-of-state selector - #1700
Conversation
Introduce fluid_pp(:)%eos, a stable five-value enumeration (stiffened_gas, ideal_gas_mixture, mie_gruneisen, jwl, table) in place of 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 every existing case is unchanged and all goldens stay bit-identical, and no runtime dispatch enters the hot per-cell path. Case files accept readable names while the integer representation stays internal. The Fortran and Python checkers 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 skips compound registry keys so the per-fluid CONSTRAINTS entries drive only readable-name resolution and validation.
State plainly that a plain ideal gas without chemistry is stiffened_gas with pi_inf = 0, and that ideal_gas_mixture is the Pyrometheus mixture backend valid only in a chemistry build. This keeps users from reaching for ideal_gas_mixture on a non-chemistry build, where it is rejected.
18786a8 to
7ee3cd3
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1700 +/- ##
==========================================
+ Coverage 60.77% 60.79% +0.01%
==========================================
Files 83 83
Lines 20872 20880 +8
Branches 3101 3101
==========================================
+ Hits 12685 12693 +8
Misses 6121 6121
Partials 2066 2066 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
sbryngelson
left a comment
There was a problem hiding this comment.
Thanks for this. The plumbing checks out — _r(f"{px}eos", INT, ...) registration means the MPI broadcast is auto-generated correctly as MPI_INTEGER for all three targets, the namelist binds fluid_pp as a derived type so fluid_pp(1)%eos resolves, and the compile-time chemistry parameter makes the pre-namelist-read default correct. The Fortran and Python checkers agree.
Four things to address before merge, mostly around the enum having several hand-synced copies. Details inline.
Separately, worth noting for context rather than as a change request: nothing in src/ currently reads %eos, and both checkers leave exactly one legal value per build since it is fully determined by chemistry. That is defensible as step-2 groundwork, but it is the part I would most want justified given the guidance against config knobs with one correct value.
than hand-sync the eos integer values, and cover the bubbles_euler slot Records the fluid_pp(:)%eos hand-written constants as a "still manual" case in common-pitfalls.md and notes it in the m_constants.fpp comment, since generate_constants_fpp silently skips compound registry keys. check_eos in case_validator.py now reads its two supported values from CONSTRAINTS["fluid_pp(1)%eos"]["names"], the same idiom already used for recon_type, instead of a third hand-synced copy of 1 and 2. check_eos (Python) and s_check_eos (Fortran) both now cover the extra fluid property slot that bubbles_euler uses, matching the existing check_stiffened_eos pattern; previously fluid_pp(num_fluids+1)%eos went unvalidated when bubbles_euler was set. Adds eos to the physical_parameters member list comment in definitions.py, the registry/type drift guard from MFlowCode#1553.
Adds
fluid_pp(i)%eos, a stable enumeration for a fluid's equation of state, in place of the implicit backend selection. This is the second step of the incremental EOS interface.Only the two backends we already support are accepted:
stiffened_gas(default)ideal_gas_mixture(chemistry builds, via Pyrometheus)mie_gruneisen,jwl, andtableare reserved in the enum and rejected until their backends exist.ideal_gas_mixtureis the Pyrometheus mixture backend and is only valid in a chemistry build. On a non-chemistry build it is rejected, not silently downgraded. A plain ideal gas without chemistry is already covered bystiffened_gaswithpi_inf = 0, which reduces the stiffened-gas law to the ideal-gas law, so it does not need its own enum value.The default resolves from the compile-time
chemistryflag, so existing cases do not change and the golden suite stays bit-identical (616/616, no goldens regenerated). The selector is validated at input time only, so nothing new enters the per-cell hot path. Case files use the readable names while the integer stays internal. The Fortran and Python checkers both reject unsupported values,ideal_gas_mixtureon a non-chemistry build, and mixing EOS families within one run.