[petsc-users] Adaptive time stepping for implicit solvers

Salazar De Troya, Miguel salazardetro1 at llnl.gov
Wed Sep 30 14:05:13 CDT 2020


Thanks. I see the example in petsc (https://www.mcs.anl.gov/petsc/petsc-current/src/ts/tutorials/ex40.c.html) modifies the solution vector in the PostEventFunction(), but there is no straightforward way to modify the RHSFunction(). Can one call TSSetRHSFunction() inside PostEventFunction() and set it for another routine? Maybe one can just change a variable in the context which is also used in the original RHSFunction(). Even if I could, such a sudden change in the RHS can make the current solution oscillate heavily. Will the TS solver adapt the time step to accommodate for this drastic change?

Thanks
Miguel

From: Barry Smith <bsmith at petsc.dev>
Date: Wednesday, September 30, 2020 at 10:19 AM
To: "Salazar De Troya, Miguel" <salazardetro1 at llnl.gov>, "Abhyankar, Shrirang G" <shrirang.abhyankar at pnnl.gov>, Emil Constantinescu <emconsta at mcs.anl.gov>
Cc: Satish Balay via petsc-users <petsc-users at mcs.anl.gov>
Subject: Re: [petsc-users] Adaptive time stepping for implicit solvers


  You might consider using the Event feature of TS to manage this. It detects when your "indicator function" changes sign and stops the integration right at that point allowing you to change your ODE or do what ever you need. It allows managing discontinuous changes in the ODE without needing smoothing (that messes up the solution).

  You would write an indicator function that depends on "solution of heat equation equal to a given parameter"

I am including Shri and Emil on this message because they understand the event handling the best (Shri wrote it).

  Barry



On Sep 30, 2020, at 11:58 AM, Salazar De Troya, Miguel via petsc-users <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>> wrote:

Hello,

I have a heat equation with a right-hand side coefficient that changes sign when a certain condition is met (solution of heat equation equal to a given parameter). I am thinking of modeling the sign change with a smoothed-out Heaviside approximation and let the solver adjust the time step to capture the sudden transition. Given that it is a heat equation, I am interested in using an implicit solver. Which ones in the TS suite also have adaptive capabilities?

Thanks
Miguel

Miguel A. Salazar de Troya
Postdoctoral Researcher, Lawrence Livermore National Laboratory
B141
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/20200930/ccb4e4b2/attachment-0001.html>


More information about the petsc-users mailing list