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

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