<div dir="ltr"><div><div><div><div>Ok, I forgot to call SNESSetJacobian(snes, J, P, NULL, NULL) with J != P, which caused to write the mass matrix into the (otherwise zero) (1,1) block of the Jacobian and which was the reason for the linesearch to fail. <br>However, after fixing that and trying to solve it with FieldSplit with LU factorization for the (0,0) block it failed because there were zero pivots for all rows.<br><br></div>Anyway, I found out that attaching the mass matrix to the Lagrange multiplier field also worked.<br><br></div>Another related question for my elasticity problem: after creating the rigid body modes with DMPlexCreateRigidBody and attaching it to the displacement field, does the matrix block size of the (0,0) block still have to be set for good performance with gamg? If so, how can I do this?<br><br></div>Thanks,<br></div>Sander<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 2 March 2016 at 12:25, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Wed, Mar 2, 2016 at 5:13 AM, Sander Arens <span dir="ltr"><<a href="mailto:Sander.Arens@ugent.be" target="_blank">Sander.Arens@ugent.be</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Hi,<br><br></div><div>I'm trying to set a mass matrix preconditioner for the Schur complement of an incompressible finite elasticity problem. I tried using the command PetscDSSetJacobianPreconditioner(prob, 1, 1, g0_pre_mass_pp, NULL, NULL, NULL) (field 1 is the Lagrange multiplier field).<br></div><div>However, this causes a DIVERGED_LINE_SEARCH due to to Nan or Inf in the function evaluation after Newton iteration 1. (Btw, I'm using the next branch).<br><br>Is this because I didn't use PetscDSSetJacobianPreconditioner for the other blocks (which uses the Jacobian itself for preconditioning)? If so, how can I tell Petsc to use the Jacobian for those blocks?<br></div></div></blockquote><div><br></div></span><div>1) I put that code in very recently, and do not even have sufficient test, so it may be buggy</div><div><br></div><div>2) If you are using FieldSplit, you can control which blocks come from A and which come from the preconditioner P</div><div><br></div><div>  <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/PC/PCFieldSplitSetDiagUseAmat.html#PCFieldSplitSetDiagUseAmat" target="_blank">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/PC/PCFieldSplitSetDiagUseAmat.html#PCFieldSplitSetDiagUseAmat</a></div><div>  <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/PC/PCFieldSplitSetOffDiagUseAmat.html#PCFieldSplitSetOffDiagUseAmat" target="_blank">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/PC/PCFieldSplitSetOffDiagUseAmat.html#PCFieldSplitSetOffDiagUseAmat</a></div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div></div><div>I guess when using PetscDSSetJacobianPreconditioner the preconditioner is recomputed at every Newton step, so for a constant mass matrix this might not be ideal. How can I avoid recomputing this at every Newton iteration?<br></div></div></blockquote><div><br></div></span><div>Maybe we need another flag like<br></div><div><br></div><div>  <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetLagPreconditioner.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetLagPreconditioner.html</a></div><div><br></div><div>or we need to expand</div><div><br></div><div>  <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetLagJacobian.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetLagJacobian.html</a></div><div><br></div><div>to separately cover the preconditioner matrix. However, both matrices are computed by one call so this would</div><div>involve interface changes to user code, which we do not like to do. Right now it seems like a small optimization.</div><div>I would want to wait and see whether it would really be maningful.</div><div><br></div><div>  Thanks,</div><div><br></div><div>    Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div></div><div>Thanks,<br></div><div>Sander<span class="HOEnZb"><font color="#888888"><br></font></span></div></div><span class="HOEnZb"><font color="#888888">
</font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</font></span></div></div>
</blockquote></div><br></div>