Actual source code: ntrdcimpl.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:   /* ---- Parameters used by the trust region method  ---- */
 11:   PetscReal mu;     /* used to compute trust region parameter */
 12:   PetscReal eta;    /* used to compute trust region parameter */
 13:   PetscReal delta;  /* trust region parameter */
 14:   PetscReal delta0; /* used to initialize trust region parameter */
 15:   PetscReal delta1; /* used to compute trust region parameter */
 16:   PetscReal delta2; /* used to compute trust region parameter */
 17:   PetscReal delta3; /* used to compute trust region parameter */

 19:   PetscReal deltatol; /* trust region tolerance */

 21:   PetscReal eta1;   /* Heeho's new TR-dogleg */
 22:   PetscReal eta2;   /* Heeho's new TR-dogleg */
 23:   PetscReal eta3;   /* Heeho's new TR-dogleg */
 24:   PetscReal t1;     /* Heeho's new TR-dogleg */
 25:   PetscReal t2;     /* Heeho's new TR-dogleg */
 26:   PetscReal deltaM; /* Heeho's new TR-dogleg */
 27:   /* currently using fixed array for the block size because of memory leak */
 28:   /* PetscReal      *inorms;         Heeho's new TR-dogleg, stores largest inf norm */
 29:   /* PetscInt       bs;              Heeho's new TR-dogleg, solution vector block size */

 31:   PetscReal sigma;                 /* used to determine termination */
 32:   PetscBool itflag;                /* flag for convergence testing */
 33:   PetscBool use_cauchy;            /* flag to use/not use Cauchy step and direction (S&D) */
 34:   PetscBool auto_scale_multiphase; /* flag to use/not use autoscaling for Cauchy S&D for multiphase*/
 35:   PetscReal auto_scale_max;        /* max cap value for auto-scaling must be > 1 */
 36:   PetscBool rho_satisfied;         /* flag for whether inner iteration satisfied rho */
 37:   PetscReal rnorm0, ttol;          /* used for KSP convergence test */
 38:   PetscErrorCode (*precheck)(SNES, Vec, Vec, PetscBool *, void *);
 39:   void *precheckctx;
 40:   PetscErrorCode (*postcheck)(SNES, Vec, Vec, Vec, PetscBool *, PetscBool *, void *);
 41:   void *postcheckctx;
 42: } SNES_NEWTONTRDC;