pmgbergen / porepy

Python Simulation Tool for Fractured and Deformable Porous Media
GNU General Public License v3.0
251 stars 88 forks source link

Deactivate redundant residual computation before check_convergence. #1171

Closed jwboth closed 6 months ago

jwboth commented 6 months ago

Proposed changes

Prior to checking the convergence in check_convergence, the residual is always computed to ask for the recent residual. However, if the tolerance is np.inf, it will actually not be required. The PR only updates the residual if the tolerance is not np.inf.

Types of changes

What types of changes does this PR introduce to PorePy? Put an x in the boxes that apply.

Checklist

Put an x in the boxes that apply or explain briefly why the box is not relevant.

No updates to tests are added, as the change only works on improving the logic.

jwboth commented 6 months ago

The following thought occurred to me when looking at the change: Does the residual update call perhaps belong inside check_convergence?

I had the identical intuitive reaction when making the changes. If we both agree on that conceptual thought, I can suggest a change for discussion.