pmgbergen / porepy

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

Improvements and fixes for the dynamic time stepper #1201

Closed Yuriyzabegaev closed 4 months ago

Yuriyzabegaev commented 5 months ago

Proposed changes

Fixed a bug of dynamic time stepping when a time step failed right before meeting the schedule. Also improved documentation a bit.

Update: This also addresses the issue with resetting the iterate values after an unsuccessful time step.

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.

Yuriyzabegaev commented 5 months ago

I had to change the behavior of the test_final_simulation_time. Previously, it expected None which signalized that simulation is over if the simulation reached the end time, even if we asked to recompute solution. This behavior is incorrect, because it leads to the bug I'm fixing: We did not accept the solution at the last time step and want to recompute it, but the time manager stops the simulation.

This opens another question: Should it return None if we ask to recompute the solution, and the simulation time for some reason exceeded the end time? Previously, it would stop the simulation. I believe that it's also not expected, so now it will recompute the solution if we ask for it, regardless of how close we are to the end time, or if we exceed it. This shouldn't happen in a real simulation anyway.

Yuriyzabegaev commented 4 months ago

The last commit aims to fix #1205.