Equation- and variable-based convergence checks - #1448
Conversation
|
Next steps:
|
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
… in multiphysics convergence check.
…eadibility of output.
There was a problem hiding this comment.
Pull Request Overview
This PR refactors convergence checking in PorePy by introducing multiphysics norms that allow filtering of residual and increment norms by equations and variables while removing the redundant reference_residual argument. Key changes include:
- Updating the convergence check to use multiphysics-specific norms by introducing a new mixin.
- Removing the reference_residual parameter from the signature of check_convergence throughout the code and tests.
- Enhancing tutorial notebooks and tests to compare solver statistics (e.g., nonlinear iterations) and residual norms for the two convergence approaches.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tutorials/poromechanics.ipynb | Adds markdown cells and examples illustrating multiphysics convergence checks with plots and iteration comparisons. |
| tests/numerics/test_time_step_control.py | Removes the reference_residual parameter from check_convergence. |
| tests/numerics/nonlinear/test_nonlinear_solvers.py | Updates the check_convergence signature accordingly. |
| tests/models/test_solution_strategy.py | Updates check_convergence calls to remove reference_residual. |
| tests/models/test_poromechanics.py | Adds a new test to compare model outputs with multiphysics norms. |
| src/porepy/numerics/nonlinear/nonlinear_solvers.py | Removes extraction and passing of reference_residual in the Newton solver routine. |
| src/porepy/numerics/linear_solvers.py | Adjusts the check_convergence call to eliminate the unnecessary reference_residual. |
Comments suppressed due to low confidence (2)
tutorials/poromechanics.ipynb:513
- The printed iteration counts (original model: 9, tailored criteria: 2) appear inconsistent with the accompanying explanation stating that the multiphysics norms lead to additional iterations. Please verify the intended behavior and update either the print output or the explanatory text to ensure consistency.
"print(f\"Number of iterations (original model): {model.nonlinear_solver_statistics.num_iteration}\")\n",
src/porepy/numerics/nonlinear/nonlinear_solvers.py:101
- The removal of the 'reference_residual' argument from the check_convergence call appears correct; please ensure that all related documentation and usage examples across the codebase reflect this update to avoid potential confusion.
nonlinear_increment, residual, self.params
IvarStefansson
left a comment
There was a problem hiding this comment.
Partial review. This is going to be great! Main concern: The new check_convergence method is quite long and has a somewhat convoluted logic. I'll return to this in a separate review. In the meantime, please consider my other comments.
…asuring norms or checking convergence
…tructure logging.
The recent updates extend the code to use L2 norms. One needs to discuss whether these should fully replace Euclidean norms. I left both options for now, requiring input from the user in form of providing the right mixin defining norm definitions. |
|
Remaining discussion points for discussion with @IvarStefansson @keileg:
Now may be the best timing to also consider the right names for some of the central objects introduced in this PR:
|
…/pmgbergen/porepy into equation_based_convergence_check
Proposed changes
Regarding issue #1441. This PR introduces the option to filter residual and increment norms by equations and variables, respectively, to be used in the convergence checks. This PR introduces a separate mixin allowing to switch between the standard convergence check and a multiphysics one.
Minor breaking change: reference_residual is removed from the signature of the check_convergence method. Upstream adaptations are made to cleanup.
Types of changes
What types of changes does this PR introduce to PorePy?
Put an
xin the boxes that apply.Checklist
Put an
xin the boxes that apply or explain briefly why the box is not relevant.pytestwas run with the--run-skippedflag.