On Mon, May 16, 2022 at 6:48 AM Mark Adams <[email protected]> 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
computations).

  Thanks,

     Matt


> On Mon, May 16, 2022 at 11:03 AM Karol Lewandowski <
> [email protected]> 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/>

Reply via email to