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

Reply via email to