A question about the Newton method in SNES

Dear all,

I am trying to use petsc SNES to solve the nonlinear equation instead of doing Newton iteration by hand. I find there are many options for -snes_type and -snes_linesearch_type. The default option is the Line Search Newton. I tried the “-snes_linesearch_type basic” , but I find that the results are different with that I get with standard Newton iteration by using loops and only ksp solvers in some cases, and even sometimes the SNES just diverge (I check the ksp solver for mat converges when I use snes ).

Is there many differences between the line search Newton and standard Newton iteration?( I think they should be mostly the same, in some cases I get the same results but sometimes different) or any options in the SNES that can help me do the standard Newton iteration?

Thanks very much .

One reason I have tried is that when doing standard Newton Iteration, I sometimes introduce one damping parameter alpha(just smaller than one) and updated my solution with

u = u - alpha*du

Within petsc SNES, I use the option “-snes_linesearch_damping” but still there exists the problem that sometimes SNES with “-snes_linesearch_type basic” will diverge but standard Newton Iteration converge.

-snes_linesearch_type basic should yield the same results as the Newton method written from scratch naively.

Thanks for your fast reply. I also think there should not be different. I will check the codes more carefully.

One way to check is to use the two funcs you are using in SNESSolve() (Jacobian and residual evaluations) in your hand-written Newton method.