[petsc-users] Programmatically get TS Error estimates without adaptivity

Constantinescu, Emil M. emconsta at anl.gov
Mon Sep 16 12:15:47 CDT 2019


On 9/16/19 11:38 AM, Mark Lohry wrote:
Hi Emil, maybe I was unclear, let me try to clarify, I only want the local truncation error at a given step.

Most integrators outside of GLEE also support ts_adapt basic (I'm specifically testing arkimex and bdf), and they compute the WLTE weighted error term, e.g. for arkimex:

TSAdapt basic arkimex 0:3 step   0 accepted t=0          + 1.896e-02 dt=1.967e-02  wlte=0.653  wltea=   -1 wlter=   -1

or BDF2:

TSAdapt basic bdf 0:2 step   0 rejected t=0          + 3.673e-02 dt=3.673e-03  wlte= 36.6  wltea=   -1 wlter=   -1

I'd like to have access to that wlte value. I can call TSEvaluateWLTE which works for BDF2 but crashes on arkimex for not being implemented. Is there a different avenue to getting this value through arkimex?


I see, wlte is estimated in the adapter and logically separated from the time stepper. For ARKIMEX wlte is computed in TSAdaptChoose_Basic: https://www.mcs.anl.gov/petsc/petsc-current/src/ts/adapt/impls/basic/adaptbasic.c.html#TSAdaptChoose_Basic

That is used internally in ARKIMEX to adapt the step size, but you would have to call it after every step. TSEvaluateWLTE will also provide wlte after each step.

Emil





On Mon, Sep 16, 2019 at 10:56 AM Constantinescu, Emil M. <emconsta at anl.gov<mailto:emconsta at anl.gov>> wrote:
Mark, most integrators estimate the error occurring every step for
adapting the step size. These are called local errors. GLEE are
specialized integrator that estimate the actual error in time; this is
called the global error. GLEE returns TimeError because it computes it
internally, however none of the other solvers does it.

To assess the accuracy for a specific problem you have two options, and
both involve you estimating the error yourself:

1. Use an integrator with very small step, store or save the solution
(call it reference) and do the same for the others and then compute the
error with respect to the reference. A strategy similar to this is
implemented in src/ts/examples/tutorials/ex31.c

2. If you have an exact or manufactured solution, you can compare
against that.

Emil

On 9/16/19 9:07 AM, Mark Lohry via petsc-users wrote:
> I'm trying to assess time accuracy for a couple different integrators
> and timesteps in a setup where I need constant time steps.
>
> TSGetTimeError seems to only work for GLEE methods (it returns a 0
> vector otherwise); is there an equivalent for others?
>
> I can run -ts_adapt_type basic, and just set min=max=constant, and it
> clearly computes some integrator errors for printf, but is there a way
> I can get that programmatically?
>
> Thanks,
> Mark
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190916/bc1f436a/attachment.html>


More information about the petsc-users mailing list