Merged
Conversation
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.
Summary
Fix Issue #42 by resetting transient equilibrium Newton state on each
EqSolver_solvecall so reusing anEqSolutiondoes not carry stale iteration history into the next solve.This addresses history-dependent non-convergence observed in:
In addition, this PR now hardens the non-converged recovery path so failed/singular solves do not poison subsequent solves:
EqSolutionnow stores a last-stable warm-start snapshotconverged=.false.(instead of abort) so sweeps can continueChanges
Core solver robustness:
EqSolution_reset_iteration_state(soln)insource/equilibrium.f90EqSolver_solve(after constraints setup, before matrix/phase iteration)Reset scope is intentionally surgical (transient fields only):
dln_nj(:),dnj_c(:),dln_n,dln_T,dpi_egas_converged,condensed_converged,moles_converged,element_converged,temperature_converged,entropy_converged,pi_converged,ions_converged,converged)T,nj,ln_nj, active condensed set,pi,pi_prev)Additional core recovery/state lifecycle updates in
source/equilibrium.f90:EqSolution:T_seed,n_seednj_seed(:),ln_nj_seed(:)is_active_seed(:),active_rank_seed(:)j_sol_seed,j_liq_seed,j_switch_seed,last_cond_idx_seedEqSolution_save_seed(soln)EqSolution_restore_seed(soln)EqSolution_initEqSolver_solveentry logic:EqSolver_solve:soln%converged=.false.(and restore reduced elements) rather than abortingNew core regressions in
source/equilibrium_test.pf:test_issue42_reuse_solution_hp_then_tptest_issue42_reuse_solution_condensed_tp_gridtest_reuse_solution_recovers_after_nonconverged_pointNew Python regressions in
source/bind/python/tests/test_issue42_solver_history.py:test_issue42_detonation_no_inner_eq_failuretest_issue42_reused_eqsolution_matches_freshTesting
ctest -R cea_core_test -Vpython test_main.pypython -m pytest.pyfiles attached to the issueCompatibility / Numerical behavior
Expected behavior change is limited to solver robustness when reusing
EqSolutionobjects across solves:converged=.false.instead of aborting the process.