[petsc-users] snes failures

Juha Jaykka juhaj at iki.fi
Wed May 18 13:45:22 CDT 2016


Oh, and one additional point I forgot: *any* type except ncg will converge if 
I change my initial conditions from a straight line from 0 to 2pi to a two-
domain solution phi(x) where phi(x>=0) == 2pi and phi(x<0) == 0. Ncg still 
fails, though. In fact, it goes NAN with the default LS type (cp), but fails 
completely with bt.

Ncg even fails if my initial condition is the exact solution itself (or, 
rather, the exact solution restricted to the numerical interval).

Cheers,
Juha

On Wednesday 18 May 2016 19:38:53 Juha Jaykka wrote:
> 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.



More information about the petsc-users mailing list