Hi All, Matt: 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.
Barry: Yes, this is a pressure projection method where one needs the pressure field at each timestep to solve for the velocity field. I will likely have more follow up questions as I quick write this up. Thank you both for your input. -Scott Dossa On Mon, May 1, 2017 at 3:32 PM, Barry Smith <[email protected]> wrote: > > Scott - Are you doing some kind of pressure projection method? > > PETSc-developers - should this functionality be directly added to TS > since it comes up fairly often? > > Barry > > > > > On May 1, 2017, at 3:24 PM, Matthew Knepley <[email protected]> wrote: > > > > On Mon, May 1, 2017 at 3:13 PM, Scott Dossa <[email protected]> wrote: > > Hi All, > > > > 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. > > > > 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: > > > > while (step < maxsteps+1){ > > KSPSolve(ksp, v, p); /* solves for Vec p and passes this info > onto TS */ > > TSSolve(ts, u); /* only iterate for 1 timestep */ > > } > > > > The function TSSetPreStep() seemed promising, but it can only take TS as > arguments which may not be sufficient to pass a global vector. > > > > Yes, this is the correct thing. You can > > > > a) Just attach a Vec to the TS using PetscObjectCompose(), but that is > ugly so you can > > > > b) Make a context structure, and stick it in the TS using > > > > http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/ > TSSetApplicationContext.html > > > > That is also where the KSP should go. > > > > Thanks, > > > > Matt > > > > Thank you in advance. > > Scott Dossa > > > > > > > > > > > > -- > > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which their > experiments lead. > > -- Norbert Wiener > >
