Hong Zhang hzhang at mcs.anl.gov
Wed Feb 21 09:24:55 CST 2007


Since you have to solve equation at each time-step,
I would suggest using Crank-Nicholson method, which combines
implicit and explicit methods and gives
higher order of approximation than Euler and Backward Euler
methods that petsc supports.

However, Crank-Nicholson method is not supported by the
petsc release. You must use petsc-dev
on how to get it).

Additional note: in petsc-dev, the interface functions
TSSetRHSMatrix() and TSSetLHSMatrix() are replaced by TSSetMatrices().
An example of using cn method is petsc-dev/src/ts/examples/tests/ex1.c
See the targets of
"runex1_cn_*" in petsc-dev/src/ts/examples/tests/makefile
on how to run this example.

Use of LHS matrices in petsc is not well tested yet.
I've been looking for examples that involve LHS matrix.
Would you like contribute your application, or a simplified version
of it to us as a test example? We'll put your name
in the contributed example.


> [C(t,{T})] d{T}/dt = {F(t,{T})} - [K(t,{T})] {T}
> with initial conditions
> {T(0)} = {T0}
> So, I have a problem which has a LHS matrix, which is also dependent
> on the primary variable (which is temperature {T}).
> In the simple case, ofcourse, we can neglect this dependence on
> temperature (for [C]), but that has limited applicability for my
> problem, since the [C] matrix has non-negligible nonlinearities.
> So, I am looking for ways to formulate my problem to use the Petsc
> solvers. The best option that I can think  of is to restate the
> problem as:
> d{T}/dt = [C(t,{T})]^(-1) ({F(t,{T})} - [K(t,{T})] {T})
> where I can now specify the RHS function and its jacobian (I will
> provide the jacobian, so no need to use finite differencing), and use
> an explicit / implicit solver.
> However, if I assume a linear problem, then I am left with a case of
> [C] d{T}/dt = {F(t)} - [K]{T}
> Here, I could either restate the problem in the same way as I did
> above, or I could specify a LHS matrix (in this case [C]), and ask
> the solver to handle it. But, from our previous email exchanges, it
> seems like I will have to use an implicit solver for the same, since
> an explicit solver will not handle a LHS matrix.
> Kindly correct me if I am wrong.
> Thanks,
> Manav

More information about the petsc-users mailing list