As Matt notes you absolutely need to run with -pc_type lu -ksp_monitor_true_residual -ksp_converged_reason to make sure that the linear system solve is not the issue. It is also possible that a bug in the function evaluation (using uninitialized values or something) is causing the difficulty: run with valgrind (http://www.mcs.anl.gov/petsc/petsc-as/documentation/faq.html#valgrind) to check for these types of errors and review the code.
Barry On Jun 22, 2011, at 8:20 PM, Matthew Knepley wrote: > On Wed, Jun 22, 2011 at 6:52 PM, Juha J?ykk? <juhaj at iki.fi> wrote: > Hi all! > > I am having nasty problems with SNES. As you probably guess already, my result > is non-converging line search. I have a good candidate reason for this, but I > do not know how to fix it. > > Jacobian should be fine: -snes_ls_type test gives nice small numbers (not > quite as small as I would like: around 1e-7). > > And even if Jacobian was wrong, -snes_fd behaves in exactly the same way. > > When snes gives up with its line search, the values in the residual vector > are: > > 0.00000000e+00, 1.02404374e+00, 2.28558501e-01, > 1.94195641e-02, -4.82401091e-02, -7.07456591e-02, > -7.64790651e-02, -7.55281623e-02, -7.19176452e-02 > > before they stabilise to interval (1.e-5, 8e-2). Now, my candidate is the huge > (compared to others) value of the rhs at the second lattice point and slightly > smaller, but still large at the third. The diverged solution vector grows very > fast in the beginning and then settles to an almost constant value after about > one tenth of the lattice, so my guess is that the big change needed at i=1 > causes precision to be lost at i>>1 and therefore line search fails. > > Do you have any ideas how to get around this or if my theory is even correct? > > Its hard to say anything without knowing what equations are being solved. > However, > does the linear problem converge? If so, you could try continuation in a > parameter > in the nonlinear term. > > Matt > > Trying trust region search does not really help: it suffers from the same > deficiency - except that it thinks it converges even though the function norm > is of the order of 0.5. (It does fare slightly better, though, its rhs starts > like > > 0.00000000e+00, 3.93745063e-01, 1.79187741e-01, > 1.03100385e-01, 6.76686117e-02, 4.82967347e-02, > 3.65243377e-02, 2.88059666e-02, 2.34452314e-02, > > which is better, but still not good enough.) > > Cheers, > Juha > > -- > ----------------------------------------------- > | Juha J?ykk?, juhaj at iki.fi | > | http://www.maths.leeds.ac.uk/~juhaj | > ----------------------------------------------- > > > > -- > What most experimenters take for granted before they begin their experiments > is infinitely more interesting than any results to which their experiments > lead. > -- Norbert Wiener
