Actual source code: ntrdcimpl.h


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

  9: #include <petsc/private/snesimpl.h>

 11: typedef struct {
 12:   /* ---- Parameters used by the trust region method  ---- */
 13:   PetscReal      mu;             /* used to compute trust region parameter */
 14:   PetscReal      eta;            /* used to compute trust region parameter */
 15:   PetscReal      delta;          /* trust region parameter */
 16:   PetscReal      delta0;         /* used to initialize trust region parameter */
 17:   PetscReal      delta1;         /* used to compute trust region parameter */
 18:   PetscReal      delta2;         /* used to compute trust region parameter */
 19:   PetscReal      delta3;         /* used to compute trust region parameter */

 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 detemine 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 muste 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;

 44: #endif