<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 22, 2018, at 11:47 AM, Mark Lohry <<a href="mailto:mlohry@gmail.com" class="">mlohry@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Thanks Stefano.<div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">If the filter is part got your residual evaluation (your R), then you should do it inside  your RHS function itself.</blockquote><div class=""><br class=""></div><div class="">I've tried this and it works okay for explicit, but with implicit it seems to totally tank the krylov convergence. </div><div class=""><br class=""></div></div></div></blockquote><div><br class=""></div><div>What do you mean by “tank”? more iterations? larger time to solution?</div><div>Also, which kind of filter is this? Probably you are changing the sparsity of the Jacobian.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial" class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline" class="">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.</span></blockquote><div class=""><br class=""></div><div class="">And it's okay to call a TSSetSolution here without any side effects?</div><div class=""><br class=""></div></div></div></div></blockquote><div><br class=""></div><div>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.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class="">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. </div></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sun, Jul 22, 2018 at 10:06 AM, Stefano Zampini <span dir="ltr" class=""><<a href="mailto:stefano.zampini@gmail.com" target="_blank" class="">stefano.zampini@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If the filter is part got your residual evaluation (your R), then you should do it inside  your RHS function itself.<br class="">
<br class="">
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.<br class="">
<div class="HOEnZb"><div class="h5"><br class="">
> On Jul 22, 2018, at 11:13 AM, Mark Lohry <<a href="mailto:mlohry@gmail.com" class="">mlohry@gmail.com</a>> wrote:<br class="">
> <br class="">
> For the time iteration<br class="">
> <br class="">
> y(t+dt) = y(t) + dt * R(y,t,...)<br class="">
> <br class="">
> 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.<br class="">
> <br class="">
> Where is the appropriate place to do this? SNES provides SNESLineSearchSetPostCheck where you can modify the newton step; is there a TS equivalent?<br class="">
> <br class="">
> Or do I need to internally maintain a copy of y(t) to re-compute R and then call TSSetSolution with a modified vector?<br class="">
<br class="">
</div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>