[petsc-users] Modifying the computed TS step, TSSetPostStep vs TSSetPostEvaluate

Mark Lohry mlohry at gmail.com
Sun Jul 22 11:17:54 CDT 2018


>
>
> 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.
>
>
This is a cell-local exponential filter in DG so it shouldn't change the
sparsity.

By "tank" I mean I've seen it take 2x more krylov iterations or worse when
i apply the same filter directly to the RHS evaluation... although saying
that now I'm having trouble recreating it and it's converging fine with a
filtered right hand side.

I've done some experiments with applying the same filter (a) to the right
hand side directly, (b) to the newton search direction at each SNES step,
and (c) to the time step update. (c) seems to be preferable, (b) has never
worked for me, (a) works for explicit at least, but is of course more
dissipative.


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.


Perfect, thanks!


On Sun, Jul 22, 2018 at 10:21 AM, Stefano Zampini <stefano.zampini at gmail.com
> wrote:

>
> 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> 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> 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/f452b09f/attachment-0001.html>


More information about the petsc-users mailing list