xref: /petsc/src/snes/impls/tr/trimpl.h (revision 6e4289a0dd4d962ed977e39cfbc50d2f2c3b3d96)
1 /*
2    Context for a Newton trust region method for solving a system
3    of nonlinear equations
4  */
5 
6 #ifndef __SNES_TR_H
7 #define __SNES_TR_H
8 #include <petsc/private/snesimpl.h>
9 
10 typedef struct {
11   PetscReal delta;  /* trust region parameter */
12   PetscReal delta0; /* initial radius for trust region */
13   PetscReal deltaM; /* maximum radius for trust region */
14 
15   /*
16     Given rho = (fk - fkp1) / (m(0) - m(pk))
17 
18     The radius is modified as:
19       rho < eta2 -> delta *= t1
20       rho > eta3 -> delta *= t2
21       delta = min(delta,deltaM)
22 
23     The step is accepted if rho > eta1
24   */
25   PetscReal eta1;
26   PetscReal eta2;
27   PetscReal eta3;
28   PetscReal t1;
29   PetscReal t2;
30 
31   SNESNewtonTRFallbackType fallback; /* enum to distinguish fallback in case Newton step is outside of the trust region */
32 
33   PetscErrorCode (*precheck)(SNES, Vec, Vec, PetscBool *, void *);
34   void *precheckctx;
35   PetscErrorCode (*postcheck)(SNES, Vec, Vec, Vec, PetscBool *, PetscBool *, void *);
36   void *postcheckctx;
37 } SNES_NEWTONTR;
38 
39 #endif
40