<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Got it.  I’m trying to build up my desired convergence test, based on the default routine. I’m getting the following compiler error, which I don’t entirely understand:<div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><b class="">blowup_utils.c:180:9: </b><span style="font-variant-ligatures: no-common-ligatures; color: #c33720" class=""><b class="">error: </b></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><b class="">      incomplete definition of type 'struct _p_SNES'</b></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class="">    snes->ttol = fnorm_scaled*snes->rtol;</div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(52, 189, 38);" class=""><b class="">    ~~~~^</b></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><b class="">/opt/petsc/include/petscsnes.h:20:16: note: </b>forward declaration of</div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class="">      'struct _p_SNES'</div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class="">typedef struct _p_SNES* SNES;</div><div class=""><br class=""></div><div class="">Separately, is there a way to get the step vector?</div><div class=""><br class=""></div><div class="">
<span class="Apple-style-span" style="border-collapse: separate; line-height: normal; border-spacing: 0px;">-gideon</span>

</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Jan 12, 2016, at 9:17 AM, Dave May <<a href="mailto:dave.mayhem23@gmail.com" class="">dave.mayhem23@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On 12 January 2016 at 15:06,  <span dir="ltr" class=""><<a href="mailto:gideon.simpson@gmail.com" target="_blank" class="">gideon.simpson@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto" class=""><div class="">Do I have to manually code in the divergence criteria too?<br class=""></div></div></blockquote><div class=""><br class=""></div><div class="">Yes.<br class=""><br class="">By calling<span style="font-family:arial,helvetica,sans-serif" class=""><font size="2" class=""><span style="font-weight:normal" class=""> SNESSetConvergenceTest()</span></font></span> you are replacing the default SNES convergence test function which will get called at each SNES iteration, therefore you are responsible for defining all reasons for convergence and divergence.<br class=""><br class=""></div><div class="">To make life easy, you could copy everything in the funciton SNESConvergedDefault(), <br class=""><br class=""><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESConvergedDefault.html#SNESConvergedDefault" target="_blank" class="">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESConvergedDefault.html#SNESConvergedDefault</a><br class=""><div class=""><br class=""></div><font size="2" class=""><span style="font-family:arial,helvetica,sans-serif" class="">and just replace the rule for <br class=""></span></font></div><div class=""><font size="2" class=""><span style="font-family:arial,helvetica,sans-serif" class="">  SNES_CONVERGED_FNORM_RELATIVE<br class=""></span></font></div><div class=""><font size="2" class=""><span style="font-family:arial,helvetica,sans-serif" class="">with your custom scaled stopping condition.<br class=""><br class=""><br class=""></span></font><pre width="80" class=""><font size="2" class=""><span style="font-family:arial,helvetica,sans-serif" class=""><br class=""><br class=""></span></font></pre></div><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto" class=""><div class=""></div><div class=""><div class=""><div class=""><br class="">On Jan 12, 2016, at 8:37 AM, Dave May <<a href="mailto:dave.mayhem23@gmail.com" target="_blank" class="">dave.mayhem23@gmail.com</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On 12 January 2016 at 14:33, Gideon Simpson <span dir="ltr" class=""><<a href="mailto:gideon.simpson@gmail.com" target="_blank" class="">gideon.simpson@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">I’m just a bit confused by the documentation for SNESConvergenceTestFunction.  the arguments for the xnorm, gnorm, and f are passed in, at the current iterate, correct? </div></div></blockquote><div class=""><br class=""></div><div class="">Yes, but nothing requires you to use them :D<br class=""></div><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""> I interpreted this as though I had to build by convergence test based on those values.</div></div></blockquote><div class=""><br class=""></div><div class="">This is a misinterpretation. You can ignore all of xnorm, gnorm and fnorm and define any crazy stopping condition you like. <br class=""><br class="">xnorm, gnorm and fnorm are commonly required for many stopping conditions and are computed by the snes methods. As such, are readily available and for efficiency and convenience they are provided to the user (e.g. to avoid you having to re-compute norms).<br class=""><br class=""></div><div class="">Cheers,<br class=""></div><div class="">  Dave<br class=""></div><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><span class=""><font color="#888888" class=""><br class=""><div class="">
<span style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">-gideon</span>

</div></font></span><div class=""><div class="">
<br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 12, 2016, at 8:24 AM, Dave May <<a href="mailto:dave.mayhem23@gmail.com" target="_blank" class="">dave.mayhem23@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On 12 January 2016 at 14:14, Gideon Simpson <span dir="ltr" class=""><<a href="mailto:gideon.simpson@gmail.com" target="_blank" class="">gideon.simpson@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class="">That seems to to allow for me to cook up a convergence test in terms of the 2 norm.  </div></blockquote><div class=""><br class=""></div><div class="">While you are only provided the 2 norm of F, you are also given access to the SNES object. Thus inside your user convergence test function, you can call SNESGetFunction() and SNESGetSolution(), then you can compute your 
convergence criteria and set the converged reason to what ever you want.<br class=""><div class=""><br class=""></div>See <br class=""><div class=""><br class=""><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESGetFunction.html" target="_blank" class="">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESGetFunction.html</a><br class=""><br class=""><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESGetSolution.html" target="_blank" class="">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESGetSolution.html</a><br class=""><br class=""></div><div class="">Cheers,<br class=""></div><div class="">  Dave<br class=""></div><div class=""><br class=""></div><br class=""></div><div class=""><br class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class="">What I’m really looking for is the ability to change things to be something like the 2 norm of the vector with elements<div class=""><br class=""></div><div class="">F_i/|x_i|</div><div class=""><br class=""></div><div class="">where I am looking for a root of F(x).  I can just build that scaling into the form function, but is there a way to do it without rewriting that piece of the code?</div><span class=""><font color="#888888" class=""><div class=""><br class=""></div></font></span><div class=""><div class=""><div class=""><span class=""><font color="#888888" class=""><br class=""><div class="">
<span style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="">-gideon</span>

</div></font></span><div class=""><div class="">
<br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 12, 2016, at 12:14 AM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" target="_blank" class="">bsmith@mcs.anl.gov</a>> wrote:</div><br class=""><div class=""><div class=""><br class="">   You can use SNESSetConvergenceTest() to use whatever test you want to decide on convergence.<br class=""><br class="">Barry<br class=""><br class=""><blockquote type="cite" class="">On Jan 11, 2016, at 3:26 PM, Gideon Simpson <<a href="mailto:gideon.simpson@gmail.com" target="_blank" class="">gideon.simpson@gmail.com</a>> wrote:<br class=""><br class="">I’m solving nonlinear problem for a complex valued function which is decomposed into real and imaginary parts, Q = u + i v.  What I’m finding is that where |Q| is small, the numerical phase errors tend to be larger.  I suspect this is because it’s using the 2-norm for convergence in the SNES, so, where the solution is already, the phase errors are seen as small too.  Is there a way to use something more like an infinity norm with SNES, to get more point wise control?<br class=""><br class="">-gideon<br class=""><br class=""></blockquote><br class=""></div></div></blockquote></div><br class=""></div></div></div></div></div></div></blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></div></div></div></div></blockquote></div><br class=""></div></div>
</div></blockquote></div></div></div></blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></div></body></html>