Thanks Barry and Jed.  TSSetIFunction and TSSetIJacobian from petsc-dev

are working perfectly.

 

Chetan

 

 

From: petsc-users-bounces at mcs.anl.gov 
[mailto:[email protected]] 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 at 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20101118/af13af84/attachment-0001.htm>

Reply via email to