Dear list, I'm designing a short training course on HPC, and decided to use PETSc as an example of a good way of getting things done quick, easy, and with good performance, and without needing to write one's own code for things like linear or non-linear solvers etc.
However, my SNES example turned out to be problematic: I chose the (static) sine-Gordon equation for my example, mostly because its exact solution is known so it is easy to compare with numerics and also because it is, after all, a dead simple equation. Yet my code refuses to converge most of the time! Using -snes_type ngs always succeeds, but is also very slow. Any other type will fail once I increase the domain size from ~100 points (the actual number depends on the type). I always keep the lattice spacing at 0.1. The failure is also always the same: DIVERGED_LINE_SEARCH. Some types manage to take one step and get stuck, some types manage to decrease the norm once and then continue forever without decreasing the norm but not complaining about divergence either (unless they hit one of the max_it-type limits), and ncg is the worst of all: it always (with any lattice size!) fails at the very first step. I've checked the Jacobian, and I suspect it is ok as ngs converges and the other types except ncg also converge nicely unless the domain is too big. Any ideas of where this could go wrong? Cheers, Juha P.S. I can share the whole code, if that is needed, but it is presently quite messy thanks to all my efforts at trying to sort this out.
