Chombo + EB + MF  3.2
MFPoissonOpFactory.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 _MFPOISSONOPFACTORY_H_
12 #define _MFPOISSONOPFACTORY_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 "BaseBCValue.H"
31 #include "CFIVS.H"
32 #include "EBFluxRegister.H"
33 #include "EBMGAverage.H"
34 #include "EBMGInterp.H"
35 #include "EBCoarsen.H"
36 #include "PolyGeom.H"
37 #include "MFPoissonOp.H"
38 #include "EBLevelGrid.H"
39 #include "NamespaceHeader.H"
40 
41 
42 ///
43 /**
44  Factory class to generate MFPoissonOps. This follows the AMRLevelOpFactory interface.
45 */
46 class MFPoissonOpFactory: public AMRLevelOpFactory<LevelData<MFCellFAB> >
47 {
48 public:
49  ///
50  virtual ~MFPoissonOpFactory();
51 
52  ///
53  /**
54  a_dilbos : layouts at each AMR level \\
55  a_domainFactory : domain boundary conditions \\
56  a_ebBCFactory: eb boundary conditions \\
57  a_dxCoarse: grid spacing at coarsest level \\
58  a_origin: offset to lowest corner of the domain \\
59  a_refRatio: refinement ratios. refRatio[i] is between levels i and i+1 \\
60  a_preCondIters: number of iterations to do for pre-conditioning \\
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<DisjointBoxLayout>& a_dilbos,
72  const Vector<int>& a_refRatio,
73  const ProblemDomain& a_domainCoar,
74  const RealVect& a_dxCoarse,
75  const RealVect& a_origin,
76  const Vector<RefCountedPtr<BaseDomainBC> >& a_bc,
77  const Vector<Real>& a_alpha,
78  const Vector<Real>& a_beta,
79  const int& a_ncomp,
80  const IntVect& a_ghostCellsPhi,
81  const IntVect& a_ghostCellsRHS,
82  int a_numLevels = -1);
83 
84  ///
85  void setJump(const Real& a_gD,
86  const Real& a_gN);
87 
88  ///
89  void setJump(const RealVect& a_gD,
90  const RealVect& a_gN);
91 
92  ///
93  void setJump(const Vector< RefCountedPtr<BaseBCValue> >& a_phiValVect,
94  const Vector< RefCountedPtr<BaseBCValue> >& a_flxValVect);
95 
96  ///
98  MGnewOp(const ProblemDomain& a_FineindexSpace,
99  int a_depth,
100  bool a_homoOnly = true);
101 
102  MFPoissonOp* createOperator(const DisjointBoxLayout& a_dilboMGLevel,
103  const DisjointBoxLayout& a_dilboCoarMG,
104  const ProblemDomain& a_domainMGLevel,
105  const bool& a_hasMGObjects,
106  const bool& a_layoutChanged,
107  const RealVect& a_dxMGLevel,
108  const RealVect& a_dxCoar,
109  const int& a_whichLevel,
110  const int& a_mgLevel);
111  ///
112  virtual void reclaim(MGLevelOp<LevelData<EBCellFAB> >* a_reclaim);
113 
114  ///
116  AMRnewOp(const ProblemDomain& a_FineindexSpace);
117 
118  ///
119  virtual void AMRreclaim(MFPoissonOp* a_reclaim);
120 
121  ///
122  /** Refinement ratio between this level and coarser level.
123  Returns 1 when there are no coarser AMRLevelOp objects */
124  virtual int refToFiner(const ProblemDomain& a_domain) const;
125 
126  ///
127  /**
128  testRef is the size of the coarsest domain allowed in multigrid. If testRef=2,
129  then the coarsest domain in multigrid will be 2x2(x2)
130  **/
131  static void setTestRef(int a_testRef)
132  {
133  s_testRef = a_testRef;
134  }
135 
136  ///
137  /**
138  **/
139  static void setRelaxType(int a_relaxType)
140  {
141  s_relaxType = a_relaxType;
142  }
143 
144 protected:
145  static int s_testRef, s_relaxType;
146 
150  int m_ncomp;
151 
157  std::vector<bool> m_hasMGObjects;
158  std::vector<bool> m_layoutChanged;
159  std::vector< std::vector<bool> > m_layoutChangedMG;
171 
172 private:
173  ///weak construction bad
175  {
176  MayDay::Error("invalid operator");
177  }
178 
179  //copy constructor and operator= disallowed for all the usual reasons
181  {
182  MayDay::Error("invalid operator");
183  }
184 
185  void operator=(const MFPoissonOpFactory& a_opin)
186  {
187  MayDay::Error("invalid operator");
188  }
189 };
190 
191 #include "NamespaceFooter.H"
192 #endif
Definition: MFPoissonOpFactory.H:46
virtual AMRLevelOp< LevelData< MFCellFAB > > * AMRnewOp(const ProblemDomain &a_FineindexSpace)
int m_numLevels
Definition: MFPoissonOpFactory.H:149
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
Vector< RealVect > m_dxVec
Definition: MFPoissonOpFactory.H:161
virtual void AMRreclaim(MFPoissonOp *a_reclaim)
Multifluid poisson operator – computes (alpha + div(Beta Grad))
Definition: MFPoissonOp.H:37
void setJump(const Real &a_gD, const Real &a_gN)
Vector< RefCountedPtr< BaseDomainBC > > m_bc
Definition: MFPoissonOpFactory.H:170
std::vector< std::vector< bool > > m_layoutChangedMG
Definition: MFPoissonOpFactory.H:159
bool m_isScalarJump
Definition: MFPoissonOpFactory.H:148
Vector< RefCountedPtr< BaseBCValue > > m_flxValVect
Definition: MFPoissonOpFactory.H:169
Vector< Vector< ProblemDomain > > m_domainVecMG
Definition: MFPoissonOpFactory.H:156
RealVect m_vectorGD
Definition: MFPoissonOpFactory.H:168
Definition: AMRMultiGrid.H:39
RealVect m_origin
Definition: MFPoissonOpFactory.H:162
static int s_relaxType
Definition: MFPoissonOpFactory.H:145
static int s_testRef
Definition: MFPoissonOpFactory.H:145
void operator=(const MFPoissonOpFactory &a_opin)
Definition: MFPoissonOpFactory.H:185
virtual MGLevelOp< LevelData< MFCellFAB > > * MGnewOp(const ProblemDomain &a_FineindexSpace, int a_depth, bool a_homoOnly=true)
RealVect m_vectorGN
Definition: MFPoissonOpFactory.H:168
static void setTestRef(int a_testRef)
Definition: MFPoissonOpFactory.H:131
bool m_isDefined
Definition: MFPoissonOpFactory.H:147
const IntVect m_ghostCellsRHS
Definition: MFPoissonOpFactory.H:166
double Real
Definition: REAL.H:33
Definition: MultiGrid.H:30
bool m_analyticJump
Definition: MFPoissonOpFactory.H:148
Vector< int > m_refRatioVec
Definition: MFPoissonOpFactory.H:160
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
MFPoissonOpFactory(const MFPoissonOpFactory &a_opin)
Definition: MFPoissonOpFactory.H:180
virtual int refToFiner(const ProblemDomain &a_domain) const
virtual void reclaim(MGLevelOp< LevelData< EBCellFAB > > *a_reclaim)
std::vector< bool > m_layoutChanged
Definition: MFPoissonOpFactory.H:158
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.
MFPoissonOpFactory()
weak construction bad
Definition: MFPoissonOpFactory.H:174
RefCountedPtr< MFIndexSpace > m_mfis
Definition: MFPoissonOpFactory.H:152
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
std::vector< bool > m_hasMGObjects
Definition: MFPoissonOpFactory.H:157
Vector< Real > m_beta
Definition: MFPoissonOpFactory.H:164
static void setRelaxType(int a_relaxType)
Definition: MFPoissonOpFactory.H:139
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
Vector< Real > m_alpha
Definition: MFPoissonOpFactory.H:163
int m_ncomp
Definition: MFPoissonOpFactory.H:150
virtual ~MFPoissonOpFactory()
MFPoissonOp * createOperator(const DisjointBoxLayout &a_dilboMGLevel, const DisjointBoxLayout &a_dilboCoarMG, const ProblemDomain &a_domainMGLevel, const bool &a_hasMGObjects, const bool &a_layoutChanged, const RealVect &a_dxMGLevel, const RealVect &a_dxCoar, const int &a_whichLevel, const int &a_mgLevel)
Vector< ProblemDomain > m_domainVec
Definition: MFPoissonOpFactory.H:154
Vector< RefCountedPtr< BaseBCValue > > m_phiValVect
Definition: MFPoissonOpFactory.H:169
Vector< DisjointBoxLayout > m_dilboVec
Definition: MFPoissonOpFactory.H:153
Definition: AMRMultiGrid.H:233
Real m_scalarGD
Definition: MFPoissonOpFactory.H:167
const IntVect m_ghostCellsPhi
Definition: MFPoissonOpFactory.H:165
Real m_scalarGN
Definition: MFPoissonOpFactory.H:167
Vector< Vector< DisjointBoxLayout > > m_dilboVecMG
Definition: MFPoissonOpFactory.H:155