Actual source code: trimpl.h

  1: /*
  2:    Context for a Newton trust region method for solving a system
  3:    of nonlinear equations
  4:  */

  6: #pragma once
  7: #include <petsc/private/snesimpl.h>

  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 */

 15:   /*
 16:     Given rho = (fk - fkp1) / (m(0) - m(pk))

 18:     The radius is modified as:
 19:       rho < eta2 -> delta *= t1
 20:       rho > eta3 -> delta *= t2
 21:       delta = min(delta,deltaM)

 23:     The step is accepted if rho > eta1
 24:   */
 25:   PetscReal eta1;
 26:   PetscReal eta2;
 27:   PetscReal eta3;
 28:   PetscReal t1;
 29:   PetscReal t2;

 31:   SNESNewtonTRFallbackType fallback; /* enum to distinguish fallback in case Newton step is outside of the trust region */

 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;