Chombo + EB  3.2
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 void setData(Vector<LevelData<EBCellFAB>* >& a_data)
95  {
96  m_dataDomain = a_data;
97  m_dataBasedDomain = true;
98  }
99 
100  ///
101  virtual void setType(Vector< RefCountedPtr<LevelData<BaseIVFAB<int> > > >& a_type)
102  {
103  m_type = a_type;
104  m_typeBased = true;
105  }
106 
107  ///
108  virtual EBAMRPoissonOp*
109  MGnewOp(const ProblemDomain& a_FineindexSpace,
110  int a_depth,
111  bool a_homoOnly = true);
112 
113  EBAMRPoissonOp* createOperator(const EBLevelGrid& a_eblgMGLevel,
114  const EBLevelGrid& a_eblgCoarMG,
115  const bool& a_hasMGObjects,
116  const bool& a_layoutChanged,
117  const RealVect& a_dxMGLevel,
118  const RealVect& a_dxCoar,
119  RefCountedPtr<EBQuadCFInterp>& a_quadCFIMGLevel,
120  const int& a_whichLevel,
121  bool a_amrop);
122  ///
123  virtual void reclaim(MGLevelOp<LevelData<EBCellFAB> >* a_reclaim);
124 
125  ///
126  virtual EBAMRPoissonOp*
127  AMRnewOp(const ProblemDomain& a_FineindexSpace);
128 
129  ///
130  virtual void AMRreclaim(EBAMRPoissonOp* a_reclaim);
131 
132  ///
133  /** Refinement ratio between this level and coarser level.
134  Returns 1 when there are no coarser AMRLevelOp objects */
135  virtual int refToFiner(const ProblemDomain& a_domain) const;
136 
137  ///
138  /**
139  testRef is the size of the coarsest domain allowed in multigrid. If testRef=2,
140  then the coarsest domain in multigrid will be 2x2(x2)
141  **/
142  static void setTestRef(int a_testRef)
143  {
144  s_testRef = a_testRef;
145  }
146 
147  static void setMaxBoxSize(int a_maxBoxSize)
148  {
149  s_maxBoxSize = a_maxBoxSize;
150  }
151 
152  static void setWhichReflux(int & a_whichReflux);
153 
154  static int getWhichReflux();
155 
156 protected:
157  static int s_testRef;
158  static int s_maxBoxSize;
159 
164 
165 
168 
170  std::vector< bool > m_hasMGObjects;
171  std::vector< bool > m_layoutChanged;
172  std::vector< std::vector<bool> > m_layoutChangedMG;
173 
182 
185 
186  static int s_whichReflux;
187 
188 private:
189 
192 
195 
198 
199  ///weak construction bad
201  {
202  MayDay::Error("invalid operator");
203  }
204 
205  //copy constructor and operator= disallowed for all the usual reasons
207  {
208  MayDay::Error("invalid operator");
209  }
210 
211  void operator=(const EBAMRPoissonOpFactory& a_opin)
212  {
213  MayDay::Error("invalid operator");
214  }
215 };
216 
217 #include "NamespaceFooter.H"
218 #endif
virtual ~EBAMRPoissonOpFactory()
static int s_whichReflux
Definition: EBAMRPoissonOpFactory.H:186
Vector< RealVect > m_dxVec
Definition: EBAMRPoissonOpFactory.H:175
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
bool m_dataBased
Definition: EBAMRPoissonOpFactory.H:191
bool m_typeBased
Definition: EBAMRPoissonOpFactory.H:197
RefCountedPtr< BaseEBBCFactory > m_ebBCFactory
Definition: EBAMRPoissonOpFactory.H:184
Real m_alpha
Definition: EBAMRPoissonOpFactory.H:177
Vector< RefCountedPtr< LevelData< BaseIVFAB< int > > > > m_type
Definition: EBAMRPoissonOpFactory.H:196
Definition: EBLevelGrid.H:30
std::vector< std::vector< bool > > m_layoutChangedMG
Definition: EBAMRPoissonOpFactory.H:172
virtual EBAMRPoissonOp * MGnewOp(const ProblemDomain &a_FineindexSpace, int a_depth, bool a_homoOnly=true)
static int s_maxBoxSize
Definition: EBAMRPoissonOpFactory.H:158
EBAMRPoissonOpFactory(const EBAMRPoissonOpFactory &a_opin)
Definition: EBAMRPoissonOpFactory.H:206
Vector< LevelData< EBCellFAB > *> m_dataDomain
Definition: EBAMRPoissonOpFactory.H:193
EBAMRPoissonOpFactory()
weak construction bad
Definition: EBAMRPoissonOpFactory.H:200
virtual int refToFiner(const ProblemDomain &a_domain) const
static void setWhichReflux(int &a_whichReflux)
Definition: EBAMRPoissonOp.H:76
virtual void setData(Vector< RefCountedPtr< LevelData< BaseIVFAB< Real > > > > &a_data)
Definition: EBAMRPoissonOpFactory.H:87
bool m_dataBasedDomain
Definition: EBAMRPoissonOpFactory.H:194
static void setTestRef(int a_testRef)
Definition: EBAMRPoissonOpFactory.H:142
new code
Definition: BoxLayoutData.H:170
Vector< Vector< EBLevelGrid > > m_eblgVecMG
Definition: EBAMRPoissonOpFactory.H:169
void operator=(const EBAMRPoissonOpFactory &a_opin)
Definition: EBAMRPoissonOpFactory.H:211
virtual void setData(Vector< LevelData< EBCellFAB > * > &a_data)
Definition: EBAMRPoissonOpFactory.H:94
double Real
Definition: REAL.H:33
Definition: MultiGrid.H:30
const IntVect m_ghostCellsRHS
Definition: EBAMRPoissonOpFactory.H:181
int m_relaxType
Definition: EBAMRPoissonOpFactory.H:162
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:157
Real m_beta
Definition: EBAMRPoissonOpFactory.H:178
RealVect m_origin
Definition: EBAMRPoissonOpFactory.H:176
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
const IntVect m_ghostCellsPhi
Definition: EBAMRPoissonOpFactory.H:180
std::vector< bool > m_layoutChanged
Definition: EBAMRPoissonOpFactory.H:171
RefCountedPtr< BaseDomainBCFactory > m_domainBCFactory
Definition: EBAMRPoissonOpFactory.H:183
Definition: EBAMRPoissonOpFactory.H:45
std::vector< bool > m_hasMGObjects
Definition: EBAMRPoissonOpFactory.H:170
bool m_isDefined
Definition: EBAMRPoissonOpFactory.H:160
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
static void setMaxBoxSize(int a_maxBoxSize)
Definition: EBAMRPoissonOpFactory.H:147
Vector< RefCountedPtr< EBQuadCFInterp > > m_quadCFIVec
Definition: EBAMRPoissonOpFactory.H:167
Vector< EBLevelGrid > m_eblgVec
Definition: EBAMRPoissonOpFactory.H:166
static int getWhichReflux()
Real m_time
Definition: EBAMRPoissonOpFactory.H:179
Definition: AMRMultiGrid.H:233
int m_numPreCondIters
Definition: EBAMRPoissonOpFactory.H:161
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:174
Vector< RefCountedPtr< LevelData< BaseIVFAB< Real > > > > m_data
Definition: EBAMRPoissonOpFactory.H:190
virtual void setType(Vector< RefCountedPtr< LevelData< BaseIVFAB< int > > > > &a_type)
Definition: EBAMRPoissonOpFactory.H:101
virtual void reclaim(MGLevelOp< LevelData< EBCellFAB > > *a_reclaim)
int m_numLevels
Definition: EBAMRPoissonOpFactory.H:163