Chombo + EB + MF  3.2
PetscCompGridVTO.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _PETSCCOMPGRIDVTO_H_
12 #define _PETSCCOMPGRIDVTO_H_
13 #include "PetscCompGrid.H"
14 #include "NamespaceHeader.H"
15 
16 //! \class PetscCompGridVTO
17 //! This base class organizes the construction of a PETSc matrix,
18 //! and solve with an AMR
20 {
21 public:
22 
23  //! Destructor.
25  {
26 #ifdef CH_USE_PETSC
27  clean();
28 #endif
29  }
30 
31 #ifdef CH_USE_PETSC
32  //! Base class constructor. Called by all subclass constructors.
33  PetscCompGridVTO(Real a_al=0., Real a_beta=1.0) :
34  PetscCompGrid(CH_SPACEDIM), m_alpha(a_al), m_beta(a_beta)
35  {
36  }
37  virtual void clean();
38 
39  void defineCoefs( Real a_alpha, Real a_beta,
43  {
44  m_alpha = a_alpha;
45  m_beta = a_beta;
46  m_a = a_a;
47  m_eta = a_mu;
48  m_lamb = a_lambda;
49  }
50 
51  virtual IntVect getGhostVect()const
52  {
53  return IntVect::Unit;
54  }
55  Real getAlpha()const{return m_alpha;}
56  Real getBeta()const{return m_beta;}
57  void setAlpha(Real a_b) {m_alpha = a_b;}
58  void setBeta(Real a_b) {m_beta = a_b;}
59 protected:
60  virtual void createOpStencil(IntVect,int,const DataIndex&,StencilTensor&);
61  virtual void applyBCs(IntVect,int,const DataIndex&,Box,StencilTensor &);
64  //coefficient storage.
68 #endif // ifdef petsc
69 };
70 
71 class CompGridVTOBC : public CompBC
72 {
73 public:
74  CompGridVTOBC(int a_nSource=1, IntVect a_nGhosts=IntVect::Unit) : CompBC(a_nSource,a_nGhosts)
75  {
76  for (int comp=0; comp<SpaceDim; comp++)
77  {
78  m_bcDiri[0][0][comp] = true;
79  m_bcDiri[0][1][comp] = true;
80  m_bcDiri[1][0][comp] = true;
81  m_bcDiri[1][1][comp] = true;
82  }
83  }
84  // destructor
85  virtual ~CompGridVTOBC()
86  {
87  }
88 
89 
90  void setDiri(int dir, int side, int comp, bool a_diri = true) {m_bcDiri[dir][side][comp] = a_diri;}
91  bool isDiri(int dir, int side, int comp) { return m_bcDiri[dir][side][comp]; }
92  virtual void createCoefs();
93  virtual void operator()( FArrayBox& a_state,
94  const Box& a_valid,
95  const ProblemDomain& a_domain,
96  Real a_dx,
97  bool a_homogeneous);
98 
99  virtual void operator()( FArrayBox& a_state,
100  const Box& a_valid,
101  const ProblemDomain& a_domain,
102  Real a_dx,
103  const DataIndex& a_index,
104  bool a_homogeneous)
105  {
106  operator()(a_state, a_valid, a_domain, a_dx, a_homogeneous);
107  }
108 
109 
110  bool m_bcDiri[CH_SPACEDIM][2][CH_SPACEDIM]; // dim, side, Comp: false = Neumann, true: Diri
111 };
112 
113 #include "NamespaceFooter.H"
114 #endif
Definition: PetscCompGrid.H:148
void setAlpha(Real a_b)
Definition: PetscCompGridVTO.H:57
A reference-counting handle class.
Definition: RefCountedPtr.H:173
PetscCompGridVTO(Real a_al=0., Real a_beta=1.0)
Base class constructor. Called by all subclass constructors.
Definition: PetscCompGridVTO.H:33
#define CH_SPACEDIM
Definition: SPACE.H:51
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
virtual ~PetscCompGridVTO()
Destructor.
Definition: PetscCompGridVTO.H:24
Vector< RefCountedPtr< LevelData< FluxBox > > > m_eta
Definition: PetscCompGridVTO.H:65
one dimensional dynamic array
Definition: Vector.H:53
Real m_beta
Definition: PetscCompGridVTO.H:63
std::map< IndexML, StencilTensorValue > StencilTensor
Definition: Stencil.H:137
const int SpaceDim
Definition: SPACE.H:38
Real getBeta() const
Definition: PetscCompGridVTO.H:56
static const IntVect Unit
Definition: IntVect.H:663
bool isDiri(int dir, int side, int comp)
Definition: PetscCompGridVTO.H:91
Definition: PetscCompGrid.H:30
void defineCoefs(Real a_alpha, Real a_beta, Vector< RefCountedPtr< LevelData< FluxBox > > > &a_mu, Vector< RefCountedPtr< LevelData< FluxBox > > > &a_lambda, Vector< RefCountedPtr< LevelData< FArrayBox > > > &a_a)
Definition: PetscCompGridVTO.H:39
Real getAlpha() const
Definition: PetscCompGridVTO.H:55
double Real
Definition: REAL.H:33
Vector< RefCountedPtr< LevelData< FluxBox > > > m_lamb
Definition: PetscCompGridVTO.H:66
void setDiri(int dir, int side, int comp, bool a_diri=true)
Definition: PetscCompGridVTO.H:90
virtual void createOpStencil(IntVect, int, const DataIndex &, StencilTensor &)
Definition: PetscCompGridVTO.H:71
virtual void clean()
virtual void applyBCs(IntVect, int, const DataIndex &, Box, StencilTensor &)
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
Definition: PetscCompGridVTO.H:19
Definition: DataIndex.H:114
void setBeta(Real a_b)
Definition: PetscCompGridVTO.H:58
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
Definition: FArrayBox.H:45
virtual ~CompGridVTOBC()
Definition: PetscCompGridVTO.H:85
CompGridVTOBC(int a_nSource=1, IntVect a_nGhosts=IntVect::Unit)
Definition: PetscCompGridVTO.H:74
virtual IntVect getGhostVect() const
Definition: PetscCompGridVTO.H:51
Real m_alpha
Definition: PetscCompGridVTO.H:62
Vector< RefCountedPtr< LevelData< FArrayBox > > > m_a
Definition: PetscCompGridVTO.H:67
virtual void operator()(FArrayBox &a_state, const Box &a_valid, const ProblemDomain &a_domain, Real a_dx, const DataIndex &a_index, bool a_homogeneous)
Definition: PetscCompGridVTO.H:99