xref: /petsc/src/snes/impls/ntrdc/ntrdcimpl.h (revision 9f55a80c5994219f655b6306b362625b9957fa37)
141ba4c6cSHeeho Park /*
241ba4c6cSHeeho Park    Context for a Newton trust region method for solving a system
341ba4c6cSHeeho Park    of nonlinear equations
441ba4c6cSHeeho Park  */
541ba4c6cSHeeho Park 
6a4963045SJacob Faibussowitsch #pragma once
741ba4c6cSHeeho Park #include <petsc/private/snesimpl.h>
841ba4c6cSHeeho Park 
941ba4c6cSHeeho Park typedef struct {
1041ba4c6cSHeeho Park   /* ---- Parameters used by the trust region method  ---- */
1141ba4c6cSHeeho Park   PetscReal mu;     /* used to compute trust region parameter */
1241ba4c6cSHeeho Park   PetscReal eta;    /* used to compute trust region parameter */
1341ba4c6cSHeeho Park   PetscReal delta;  /* trust region parameter */
1441ba4c6cSHeeho Park   PetscReal delta0; /* used to initialize trust region parameter */
1541ba4c6cSHeeho Park   PetscReal delta1; /* used to compute trust region parameter */
1641ba4c6cSHeeho Park   PetscReal delta2; /* used to compute trust region parameter */
1741ba4c6cSHeeho Park   PetscReal delta3; /* used to compute trust region parameter */
1841ba4c6cSHeeho Park 
19*3201ab8dSStefano Zampini   PetscReal deltatol; /* trust region tolerance */
20*3201ab8dSStefano Zampini 
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 
31da81f932SPierre 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*/
35da81f932SPierre 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;
43