xref: /petsc/src/snes/impls/tr/trimpl.h (revision fbf9dbe564678ed6eff1806adbc4c4f01b9743f4)
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   PetscReal kmdc;   /* sufficient decrease parameter */
15 
16   /*
17     Given rho = (fk - fkp1) / (m(0) - m(pk))
18 
19     The radius is modified as:
20       rho < eta2 -> delta *= t1
21       rho > eta3 -> delta *= t2
22       delta = min(delta,deltaM)
23 
24     The step is accepted if rho > eta1
25   */
26   PetscReal eta1;
27   PetscReal eta2;
28   PetscReal eta3;
29   PetscReal t1;
30   PetscReal t2;
31 
32   SNESNewtonTRFallbackType fallback; /* enum to distinguish fallback in case Newton step is outside of the trust region */
33 
34   PetscErrorCode (*precheck)(SNES, Vec, Vec, PetscBool *, void *);
35   void *precheckctx;
36   PetscErrorCode (*postcheck)(SNES, Vec, Vec, Vec, PetscBool *, PetscBool *, void *);
37   void *postcheckctx;
38 } SNES_NEWTONTR;
39 
40 #endif
41