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