xref: /petsc/src/snes/interface/snesregi.c (revision 6a5217c03994f2d95bb2e6dbd8bed42381aeb015)
1 
2 #include <petsc/private/snesimpl.h>     /*I  "petscsnes.h"  I*/
3 
4 PETSC_EXTERN PetscErrorCode SNESCreate_NEWTONLS(SNES);
5 PETSC_EXTERN PetscErrorCode SNESCreate_NEWTONTR(SNES);
6 PETSC_EXTERN PetscErrorCode SNESCreate_NEWTONTRDC(SNES);
7 PETSC_EXTERN PetscErrorCode SNESCreate_NRichardson(SNES);
8 PETSC_EXTERN PetscErrorCode SNESCreate_KSPONLY(SNES);
9 PETSC_EXTERN PetscErrorCode SNESCreate_KSPTRANSPOSEONLY(SNES);
10 PETSC_EXTERN PetscErrorCode SNESCreate_VINEWTONRSLS(SNES);
11 PETSC_EXTERN PetscErrorCode SNESCreate_VINEWTONSSLS(SNES);
12 PETSC_EXTERN PetscErrorCode SNESCreate_NGMRES(SNES);
13 PETSC_EXTERN PetscErrorCode SNESCreate_QN(SNES);
14 PETSC_EXTERN PetscErrorCode SNESCreate_Shell(SNES);
15 PETSC_EXTERN PetscErrorCode SNESCreate_NGS(SNES);
16 PETSC_EXTERN PetscErrorCode SNESCreate_NCG(SNES);
17 PETSC_EXTERN PetscErrorCode SNESCreate_FAS(SNES);
18 PETSC_EXTERN PetscErrorCode SNESCreate_MS(SNES);
19 PETSC_EXTERN PetscErrorCode SNESCreate_NASM(SNES);
20 PETSC_EXTERN PetscErrorCode SNESCreate_Anderson(SNES);
21 PETSC_EXTERN PetscErrorCode SNESCreate_ASPIN(SNES);
22 PETSC_EXTERN PetscErrorCode SNESCreate_Composite(SNES);
23 PETSC_EXTERN PetscErrorCode SNESCreate_Patch(SNES);
24 
25 const char *SNESConvergedReasons_Shifted[] = {" ","DIVERGED_TR_DELTA","DIVERGED_JACOBIAN_DOMAIN","DIVERGED_DTOL","DIVERGED_LOCAL_MIN","DIVERGED_INNER","DIVERGED_LINE_SEARCH","DIVERGED_MAX_IT",
26                                               "DIVERGED_FNORM_NAN","DIVERGED_LINEAR_SOLVE","DIVERGED_FUNCTION_COUNT","DIVERGED_FUNCTION_DOMAIN",
27                                               "CONVERGED_ITERATING"," ","CONVERGED_FNORM_ABS","CONVERGED_FNORM_RELATIVE",
28                                               "CONVERGED_SNORM_RELATIVE","CONVERGED_ITS"," ","SNESConvergedReason","",NULL};
29 const char *const *SNESConvergedReasons = SNESConvergedReasons_Shifted + 12;
30 
31 const char *SNESNormSchedules_Shifted[]    = {"DEFAULT","NONE","ALWAYS","INITIALONLY","FINALONLY","INITIALFINALONLY","SNESNormSchedule","SNES_NORM_",NULL};
32 const char *const *const SNESNormSchedules = SNESNormSchedules_Shifted + 1;
33 
34 const char *SNESFunctionTypes_Shifted[]    = {"DEFAULT","UNPRECONDITIONED","PRECONDITIONED","SNESFunctionType","SNES_FUNCTION_",NULL};
35 const char *const *const SNESFunctionTypes = SNESFunctionTypes_Shifted + 1;
36 
37 /*@C
38    SNESRegisterAll - Registers all of the nonlinear solver methods in the SNES package.
39 
40    Not Collective
41 
42    Level: advanced
43 
44 .seealso:  SNESRegisterDestroy()
45 @*/
46 PetscErrorCode  SNESRegisterAll(void)
47 {
48   PetscFunctionBegin;
49   if (SNESRegisterAllCalled) PetscFunctionReturn(0);
50   SNESRegisterAllCalled = PETSC_TRUE;
51 
52   PetscCall(SNESRegister(SNESNEWTONLS,         SNESCreate_NEWTONLS));
53   PetscCall(SNESRegister(SNESNEWTONTR,         SNESCreate_NEWTONTR));
54   PetscCall(SNESRegister(SNESNEWTONTRDC,       SNESCreate_NEWTONTRDC));
55   PetscCall(SNESRegister(SNESNRICHARDSON,      SNESCreate_NRichardson));
56   PetscCall(SNESRegister(SNESKSPONLY,          SNESCreate_KSPONLY));
57   PetscCall(SNESRegister(SNESKSPTRANSPOSEONLY, SNESCreate_KSPTRANSPOSEONLY));
58   PetscCall(SNESRegister(SNESVINEWTONRSLS,     SNESCreate_VINEWTONRSLS));
59   PetscCall(SNESRegister(SNESVINEWTONSSLS,     SNESCreate_VINEWTONSSLS));
60   PetscCall(SNESRegister(SNESNGMRES,           SNESCreate_NGMRES));
61   PetscCall(SNESRegister(SNESQN,               SNESCreate_QN));
62   PetscCall(SNESRegister(SNESSHELL,            SNESCreate_Shell));
63   PetscCall(SNESRegister(SNESNGS,              SNESCreate_NGS));
64   PetscCall(SNESRegister(SNESNCG,              SNESCreate_NCG));
65   PetscCall(SNESRegister(SNESFAS,              SNESCreate_FAS));
66   PetscCall(SNESRegister(SNESMS,               SNESCreate_MS));
67   PetscCall(SNESRegister(SNESNASM,             SNESCreate_NASM));
68   PetscCall(SNESRegister(SNESANDERSON,         SNESCreate_Anderson));
69   PetscCall(SNESRegister(SNESASPIN,            SNESCreate_ASPIN));
70   PetscCall(SNESRegister(SNESCOMPOSITE,        SNESCreate_Composite));
71   PetscCall(SNESRegister(SNESPATCH,            SNESCreate_Patch));
72 
73   PetscCall(KSPMonitorRegister("snes_preconditioned_residual", PETSCVIEWERASCII, PETSC_VIEWER_DEFAULT, KSPMonitorSNESResidual,       NULL, NULL));
74   PetscCall(KSPMonitorRegister("snes_preconditioned_residual", PETSCVIEWERDRAW,  PETSC_VIEWER_DRAW_LG, KSPMonitorSNESResidualDrawLG, KSPMonitorSNESResidualDrawLGCreate, NULL));
75   PetscFunctionReturn(0);
76 }
77