11 #ifndef _PETSCSOLVER_H_ 12 #define _PETSCSOLVER_H_ 23 #include "petscviewer.h" 26 #include "NamespaceHeader.H" 55 #
if PETSC_VERSION_GE(3,5,0)
56 PetscErrorCode (*j)(SNES,Vec,Mat,Mat,
void*)
58 PetscErrorCode (*j)(SNES,Vec,Mat*,Mat*,MatStructure*,
void*)
65 static PetscErrorCode
ksp_monitor_pout(KSP ksp, PetscInt it, PetscReal rnorm ,
void *ctx)
67 pout() <<
" KSP:: iteration = " << it <<
" residual norm = " << rnorm << std::endl;
72 virtual void define(
Real a_dx,
bool a_homogeneous =
true );
78 virtual void solve( T& a_phi,
const T& a_rhs );
112 virtual int applyOp(T & a_phi,
const T & a_rhs );
129 KSPSetOptionsPrefix(
m_ksp,prefix);
225 #if PETSC_VERSION_GE(3,5,0) 226 PetscErrorCode (*
m_jacobian)(SNES,Vec,Mat,Mat,
void*);
228 PetscErrorCode (*
m_jacobian)(SNES,Vec,Mat*,Mat*,MatStructure*,
void*);
244 virtual int formMatrix( Mat,
const T* =0, PetscInt my0=0, PetscInt nloc=0, PetscInt *d=0, PetscInt *o=0) = 0;
278 a_box = fabref.
box();
293 virtual void define(
Real a_dx,
bool a_homogeneous =
true );
343 #include "NamespaceFooter.H" 346 #ifndef CH_EXPLICIT_TEMPLATES 348 #endif // CH_EXPLICIT_TEMPLATES std::ostream & pout()
Use this in place of std::cout for program output.
Definition: LinearSolver.H:28
virtual void define(Real a_dx, bool a_homogeneous=true)
Definition: PetscSolverI.H:81
virtual Real addBCdiagValue(const IntVect &a_iv, const IntVect &a_jv, const T &a_rhs, const DataIndex &a_datInd, const Real coeff=1)
Definition: PetscSolver.H:180
KSP m_ksp
Definition: PetscSolver.H:221
LevelData< FluxBox > * m_eta
Definition: PetscSolver.H:330
virtual void solve(T &a_phi, const T &a_rhs)
Definition: PetscSolverI.H:106
int solve_private(T &a_phi, const T &a_rhs)
Definition: PetscSolverI.H:420
Real m_beta
Definition: PetscSolver.H:327
PetscInt m_gid0
Definition: PetscSolver.H:241
virtual void rhsOperation(const T &a_rhs)
Definition: PetscSolver.H:159
Definition: PetscSolver.H:256
static PetscErrorCode ksp_monitor_pout(KSP ksp, PetscInt it, PetscReal rnorm, void *ctx)
Definition: PetscSolver.H:65
virtual int formMatrix(Mat, const T *=0, PetscInt my0=0, PetscInt nloc=0, PetscInt *d=0, PetscInt *o=0)=0
virtual void solve_mfree(T &a_phi, const T &a_rhs, LinearOp< T > *a_op)
Definition: PetscSolverI.H:116
virtual void setHomogeneous(bool a_homogeneous)
Definition: PetscSolver.H:46
virtual int getNNZPerRow() const
Definition: PetscSolver.H:319
const Box & box() const
Definition: BaseFabImplem.H:271
virtual Real addBCrhsValue(const IntVect &a_iv, const T &a_phi, const DataIndex &a_datInd, const Real &coeff=1)
Definition: PetscSolver.H:208
const BaseFab< Real > & getRegFab(const LevelData< FArrayBox > &a_fab, const DataIndex &a_datInd, Box &a_box) const
Definition: PetscSolver.H:275
void define(Real alpha, Real beta, LevelData< FArrayBox > *a, LevelData< FluxBox > *eta, LevelData< FluxBox > *lam)
Definition: PetscSolver.H:333
virtual int applyOp(T &a_phi, const T &a_rhs)
Definition: PetscSolverI.H:826
int resetOperator()
Definition: PetscSolver.H:185
virtual ~PetscSolver()
Definition: PetscSolverI.H:74
virtual BaseFab< Real > & getRegFab(T &a_fab, const DataIndex &a_datInd)=0
Real m_dx
Definition: PetscSolver.H:172
virtual bool supportNNZExact() const
Definition: PetscSolver.H:151
bool m_null
Definition: PetscSolver.H:233
void const char const int const int const int const Real const Real * A
Definition: Lapack.H:83
bool m_mfree_homogeneous
Definition: PetscSolver.H:98
Real computeResidual()
Definition: PetscSolverI.H:782
PetscSolverFAB()
Definition: PetscSolver.H:259
PetscErrorCode putPetscInChombo(T &a_phi, const Vec xx)
Definition: PetscSolverI.H:702
void setNull(bool n=true)
Definition: PetscSolverI.H:99
LevelData< BaseFab< bool > > m_bccode
Definition: PetscSolver.H:235
Real m_alpha
Definition: PetscSolver.H:301
LinearOp< T > * m_op_mfree
Definition: PetscSolver.H:95
void * m_ctx
Definition: PetscSolver.H:217
int solve_mfree_private(T &a_phi, const T &a_rhs, LinearOp< T > *a_op)
Definition: PetscSolverI.H:547
new code
Definition: BoxLayoutData.H:170
Mat m_mat
Definition: PetscSolver.H:216
void setOptionsPrefix(const char prefix[])
Definition: PetscSolver.H:124
Vec m_bb
Definition: PetscSolver.H:219
LevelData< FluxBox > * m_lamb
Definition: PetscSolver.H:331
PetscErrorCode(* m_function)(SNES, Vec, Vec, void *)
Definition: PetscSolver.H:224
double Real
Definition: REAL.H:33
LevelData< BaseFab< PetscInt > > m_gids
Definition: PetscSolver.H:240
void setInitialGuessNonzero(bool b=true)
Definition: PetscSolver.H:116
Real m_beta
Definition: PetscSolver.H:302
virtual int getNNZPerRow() const
Definition: PetscSolver.H:144
Real normInfinity(const T &a_phi) const
Definition: PetscSolverI.H:810
PetscSolver()
Definition: PetscSolverI.H:26
T m_phi_mfree
Definition: PetscSolver.H:96
virtual void define(LinearOp< T > *a_op, bool a_homogeneous=true)
Definition: PetscSolver.H:294
bool m_nz_init_guess
Definition: PetscSolver.H:234
char m_prestring[32]
Definition: PetscSolver.H:232
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
static PetscErrorCode apply_mfree(Mat A, Vec x, Vec f)
Definition: PetscSolverI.H:532
Real m_dxCrse
Definition: PetscSolver.H:328
Definition: LinearSolver.H:156
Vec m_xx
Definition: PetscSolver.H:219
Definition: DataIndex.H:112
T m_Lphi_mfree
Definition: PetscSolver.H:97
int setup_solver(const T &a_phi)
Definition: PetscSolverI.H:267
PetscErrorCode putChomboInPetsc(Vec out, const T &a_phi)
Definition: PetscSolverI.H:736
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
Definition: PetscSolver.H:36
void destroy()
Definition: PetscSolverI.H:43
PetscErrorCode(* m_jacobian)(SNES, Vec, Mat *, Mat *, MatStructure *, void *)
Definition: PetscSolver.H:228
Definition: FArrayBox.H:45
KSP getKSP()
Definition: PetscSolver.H:138
SNES m_snes
Definition: PetscSolver.H:220
Definition: PetscSolver.H:289
BaseFab< Real > & getRegFab(LevelData< FArrayBox > &a_fab, const DataIndex &a_datInd)
Definition: PetscSolver.H:263
virtual void setFunctionAndJacobian(PetscErrorCode(*f)(SNES, Vec, Vec, void *), PetscErrorCode(*j)(SNES, Vec, Mat *, Mat *, MatStructure *, void *))
Definition: PetscSolver.H:54
int create_mat_vec(const T &a_phi)
Definition: PetscSolverI.H:131
PetscInt m_defined
Definition: PetscSolver.H:223
Definition: PetscSolver.H:311
const BaseFab< Real > & getRegFab(const LevelData< FArrayBox > &a_fab, const DataIndex &a_datInd) const
Definition: PetscSolver.H:269
Vec m_rr
Definition: PetscSolver.H:219
LevelData< FArrayBox > * m_a
Definition: PetscSolver.H:329
bool m_homogeneous
Definition: PetscSolver.H:166