[petsc-users] Modifying the computed TS step, TSSetPostStep vs TSSetPostEvaluate
Stefano Zampini
stefano.zampini at gmail.com
Sun Jul 22 09:21:13 CDT 2018
> On Jul 22, 2018, at 11:47 AM, Mark Lohry <mlohry at gmail.com> wrote:
>
> Thanks Stefano.
>
> If the filter is part got your residual evaluation (your R), then you should do it inside your RHS function itself.
>
> I've tried this and it works okay for explicit, but with implicit it seems to totally tank the krylov convergence.
>
What do you mean by “tank”? more iterations? larger time to solution?
Also, which kind of filter is this? Probably you are changing the sparsity of the Jacobian.
>
> Instead, if the filter applies to y(t+dt), you should do it in PostEvaluate. Note that PostStep is equivalent to PostEvaluate if you don’t have TSEvents set.
>
> And it's okay to call a TSSetSolution here without any side effects?
>
There’s no need to call TSSetSolution inside the PostEvaluate routine. Just call TSGetSolution(ts,&U) and apply your filter on U. You are allowed to change U inside the post evaluate routine.
> The filter is only applied to the time step direction, not y(t+dt) itself (i.e. if R=0 then y(t+dt) should equal y(t) without any filter effects), so I assume I'll have to store the previous time step and manually do the arithmetic here.
>
> On Sun, Jul 22, 2018 at 10:06 AM, Stefano Zampini <stefano.zampini at gmail.com <mailto:stefano.zampini at gmail.com>> wrote:
> If the filter is part got your residual evaluation (your R), then you should do it inside your RHS function itself.
>
> Instead, if the filter applies to y(t+dt), you should do it in PostEvaluate. Note that PostStep is equivalent to PostEvaluate if you don’t have TSEvents set.
>
> > On Jul 22, 2018, at 11:13 AM, Mark Lohry <mlohry at gmail.com <mailto:mlohry at gmail.com>> wrote:
> >
> > For the time iteration
> >
> > y(t+dt) = y(t) + dt * R(y,t,...)
> >
> > I need to apply a spectral filter to R prior to moving to the next step, e.g. so not use exactly the step computed by TS.
> >
> > Where is the appropriate place to do this? SNES provides SNESLineSearchSetPostCheck where you can modify the newton step; is there a TS equivalent?
> >
> > Or do I need to internally maintain a copy of y(t) to re-compute R and then call TSSetSolution with a modified vector?
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180722/f9dcc946/attachment.html>
More information about the petsc-users
mailing list