<div class="gmail_quote">On Wed, Sep 28, 2011 at 08:02, 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=":17z">I need to solve the linearized, incompressible Navier Stokes equation<br>
in time. I have reformulated the problem as<br>
<br>
B du/dt = J u<br>
<br>
where J is the Jacobian of the Navier Stokes equations and u is a<br>
vector containing {u,v,,w,p}.<br>
B is a diagonal matrix which is 0 in the lines corresponding to the<br>
pressure equation (enforcing the divergence free condition) and<br>
Dirichlet BC's and 1 otherwise.<br>
<br>
Backward Euler would then solve it as<br>
<br>
u(t+1) = (B-dt J)^-1 B u(t)<br>
<br>
as in page 115 of the user guide (is there a typing error there?<br>
Should it be " (B - dt A) u(n+1) = B u(n) " ?)<br></div></blockquote><div><br></div><div>Yes, thank you. I should rewrite this section because it's confusing in its current form. It would be better to look at the later sections 6.1.2 Solving Differential Algebraic Equations and 6.1.3 on IMEX methods.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div id=":17z">
<br>
Using PETSc 3.2, I pass J to the TS object as<br>
<br>
TSSetRHSFunction(ts,PETSC_NULL,TSComputeRHSFunctionLinear,PETSC_NULL);CHKERRQ(ierr);<br>
TSSetRHSJacobian(ts,A,A,TSComputeRHSJacobianConstant,PETSC_NULL);CHKERRQ(ierr);<br></div></blockquote><div><br></div><div>This sets a constant Jacobian that never changes. I don't know if that's what you mean by linearized Navier-Stokes.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div id=":17z">
<br>
but I don't understand how I can set B (or whether I am using a wrong approach).<br></div></blockquote></div><br><div>If you have a B that is not the identity, then you should use TSSetIFunction() and/or TSSetIJacobian(). Note that incompressible flow in velocity-pressure form is an index 2 DAE, so not all coupled time integration methods perform well. There is very new code in petsc-dev that you may want to try for this problem. You have to enable these by configuring --with-rosw and then you can run with -ts_type rosw -ts_rosw_type ra34pw2. (This would use a four stage third order Rosenbrock-W scheme for stiff problems that performed well in the Navier-Stokes test problems of Rang & Angermann 2005, -ts_rosw_type ra3pw is a three-stage third order method that is also worth trying.)</div>
<div><br></div><div>The need to configure --with-rosw will go away in a week or two, once that code stabilizes.</div>