[FXC-6100] Fix restart of mass flow rate boundary conditions#1874
Merged
yifan-flex merged 1 commit intomainfrom Mar 3, 2026
Merged
[FXC-6100] Fix restart of mass flow rate boundary conditions#1874yifan-flex merged 1 commit intomainfrom
yifan-flex merged 1 commit intomainfrom
Conversation
4e32ee5 to
ea3d9d5
Compare
yifan-flex
commented
Mar 3, 2026
Contributor
Author
yifan-flex
left a comment
There was a problem hiding this comment.
@johnmoore4 With the fix the update law will not get called for a forked case at the first pseudo step, so it still doesn't behave the same as a case continuously running. We could also remove the pseudoStep==0 guard, but this will make a fresh start case have a total pressure ~1.002. Which do you think is better?
johnmoore4
approved these changes
Mar 3, 2026
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.
Mass Flow Rate Boundary Condition Restart Bug
Symptom
When a converged steady-state case with mass flow rate inflow/outflow boundaries is forked (restarted), the solver diverges within the first few pseudo steps. Mass flow rates change drastically from their converged values and supersonic flow
appears at outflow boundaries.
Root Cause
Mass flow rate boundaries are implemented as PI controllers that iteratively adjust a pressure ratio to match a target mass flow rate. The controller's internal state (the converged pressure ratio) is correctly saved to and loaded from the restart
file.
However, on a forked restart the pseudo-step counter is reset to zero. The controller's output expression uses a pseudoStep > 0 guard that was designed to apply an initial default value (pressure ratio = 1.0) on the very first step of a fresh run.
On restart, this guard incorrectly overrides the loaded converged state with the default value, causing a sudden jump in the applied boundary pressure — for example from ~1.15 to 1.0 for total pressure ratio at an inflow.
This mismatch between the converged flow field and the suddenly-wrong boundary condition causes immediate instability and divergence.
Fix
Move the pseudoStep > 0 guard from the output expression to the update expression. The output always uses the current controller state directly. At pseudo step 0 the update becomes a no-op, preserving whatever value the state holds — the default
1.0 on a fresh start, or the converged value on a restart. This is correct in both cases since at step 0 no flow data has been computed yet to base an update on.
Note
Cursor Bugbot is generating a summary for commit 4e32ee5. Configure here.