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

Matthew Knepley knepley at gmail.com
Tue May 1 09:36:42 CDT 2012

```On Tue, May 1, 2012 at 10:24 AM, Hong Zhang <hzhang at mcs.anl.gov> wrote:

> 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:
>>
>
I am not sure I understand what you mean. Your Jacobian above is F(t), so
it does change. You can
of course do this MF since it will be exact, just probably more expensive.

Matt

> 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
>
>
>

--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their