Chombo + EB  3.0
EBAMRPoissonOpFactory.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 _EBAMRPOISSONOPFACTORY_H_
12 #define _EBAMRPOISSONOPFACTORY_H_
13 
14 #include "REAL.H"
15 #include "Box.H"
16 #include "FArrayBox.H"
17 #include "Vector.H"
18 #include <map>
19 #include "RefCountedPtr.H"
20 
21 #include "AMRMultiGrid.H"
22 
23 #include "EBIndexSpace.H"
24 #include "EBCellFAB.H"
25 #include "EBCellFactory.H"
26 
27 #include "EBLevelDataOps.H"
28 #include "BaseEBBC.H"
29 #include "BaseDomainBC.H"
30 #include "CFIVS.H"
31 #include "EBFluxRegister.H"
32 #include "EBMGAverage.H"
33 #include "EBMGInterp.H"
34 #include "EBCoarsen.H"
35 #include "PolyGeom.H"
36 #include "EBAMRPoissonOp.H"
37 #include "EBLevelGrid.H"
38 #include "NamespaceHeader.H"
39 
40 
41 ///
42 /**
43  Factory class to generate EBAMRPoissonOps. This follows the AMRLevelOpFactory interface.
44 */
45 class EBAMRPoissonOpFactory: public AMRLevelOpFactory<LevelData<EBCellFAB> >
46 {
47 public:
48  ///
49  virtual ~EBAMRPoissonOpFactory();
50 
51  ///
52  /**
53  a_eblgs : layouts at each AMR level \\
54  a_domainFactory : domain boundary conditions \\
55  a_ebBCFactory: eb boundary conditions \\
56  a_dxCoarse: grid spacing at coarsest level \\
57  a_origin: offset to lowest corner of the domain \\
58  a_refRatio: refinement ratios. refRatio[i] is between levels i and i+1 \\
59  a_preCondIters: number of iterations to do for pre-conditioning \\
60  a_relaxType: 0 means point Jacobi, 1 is Gauss-Seidel, 2 is line solver. \\
61  a_alpha: coefficent of identity \\
62  a_beta: coefficient of laplacian.\\
63  a_time: time for boundary conditions \\
64  a_ghostCellsPhi: Number of ghost cells in phi, correction (typically one)\\
65  a_ghostCellsRhs: Number of ghost cells in RHS, residual, lphi (typically zero)\\
66  Ghost cell arguments are there for caching reasons. Once you set them, an error is thrown if
67  you send in data that does not match. Use numlevels = -1 if you want to use the
68  size of the vectors for numlevels.
69  */
71  const Vector<int>& a_refRatio,
72  const Vector<RefCountedPtr<EBQuadCFInterp> >& a_quadCFI,
73  const RealVect& a_dxCoarse,
74  const RealVect& a_origin,
75  const int& a_numPreCondIters,
76  const int& a_relaxType,
77  RefCountedPtr<BaseDomainBCFactory> a_domainBCFactory,
78  RefCountedPtr<BaseEBBCFactory> a_ebBcFactory,
79  const Real& a_alpha,
80  const Real& a_beta,
81  const Real& a_time,
82  const IntVect& a_ghostCellsPhi,
83  const IntVect& a_ghostCellsRhs,
84  int a_numLevels = -1);
85 
86  ///
87  virtual void setData(Vector< RefCountedPtr<LevelData<BaseIVFAB<Real> > > >& a_data)
88  {
89  m_data = a_data;
90  m_dataBased = true;
91  }
92 
93  ///
94  virtual EBAMRPoissonOp*
95  MGnewOp(const ProblemDomain& a_FineindexSpace,
96  int a_depth,
97  bool a_homoOnly = true);
98 
99  EBAMRPoissonOp* createOperator(const EBLevelGrid& a_eblgMGLevel,
100  const EBLevelGrid& a_eblgCoarMG,
101  const bool& a_hasMGObjects,
102  const bool& a_layoutChanged,
103  const RealVect& a_dxMGLevel,
104  const RealVect& a_dxCoar,
105  RefCountedPtr<EBQuadCFInterp>& a_quadCFIMGLevel,
106  const int& a_whichLevel,
107  bool a_amrop);
108  ///
109  virtual void reclaim(MGLevelOp<LevelData<EBCellFAB> >* a_reclaim);
110 
111  ///
112  virtual EBAMRPoissonOp*
113  AMRnewOp(const ProblemDomain& a_FineindexSpace);
114 
115  ///
116  virtual void AMRreclaim(EBAMRPoissonOp* a_reclaim);
117 
118  ///
119  /** Refinement ratio between this level and coarser level.
120  Returns 1 when there are no coarser AMRLevelOp objects */
121  virtual int refToFiner(const ProblemDomain& a_domain) const;
122 
123  ///
124  /**
125  testRef is the size of the coarsest domain allowed in multigrid. If testRef=2,
126  then the coarsest domain in multigrid will be 2x2(x2)
127  **/
128  static void setTestRef(int a_testRef)
129  {
130  s_testRef = a_testRef;
131  }
132 
133  static void setMaxBoxSize(int a_maxBoxSize)
134  {
135  s_maxBoxSize = a_maxBoxSize;
136  }
137 
138  static void setWhichReflux(int & a_whichReflux);
139 
140  static int getWhichReflux();
141 
142 protected:
143  static int s_testRef;
144  static int s_maxBoxSize;
145 
150 
151 
154 
156  std::vector< bool > m_hasMGObjects;
157  std::vector< bool > m_layoutChanged;
158  std::vector< std::vector<bool> > m_layoutChangedMG;
159 
168 
171 
172  static int s_whichReflux;
173 
174 private:
175 
178 
179  ///weak construction bad
181  {
182  MayDay::Error("invalid operator");
183  }
184 
185  //copy constructor and operator= disallowed for all the usual reasons
187  {
188  MayDay::Error("invalid operator");
189  }
190 
191  void operator=(const EBAMRPoissonOpFactory& a_opin)
192  {
193  MayDay::Error("invalid operator");
194  }
195 };
196 
197 #include "NamespaceFooter.H"
198 #endif
virtual ~EBAMRPoissonOpFactory()
static int s_whichReflux
Definition: EBAMRPoissonOpFactory.H:172
Vector< RealVect > m_dxVec
Definition: EBAMRPoissonOpFactory.H:161
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
bool m_dataBased
Definition: EBAMRPoissonOpFactory.H:177
RefCountedPtr< BaseEBBCFactory > m_ebBCFactory
Definition: EBAMRPoissonOpFactory.H:170
Real m_alpha
Definition: EBAMRPoissonOpFactory.H:163
Definition: EBLevelGrid.H:30
std::vector< std::vector< bool > > m_layoutChangedMG
Definition: EBAMRPoissonOpFactory.H:158
virtual EBAMRPoissonOp * MGnewOp(const ProblemDomain &a_FineindexSpace, int a_depth, bool a_homoOnly=true)
static int s_maxBoxSize
Definition: EBAMRPoissonOpFactory.H:144
EBAMRPoissonOpFactory(const EBAMRPoissonOpFactory &a_opin)
Definition: EBAMRPoissonOpFactory.H:186
EBAMRPoissonOpFactory()
weak construction bad
Definition: EBAMRPoissonOpFactory.H:180
virtual int refToFiner(const ProblemDomain &a_domain) const
static void setWhichReflux(int &a_whichReflux)
Definition: EBAMRPoissonOp.H:66
virtual void setData(Vector< RefCountedPtr< LevelData< BaseIVFAB< Real > > > > &a_data)
Definition: EBAMRPoissonOpFactory.H:87
static void setTestRef(int a_testRef)
Definition: EBAMRPoissonOpFactory.H:128
Definition: BoxLayoutData.H:136
Vector< Vector< EBLevelGrid > > m_eblgVecMG
Definition: EBAMRPoissonOpFactory.H:155
void operator=(const EBAMRPoissonOpFactory &a_opin)
Definition: EBAMRPoissonOpFactory.H:191
double Real
Definition: REAL.H:33
Definition: MultiGrid.H:30
const IntVect m_ghostCellsRHS
Definition: EBAMRPoissonOpFactory.H:167
int m_relaxType
Definition: EBAMRPoissonOpFactory.H:148
static void Error(const char *const a_msg=m_nullString, int m_exitCode=CH_DEFAULT_ERROR_CODE)
Print out message to cerr and exit with the specified exit code.
virtual EBAMRPoissonOp * AMRnewOp(const ProblemDomain &a_FineindexSpace)
virtual void AMRreclaim(EBAMRPoissonOp *a_reclaim)
static int s_testRef
Definition: EBAMRPoissonOpFactory.H:143
Real m_beta
Definition: EBAMRPoissonOpFactory.H:164
RealVect m_origin
Definition: EBAMRPoissonOpFactory.H:162
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
const IntVect m_ghostCellsPhi
Definition: EBAMRPoissonOpFactory.H:166
std::vector< bool > m_layoutChanged
Definition: EBAMRPoissonOpFactory.H:157
RefCountedPtr< BaseDomainBCFactory > m_domainBCFactory
Definition: EBAMRPoissonOpFactory.H:169
Definition: EBAMRPoissonOpFactory.H:45
std::vector< bool > m_hasMGObjects
Definition: EBAMRPoissonOpFactory.H:156
bool m_isDefined
Definition: EBAMRPoissonOpFactory.H:146
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
static void setMaxBoxSize(int a_maxBoxSize)
Definition: EBAMRPoissonOpFactory.H:133
Vector< RefCountedPtr< EBQuadCFInterp > > m_quadCFIVec
Definition: EBAMRPoissonOpFactory.H:153
Vector< EBLevelGrid > m_eblgVec
Definition: EBAMRPoissonOpFactory.H:152
static int getWhichReflux()
Real m_time
Definition: EBAMRPoissonOpFactory.H:165
Definition: AMRMultiGrid.H:231
int m_numPreCondIters
Definition: EBAMRPoissonOpFactory.H:147
EBAMRPoissonOp * createOperator(const EBLevelGrid &a_eblgMGLevel, const EBLevelGrid &a_eblgCoarMG, const bool &a_hasMGObjects, const bool &a_layoutChanged, const RealVect &a_dxMGLevel, const RealVect &a_dxCoar, RefCountedPtr< EBQuadCFInterp > &a_quadCFIMGLevel, const int &a_whichLevel, bool a_amrop)
Vector< int > m_refRatioVec
Definition: EBAMRPoissonOpFactory.H:160
Vector< RefCountedPtr< LevelData< BaseIVFAB< Real > > > > m_data
Definition: EBAMRPoissonOpFactory.H:176
virtual void reclaim(MGLevelOp< LevelData< EBCellFAB > > *a_reclaim)
int m_numLevels
Definition: EBAMRPoissonOpFactory.H:149