On Sat, Nov 5, 2011 at 3:45 PM, Jed Brown <span dir="ltr">&lt;<a href="mailto:jedbrown@mcs.anl.gov">jedbrown@mcs.anl.gov</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div class="im">On Sat, Nov 5, 2011 at 08:06, Matthew Knepley <span dir="ltr">&lt;<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I want to start small by porting a very simple code using fixed point<br>
iterations as follows: A(x)x = b(x) is approximated as A(x0)x = b(x0),<br>
then solved by KSP for x, then x0 is updated to x, then repeat until<br>
convergence.<br></blockquote></div></div></blockquote><div><br></div></div><div>Run the usual &quot;Newton&quot; methods with A(x) in place of the true Jacobian. You can compute A(x) in the residual</div><div><br></div><div>
F(x) = A(x) x - b(x)</div>
<div><br></div><div>and cache it in your user context, then pass it back when asked to compute the Jacobian.</div><div><br></div><div>This runs your algorithm (often called Picard) in &quot;defect correction mode&quot;, but once you write your equations this way, you can try Newton iteration using -snes_mf_operator.</div>
<div class="im">
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<br>
In the documentation chapter 5 I see all sorts of sophisticated Newton<br>
type methods, requiring computation of the Jacobian. Is the above<br>
defined simple method still accessible somehow in Petsc or such<br>
triviality can only be done by hand? Which one from the existing<br>
nonlinear solvers would be a closest match both in simplicity and<br>
robustness (even if slow performance)?<br></blockquote><div><br></div></div></div><div>You want -snes_type nrichardson. All you need is to define the residual.</div></blockquote></div></div><br><div>Matt, were the 1000 emails we exchanged over this last month not enough to prevent you from spreading misinformation under a different name?</div>

</blockquote></div><br>Tell people whatever you want. The above is just Newton or &quot;iterative refinement&quot; in thousands of NA papers.<div><br></div><div>  Matt<br clear="all"><div><br></div>-- <br>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<br>
</div>