<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal style='margin-left:.5in'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:.5in'><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Peter Brune [mailto:prbrune@gmail.com] <br><b>Sent:</b> Tuesday, April 22, 2014 10:16 AM<br><b>To:</b> Fischer, Greg A.<br><b>Cc:</b> petsc-users@mcs.anl.gov<br><b>Subject:</b> Re: [petsc-users] SNES: approximating the Jacobian with computed residuals?<o:p></o:p></span></p><div><div><p class=MsoNormal style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:.5in'><o:p> </o:p></p><div><p class=MsoNormal style='margin-left:1.0in'>On Tue, Apr 22, 2014 at 8:48 AM, Fischer, Greg A. <<a href="mailto:fischega@westinghouse.com" target="_blank">fischega@westinghouse.com</a>> wrote:<o:p></o:p></p><p class=MsoNormal style='margin-left:1.0in'>Hello PETSc-users,<br><br>I'm using the SNES component with the NGMRES method in my application. I'm using a matrix-free context for the Jacobian and the MatMFFDComputeJacobian() function in my FormJacobian routine. My understanding is that this effectively approximates the Jacobian using the equation at the bottom of Page 103 in the PETSc User's Manual. This works, but the expense of computing two function evaluations in each SNES iteration nearly wipes out the performance improvements over Picard iteration.<o:p></o:p></p><div><p class=MsoNormal style='margin-left:.5in'><o:p> </o:p></p></div><div><p class=MsoNormal style='margin-left:.5in'>Try -snes_type anderson.  It's less stable than NGMRES, but requires one function evaluation per iteration.  The manual is out of date.  I guess it's time to fix that.  It's interesting that the cost of matrix assembly and a linear solve is around the same as that of a function evaluation.  Output from -log_summary would help in the diagnosis.<o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I tried the –snes_type anderson option, and it seems to be requiring even more function evaluations than the Picard iterations. I’ve attached –log_summary output. This seems strange, because I can use the NLKAIN code (<a href="http://nlkain.sourceforge.net/">http://nlkain.sourceforge.net/</a>) to fairly good effect, and I’ve read that it’s related to Anderson mixing. Would it be useful to adjust the parameters?<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I’ve also attached –log_summary output for NGMRES. Does anything jump out as being amiss?<o:p></o:p></span></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><p class=MsoNormal style='margin-left:24.45pt'><br>Based on my (limited) understanding of the Oosterlee/Washio SIAM paper ("Krylov Subspace Acceleration of Nonlinear Multigrid..."), they seem to suggest that it's possible to approximate the Jacobian with a series of previously-computed residuals (eq 2.14), rather than additional function evaluations in each iteration. Is this correct? If so, could someone point me to a reference that demonstrates how to do this with PETSc?<o:p></o:p></p></blockquote><div><p class=MsoNormal style='margin-left:24.45pt'><o:p> </o:p></p></div><div><p class=MsoNormal style='margin-left:24.45pt'>What indication do you have that the Jacobian is calculated at all in the NGMRES method?  The two function evaluations are related to computing the quantities labeled F(u_M) and F(u_A) in O/W.  We already use the Jacobian approximation for the minimization problem (2.14).<o:p></o:p></p></div><div><p class=MsoNormal style='margin-left:24.45pt'><o:p> </o:p></p></div><div><p class=MsoNormal style='margin-left:24.45pt'>- Peter<o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks for the clarification.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>-Greg<o:p></o:p></span></p></div><div><p class=MsoNormal style='margin-left:24.45pt'><o:p> </o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><p class=MsoNormal style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:24.45pt'><br>Or, perhaps a better question to ask is: are there other ways of reducing the computing burden associated with estimating the Jacobian?<br><br>Thanks,<br>Greg<o:p></o:p></p></blockquote></div><p class=MsoNormal style='margin-left:24.45pt'><o:p> </o:p></p></div></div></div></body></html>