[petsc-users] Solving a very simple time step problem:

Hong Zhang hzhang at mcs.anl.gov
Tue May 1 09:24:50 CDT 2012


Andrew :
We have TS examples under
~/src/ts/examples/tutorials/
/src/ts/examples/tests

Hong

> I want to solve a very simple equation:
>
> u_t = F(t) u
>
> Where F(t) = H_0 + a(t) H' (H_0 and H' are constant matrices, and a(t) is
> a time dependent scalar).
>
> But I'm not sure how to go about doing this using the TS context.
>
> I don't have a Jacobian that I need to be worried about, so should I be
> doing:
>
> TSSetRHSFunction(ts,PETSC_NULL,myRHSFunction,&appctx);
> TSSetRHSJacobian(ts,A,A,TSComputeRHSJacobianConstant,&appctx);
>
> Where:
> myRHSFunction(TS ts,PetscReal t,Vec u,Vec F,void *ctx)
> {
>        //Create temporary matrix A = H_0 + a(t) H'
>        //then do F = A u
> }
>
> Or should I be doing something else?
>
> Thanks for the help, unfortunately, it looks like the documentation on TS
> in the manual isn't accurate.
>
> -Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120501/10f83278/attachment.htm>


More information about the petsc-users mailing list