<div dir="ltr"><span class="gmail-im" style="color:rgb(80,0,80);font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br class="gmail-Apple-interchange-newline">What do you mean by “tank”? more iterations? larger time to solution?</div><div style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">Also, which kind of filter is this? Probably you are changing the sparsity of the Jacobian.</div><br></blockquote><div><br></div></span><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial">This is a cell-local exponential filter in DG so it shouldn't change the sparsity. </div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial">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.</div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial">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.</div><span class="gmail-im" style="color:rgb(80,0,80);font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><div><br></div><div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">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.</blockquote></div><div><br></div></span><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial">Perfect, thanks!</div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 22, 2018 at 10:21 AM, Stefano Zampini <span dir="ltr"><<a href="mailto:stefano.zampini@gmail.com" target="_blank">stefano.zampini@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Jul 22, 2018, at 11:47 AM, Mark Lohry <<a href="mailto:mlohry@gmail.com" target="_blank">mlohry@gmail.com</a>> wrote:</div><br class="m_922603843987673425Apple-interchange-newline"><div><div dir="ltr">Thanks Stefano.<div><br></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><br></div><div>I've tried this and it works okay for explicit, but with implicit it seems to totally tank the krylov convergence. </div><div><br></div></div></div></blockquote><div><br></div></span><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><span class=""><br><blockquote type="cite"><div><div dir="ltr"><div><br style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><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">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><br></div><div>And it's okay to call a TSSetSolution here without any side effects?</div><div><br></div></div></div></div></blockquote><div><br></div></span><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><span class=""><br><blockquote type="cite"><div><div dir="ltr"><div><div>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><div class="gmail_quote">On Sun, Jul 22, 2018 at 10:06 AM, Stefano Zampini <span dir="ltr"><<a href="mailto:stefano.zampini@gmail.com" target="_blank">stefano.zampini@gmail.com</a>></span> wrote:<br><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>
<br>
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>
<div class="m_922603843987673425HOEnZb"><div class="m_922603843987673425h5"><br>
> On Jul 22, 2018, at 11:13 AM, Mark Lohry <<a href="mailto:mlohry@gmail.com" target="_blank">mlohry@gmail.com</a>> wrote:<br>
> <br>
> For the time iteration<br>
> <br>
> y(t+dt) = y(t) + dt * R(y,t,...)<br>
> <br>
> 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>
> <br>
> Where is the appropriate place to do this? SNES provides SNESLineSearchSetPostCheck where you can modify the newton step; is there a TS equivalent?<br>
> <br>
> 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>
<br>
</div></div></blockquote></div><br></div>
</div></blockquote></span></div><br></div></blockquote></div><br></div>