[petsc-users] Reusing Jacobian across time steps

Matthew Knepley knepley at gmail.com
Wed Feb 23 17:44:50 CST 2022


On Wed, Feb 23, 2022 at 6:01 PM Alfredo J Duarte Gomez <aduarteg at utexas.edu>
wrote:

> Good morning PETSC team,
>
> I am currently using a TS object to advance a set of PDEs in time.
>
> However, the computation of the Jacobian is quite expensive and I wish to
> reuse it across time steps if possible.
>
> I am well aware of the options -snes_lag_jacobian and
> -snes_lag_jacobian_persists, but I do not quite understand how to combine
> them for what I want.
>
> In summary I want to compute the Jacobian only at the beginning of a given
> time step, reuse that Jacobian for N time steps, and then recompute again
> at the beginning of the next time step.
>
> With my current understanding I have been able to reuse it across time
> steps by recomputing every N snes iterations, however, this leads to
> recomputations in the middle of time steps which is not what I desire.
>

I think the right way to handle this is for the TS to set the lag to (-2,
persist) at each timestep where it wants a recompute. I think putting this
in a TSMonitor should work. Is that okay for you?

  Thanks,

     Matt


> Thank you,
>
> -Alfredo
>
>
>
> --
> Alfredo Duarte
> Graduate Research Assistant
> The University of Texas at Austin
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220223/073bd06d/attachment.html>


More information about the petsc-users mailing list