<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, May 1, 2017 at 4:27 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>Hi All,<br><br></div>Matt:<br></div>Thank you! Using the application context is a good approach to pass the vector information. Can you also direct me to which command allows TSSolve to be only called for one timestep / start at the correct timestep? When TSSolve() is called, it always resets to timestep 0.<br></div></div></div></div></blockquote><div><br></div><div>You should not need that since PreStep will be called at the beginning of each step, but just in case</div><div><br></div><div>  <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSStep.html">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSStep.html</a></div><div><br></div><div>although using this is tricky so I do not recommend it.</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>Barry: <br>Yes, this is a pressure projection method where one needs the pressure field at each timestep to solve for the velocity field.<br></div></div></div></blockquote><div><br></div><div>If it was me, I would not do it this way, but its somewhat a matter of taste. It makes more sense to me to formulate the whole</div><div>system as a DAE, meaning time derivatives on some things (v) and not others (p). Then use a DAE timestepper and your</div><div>fluid solver can be formulated as pressure projection using PCFIELDSPLIT. This way, if you want to use another kind of fluid</div><div>solver, you can, whereas now you are stuck with the alternation of projection of momentum update.</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>I will likely have more follow up questions as I quick write this up. Thank you both for your input.<br></div>-Scott Dossa<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 1, 2017 at 3:32 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</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"><br>
   Scott -  Are you doing some kind of pressure projection method?<br>
<br>
   PETSc-developers - should this functionality be directly added to TS since it comes up fairly often?<br>
<span class="gmail-m_-446719954334148439HOEnZb"><font color="#888888"><br>
   Barry<br>
</font></span><div class="gmail-m_-446719954334148439HOEnZb"><div class="gmail-m_-446719954334148439h5"><br>
<br>
<br>
> On May 1, 2017, at 3:24 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br>
><br>
> On Mon, May 1, 2017 at 3:13 PM, Scott Dossa <<a href="mailto:doss0032@umn.edu" target="_blank">doss0032@umn.edu</a>> wrote:<br>
> Hi All,<br>
><br>
> 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>
> while (step < maxsteps+1){<br>
>         KSPSolve(ksp, v, p); /* solves for Vec p and passes this info onto TS */<br>
>         TSSolve(ts, u); /* only iterate for 1 timestep */<br>
> }<br>
><br>
> The function TSSetPreStep() seemed promising, but it can only take TS as arguments which may not be sufficient to pass a global vector.<br>
><br>
> Yes, this is the correct thing. You can<br>
><br>
>   a) Just attach a Vec to the TS using PetscObjectCompose(), but that is ugly so you can<br>
><br>
>   b) Make a context structure, and stick it in the TS using<br>
><br>
>   <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSSetApplicationContext.html" rel="noreferrer" target="_blank">http://www.mcs.anl.gov/petsc/<wbr>petsc-current/docs/manualpages<wbr>/TS/TSSetApplicationContext.<wbr>html</a><br>
><br>
>       That is also where the KSP should go.<br>
><br>
>   Thanks,<br>
><br>
>     Matt<br>
><br>
> Thank you in advance.<br>
> Scott Dossa<br>
><br>
><br>
><br>
><br>
><br>
> --<br>
> 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<br>
<br>
</div></div></blockquote></div><br></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>