petsc-3.7.1 2016-05-15
Report Typos and Errors

# SNESSetType

Sets the method for the nonlinear solver.

### Synopsis

    #include "petscsnes.h"
    PetscErrorCode  SNESSetType(SNES snes,SNESType type)

Collective on SNES Many br

### Input Parameters

| snes | - the SNES context Many br
| type | - a known method Many br

### Options Database Key

-snes_type <type> -Sets the method; use -help for a list Many brof available methods (for instance, newtonls or newtontr) Many br

### Notes

See "petsc/include/petscsnes.h" for available methods (for instance) Many br

| SNESNEWTONLS | - Newton's method with line search Many br(systems of nonlinear equations) Many br
| SNESNEWTONTR | - Newton's method with trust region Many br(systems of nonlinear equations) Many br

Normally, it is best to use the SNESSetFromOptions() command and then Many brset the SNES solver type from the options database rather than by using Many brthis routine. Using the options database provides the user with Many brmaximum flexibility in evaluating the many nonlinear solvers. Many brThe SNESSetType() routine is provided for those situations where it Many bris necessary to set the nonlinear solver independently of the command Many brline or options database. This might be the case, for example, when Many brthe choice of solver changes during the execution of the program, Many brand the user's application is taking responsibility for choosing the Many brappropriate method. Many br

Developer Notes: SNESRegister() adds a constructor for a new SNESType to SNESList, SNESSetType() locates Many brthe constructor in that list and calls it to create the spexific object. Many br

Many br

### Keywords

SNES, set, type

### See Also

SNESType, SNESCreate(), SNESDestroy(), SNESGetType(), SNESSetFromOptions()

Level:intermediate
Location:src/snes/interface/snes.c
Index of all SNES routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/snes/examples/tutorials/ex35.c.html
src/ts/examples/tutorials/ex22.c.html