xref: /petsc/src/snes/impls/tr/trimpl.h (revision 66af8762ec03dbef0e079729eb2a1734a35ed7ff)
1 /*
2    Context for a Newton trust region method for solving a system
3    of nonlinear equations
4  */
5 
6 #pragma once
7 #include <petsc/private/snesimpl.h>
8 
9 typedef struct {
10   PetscReal delta;  /* trust region parameter */
11   PetscReal delta0; /* initial radius for trust region */
12   PetscReal deltaM; /* maximum radius for trust region */
13   PetscReal kmdc;   /* sufficient decrease parameter */
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