<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, May 18, 2016 at 1:38 PM, Juha Jaykka <span dir="ltr"><<a href="mailto:juhaj@iki.fi" target="_blank">juhaj@iki.fi</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Dear list,<br>
<br>
I'm designing a short training course on HPC, and decided to use PETSc as an<br>
example of a good way of getting things done quick, easy, and with good<br>
performance, and without needing to write one's own code for things like<br>
linear or non-linear solvers etc.<br>
<br>
However, my SNES example turned out to be problematic: I chose the (static)<br>
sine-Gordon equation for my example, mostly because its exact solution is<br>
known so it is easy to compare with numerics and also because it is, after<br>
all, a dead simple equation. Yet my code refuses to converge most of the time!<br>
<br>
Using -snes_type ngs always succeeds, but is also very slow. Any other type<br>
will fail once I increase the domain size from ~100 points (the actual number<br>
depends on the type). I always keep the lattice spacing at 0.1. The failure is<br>
also always the same: DIVERGED_LINE_SEARCH. Some types manage to take one step<br>
and get stuck, some types manage to decrease the norm once and then continue<br>
forever without decreasing the norm but not complaining about divergence<br>
either (unless they hit one of the max_it-type limits), and ncg is the worst<br>
of all: it always (with any lattice size!) fails at the very first step.<br>
<br>
I've checked the Jacobian, and I suspect it is ok as ngs converges and the<br>
other types except ncg also converge nicely unless the domain is too big.<br></blockquote><div><br></div><div>Nope, ngs does not use the Jacobian, and small problems can converge with wrong Jacobians.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
Any ideas of where this could go wrong?</blockquote><div><br></div><div>1) Just run with -snes_fd_color  -snes_fd_color_use_mat -mat_coloring_type greedy and</div><div>    see if it converges.</div><div><br></div><div>2) Check out <a href="http://scicomp.stackexchange.com/questions/30/why-is-newtons-method-not-converging">http://scicomp.stackexchange.com/questions/30/why-is-newtons-method-not-converging</a></div><div><br></div><div>  Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
Cheers,<br>
Juha<br>
<br>
P.S. I can share the whole code, if that is needed, but it is presently quite<br>
messy thanks to all my efforts at trying to sort this out.<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">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></div>