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 );
86 virtual void solve( T& a_phi,
const T& a_rhs );
130 virtual int applyOp(T & a_phi,
const T & a_rhs );
151 KSPSetOptionsPrefix(
m_ksp,prefix);
247 #if PETSC_VERSION_GE(3,5,0) 248 PetscErrorCode (*
m_jacobian)(SNES,Vec,Mat,Mat,
void*);
250 PetscErrorCode (*
m_jacobian)(SNES,Vec,Mat*,Mat*,MatStructure*,
void*);
266 virtual int formMatrix( Mat,
const T* =0, PetscInt my0=0, PetscInt nloc=0, PetscInt *d=0, PetscInt *o=0) = 0;
300 a_box = fabref.
box();
315 virtual void define(
Real a_dx,
bool a_homogeneous =
true );
367 #include "NamespaceFooter.H" 370 #ifndef CH_EXPLICIT_TEMPLATES 372 #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:202
KSP m_ksp
Definition: PetscSolver.H:243
LevelData< FluxBox > * m_eta
Definition: PetscSolver.H:353
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:350
PetscInt m_gid0
Definition: PetscSolver.H:263
virtual void rhsOperation(const T &a_rhs)
Definition: PetscSolver.H:181
Definition: PetscSolver.H:278
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:342
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:230
const BaseFab< Real > & getRegFab(const LevelData< FArrayBox > &a_fab, const DataIndex &a_datInd, Box &a_box) const
Definition: PetscSolver.H:297
void define(Real alpha, Real beta, LevelData< FArrayBox > *a, LevelData< FluxBox > *eta, LevelData< FluxBox > *lam)
Definition: PetscSolver.H:356
virtual int applyOp(T &a_phi, const T &a_rhs)
Definition: PetscSolverI.H:826
int resetOperator()
Definition: PetscSolver.H:207
virtual ~PetscSolver()
Definition: PetscSolverI.H:74
virtual BaseFab< Real > & getRegFab(T &a_fab, const DataIndex &a_datInd)=0
Real m_dx
Definition: PetscSolver.H:194
virtual bool supportNNZExact() const
Definition: PetscSolver.H:173
bool m_null
Definition: PetscSolver.H:255
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:113
Real computeResidual()
Definition: PetscSolverI.H:782
PetscSolverFAB()
Definition: PetscSolver.H:281
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:257
Real m_alpha
Definition: PetscSolver.H:323
LinearOp< T > * m_op_mfree
Definition: PetscSolver.H:110
void * m_ctx
Definition: PetscSolver.H:239
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:238
void setOptionsPrefix(const char prefix[])
Definition: PetscSolver.H:146
Vec m_bb
Definition: PetscSolver.H:241
LevelData< FluxBox > * m_lamb
Definition: PetscSolver.H:354
PetscErrorCode(* m_function)(SNES, Vec, Vec, void *)
Definition: PetscSolver.H:246
double Real
Definition: REAL.H:33
LevelData< BaseFab< PetscInt > > m_gids
Definition: PetscSolver.H:262
void setInitialGuessNonzero(bool b=true)
Definition: PetscSolver.H:138
Real m_beta
Definition: PetscSolver.H:324
virtual int getNNZPerRow() const
Definition: PetscSolver.H:166
Real normInfinity(const T &a_phi) const
Definition: PetscSolverI.H:810
PetscSolver()
Definition: PetscSolverI.H:26
T m_phi_mfree
Definition: PetscSolver.H:111
virtual void define(LinearOp< T > *a_op, bool a_homogeneous=true)
Definition: PetscSolver.H:316
bool m_nz_init_guess
Definition: PetscSolver.H:256
char m_prestring[32]
Definition: PetscSolver.H:254
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
static PetscErrorCode apply_mfree(Mat A, Vec x, Vec f)
Definition: PetscSolverI.H:532
Real m_dxCrse
Definition: PetscSolver.H:351
Definition: LinearSolver.H:156
Vec m_xx
Definition: PetscSolver.H:241
Definition: DataIndex.H:114
T m_Lphi_mfree
Definition: PetscSolver.H:112
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:250
Definition: FArrayBox.H:45
KSP getKSP()
Definition: PetscSolver.H:160
SNES m_snes
Definition: PetscSolver.H:242
Definition: PetscSolver.H:311
BaseFab< Real > & getRegFab(LevelData< FArrayBox > &a_fab, const DataIndex &a_datInd)
Definition: PetscSolver.H:285
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:245
Definition: PetscSolver.H:334
const BaseFab< Real > & getRegFab(const LevelData< FArrayBox > &a_fab, const DataIndex &a_datInd) const
Definition: PetscSolver.H:291
Vec m_rr
Definition: PetscSolver.H:241
LevelData< FArrayBox > * m_a
Definition: PetscSolver.H:352
bool m_homogeneous
Definition: PetscSolver.H:188