# [petsc-users] Can I use TS routines for operator split formulation

Matthew Knepley knepley at gmail.com
Mon Jun 9 13:49:02 CDT 2014

```On Mon, Jun 9, 2014 at 1:37 PM, Shriram Srinivasan <shriram at ualberta.ca>
wrote:

> It isnt an ODE actually. Its the unsteady diffusion equation u_t + div(k
> grad(u)) = f. The matrices A and B represent discretisations of the fluxes.
>  I am using operator splitting to advance the solution in two stages in
> every time step:
> First compute u*, then use it to compute u.
>

For a purely explicit method, this would map to

u_t = G(u, t)

where

G(u, t) = f - div(k grad u)

which you could set using

http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSSetRHSFunction.html

If you want to use implicit methods, then you can set

F(u_t, u, t) = u_t + div(k grad u) - f

using

http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSSetIFunction.html

TS ex25 is a reaction-diffusion example, and is gone over in these slides

http://www.mcs.anl.gov/petsc/documentation/tutorials/BuffaloTutorial.pdf

starting at slide 169

Thanks,

Matt

> Shriram
>
>
>
> On 14-06-09 12:28 PM, Barry Smith wrote:
>
>>    What is the ODE you are solving?
>>
>>     Barr
>>
>> On Jun 9, 2014, at 11:51 AM, Shriram Srinivasan <shriram at ualberta.ca>
>> wrote:
>>
>>  Hi,
>>> I am working with the (discretised) PDE:
>>> (u* - u_prev) + (tau )A u* = f1
>>> (u - u*) + (tau)B u = f2
>>> Here A and B are constant matrices which have been assembled, u_prev is
>>> solution at previous time level, tau is the time step and u is the solution
>>> at current time level.
>>>
>>> It appears to me I cannot rewrite this in a form required by the TS
>>> module. So my question(s) are:
>>>
>>> 1) Am I missing something here, or is there a way to cast this into the
>>> framework of TS
>>> 2) If there isn’t a way, am I better off doing the time stepping myself ?
>>>
>>> Thanks,
>>> Shriram
>>>
>>
>

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