1 #ifndef _SNESNGMRES_H 2 #define _SNESNGMRES_H 3 4 #include <private/snesimpl.h> 5 #include <petsclinesearch.h> 6 7 /* Data structure for the Nonlinear GMRES method. */ 8 typedef struct { 9 10 /* Solver parameters and counters */ 11 PetscInt msize; /* maximum size of krylov space */ 12 PetscInt restart_it; /* number of iterations the restart conditions persist before restart */ 13 PetscViewer monitor; /* debugging output for NGMRES */ 14 15 /* History and subspace data */ 16 Vec *Fdot; /* residual history -- length msize */ 17 Vec *Xdot; /* solution history -- length msize */ 18 PetscReal *fnorms; /* the residual norm history */ 19 20 /* General minimization problem context */ 21 PetscScalar *h; /* the constraint matrix */ 22 PetscScalar *beta; /* rhs for the minimization problem */ 23 PetscScalar *xi; /* the dot-product of the current and previous res. */ 24 25 /* Line searches */ 26 PetscLineSearch linesearch; /* Line search for the default step */ 27 PetscLineSearch additive_linesearch; /* Line search for the additive variant */ 28 29 /* Selection constants */ 30 PetscBool anderson; /* use anderson-mixing approach */ 31 PetscBool additive; /* use additive variant instead of selection */ 32 PetscReal gammaA; /* Criterion A residual tolerance */ 33 PetscReal epsilonB; /* Criterion B difference tolerance */ 34 PetscReal deltaB; /* Criterion B residual tolerance */ 35 PetscReal gammaC; /* Restart residual tolerance */ 36 37 /* Least squares minimization solve context */ 38 PetscScalar *q; /* the matrix formed as q_ij = (rdot_i, rdot_j) */ 39 PetscBLASInt m; /* matrix dimension */ 40 PetscBLASInt n; /* matrix dimension */ 41 PetscBLASInt nrhs; /* the number of right hand sides */ 42 PetscBLASInt lda; /* the padded matrix dimension */ 43 PetscBLASInt ldb; /* the padded vector dimension */ 44 PetscReal *s; /* the singular values */ 45 PetscReal rcond; /* the exit condition */ 46 PetscBLASInt rank; /* the effective rank */ 47 PetscScalar *work; /* the work vector */ 48 PetscReal *rwork; /* the real work vector used for complex */ 49 PetscBLASInt lwork; /* the size of the work vector */ 50 PetscBLASInt info; /* the output condition */ 51 52 PetscBool setup_called; /* indicates whether SNESSetUp_NGMRES() has been called */ 53 } SNES_NGMRES; 54 55 #define H(i,j) ngmres->h[i*ngmres->msize + j] 56 #define Q(i,j) ngmres->q[i*ngmres->msize + j] 57 58 #endif 59