pmgbergen / porepy

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

`SolutionStrategy.after_nonlinear_failure` saves time step data causing weird visualization #1421

Open vlipovac opened 1 month ago

vlipovac commented 1 month ago

The base solution strategy at line 477 calls self.save_data_time_step() after a time step failes to converge. If the time manager then goes back in time and reduces dt, and converges, it results in a weird visualization where the simulation jumps back and forth in time.

https://github.com/user-attachments/assets/304dd90a-8780-4b09-9295-494243dfb227

To me this is unexpected behavior, useful only for debugging maybe. Should this be removed? Or at least made optional?

jwboth commented 1 month ago

I do not think this is intended. I also realized a similar thing. The exporting counter is increased even though the time step has not passed convergence. In my view, this is a bug and can be declared as such.

pschultzendorff commented 1 month ago

Just my two cents: save_data_time_step also calls solver_statistics.save in addition to exporting data. Removing self.save_data_time_step() from after_nonlinear_failure would eliminate any trace of failed time steps. Then one could no longer assess some common solver metrics such as total number of nonlinear iterations.

vlipovac commented 1 month ago

Yes, that is important. The data extracted by solver_statistics could use a facelift in terms of flexibility how data is saved and stored, and when.

jwboth commented 1 month ago

I agree (having implemented some small fixes myself due to some limitations). Since several people make use of the solver statistics, I suggest a common effort. It would start with a consolidation of ideas and then the upgrade of the code.

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Veljko Lipovac @.> Sent: Monday, May 19, 2025 10:32:47 AM To: pmgbergen/porepy @.> Cc: Jakub Wiktor Both @.>; Comment @.> Subject: Re: [pmgbergen/porepy] SolutionStrategy.after_nonlinear_failure saves time step data causing weird visualization (Issue #1421)

[https://avatars.githubusercontent.com/u/68282540?s=20&v=4]vlipovac left a comment (pmgbergen/porepy#1421)https://github.com/pmgbergen/porepy/issues/1421#issuecomment-2890118688

Yes, that is important. The data extracted by solver_statistics could use a facelift in terms of flexibility how data is saved and stored, and when

— Reply to this email directly, view it on GitHubhttps://github.com/pmgbergen/porepy/issues/1421#issuecomment-2890118688, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARR52V5KXBFN2QH7JJ3VKYD27GJK7AVCNFSM6AAAAAB4GXF4AGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQOJQGEYTQNRYHA. You are receiving this because you commented.Message ID: @.***>

[External email] Make sure you recognize the sender's email address before you click links, open attachments, or get involved in financial transactions. Contact IT-support BRITA if you have any questions.