[petsc-users] TS Time Derivative after solved step

Matthew Knepley knepley at gmail.com
Mon May 16 12:26:48 CDT 2022

On Mon, May 16, 2022 at 6:48 AM Mark Adams <mfadams at lbl.gov> wrote:

> You generally want to use
> https://petsc.org/main/docs/manualpages/TS/TSMonitorSet/ for
> something like this.
> TSSetPostStep is for diagnostics.
> There are differences between the two but I don't recall them.

Yes, I think this belongs in a monitor.

> And you can get the timer derivative with
> https://petsc.org/release/docs/manualpages/TS/TS2GetSolution.html

This only applies to a restricted set of TS implementations.

In general, you have to compute approximations to the derivatives yourself,
since it is not guaranteed to be represented
in any given integration method. If you want a first order approximation,
you would save the last solution, or maybe more
for higher order reconstruction. PETSc provides the TSTrajectory object to
automate this process (it is also used for adjoint



> On Mon, May 16, 2022 at 11:03 AM Karol Lewandowski <
> Karol.Lewandowski at glasgow.ac.uk> wrote:
>> Hi, I am developing a program for solving a time-dependent problem using TS solver. At some point, after a successful step, I would like to compute the error indicator which involves time derivatives. I tried to use routines like TSSetPostStep(), however, they do not give me access to vector ts_u_t.
>> Is there a way to compute the post-step time derivative without copying the vectors (like ts_u_t, ts_u_tt) at each step?
>> Kind regards,
>> Karol

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/20220516/79b4a431/attachment.html>

More information about the petsc-users mailing list