[petsc-users] Detecting steady-state with TS

Zhang, Hong hongzhang at anl.gov
Sat May 1 09:02:29 CDT 2021

Although TSMonitor may also work, I would suggest to use TSPostStep for the customized convergence check. TSPostStep allows to modify the system or change the solver settings. It skips the time steps that are rolled back (e.g. rejected time steps), but TSMonitor is applied to every time step including the rejected ones.

For time derivative, I would just do a RHS function evaluation if the extra cost is acceptable. If not, then I would consider caching the current solution in TSPostStep.

Hong (Mr.)

On Apr 30, 2021, at 6:36 PM, Salazar De Troya, Miguel via petsc-users <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>> wrote:

Thanks, can you elaborate on computing the time derived? TSMonitor only gives me the information at the current time step. I guess I could store a copy of the solution in the context so I can use it in the next call to compute the difference. On the other hand, I could also store the norm of the RHS function (since this is equal to the time derivative \frac{\partial \phi}{\partial t}).


From: Mark Adams <mfadams at lbl.gov<mailto:mfadams at lbl.gov>>
Date: Friday, April 30, 2021 at 3:56 PM
To: "Salazar De Troya, Miguel" <salazardetro1 at llnl.gov<mailto:salazardetro1 at llnl.gov>>
Cc: "Zhang, Hong via petsc-users" <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [petsc-users] Detecting steady-state with TS

You could add a https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSMonitorSet.html<https://urldefense.us/v3/__https:/www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSMonitorSet.html__;!!G2kpM7uM-TzIFchu!hG6eR--4AkxoFHnPn3N8DJF2pPoVkaJT0f6vy9E2qTLMZ0TiqDR_kr5wbAbwapvuLtnSGw$> method, compute the time derived and decide how to declare converged.

Then set converged (https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSSetConvergedReason.html<https://urldefense.us/v3/__https:/www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSSetConvergedReason.html__;!!G2kpM7uM-TzIFchu!hG6eR--4AkxoFHnPn3N8DJF2pPoVkaJT0f6vy9E2qTLMZ0TiqDR_kr5wbAbwaptYI8kTFA$>) with TS_CONVERGED_USER

That should cause TS to wrap up the solve and exit cleanly.


On Thu, Apr 29, 2021 at 3:27 PM Salazar De Troya, Miguel via petsc-users <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>> wrote:
I am solving the signed distance equation

\frac{\partial \phi}{\partial t} + sign (\phi_{0})(|\nabla \phi| - 1) = 0

using a Local Discontinuous Galerkin (LDG) method as described in https://www.sciencedirect.com/science/article/pii/S0021999110005255<https://urldefense.us/v3/__https:/www.sciencedirect.com/science/article/pii/S0021999110005255__;!!G2kpM7uM-TzIFchu!hG6eR--4AkxoFHnPn3N8DJF2pPoVkaJT0f6vy9E2qTLMZ0TiqDR_kr5wbAbwapsr29KQOw$>

I am interested in solving it close to steady state. I was hoping I could measure how close to steady state the solution is by using the TSSetEventHandler infrastructure, but the handler does not have information on the time derivative. I looked at TSPSEUDO, but it forces me to use an implicit method, which I cannot provide because how the LDG method works (it calculates the fluxes solving additional equations). This makes me wonder if the LDG method is the best choice, so I am open to suggestions.

Given my current progress with the LDG approach, I am wondering if there is a way to solve to steady state using explicit algorithms such as Runge-Kutta.


Miguel A. Salazar de Troya
Postdoctoral Researcher, Lawrence Livermore National Laboratory
Rm: 1085-5
Ph: 1(925) 422-6411

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210501/6daae58b/attachment-0001.html>

More information about the petsc-users mailing list