-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove iteration counter and norms that are already covered by SolverStatistics #1232
base: develop
Are you sure you want to change the base?
Conversation
…nd nonlinear_increment_norm between solver methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Would it make sense to add a test that runs for a fixed number of iterations and than e.g. checks that at the end the iteration count is as expected?
|
||
solver_progressbar.update(n=1) | ||
# Ignore line being too long, because we would need an additional | ||
# variable to fix this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you agree with this, @keileg?
break | ||
|
||
if not is_converged: | ||
model.after_nonlinear_failure() | ||
|
||
return is_converged, iteration_counter | ||
return is_converged, model.nonlinear_solver_statistics.num_iteration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it important to return the counter?
Changes proposed by @IngridKJ and I.
Proposed changes
Adresses issues #1219 and #1200.
model.nonlinar_solver_statistics
already keeps track of the number of nonlinear iterations, residual norms, and nonlinear increment norms. Thus, any explicit passes of these values betweenSolutionStrategy.after_nonlinear_convergence
,SolutionStrategy.check_convergence
, andNewtonSolver.solve
are removed. Conveniently, this fixesiteration_counter
lagging behind by one step.On an additional note, we noticed that the test suite does not cover the case of divergence due to nan values in
SolutionStrategy.check_convergence
, i.e., lines 547-551 insolution_strategy.py
. Wwe only noticed a mistake in our changes due to flake complaining, not the tests. Any opinions on that would be welcome :)Types of changes
What types of changes does this PR introduce to PorePy?
Not quite sure how to categorize this, as it is only code cleanup, but any custom scripts depending on
iteration_counter
andcheck_convergence
will break.Checklist
pytest
was run with the--run-skipped
flag.