PetscSolver< T > Class Template Reference

#include <PetscSolver.H>

Inheritance diagram for PetscSolver< T >:

Inheritance graph
[legend]

List of all members.


Detailed Description

template<class T>
class PetscSolver< T >

Interface to PETSC linear solvers BC implementation hooks: addBCdiagValue (formMatrix) and addBCrhsValue (solveprivate) m_bccode should be encoded true for cells that are at the domain boundaries at formMatrix time.

Public Member Functions

 PetscSolver ()
virtual ~PetscSolver ()
void destroy ()
virtual void setHomogeneous (bool a_homogeneous)
virtual void define (Real a_dx, bool a_homogeneous=true)
virtual void define (LinearOp< T > *, bool a_homogeneous=true)
virtual void solve (T &a_phi, const T &a_rhs)
int solve_private (T &a_phi, const T &a_rhs)
virtual void solve_mfree (T &a_phi, const T &a_rhs, LinearOp< T > *a_op)
int solve_mfree_private (T &a_phi, const T &a_rhs, LinearOp< T > *a_op)
Real computeResidual ()
virtual int applyOp (T &a_phi, const T &a_rhs)
void setInitialGuessNonzero (bool b=true)
void setOptionsPrefix (const char prefix[])
virtual int getNNZPerRow () const
virtual bool supportNNZExact () const
virtual void rhsOperation (const T &a_rhs)
virtual Real addBCdiagValue (const IntVect &a_iv, const IntVect &a_jv, const T &a_rhs, DataIterator dit, const Real coeff=1)
int resetOperator ()
Real normInfinity (const T &a_phi) const
int setup_solver (const T &a_phi)
int create_mat_vec (const T &a_phi)
virtual BaseFab< Real > & getRegFab (T &a_fab, DataIterator &dit)=0
virtual const BaseFab< Real > & getRegFab (const T &a_fab, DataIterator &dit) const =0
virtual const BaseFab< Real > & getRegFab (const T &a_fab, DataIterator &dit, Box &a_box) const =0
void setNull (bool n=true)

Public Attributes

LinearOp< T > * m_op_mfree
m_phi_mfree
m_Lphi_mfree
bool m_mfree_homogeneous
bool m_homogeneous
Real m_dx

Protected Member Functions

virtual Real addBCrhsValue (const IntVect &a_iv, const T &a_phi, DataIterator dit, const Real &coeff=1)

Protected Attributes

char m_prestring [32]
bool m_null
bool m_nz_init_guess
LevelData< BaseFab< bool > > m_bccode

Constructor & Destructor Documentation

template<class T>
PetscSolver< T >::PetscSolver (  )  [inline]

template<class T>
PetscSolver< T >::~PetscSolver (  )  [inline, virtual]


Member Function Documentation

template<class T>
void PetscSolver< T >::destroy (  )  [inline]

template<class T>
virtual void PetscSolver< T >::setHomogeneous ( bool  a_homogeneous  )  [inline, virtual]

Set whether the solver uses only homogeneous boundary conditions

Implements LinearSolver< T >.

template<class T>
void PetscSolver< T >::define ( Real  a_dx,
bool  a_homogeneous = true 
) [inline, virtual]

Set Function F(u) = 0 and Jacobian dF(u)/du for nonlinear solves

Reimplemented in PetscSolverPoisson< T >.

References CH_assert, PetscSolver< T >::m_dx, and PetscSolver< T >::m_homogeneous.

Referenced by PetscSolver< T >::define(), and PetscSolverPoisson< T >::define().

template<class T>
void PetscSolver< T >::define ( LinearOp< T > *  a_operator,
bool  a_homogeneous = true 
) [inline, virtual]

Define the operator and whether it is a homogeneous solver or not. The LinearSolver does not take over ownership of this a_operator object. It does not call delete on it when the LinearSolver is deleted. It is meant to be like a late-binding reference. If you created a_operator with new, you should call delete on it after LinearSolver is deleted if you want to avoid memory leaks.

Implements LinearSolver< T >.

Reimplemented in PetscSolverPoisson< T >.

References PetscSolver< T >::define(), and LinearOp< T >::dx().

template<class T>
void PetscSolver< T >::solve ( T &  a_phi,
const T &  a_rhs 
) [inline, virtual]

template<class T>
int PetscSolver< T >::solve_private ( T &  a_phi,
const T &  a_rhs 
) [inline]

template<class T>
void PetscSolver< T >::solve_mfree ( T &  a_phi,
const T &  a_rhs,
LinearOp< T > *  a_op 
) [inline, virtual]

Solve a_op*a_phi = a_rhs using the PETSC matrix free functions The preconditioner (for which a matrix is formed) need not be the same as the actual operator.

References PetscSolver< T >::solve_mfree_private().

template<class T>
int PetscSolver< T >::solve_mfree_private ( T &  a_phi,
const T &  a_rhs,
LinearOp< T > *  a_op 
) [inline]

template<class T>
Real PetscSolver< T >::computeResidual (  )  [inline]

template<class T>
int PetscSolver< T >::applyOp ( T &  a_phi,
const T &  a_rhs 
) [inline, virtual]

template<class T>
void PetscSolver< T >::setInitialGuessNonzero ( bool  b = true  )  [inline]

set initial guess non-zero

template<class T>
void PetscSolver< T >::setOptionsPrefix ( const char  prefix[]  )  [inline]

set initial guess non-zero

template<class T>
virtual int PetscSolver< T >::getNNZPerRow (  )  const [inline, virtual]

get an estimate of the number of nnz/row for matrix allocation

Reimplemented in PetscSolverViscousTensor< T >.

Referenced by PetscSolver< T >::create_mat_vec().

template<class T>
virtual bool PetscSolver< T >::supportNNZExact (  )  const [inline, virtual]

do I support having formMatrix precompute exact NNZ/row

Referenced by PetscSolver< T >::create_mat_vec().

template<class T>
virtual void PetscSolver< T >::rhsOperation ( const T &  a_rhs  )  [inline, virtual]

template<class T>
virtual Real PetscSolver< T >::addBCdiagValue ( const IntVect a_iv,
const IntVect a_jv,
const T &  a_rhs,
DataIterator  dit,
const Real  coeff = 1 
) [inline, virtual]

handling boundary conditions, turn it into a term to be added to the diag term this function coordinates with addBCrhsValue for Dirichlet BC for Neumann BC no RHS modification is required

template<class T>
int PetscSolver< T >::resetOperator (  )  [inline]

template<class T>
Real PetscSolver< T >::normInfinity ( const T &  a_phi  )  const [inline]

Infinity norm

References norm().

template<class T>
virtual Real PetscSolver< T >::addBCrhsValue ( const IntVect a_iv,
const T &  a_phi,
DataIterator  dit,
const Real coeff = 1 
) [inline, protected, virtual]

handling boundary conditions, turn it into a term to be added to the RHS this function coordinates with addBCdiagValue for Dirichlet BC, should return a term that is to be added to RHS

Referenced by PetscSolver< T >::solve_mfree_private(), and PetscSolver< T >::solve_private().

template<class T>
int PetscSolver< T >::setup_solver ( const T &  a_phi  )  [inline]

template<class T>
int PetscSolver< T >::create_mat_vec ( const T &  a_phi  )  [inline]

template<class T>
virtual BaseFab<Real>& PetscSolver< T >::getRegFab ( T &  a_fab,
DataIterator dit 
) [pure virtual]

template<class T>
virtual const BaseFab<Real>& PetscSolver< T >::getRegFab ( const T &  a_fab,
DataIterator dit 
) const [pure virtual]

template<class T>
virtual const BaseFab<Real>& PetscSolver< T >::getRegFab ( const T &  a_fab,
DataIterator dit,
Box a_box 
) const [pure virtual]

template<class T>
void PetscSolver< T >::setNull ( bool  n = true  )  [inline]


Member Data Documentation

template<class T>
LinearOp<T>* PetscSolver< T >::m_op_mfree

template<class T>
T PetscSolver< T >::m_phi_mfree

template<class T>
T PetscSolver< T >::m_Lphi_mfree

template<class T>
bool PetscSolver< T >::m_mfree_homogeneous

template<class T>
bool PetscSolver< T >::m_homogeneous

public member data: whether or not to use inhomogeneous boundary conditions.

Referenced by PetscSolver< T >::define(), and PetscSolver< LevelData< FArrayBox > >::setHomogeneous().

template<class T>
Real PetscSolver< T >::m_dx

template<class T>
char PetscSolver< T >::m_prestring[32] [protected]

template<class T>
bool PetscSolver< T >::m_null [protected]

template<class T>
bool PetscSolver< T >::m_nz_init_guess [protected]

template<class T>
LevelData<BaseFab<bool> > PetscSolver< T >::m_bccode [protected]


The documentation for this class was generated from the following files:

Generated on Mon May 29 04:03:53 2017 for Chombo + EB by  doxygen 1.5.5