Fix recuperator effectiveness for real-gas fluids#71
Merged
Conversation
The bisection observer assumed positive residual on model failure, telling the solver the pinch point hadn't been reached yet. For real-gas fluids (CoolProp), model failures near the upper bracket mean the cold outlet temperature violates the second law — the solver should treat that as negative (past the pinch). The inverted sign collapsed the bracket toward q_actual, producing effectiveness of 1.0 regardless of the actual min ΔT.
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.
Fix recuperator effectiveness returning 1.0 for real-gas fluids (CoolProp) even when min ΔT is well above zero.
The bug
The bisection observer in
effectiveness::computeassumed positive residual on model failure, telling the solver "min ΔT is still above zero, keep pushing." For real-gas fluids near the critical point, model failures at high cold outlet temperatures mean the second law has been violated — the solver should treat that as negative (past the pinch). The inverted sign collapsed the bracket towardq_actualinstead ofq_max, givingq_actual / q_max ≈ 1.0.Visible on the dashboard with default sCO₂ conditions: effectiveness showed 1.000 while min ΔT was 7.8 K.
The fix
One-line change:
assume_positive()→assume_negative()in the bisection observer.Test
Added
effectiveness_consistent_with_min_delta_tcovering both PerfectGas and CoolProp. Asserts that effectiveness < 1.0 whenever min ΔT > 1 K.With the fix, CoolProp returns effectiveness ≈ 0.97 for the dashboard defaults — consistent with the 7.8 K min ΔT.