141ba4c6cSHeeho Park 241ba4c6cSHeeho Park /* 341ba4c6cSHeeho Park Context for a Newton trust region method for solving a system 441ba4c6cSHeeho Park of nonlinear equations 541ba4c6cSHeeho Park */ 641ba4c6cSHeeho Park 76524c165SJacob Faibussowitsch #ifndef __SNES_TR_H 841ba4c6cSHeeho Park #define __SNES_TR_H 941ba4c6cSHeeho Park #include <petsc/private/snesimpl.h> 1041ba4c6cSHeeho Park 1141ba4c6cSHeeho Park typedef struct { 1241ba4c6cSHeeho Park /* ---- Parameters used by the trust region method ---- */ 1341ba4c6cSHeeho Park PetscReal mu; /* used to compute trust region parameter */ 1441ba4c6cSHeeho Park PetscReal eta; /* used to compute trust region parameter */ 1541ba4c6cSHeeho Park PetscReal delta; /* trust region parameter */ 1641ba4c6cSHeeho Park PetscReal delta0; /* used to initialize trust region parameter */ 1741ba4c6cSHeeho Park PetscReal delta1; /* used to compute trust region parameter */ 1841ba4c6cSHeeho Park PetscReal delta2; /* used to compute trust region parameter */ 1941ba4c6cSHeeho Park PetscReal delta3; /* used to compute trust region parameter */ 2041ba4c6cSHeeho Park 2141ba4c6cSHeeho Park PetscReal eta1; /* Heeho's new TR-dogleg */ 2241ba4c6cSHeeho Park PetscReal eta2; /* Heeho's new TR-dogleg */ 2341ba4c6cSHeeho Park PetscReal eta3; /* Heeho's new TR-dogleg */ 2441ba4c6cSHeeho Park PetscReal t1; /* Heeho's new TR-dogleg */ 2541ba4c6cSHeeho Park PetscReal t2; /* Heeho's new TR-dogleg */ 2641ba4c6cSHeeho Park PetscReal deltaM; /* Heeho's new TR-dogleg */ 2741ba4c6cSHeeho Park /* currently using fixed array for the block size because of memory leak */ 2841ba4c6cSHeeho Park /* PetscReal *inorms; Heeho's new TR-dogleg, stores largest inf norm */ 2941ba4c6cSHeeho Park /* PetscInt bs; Heeho's new TR-dogleg, solution vector block size */ 3041ba4c6cSHeeho Park 31*da81f932SPierre Jolivet PetscReal sigma; /* used to determine termination */ 3241ba4c6cSHeeho Park PetscBool itflag; /* flag for convergence testing */ 3341ba4c6cSHeeho Park PetscBool use_cauchy; /* flag to use/not use Cauchy step and direction (S&D) */ 3441ba4c6cSHeeho Park PetscBool auto_scale_multiphase; /* flag to use/not use autoscaling for Cauchy S&D for multiphase*/ 35*da81f932SPierre Jolivet PetscReal auto_scale_max; /* max cap value for auto-scaling must be > 1 */ 3641ba4c6cSHeeho Park PetscBool rho_satisfied; /* flag for whether inner iteration satisfied rho */ 3741ba4c6cSHeeho Park PetscReal rnorm0, ttol; /* used for KSP convergence test */ 3841ba4c6cSHeeho Park PetscErrorCode (*precheck)(SNES, Vec, Vec, PetscBool *, void *); 3941ba4c6cSHeeho Park void *precheckctx; 4041ba4c6cSHeeho Park PetscErrorCode (*postcheck)(SNES, Vec, Vec, Vec, PetscBool *, PetscBool *, void *); 4141ba4c6cSHeeho Park void *postcheckctx; 4241ba4c6cSHeeho Park } SNES_NEWTONTRDC; 4341ba4c6cSHeeho Park 4441ba4c6cSHeeho Park #endif 45