Skip to content

Require the full inflow state when grcbc_in is enabled - #1854

Open
sbryngelson wants to merge 2 commits into
masterfrom
fix/grcbc-inflow-state
Open

Require the full inflow state when grcbc_in is enabled#1854
sbryngelson wants to merge 2 commits into
masterfrom
fix/grcbc-inflow-state

Conversation

@sbryngelson

Copy link
Copy Markdown
Member

A GRCBC subsonic inflow relaxes the boundary towards a prescribed state, so that state has to be given in full: velocity, pressure, partial densities and volume fractions. The validator checked only that the boundary type was -7.

Leaving alpha_rho_in and alpha_in unset does not fail. The boundary keeps its default sentinel and the solution diverges over a few hundred steps, which surfaces as an ICFL abort a long way from the cause:

                    22    0.002730   0.060069   0.402081
                    42    0.002730   0.114677   0.542220
                    62    0.002730   0.169285   0.783443
                    75    0.002730   0.204780   1.008977
 ICFL is greater than 1.0. Exiting.

Flat, then exponential. That cost me two runs before I compared against a case that worked, which is a poor way to learn that four parameters are mandatory rather than three.

The new check accepts every example case in the tree (./mfc.sh precheck passes, including "Validating example cases") and rejects exactly the configuration that diverged:

case result
complete inflow state accepted
same case with alpha_rho_in/alpha_in removed Subsonic Inflow (grcbc_in) needs the full inflow state; missing bc_x%alpha_rho_in(1), bc_x%alpha_in(1)

https://claude.ai/code/session_01HMJ7cycfo7kTFSFq5yhHLG

A GRCBC subsonic inflow relaxes the boundary towards a prescribed state, so
that state has to be given in full: velocity, pressure, partial densities and
volume fractions. The validator checked only that the boundary type was -7.

Leaving alpha_rho_in and alpha_in unset does not fail; the boundary keeps the
default sentinel and the solution diverges over a few hundred steps, surfacing
as an ICFL abort far from the cause. That cost me two runs before I compared
against a case that worked, which is a poor way to learn that four parameters
are mandatory rather than three.

The check accepts every example case in the tree and rejects exactly the
configuration that diverged.

Claude-Session: https://claude.ai/code/session_01HMJ7cycfo7kTFSFq5yhHLG
Copilot AI lite review requested due to automatic review settings September 11, 2026 22:19

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

Tightens input validation for GRCBC subsonic inflow so that the full prescribed inflow state is required when grcbc_in is enabled, preventing late-run divergence caused by unset sentinel defaults.

Changes:

  • Add validation that pres_in, vel_in, alpha_rho_in(*), and alpha_in(*) are all set when grcbc_in is active.
  • Improve failure reporting by listing exactly which inflow-state parameters are missing.

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

Comment thread toolchain/mfc/case_validator.py Outdated
# full. An unset component keeps its default sentinel and the boundary diverges over a few hundred
# steps rather than failing outright, which is a hard failure to read backwards from an ICFL abort.
num_fluids = self.get("num_fluids", 1)
missing = [n for n in (f"bc_{dir}%pres_in", f"bc_{dir}%vel_in(1)") if self.get(n) is None]
Comment thread toolchain/mfc/case_validator.py Outdated
Comment on lines +1800 to +1802
missing = [n for n in (f"bc_{dir}%pres_in", f"bc_{dir}%vel_in(1)") if self.get(n) is None]
missing += [f"bc_{dir}%alpha_rho_in({i})" for i in range(1, num_fluids + 1) if self.get(f"bc_{dir}%alpha_rho_in({i})") is None]
missing += [f"bc_{dir}%alpha_in({i})" for i in range(1, num_fluids + 1) if self.get(f"bc_{dir}%alpha_in({i})") is None]
@github-actions

Copy link
Copy Markdown

Claude Code Review

Head SHA: 4dae9bb

Files changed:

  • 1
  • toolchain/mfc/case_validator.py

Findings:

  • toolchain/mfc/case_validator.py (check_grcbc, new missing list): the completeness check for grcbc_in only inspects bc_{dir}%vel_in(1), but vel_in is declared with 3 components (vel_in(1..3), definitions.py) and the codebase's own convention (e.g. the turb_pos/synth_L check a few hundred lines above, which loops for d in range(1, num_dims + 1)) is that components beyond num_dims are unused while components up to num_dims are required. For a 2D (n>0) or 3D (p>0) case, an unset bc_{dir}%vel_in(2) or vel_in(3) will not be flagged as missing, silently defeating the stated purpose of this check (catching an incomplete inflow state before it causes the slow ICFL divergence described in the added comment).

@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.26%. Comparing base (e7139bc) to head (4dae9bb).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1854   +/-   ##
=======================================
  Coverage   61.26%   61.26%           
=======================================
  Files          84       84           
  Lines       22330    22330           
  Branches     3265     3265           
=======================================
  Hits        13680    13680           
  Misses       6207     6207           
  Partials     2443     2443           

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

2 participants