<div class="gmail_quote">On Wed, Sep 28, 2011 at 10:37, Gianluca Meneghello <span dir="ltr"><<a href="mailto:gianmail@gmail.com">gianmail@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":j6">I do have a constant Jacobian that never changes. What I understand is<br>
the matrix I should pass to TSSetIJacobian looks like<br>
<br>
J + a B<br>
<br>
together with TSComputeIJacobianConstant. Something like<br>
<br>
<br>
TSSetIFunction(ts,PETSC_NULL,TSComputeIFunctionLinear,PETSC_NULL);<br>
TSSetIJacobian(ts,A,A,TSComputeIJacobianConstant,PETSC_NULL);<br></div></blockquote><div><br></div><div>I may have made a mistake by introducing TSComputeIJacobianConstant() at all since it only works for constant time steps.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div id=":j6">
<br>
where A = J + a B<br>
<br>
but then I don't understand how I can fix a before deciding the time<br>
integration method or even the time step, so I guess I'm wrong.<br></div></blockquote><div><br></div><div>You can cache J and/or B in your application context and add them together with the variable shift. PETSc does not store the matrices J and B because they are not part of the solution process, just an artifact of how some people choose to write the system. Their existence is entirely unnecessary, and I would encourage you to benchmark before concluding that it's worth storing them separately. It may be more cost-effective to just recompute A on the fly whenever it is requested. You can choose to do this only when 'a' changes, which might be infrequent or never depending on how the time integration method and adaptive controller.</div>
<div><br></div><div>And do you really mean to solve transient linearized Navier-Stokes (constant "wind")? I don't see any way this makes sense physically. For nonlinear Navier-Stokes, the matrix J (which contains everything that is potentially expensive to build) is changing on each time step.</div>
</div>