Thanks
Barry and Jed. TSSetIFunction and TSSetIJacobian from petsc-dev
are
working perfectly.
Chetan
From:
petsc-users-bounces@mcs.anl.gov [mailto:petsc-users-bounces@mcs.anl.gov] On
Behalf Of Jed Brown
Sent: Thursday, November 18, 2010 3:49 PM
To: PETSc users list
Subject: Re: [petsc-users] TS with inhomogeneous rhs
On Thu, Nov 18, 2010 at 23:14, Chetan Jhurani <chetan.jhurani@gmail.com> wrote:
M U_t = -K U + f(t)
In addition, how can the code be kept nearly identical to allow different
TS types to be used (EULER, BEULER, TSRUNGE_KUTTA, TSCRANK_NICHOLSON,
etc)? I'd also like to take possible advantages of M and K being
constants.
As Barry says, we are transitioning to a better API for
this. You can use TSTHETA (theta=0.5 is Crank-Nicolson, theta=1 is
Backward Euler) with TSSetIFunction and TSSetIJacobian (see the man pages or
read section 6.1.2 of the users manual). Note that an
"explicit" method for your problem above needs to solve with the mass
matrix at every time step. Unless it is very cheap (e.g. block diagonal),
then it may not be worth it. PETSc's explicit methods do not currently
support this, but support for that will be added in the next few months.
At present, you would need to do the solve in your RHSFunction.
Jed