I'm not sure if (https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TS2GetSolution.html) would work but you just cache the norm of the solution or the whole solution in the monitor method and declare convergence when the solution does not change much.

There is probably a better way to do this but this is one way.

On Fri, Apr 30, 2021 at 7:36 PM Salazar De Troya, Miguel <salazardetro1@llnl.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}).

 

Miguel

 

From: Mark Adams <mfadams@lbl.gov>
Date: Friday, April 30, 2021 at 3:56 PM
To: "Salazar De Troya, Miguel" <salazardetro1@llnl.gov>
Cc: "Zhang, Hong via petsc-users" <petsc-users@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 method, compute the time derived and decide how to declare converged.

 

 

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

 

Mark

 

 

On Thu, Apr 29, 2021 at 3:27 PM Salazar De Troya, Miguel via petsc-users <petsc-users@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

 

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.

 

Thanks

Miguel

 

Miguel A. Salazar de Troya

Postdoctoral Researcher, Lawrence Livermore National Laboratory

B141

Rm: 1085-5

Ph: 1(925) 422-6411