SNESSetLineSearch

Sets the line search routine to be used by the method SNESLS.

Synopsis

int SNESSetLineSearch(SNES snes,int (*func)(SNES,void*,Vec,Vec,Vec,Vec,Vec,PetscReal,PetscReal*,PetscReal*,int*),void *lsctx)

Input Parameters

snes - nonlinear context obtained from SNESCreate()
lsctx - optional user-defined context for use by line search
func - pointer to int function

Collective on SNES

Available Routines

SNESCubicLineSearch() - default line search
SNESQuadraticLineSearch() - quadratic line search
SNESNoLineSearch() - the full Newton step (actually not a line search)
SNESNoLineSearchNoNorms() - the full Newton step (calculating no norms; faster in parallel)

Options Database Keys

-snes_ls [cubic,quadratic,basic,basicnonorms] - Selects line search
-snes_ls_alpha <alpha> - Sets alpha
-snes_ls_maxstep <max> - Sets maxstep
-snes_ls_steptol <steptol> - Sets steptol, this is the minimum step size that the line search code will accept; min p[i]/x[i] < steptol. The -snes_stol <stol> is the minimum step length the default convergence test will use and is based on 2-norm(p) < stol*2-norm(x)

Calling sequence of func

   func (SNES snes,void *lsctx,Vec x,Vec f,Vec g,Vec y,Vec w,
         PetscReal fnorm,PetscReal *ynorm,PetscReal *gnorm,*flag)

Input parameters for func

snes - nonlinear context
lsctx - optional user-defined context for line search
x - current iterate
f - residual evaluated at x
y - search direction (contains new iterate on output)
w - work vector
fnorm - 2-norm of f

Output parameters for func

g - residual evaluated at new iterate y
y - new iterate (contains search direction on input)
gnorm - 2-norm of g
ynorm - 2-norm of search length
flag - set to 0 if the line search succeeds; a nonzero integer on failure.

Keywords

SNES, nonlinear, set, line search, routine

See Also

SNESCubicLineSearch(), SNESQuadraticLineSearch(), SNESNoLineSearch(), SNESNoLineSearchNoNorms(),
SNESSetLineSearchCheck(), SNESSetLineSearchParams(), SNESGetLineSearchParams()

Level:advanced
Location:
src/snes/impls/ls/ls.c
Index of all SNES routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/snes/examples/tutorials/ex1f.F.html