<div dir="ltr"><div dir="ltr">On Wed, May 31, 2023 at 5:51 PM Barry Smith <<a href="mailto:bsmith@petsc.dev">bsmith@petsc.dev</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><br></div>  Sorry, I wrote to quickly in my last email. You will need to create a SNESSHELL its solve simply calls your solver (for its one iteration) SNESNRICHARSON handles the rest.</div></blockquote><div><br></div><div>Yes, this is a great suggestion. It should work with your current SNESSHELL.</div><div><br></div><div>I would also point out that we have the SNESMS, which is the multistage solver from Jameson. You can</div><div>use this as a residual smooth with FAS to do something similar to what you have, although I do not know</div><div>what Mach number preconditioning is (Jed probably knows).</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:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div><blockquote type="cite"><div>On May 31, 2023, at 4:16 PM, Kenneth C Hall <<a href="mailto:kenneth.c.hall@duke.edu" target="_blank">kenneth.c.hall@duke.edu</a>> wrote:</div><br><div><div style="font-family:Helvetica;font-size:18px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">Matt,<u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"><u></u> <u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">Thanks for your quick reply.  I think what you say makes sense.<u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"><u></u> <u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">You asked what my code does. The MySolver program performs one iteration of a CFD iteration. The CFD scheme is an explicit scheme that uses multigrid, Mach number preconditioning, and residual smoothing.  Typically, I have to call MySolver on the order of 40 to 100 times to get acceptable convergence. <u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"><u></u> <u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">And in fact, I have another version of this Petsc code that uses SNESNGMRES to solve the problem with MySolver providing the residuals as R =  N(x) - x.  But I would like a version where I am using just MySolver, without any other operations applied to it.  So I am trying to plug MySolver into the PETSc system to provide monitoring and other features, and for consistency and comparison to these other (more appropriate!) uses of PETSc.<u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"><u></u> <u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">Thanks.<u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">Kenneth<u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"><u></u> <u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"><u></u> <u></u></span></div><div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(181,196,223) currentcolor currentcolor;padding:3pt 0in 0in"><p class="MsoNormal" style="margin:0in 0in 12pt;font-size:10pt;font-family:Calibri,sans-serif"><b><span style="font-size:12pt">From:<span> </span></span></b><span style="font-size:12pt">Matthew Knepley <<a href="mailto:knepley@gmail.com" style="color:blue;text-decoration:underline" target="_blank">knepley@gmail.com</a>><br><b>Date:<span> </span></b>Wednesday, May 31, 2023 at 3:48 PM<br><b>To:<span> </span></b>Kenneth C Hall <<a href="mailto:kenneth.c.hall@duke.edu" style="color:blue;text-decoration:underline" target="_blank">kenneth.c.hall@duke.edu</a>><br><b>Cc:<span> </span></b><a href="mailto:petsc-users@mcs.anl.gov" style="color:blue;text-decoration:underline" target="_blank">petsc-users@mcs.anl.gov</a><span> </span><<a href="mailto:petsc-users@mcs.anl.gov" style="color:blue;text-decoration:underline" target="_blank">petsc-users@mcs.anl.gov</a>><br><b>Subject:<span> </span></b>Re: [petsc-users] Using SNESSHELL as a wrapper for a CFD solver.<u></u><u></u></span></p></div><div><div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">On Wed, May 31, 2023 at 3:21 PM Kenneth C Hall <</span><a href="mailto:kenneth.c.hall@duke.edu" style="color:blue;text-decoration:underline" target="_blank"><span style="font-size:11pt">kenneth.c.hall@duke.edu</span></a><span style="font-size:11pt">> wrote:<u></u><u></u></span></div></div><div><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt"><div><div><div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">Hi,<u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"> <u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">I am doing a number of problems using PETSc/SLEPc, but I also work on some non-PETSc/SLEPc flow solvers.   I would like to use PETSc as a wrapper for this non-PETSc flow solver for compatibility,  so I can use the tolerance monitoring, options, viewers, and for direct comparison to PETSc methods I am using.<u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"> <u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">Here is what I am trying to do… I have a CFD solver that iterates with a nonlinear iterator of the form x := N(x).  This can be expressed in a fortran routine of the form,<u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"> <u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif;text-indent:0.5in"><span style="font-size:11pt">SUBROUTINE MySolver(x)<span> </span><u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif;text-indent:0.5in"><span style="font-size:11pt">or<span> </span><u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif;text-indent:0.5in"><span style="font-size:11pt">SUBROUTINE MySolver(x,y)<u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"> <u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">In the first case, x is over written. In the second, y = N(x).  In any event, I want to do something like what is shown in the subroutine at the bottom of this email.<span> </span><u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"> <u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">The code below “works” in the sense that MySolver is called, but it is called exactly *<b>once</b>*. But MyMonitor and MyConverged are *<b>not</b>* called. Again, I want to iterate so MySolver should be called many times, as should MyMonitor and MyConverged.<u></u><u></u></span></div></div></div></div></blockquote><div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"><u></u> <u></u></span></div></div><div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">The SNESolve() method is called once per nonlinear solve, just as KSPSolve() is called once per linear solve. There may be iteration inside the method, but that is handled inside the particular implementation. For example, both Newton's method and Nonlinear Conjugate Gradient iterate, but the iteration is internal to both, and they both call the monitor and convergence test at each internal iterate.<u></u><u></u></span></div></div><div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"><u></u> <u></u></span></div></div><div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">So, if your nonlinear solver should iterate, it should happen inside the SNESSolve call for the SNESSHELL object. Does this make sense? What does your solver do?<u></u><u></u></span></div></div><div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"><u></u> <u></u></span></div></div><div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">  Thanks,<u></u><u></u></span></div></div><div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"><u></u> <u></u></span></div></div><div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">     Matt<u></u><u></u></span></div></div><div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"> <u></u><u></u></span></div></div><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt"><div><div><div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">The SNESView before and after SNESSolve looks like this:<u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"> <u></u><u></u></span></div><p style="margin-right:0in;margin-bottom:0in;margin-left:0.5in;background:white"><span style="font-size:9pt;font-family:Menlo">SNES Object: 1 MPI process</span></p><p style="margin-right:0in;margin-bottom:0in;margin-left:0.5in;background:white"><span style="font-size:9pt;font-family:Menlo">  type: shell</span></p><p style="margin-right:0in;margin-bottom:0in;margin-left:0.5in;background:white"><span style="font-size:9pt;font-family:Menlo">  SNES has not been set up so information may be incomplete</span></p><p style="margin-right:0in;margin-bottom:0in;margin-left:0.5in;background:white"><span style="font-size:9pt;font-family:Menlo">  maximum iterations=50, maximum function evaluations=10000</span></p><p style="margin-right:0in;margin-bottom:0in;margin-left:0.5in;background:white"><span style="font-size:9pt;font-family:Menlo">  tolerances: relative=1e-50, absolute=1e-10, solution=1e+06</span></p><p style="margin-right:0in;margin-bottom:0in;margin-left:0.5in;background:white"><span style="font-size:9pt;font-family:Menlo">  total number of function evaluations=0</span></p><p style="margin-right:0in;margin-bottom:0in;margin-left:0.5in;background:white"><span style="font-size:9pt;font-family:Menlo">  norm schedule ALWAYS</span></p><div style="margin-right:0in;margin-bottom:0in;margin-left:0.5in;background:white"><span style="font-size:9pt;font-family:Menlo"> </span><br></div><p style="margin-right:0in;margin-bottom:0in;margin-left:0.5in;background:white"><span style="font-size:9pt;font-family:Menlo">SNES Object: 1 MPI process</span></p><p style="margin-right:0in;margin-bottom:0in;margin-left:0.5in;background:white"><span style="font-size:9pt;font-family:Menlo">  type: shell</span></p><p style="margin-right:0in;margin-bottom:0in;margin-left:0.5in;background:white"><span style="font-size:9pt;font-family:Menlo">  maximum iterations=50, maximum function evaluations=10000</span></p><p style="margin-right:0in;margin-bottom:0in;margin-left:0.5in;background:white"><span style="font-size:9pt;font-family:Menlo">  tolerances: relative=1e-50, absolute=1e-10, solution=1e+06</span></p><p style="margin-right:0in;margin-bottom:0in;margin-left:0.5in;background:white"><span style="font-size:9pt;font-family:Menlo">  total number of function evaluations=0</span></p><p style="margin-right:0in;margin-bottom:0in;margin-left:0.5in;background:white"><span style="font-size:9pt;font-family:Menlo">  norm schedule ALWAYS</span></p><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:8pt"> </span><span style="font-size:11pt"><u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">Any suggestions on how to do what I am trying to accomplish?<u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"> <u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">Thanks.<u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">Kenneth Hall<u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"> <u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"> <u></u><u></u></span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:9pt"> </span><span style="font-size:11pt"><u></u><u></u></span></div><div style="margin:0in;background:white"><b><span style="font-size:9pt;font-family:Menlo;color:silver">#include <petsc/finclude/petsc.h></span></b></div><div style="margin:0in;background:white"><b><span style="font-size:9pt;font-family:Menlo;color:silver">#include "macros.h"</span></b></div><p style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo"> </span></p><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">  <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">MODULE</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">SolveWithSNESShell_module</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">USE</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">MyPetscModule</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">  <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">CONTAINS</span></b></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!====================================================================================================</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">  <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">SUBROUTINE</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">MySolver</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">x</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">)</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!====================================================================================================</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!====================================================================================================</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">USE</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">MyPetscModule</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">IMPLICIT</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">NONE</span></b></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... declared passed variables</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">SNES</span><span style="font-size:9pt;font-family:Menlo">     ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">Vec</span><span style="font-size:9pt;font-family:Menlo">      ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">x</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscErrorCode</span><span style="font-size:9pt;font-family:Menlo"><span> </span>::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... code to find residual  x := N(x)</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... (or alternatively      y := N(x))</span></div><p style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">           </span></p><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">   </span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">END</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">SUBROUTINE</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">MySolver</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!====================================================================================================</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">  <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">SUBROUTINE</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">MyMonitor</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">its</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">rnorm</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">)</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!====================================================================================================</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!====================================================================================================</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">USE</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">MyPetscModule</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">IMPLICIT</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">NONE</span></b></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... Declare passed variables</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">SNES</span><span style="font-size:9pt;font-family:Menlo">           ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscInt</span><span style="font-size:9pt;font-family:Menlo">       ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">its</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscReal</span><span style="font-size:9pt;font-family:Menlo">      ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">rnorm</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscErrorCode</span><span style="font-size:9pt;font-family:Menlo"><span> </span>::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... Code to print out convergence history</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... Code to print out convergence history</span></div><p style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo"> </span></p><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">  <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">END</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">SUBROUTINE</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">MyMonitor</span></div><p style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo"> </span></p><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!====================================================================================================</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">  <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">SUBROUTINE</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">MyConverged</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">it</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">xnorm</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ynorm</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">znorm</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">reason, ierr</span><span style="font-size:9pt;font-family:Menlo">)</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">USE</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">MyPetscModule</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">      </span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">IMPLICIT</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">NONE</span></b></div><p style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo"> </span></p><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">SNES</span><span style="font-size:9pt;font-family:Menlo">     ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscInt</span><span style="font-size:9pt;font-family:Menlo"><span> </span>::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">it</span><span style="font-size:9pt;font-family:Menlo">,</span><span style="font-size:9pt;font-family:Menlo;color:blue">ctx</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscReal</span><span style="font-size:9pt;font-family:Menlo"><span> </span>::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">xnorm</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ynorm</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">znorm</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">KSPConvergedReason</span><span style="font-size:9pt;font-family:Menlo"><span> </span>::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">reason</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscErrorCode</span><span style="font-size:9pt;font-family:Menlo"><span> </span>::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span></div><p style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green"> </span></p><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!      ... add convergence test here ...</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!      set reason to a positive value if convergence has been achieved</span></div><p style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo"> </span></p><p style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo"> </span></p><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">  <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">END</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">SUBROUTINE</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">MyConverged</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">  <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">END</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">MODULE</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">SolveWithSNESShell_module</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!====================================================================================================</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">  <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">SUBROUTINE</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">SolveWithSNESShell</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!====================================================================================================</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!====================================================================================================</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">USE</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">SolveWithSNESShell_module</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">IMPLICIT</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">NONE</span></b></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... Declare passed variables</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">INTEGER</span></b><span style="font-size:9pt;font-family:Menlo">            ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">level_tmp</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... Declare local variables</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">INTEGER</span></b><span style="font-size:9pt;font-family:Menlo">            ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">iz</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">INTEGER</span></b><span style="font-size:9pt;font-family:Menlo">            ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">imax</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">INTEGER</span></b><span style="font-size:9pt;font-family:Menlo">            ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">jmax</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">INTEGER</span></b><span style="font-size:9pt;font-family:Menlo">            ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">kmax</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">SNES</span><span style="font-size:9pt;font-family:Menlo">               ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">KSP</span><span style="font-size:9pt;font-family:Menlo">                ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ksp</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">Vec</span><span style="font-size:9pt;font-family:Menlo">                ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">x</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">      </span><span style="font-size:9pt;font-family:Menlo;color:blue">Vec</span><span style="font-size:9pt;font-family:Menlo">                ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">y</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscViewer</span><span style="font-size:9pt;font-family:Menlo">        ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">viewer</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscErrorCode</span><span style="font-size:9pt;font-family:Menlo">     ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscReal</span><span style="font-size:9pt;font-family:Menlo">          ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">rtol</span><span style="font-size:9pt;font-family:Menlo">   = 1.0</span><span style="font-size:9pt;font-family:Menlo;color:blue">D</span><span style="font-size:9pt;font-family:Menlo">-10  <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:green">!! relative tolerance</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscReal</span><span style="font-size:9pt;font-family:Menlo">          ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">atol</span><span style="font-size:9pt;font-family:Menlo">   = 1.0</span><span style="font-size:9pt;font-family:Menlo;color:blue">D</span><span style="font-size:9pt;font-family:Menlo">-50  <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:green">!! absolute tolerance</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscReal</span><span style="font-size:9pt;font-family:Menlo">          ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">dtol</span><span style="font-size:9pt;font-family:Menlo">   = 1.0</span><span style="font-size:9pt;font-family:Menlo;color:blue">D</span><span style="font-size:9pt;font-family:Menlo">+06  <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:green">!! divergence tolerance</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscInt</span><span style="font-size:9pt;font-family:Menlo">           ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">maxits</span><span style="font-size:9pt;font-family:Menlo"><span> </span>= 50</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscInt</span><span style="font-size:9pt;font-family:Menlo">           ::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">maxf</span><span style="font-size:9pt;font-family:Menlo">   = 10000</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">character</span></b><span style="font-size:9pt;font-family:Menlo">(</span><i><span style="font-size:9pt;font-family:Menlo;color:teal">len</span></i><span style="font-size:9pt;font-family:Menlo">=1000)::<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">args</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... count the number of degrees of freedom.</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">level</span><span style="font-size:9pt;font-family:Menlo"><span> </span>=<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">level_tmp</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">n</span><span style="font-size:9pt;font-family:Menlo"><span> </span>= 0</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">DO</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">iz</span><span style="font-size:9pt;font-family:Menlo"><span> </span>= 1,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">hb</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">level</span><span style="font-size:9pt;font-family:Menlo">)%</span><span style="font-size:9pt;font-family:Menlo;color:blue">nzone</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">        <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">imax</span><span style="font-size:9pt;font-family:Menlo"><span> </span>=<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">hb</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">level</span><span style="font-size:9pt;font-family:Menlo">)%</span><span style="font-size:9pt;font-family:Menlo;color:blue">zone</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">iz</span><span style="font-size:9pt;font-family:Menlo">)%</span><span style="font-size:9pt;font-family:Menlo;color:blue">imax</span><span style="font-size:9pt;font-family:Menlo"><span> </span>- 1</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">        <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">jmax</span><span style="font-size:9pt;font-family:Menlo"><span> </span>=<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">hb</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">level</span><span style="font-size:9pt;font-family:Menlo">)%</span><span style="font-size:9pt;font-family:Menlo;color:blue">zone</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">iz</span><span style="font-size:9pt;font-family:Menlo">)%</span><span style="font-size:9pt;font-family:Menlo;color:blue">jmax</span><span style="font-size:9pt;font-family:Menlo"><span> </span>- 1</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">        <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">kmax</span><span style="font-size:9pt;font-family:Menlo"><span> </span>=<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">hb</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">level</span><span style="font-size:9pt;font-family:Menlo">)%</span><span style="font-size:9pt;font-family:Menlo;color:blue">zone</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">iz</span><span style="font-size:9pt;font-family:Menlo">)%</span><span style="font-size:9pt;font-family:Menlo;color:blue">kmax</span><span style="font-size:9pt;font-family:Menlo"><span> </span>- 1</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">         </span><span style="font-size:9pt;font-family:Menlo;color:blue">n</span><span style="font-size:9pt;font-family:Menlo"><span> </span>=<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">n</span><span style="font-size:9pt;font-family:Menlo"><span> </span>+<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">imax</span><span style="font-size:9pt;font-family:Menlo"><span> </span>*<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">jmax</span><span style="font-size:9pt;font-family:Menlo"><span> </span>*<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">kmax</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">END</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">DO</span></b></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">n</span><span style="font-size:9pt;font-family:Menlo"><span> </span>=<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">n</span><span style="font-size:9pt;font-family:Menlo"><span> </span>*<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">neqn</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... Initialize PETSc</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscInitialize</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">PETSC_NULL_CHARACTER</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... Log</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscLogDefaultBegin</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... Hard-wired options.</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!     PetscCall(PetscOptionsInsertString(PETSC_NULL_OPTIONS, "command line style option here" , ierr))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... Command line options.</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">call</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><i><span style="font-size:9pt;font-family:Menlo;color:teal">GET_COMMAND</span></i><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">args</span><span style="font-size:9pt;font-family:Menlo">)</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscOptionsInsertString</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">PETSC_NULL_OPTIONS</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">args</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... view command line table</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">      </span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscViewerASCIIOpen</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">PETSC_COMM_SELF</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PETSC_VIEWER_STDOUT_SELF</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">viewer</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscOptionsView</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">PETSC_NULL_OPTIONS</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">viewer</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscViewerDestroy</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">viewer</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... Create PETSc vectors</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">VecCreateSeq</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">PETSC_COMM_SELF</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">n</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">x</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">VecCreateSeq</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">PETSC_COMM_SELF</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">n</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">y</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">VecSet</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">x</span><span style="font-size:9pt;font-family:Menlo">, 0.0</span><span style="font-size:9pt;font-family:Menlo;color:blue">d0</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">VecSet</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">y</span><span style="font-size:9pt;font-family:Menlo">, 0.0</span><span style="font-size:9pt;font-family:Menlo;color:blue">d0</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><p style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo"> </span></p><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... SNES context</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">SNESCreate</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">PETSC_COMM_SELF</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">SNESSetType</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">SNESSHELL</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">SNESShellSetSolve</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">MySolver</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><p style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo"> </span></p><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">!!!! <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">SNESSetFunction</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">x</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">MySolver</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PETSC_NULL_INTEGER</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">!!!!  this line causes a segmentation error if uncommented.</span></div><p style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo"> </span></p><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">SNESSetConvergenceTest</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">MyConverged</span><span style="font-size:9pt;font-family:Menlo">, 0,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PETSC_NULL_FUNCTION</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... Set SNES options</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">SNESSetFromOptions</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><p style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo"> </span></p><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... Set tolerances</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">SNESSetTolerances</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">rtol</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">atol</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">dtol</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">maxits</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">maxf</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... SNES montior</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">SNESMonitorSet</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">MyMonitor</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PETSC_NULL_INTEGER</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PETSC_NULL_FUNCTION</span><span style="font-size:9pt;font-family:Menlo">,</span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... Set the initial solution</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">CALL</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">HBToVecX</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">x</span><span style="font-size:9pt;font-family:Menlo">)</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... View snes context</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">SNESView</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">viewer</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... Solve SNES problem</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">SNESSolve</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PETSC_NULL_VEC</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">x</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... View snes context</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">SNESView</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">viewer</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... dump the logs</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!     call PetscLogDump(ierr)  ! Why does this cause error</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... Destroy PETSc objects</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">SNESDestroy</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">snes</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">VecDestroy</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">x</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">VecDestroy</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">y</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscViewerDestroy</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">viewer</span><span style="font-size:9pt;font-family:Menlo">,<span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo;color:green">!.... Finish</span></div><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">     <span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscCall</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">PetscFinalize</span><span style="font-size:9pt;font-family:Menlo">(</span><span style="font-size:9pt;font-family:Menlo;color:blue">ierr</span><span style="font-size:9pt;font-family:Menlo">))</span></div><p style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo"> </span></p><div style="margin:0in;background:white"><span style="font-size:9pt;font-family:Menlo">  <span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">END</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><b><span style="font-size:9pt;font-family:Menlo;color:maroon">SUBROUTINE</span></b><span style="font-size:9pt;font-family:Menlo"><span> </span></span><span style="font-size:9pt;font-family:Menlo;color:blue">SolveWithSNESShell</span></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"> <u></u><u></u></span></div></div></div></div></blockquote></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"><br clear="all"><u></u><u></u></span></div><div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"><u></u> <u></u></span></div></div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span><span style="font-size:11pt">--</span></span><span style="font-size:11pt"><u></u><u></u></span></div><div><div><div><div><div><div><div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">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<u></u><u></u></span></div></div><div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt"><u></u> <u></u></span></div></div><div><div style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><a href="https://urldefense.com/v3/__http:/www.cse.buffalo.edu/*knepley/__;fg!!OToaGQ!sE2W1qI_dqcEHL1dOCnJ3Rdv9TATFVDBiBqx_tlQsOnjvGF7StDjsmVcm9Qkfe4XcTFOBtVjtFl5om07Rdjw$" style="color:blue;text-decoration:underline" target="_blank"><span style="font-size:11pt">https://www.cse.buffalo.edu/~knepley/</span></a></div></div></div></div></div></div></div></div></div></div></div></blockquote></div><br></div></div></blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><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><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>