Skip to content

Remove the four-equation model (model_eqns = 4) - #1713

Open
sbryngelson wants to merge 1 commit into
masterfrom
remove/model-eqns-4
Open

Remove the four-equation model (model_eqns = 4)#1713
sbryngelson wants to merge 1 commit into
masterfrom
remove/model-eqns-4

Conversation

@sbryngelson

@sbryngelson sbryngelson commented Aug 9, 2026

Copy link
Copy Markdown
Member

Removes the four-equation Tait model (model_eqns = 4) from the codebase, together with the logic and variables that existed only to serve it.

Fixes #1710 — the pref overwrite in s_add_bubbles is deleted here, since the global it wrote no longer exists.

Why

Nothing exercised it. The test suite only ever sets model_eqns to 2 or 3; no example or benchmark sets 4; and no case anywhere set the rhoref/pref pair the model required. Its code paths were unverifiable in either direction — a change breaking them would have gone unnoticed, and so would a change fixing them.

Meanwhile its presence forced a model_eqns branch through the pressure inversion, the energy assembly, the primitive recovery, the HLLC solver, the immersed-boundary and acoustic-source updates, and both initialisation paths.

This surfaced while tracing pref for #1710.

What was removed

Structure

  • the eqn_idx/sys_size branch in m_global_parameters_common and its nested bubbles_euler block, plus the same block in all three m_global_parameters.fpp
  • the Tait inversion in s_compute_pressure and the zero-energy assignment in the prim -> cons path; both collapse to the five-equation forms
  • the 209-line four-equation branch in m_riemann_solver_hllc
  • the /= 4eq guards in primitive recovery, IBM, acoustic source, and pre-process patch assignment
  • the sound-speed branch condition, now simply five-equation with bubbles_euler
  • the rho vs alpha_rho variable-naming split in post-process output

model_eqns_4eq is generated from the names dict in definitions.py, so dropping "4eq" removes the constant without touching m_constants.fpp.

Variables that die with it

Variable Why
rhoref every read was a Tait relation; registry entry, GPU declaration, MPI broadcast and BASE_CFG default all removed
pref same
lit_gamma (+ the pi_inf/gamma pairs feeding it) assigned solely for the Tait density relation, in four m_icpp_patches subroutines and one in m_assign_variables
pref = gas_p(...) in s_add_bubbles #1710; its last reachable consumer was the Tait branch

A note on the hardcoded ICs. They appear to read the global pref, but do not. 2dHardcodedIC.fpp and 3dHardcodedIC.fpp each declare their own local pRef in the variables macro and set it to 1e5; because Fortran is case-insensitive, that local shadows the module global. Their references are renamed to the declared spelling so the shadowing is visible rather than implied. No behaviour change.

Toolchain and docs

Validator rules, the model_eqns choices/labels/names, the bubbles_euler requires_value, the model_eqns = 4 dependency block, and the case.md / equations.md / contributing.md entries are updated. A case setting model_eqns = 4 now fails validation with the standard out-of-range message.

Two toolchain unit tests used pref/rhoref as example registry-bound scalars; they now use poly_sigma, which is still registered in all three targets.

Verification

build (GNU 15.2, MPI):           clean
full suite:                      627 passed, 0 failed
goldens regenerated:             none
toolchain unit tests:            176 passed
precheck (CI lint-gate, 7/7):    pass

No golden moved. That is the substantive result: removing the model changes no result anywhere, which is precisely the evidence that it was dead.

The four-equation Tait model had no test, example, or benchmark exercising it:
the suite only ever sets model_eqns to 2 or 3, and no case anywhere set the
rhoref/pref pair it required. Its code paths were therefore unverifiable in
either direction, and its presence forced a model_eqns branch through the
pressure inversion, the energy assembly, the primitive recovery, the HLLC
solver, the immersed-boundary and acoustic-source updates, and both
initialisation paths.

Removed everywhere, including the logic that only existed to route around it:

  - the eqn_idx/sys_size branch and its nested bubbles_euler block
  - the Tait inversion in s_compute_pressure and the zero-energy assignment
    in the prim->cons path, collapsing both to the five-equation forms
  - the /= 4eq guards in the primitive recovery, IBM, acoustic source, and
    the pre-process patch assignment
  - the 209-line HLLC four-equation branch
  - the sound-speed branch condition, now just five-equation with
    bubbles_euler
  - the 'rho' vs 'alpha_rho' variable naming split in post-process output

model_eqns_4eq is generated from the names dict in definitions.py, so dropping
'4eq' removes the constant without touching m_constants.fpp.

Variables that die with it:

  - rhoref: every read was a Tait relation. Removed entirely, including its
    registry entry, GPU declaration, MPI broadcast, and BASE_CFG default.
  - pref: same. Note the hardcoded ICs are unaffected -- 2d/3dHardcodedIC
    declare their own local pRef and set it to 1e5, which shadowed the global
    because Fortran is case-insensitive. Their references are renamed to the
    declared spelling so the locality is visible.
  - lit_gamma, and the pi_inf/gamma pairs feeding it, in four
    m_icpp_patches subroutines and one m_assign_variables subroutine: all
    were assigned solely for the Tait density relation.
  - the pref overwrite in s_add_bubbles (#1710), whose last reachable
    consumer was the Tait branch.

Validator rules, the model_eqns choices/labels/names, the bubbles_euler
requires_value, the model_eqns=4 dependency block, and the docs entries are
updated to match. Two toolchain unit tests used pref/rhoref as example
registry-bound scalars; they now use poly_sigma, which is still registered in
all three targets.

Verified: builds clean (GNU 15.2, MPI); full suite 627 passed, 0 failed, with
no golden regenerated -- removing the model changes no result anywhere, which
is the evidence it was dead.
Copilot AI lite review requested due to automatic review settings August 9, 2026 00:28
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

Claude Code Review

Head SHA: 575d19c

Files changed:

  • 26
  • docs/documentation/case.md
  • docs/documentation/contributing.md
  • docs/documentation/equations.md
  • src/common/include/2dHardcodedIC.fpp
  • src/common/include/3dHardcodedIC.fpp
  • src/common/m_global_parameters_common.fpp
  • src/common/m_variables_conversion.fpp
  • src/post_process/m_global_parameters.fpp
  • src/post_process/m_start_up.fpp
  • src/pre_process/m_assign_variables.fpp

Findings:

  • src/simulation/m_bubbles_EL.fpp (around the removed pref = gas_p(bub_id, 1) assignment, guarded by .not. f_approx_equal((1._wp/Web), 0._wp)): this is the Euler-Lagrange bubble module (bubbles_lagrange), which is a distinct feature from bubbles_euler/model_eqns and is not gated by model_eqns anywhere in this file. Everywhere else the PR removes pref/rhoref only from code paths that were conditioned on the deleted model_eqns_4eq (Tait EOS) branch. This particular assignment had no such guard — it unconditionally set the global reference pressure from the Lagrangian bubble's initial gas pressure whenever surface tension was active. If this value was consumed anywhere outside the deleted Tait-EOS code (e.g. by other bubble/mixture pressure logic reachable with bubbles_lagrange and model_eqns 1–3), deleting the assignment silently changes that reference-pressure physics rather than being pure dead-code cleanup. Worth confirming that pref had no other live consumer before this PR, since a wrong/missing reference pressure would be a silent (non-crashing) physics regression for surface-tension Lagrangian-bubble cases.

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.

Pull request overview

This pull request removes the previously supported four-equation Tait model (model_eqns = 4) across MFC (toolchain validation/parameter registry, solver code paths in pre_process/simulation/post_process, and user-facing documentation), simplifying multiple core branches that were effectively untestable.

Changes:

  • Removed model_eqns = 4 as a valid option from the toolchain parameter definitions and case validation (including dropping pref/rhoref parameters that existed to support the Tait inversion path).
  • Deleted solver branches that were specific to the four-equation model (EOS pressure inversion/energy handling, HLLC branch, IBM/acoustic/ICPP special guards, and GPU update plumbing).
  • Updated documentation and toolchain tests to reflect the supported model_eqns set and remaining parameters.

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated no comments.

Show a summary per file
File Description
toolchain/mfc/test/case.py Removes pref/rhoref from test case defaults now that 4-equation support is gone.
toolchain/mfc/test_lint_source.py Updates lint-source tests to use poly_sigma as the example registry scalar instead of removed pref/rhoref.
toolchain/mfc/params/generators/fortran_gen.py Drops pref/rhoref from generator scalar lists so generated Fortran bindings/bcasts no longer include them.
toolchain/mfc/params/descriptions.py Removes user-facing descriptions for pref/rhoref.
toolchain/mfc/params/definitions.py Removes model_eqns=4 choice/name/label and unregisters pref/rhoref.
toolchain/mfc/params_tests/test_fortran_gen.py Adjusts generator tests to assert poly_sigma broadcast presence across targets.
toolchain/mfc/params_tests/mutation_tests.py Removes invalid-value mutation cases for pref/rhoref parameters that no longer exist.
toolchain/mfc/fp_stability.py Removes pref/rhoref from floating-point stability case parameter sets.
toolchain/mfc/case_validator.py Updates validation rules to only allow model_eqns in {1,2,3} and removes 4-equation-specific bubble checks.
src/simulation/m_riemann_solver_hllc.fpp Deletes the 4-equation HLLC flux branch and removes the constant import.
src/simulation/m_ibm.fpp Removes the model_eqns /= model_eqns_4eq gating so IBM always uses the mixture conversion path (since 4eq is removed).
src/simulation/m_global_parameters.fpp Removes 4-equation QBMM indexing block and stops GPU-updating removed pref/rhoref.
src/simulation/m_data_output.fpp Removes 4-equation-specific lit_gamma assignment path in output/probe logic.
src/simulation/m_bubbles_EL.fpp Removes assignment that overwrote global pref during Lagrangian bubble initialization.
src/simulation/m_acoustic_src.fpp Removes 4-equation guard that previously suppressed energy source updates.
src/pre_process/m_icpp_patches.fpp Removes 4-equation-dependent EOS parameter placeholders and the Tait-based density reassignment block.
src/pre_process/m_global_parameters.fpp Removes 4-equation QBMM indexing/initialization block (including the old stop path).
src/pre_process/m_assign_variables.fpp Removes 4-equation density-from-pressure logic and unifies alpha_rho assignment.
src/post_process/m_start_up.fpp Removes 4-equation constant import and simplifies output naming to always use alpha_rho* for 5eq/6eq.
src/post_process/m_global_parameters.fpp Removes 4-equation QBMM indexing/initialization block (including the old stop path).
src/common/m_variables_conversion.fpp Removes 4-equation EOS inversion and related special-casing in pressure/energy/primitive recovery/sound speed logic.
src/common/m_global_parameters_common.fpp Removes 4-equation eqn-index/system-size layout branch and drops defaults for pref/rhoref.
src/common/include/3dHardcodedIC.fpp Renames pref references to pRef to make local shadowing explicit (no behavior change intended).
src/common/include/2dHardcodedIC.fpp Same prefpRef visibility rename for the 2D hardcoded IC.
docs/documentation/equations.md Removes model_eqns = 4 from equations documentation.
docs/documentation/contributing.md Updates contributing guidance to remove references to the removed model’s EOS branch.
docs/documentation/case.md Removes pref/rhoref entries and updates model_eqns description to only list 1–3.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.27273% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.24%. Comparing base (8dfe8c7) to head (575d19c).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/simulation/m_data_output.fpp 0.00% 1 Missing and 1 partial ⚠️
src/common/m_variables_conversion.fpp 87.50% 0 Missing and 1 partial ⚠️
src/post_process/m_start_up.fpp 50.00% 0 Missing and 1 partial ⚠️
src/simulation/m_ibm.fpp 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1713      +/-   ##
==========================================
+ Coverage   60.77%   61.24%   +0.46%     
==========================================
  Files          83       83              
  Lines       20872    20700     -172     
  Branches     3101     3072      -29     
==========================================
- Hits        12685    12677       -8     
+ Misses       6121     5969     -152     
+ Partials     2066     2054      -12     

☔ 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.

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.

Lagrange bubble initialization silently overwrites the user-supplied global pref

2 participants