<div class="gmail_quote">On Thu, Nov 18, 2010 at 23:14, Chetan Jhurani <span dir="ltr">&lt;<a href="mailto:chetan.jhurani@gmail.com">chetan.jhurani@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":1o3">      M U_t = -K U + f(t)<br>
<br>
In addition, how can the code be kept nearly identical to allow different<br>
TS types to be used (EULER, BEULER, TSRUNGE_KUTTA, TSCRANK_NICHOLSON,<br>
etc)?  I&#39;d also like to take possible advantages of M and K being<br>
constants.</div></blockquote></div><br><div>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 &quot;explicit&quot; 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&#39;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.</div>
<div><br></div><div>Jed</div>