<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, May 1, 2017 at 3:13 PM, Scott Dossa <span dir="ltr"><<a href="mailto:doss0032@umn.edu" target="_blank">doss0032@umn.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div>Hi All,<br><br></div>I'm looking to pass a vector between a KSP and TS routine. The KSP routine must be called before each timestep, and the solution vector is needed for the TS routine. Normally, TSSolve() runs over all timesteps, but in my case, I'd like to be able to add a routine before each timestep.<br><br>Can someone direct me to an example script or briefly explain a case which shows how to control time stepping such that one could achieve something along the lines of:<br><br></div>while (step < maxsteps+1){<br></div><div> KSPSolve(ksp, v, p); /* solves for Vec p and passes this info onto TS */<br></div> TSSolve(ts, u); /* only iterate for 1 timestep */<br>}<br><br></div>The function TSSetPreStep() seemed promising, but it can only take TS as arguments which may not be sufficient to pass a global vector.<br></div></div></div></div></blockquote><div><br></div><div>Yes, this is the correct thing. You can</div><div><br></div><div> a) Just attach a Vec to the TS using PetscObjectCompose(), but that is ugly so you can</div><div><br></div><div> b) Make a context structure, and stick it in the TS using</div><div><br></div><div> <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSSetApplicationContext.html">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSSetApplicationContext.html</a></div><div><br></div><div> That is also where the KSP should go.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div></div>Thank you in advance.<span class="gmail-HOEnZb"><font color="#888888"><br></font></span></div><span class="gmail-HOEnZb"><font color="#888888">Scott Dossa<br></font></span></div><div><div><div><div><br><br></div></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div>