<div class="gmail_quote">On Fri, Feb 4, 2011 at 11:02, Travis C. Fisher <span dir="ltr"><<a href="mailto:travis.fisher@nasa.gov">travis.fisher@nasa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":2cu">I am trying to precondition a matrix free SNES solution. The application is a high order compressible Navier Stokes solver.</div></blockquote><div><br></div><div>What sort of high-order methods?</div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div id=":2cu"> My implementation is:<br>
<br>
I use the -snes_mf_operator option and create a matrix free matrix via MatCreateSNESMF. The function SNESSetJacobian points to (FormJacobian) uses MatMFFDComputeJacobian to calculate the matrix free jacobian. I then use SNESSetFromOptions and extract the linear solver and preconditioner. The linear solver is GMRES. The matrix free jacobian solve with no preconditioner works pretty well for the smooth test problem I am currently working on, but in general I don't expect it to perform that well without preconditioning. I have attempted to perform the preconditioning in two ways:<br>
<br>
1) Simply setting the preconditioner extracted from the SNES to PCLU. The preconditioner matrix I calculate in my FormJacobian routine is a frozen Jacobian matrix, so for the first linear solve, the preconditioned operator is essentially the identity operator. The code performs an LU decomposition, but the effect of the preconditioner is a larger linear residual, so clearly something is wrong.<br>
</div></blockquote><div><br></div><div>The assembled matrix is likely incorrect, try using a tiny problem size and -snes_type test. See also SNESSetLagJacobian <a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/SNES/SNESSetLagJacobian.html">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/SNES/SNESSetLagJacobian.html</a>.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div id=":2cu">
I realize this may point to my preconditioner matrix being completely wrong, but it "looks" right when I check values.</div></blockquote><div><br></div><div>How are you creating it and how do you know what the values should "look" like?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div id=":2cu"> It would take a lot of effort for me to set up the coloring to have petsc calculate the jacobian via finite differences since I am using a high order stencil with full boundary closures.<br>
</div></blockquote><div><br></div><div>That's what -snes_type test is for.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div id=":2cu">
My question is am I obviously doing something incorrectly?</div></blockquote><div><br></div><div>It sounds right to me, but run with -snes_view to see what's happening.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":2cu">Am I somehow failing to direct the SNES context to apply the LU decomposition and not assume that I have given it a preconditioner matrix to simply perform a matrix multiply?</div></blockquote><div><br></div>
<div>This almost never makes sense and it would be very hard to do accidentally: <a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/PC/PCMAT.html">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/PC/PCMAT.html</a></div>
</div>