Chombo + EB  3.0
NewGeometryShop.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 _NEWGEOMETRYSHOP_H_
12 #define _NEWGEOMETRYSHOP_H_
13 
14 #include "REAL.H"
15 #include "RealVect.H"
16 #include "Box.H"
17 #include "IntVect.H"
18 #include "EBISBox.H"
19 #include "GeometryService.H"
20 #include "GeometryShop.H"
21 #include "LSquares.H"
22 #include "BaseIF.H"
23 #include "AMRIO.H"
24 
25 #include "CutCellMoments.H"
26 
27 #include "NamespaceHeader.H"
28 ///
29 /**
30  This is the base class for the workshop algorithm.
31  It forms the interface between the shallow water workshop classes
32  and the geometryservice class. If globalDim < 3, then this code will break
33  */
35 {
36 
37 public:
38  ///
39  /**
40  Define the workshop using the local geometry description
41  */
42  NewGeometryShop(const BaseIF & a_baseIF,
43  const RealVect & a_origin,
44  const RealVect & a_vectDx,
45  const ProblemDomain & a_domain,
47  const int & a_order = GEOMETRY_ORDER,
48  const int & a_degreeP = GEOMETRY_DEGREEP,
49 #else
50  const int & a_orderPmax = GEOMETRY_ORDERPMAX,
51  const int & a_degreePmax = GEOMETRY_DEGREEPMAX,
52 #endif
53  const bool & a_useConstraints = GEOMETRY_CONSTRAINTS);
54 
55  ///
57 
58  /**
59  Return true if every cell in region is regular at the
60  refinement described by dx.
61  */
62  bool isRegular(const Box & a_region,
63  const ProblemDomain & a_domain,
64  const RealVect & a_origin,
65  const Real & a_dx) const;
66 
67  ///
68  /**
69  Return true if every cell in region is covered at the
70  refinement described by dx.
71  */
72  bool isCovered(const Box & a_region,
73  const ProblemDomain & a_domain,
74  const RealVect & a_origin,
75  const Real & a_dx) const;
76 
77 
78  virtual bool isIrregular(const Box & a_region,
79  const ProblemDomain & a_domain,
80  const RealVect & a_origin,
81  const Real & a_dx) const;
82 
83  virtual bool canGenerateMultiCells() const
84  {
85  return false;
86  }
87 
88  ///
89  /**
90  Define the internals of the input ebisRegion.
91  */
92  virtual void fillGraph(BaseFab<int> & a_regIrregCovered,
93  Vector<IrregNode> & a_nodes,
94  const Box & a_validRegion,
95  const Box & a_ghostRegion,
96  const ProblemDomain & a_domain,
97  const RealVect & a_origin,
98  const Real & a_dx) const;
99 
100  /**
101  */
102  void computeVoFInternals(Real & a_volFrac,
103  Vector<int> a_loArc[SpaceDim],
104  Vector<int> a_hiArc[SpaceDim],
105  Vector<Real> a_loAreaFrac[SpaceDim],
106  Vector<Real> a_hiAreaFrac[SpaceDim],
107  Real & a_bndryArea,
108  RealVect & a_normal,
109  RealVect & a_volCentroid,
110  RealVect & a_bndryCentroid,
111  Vector<RealVect> a_loFaceCentroid[SpaceDim],
112  Vector<RealVect> a_hiFaceCentroid[SpaceDim],
113  const IntVectSet & a_ivsIrreg,
114  const VolIndex & a_vof,
115  const ProblemDomain & a_domain,
116  const RealVect & a_origin,
117  const Real & a_dx,
118  const RealVect & a_vectDx,
119  const IntVect & a_iv) const;
120 
121  //computeVofInternals caches a_iv a m_currIv
122  void settCurrIv(const IntVect& a_iv)const;
123 
124  //fillResiduals
125 #if RECURSIVE_GEOMETRY_GENERATION == 0
126  void fillResiduals(int & a_degreeP)const;
127 #else
128  void fillResiduals(int & a_degreePmax)const;
129 #endif
130 
131  //fillVolFrac
132  Real fillVolFrac()const;
133 
134  //fill arc records the connectivitry between vofs
135  void fillArc(Vector<int> a_arc[SpaceDim],
136  const int & a_hilo,
137  const IntVectSet & a_ivsIrreg)const;
138 
139  void fillLoArc(Vector<int> a_loArc[SpaceDim],
140  const IntVectSet & a_ivsIrreg)const;
141 
142  void fillHiArc(Vector<int> a_hiArc[SpaceDim],
143  const IntVectSet & a_ivsIrreg)const;
144 
145  void fillAreaFrac(Vector<Real> a_AreaFrac[SpaceDim],
146  const int & a_hilo)const;
147  //face area:lo
148  void fillLoAreaFrac(Vector<Real> a_loAreaFrac[SpaceDim])const;
149 
150  //face area:hi
151  void fillHiAreaFrac(Vector<Real> a_hiAreaFrac[SpaceDim])const;
152 
153  //fill boundary area
154  Real fillBndryArea()const;
155 
156  //fillNormal
157  RealVect fillNormal()const;
158 
159  //fillvolCentroid:
160  RealVect fillvolCentroid()const;
161 
162  //fillbndryCentroid
164 
165  //faceCentroids
166  void fillFaceCentroid(Vector<RealVect>a_loFaceCentroid[SpaceDim],
167  const int & a_hilo)const;
168 
169  void fillLoFaceCentroid(Vector<RealVect>a_LOFaceCentroid[SpaceDim])const;
170 
171  void fillHiFaceCentroid(Vector<RealVect>a_hiFaceCentroid[SpaceDim])const;
172 
173 
174 
175  void clipComputedVal(Real & a_volFrac,
176  Vector<Real> a_loAreaFrac[SpaceDim],
177  Vector<Real> a_hiAreaFrac[SpaceDim],
178  Real & a_bndryArea,
179  RealVect & a_volCentroid,
180  RealVect & a_bndryCentroid,
181  Vector<RealVect> a_loFaceCentroid[SpaceDim],
182  Vector<RealVect> a_hiFaceCentroid[SpaceDim],
183  const IntVect & a_iv)const;
184 
185  //takes IndexTM<Real,SpaceDim> to RealVect
187 
188  //takes RealVect to IndexTM<Real,SpaceDim>
190 
191 
192  //takes IndexTM<int,SpaceDim> to IntVect
194 
195  //takes IntVect to IndexTM<int,SpaceDim>
197 
198  //converts a RealVect in physical coordinates to a RealVect in coordinates relative to a cell center
199  RealVect convert2RelativeCoord(const RealVect& a_rVect)const;
200 
201  //converts a IndexTM<Real,SpaceDim> in physical coordinates to a
202  //RealVect in coordinates relative to a cell center
204  int m_phase;
205 
206  //output residuals
207 #if RECURSIVE_GEOMETRY_GENERATION == 0
208  void outputResidual(int & type,int & a_degreeP)const;
209 #else
210  void outputResidual(int & type,int & a_degreePmax) const;
211 #endif
212  void outputGradNormal()const;
213 
214 private:
217 
218  //origin
220  //dx as both a RealVect and IndexTM
223 
224 #if RECURSIVE_GEOMETRY_GENERATION == 0
225  int m_order;
227 #else
228  int m_orderPmax;
229  int m_degreePmax;
230 #endif
232 
233  //reciprocal of product of components used for scaling face areas
235 
236  //dx^(SpaceDim-1)
238 
239  //FAB member data to store residuals
242 
243  //used by computeVofInternals
244  mutable IntVect m_currIv;
245 
247 
248  const BaseIF *m_baseIF;
249 
250 #if USING_TOP_FACE_MOMENTS
252 #else
254 #endif
255 
256  static bool s_verbose;
257 
258  /**
259  Return true if every cell in region is regular at the
260  refinement described by dx.
261  */
262  bool isRegularEveryPoint(const Box& a_region,
263  const ProblemDomain& a_domain,
264  const RealVect& a_origin,
265  const Real& a_dx) const;
266 
267  ///
268  /**
269  Return true if every cell in region is covered at the
270  refinement described by dx.
271  */
272  bool isCoveredEveryPoint(const Box& a_region,
273  const ProblemDomain& a_domain,
274  const RealVect& a_origin,
275  const Real& a_dx) const;
276 
277 
278  virtual bool isIrregularEveryPoint(const Box& a_region,
279  const ProblemDomain& a_domain,
280  const RealVect& a_origin,
281  const Real& a_dx,
282  const Real& a_originVal) const ;
283 
284  int getNumCellsClipped();
285 
286  //stuff disallowed for all the usual reasons.
288  {
289  MayDay::Abort("GeometryShop uses strong construction only");
290  }
291  NewGeometryShop(const NewGeometryShop& a_workshopin)
292  {
293  MayDay::Abort("GeometryShop disallows copy contruction");
294  }
295  void operator=(const NewGeometryShop& a_workshopin)
296  {
297  MayDay::Abort("GeometryShop disallows the assignment operator");
298  }
299 
300 };
301 #include "NamespaceFooter.H"
302 #endif
RealVect m_origin
Definition: NewGeometryShop.H:219
RealVect fillvolCentroid() const
FArrayBox m_residuals
Definition: NewGeometryShop.H:240
RealVect fillBndryCentroid() const
An irregular domain on an integer lattice.
Definition: IntVectSet.H:44
Definition: NewGeometryShop.H:34
#define GEOMETRY_ORDER
Definition: Notation.H:46
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
void fillAreaFrac(Vector< Real > a_AreaFrac[SpaceDim], const int &a_hilo) const
void fillLoAreaFrac(Vector< Real > a_loAreaFrac[SpaceDim]) const
virtual bool isIrregular(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const
static bool s_verbose
Definition: NewGeometryShop.H:256
one dimensional dynamic array
Definition: Vector.H:52
IntVect convertIndexTM2IntVect(const IndexTM< int, SpaceDim > &a_indexTm) const
Real fillBndryArea() const
bool isRegular(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const
int m_phase
Definition: NewGeometryShop.H:204
virtual bool isIrregularEveryPoint(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx, const Real &a_originVal) const
CutCellMoments< GLOBALDIM > m_cutCellMoments
Definition: NewGeometryShop.H:253
NewGeometryShop()
Definition: NewGeometryShop.H:287
RealVect convertIndexTM2RealVect(const IndexTM< Real, SpaceDim > &a_indexTm) const
RealVect m_vectDx
Definition: NewGeometryShop.H:221
const int SpaceDim
Definition: SPACE.H:39
Definition: IndexTM.H:36
IntVect m_currIv
Definition: NewGeometryShop.H:244
FArrayBox m_gradNormal
Definition: NewGeometryShop.H:241
bool m_useConstraints
Definition: NewGeometryShop.H:231
void computeVoFInternals(Real &a_volFrac, Vector< int > a_loArc[SpaceDim], Vector< int > a_hiArc[SpaceDim], Vector< Real > a_loAreaFrac[SpaceDim], Vector< Real > a_hiAreaFrac[SpaceDim], Real &a_bndryArea, RealVect &a_normal, RealVect &a_volCentroid, RealVect &a_bndryCentroid, Vector< RealVect > a_loFaceCentroid[SpaceDim], Vector< RealVect > a_hiFaceCentroid[SpaceDim], const IntVectSet &a_ivsIrreg, const VolIndex &a_vof, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx, const RealVect &a_vectDx, const IntVect &a_iv) const
Definition: BaseIF.H:30
void fillFaceCentroid(Vector< RealVect >a_loFaceCentroid[SpaceDim], const int &a_hilo) const
virtual bool canGenerateMultiCells() const
Definition: NewGeometryShop.H:83
RealVect convert2RelativeCoord(const RealVect &a_rVect) const
void fillHiFaceCentroid(Vector< RealVect >a_hiFaceCentroid[SpaceDim]) const
Real m_volScaleFactor
Definition: NewGeometryShop.H:234
bool isCovered(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const
NewGeometryShop(const NewGeometryShop &a_workshopin)
Definition: NewGeometryShop.H:291
double Real
Definition: REAL.H:33
#define GEOMETRY_DEGREEP
Definition: Notation.H:49
Definition: GeometryService.H:37
int getNumCellsClipped()
void operator=(const NewGeometryShop &a_workshopin)
Definition: NewGeometryShop.H:295
void fillLoFaceCentroid(Vector< RealVect >a_LOFaceCentroid[SpaceDim]) const
void outputResidual(int &type, int &a_degreeP) const
const BaseIF * m_baseIF
Definition: NewGeometryShop.H:248
IndexTM< Real, SpaceDim > convertRealVect2IndexTM(const RealVect &a_realVect) const
virtual void fillGraph(BaseFab< int > &a_regIrregCovered, Vector< IrregNode > &a_nodes, const Box &a_validRegion, const Box &a_ghostRegion, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const
void fillArc(Vector< int > a_arc[SpaceDim], const int &a_hilo, const IntVectSet &a_ivsIrreg) const
#define GEOMETRY_CONSTRAINTS
Definition: Notation.H:64
Real fillVolFrac() const
void settCurrIv(const IntVect &a_iv) const
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
RvgDim m_dxVect
Definition: NewGeometryShop.H:222
bool isRegularEveryPoint(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const
Real m_bndryAreaScaleFactor
Definition: NewGeometryShop.H:237
void outputGradNormal() const
ProblemDomain m_domain
Definition: NewGeometryShop.H:246
void fillLoArc(Vector< int > a_loArc[SpaceDim], const IntVectSet &a_ivsIrreg) const
void fillHiAreaFrac(Vector< Real > a_hiAreaFrac[SpaceDim]) const
RealVect fillNormal() const
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
Definition: FArrayBox.H:44
Real m_threshold
Definition: NewGeometryShop.H:216
Volume of Fluid Index.
Definition: VolIndex.H:31
void fillHiArc(Vector< int > a_hiArc[SpaceDim], const IntVectSet &a_ivsIrreg) const
bool isCoveredEveryPoint(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const
int m_numCellsClipped
Definition: NewGeometryShop.H:215
int m_degreeP
Definition: NewGeometryShop.H:226
#define GLOBALDIM
Definition: Notation.H:35
Definition: CutCellMoments.H:32
int m_order
Definition: NewGeometryShop.H:225
void clipComputedVal(Real &a_volFrac, Vector< Real > a_loAreaFrac[SpaceDim], Vector< Real > a_hiAreaFrac[SpaceDim], Real &a_bndryArea, RealVect &a_volCentroid, RealVect &a_bndryCentroid, Vector< RealVect > a_loFaceCentroid[SpaceDim], Vector< RealVect > a_hiFaceCentroid[SpaceDim], const IntVect &a_iv) const
void fillResiduals(int &a_degreeP) const
#define RECURSIVE_GEOMETRY_GENERATION
Definition: Notation.H:40
static void Abort(const char *const a_msg=m_nullString)
Print out message to cerr and exit via abort() (if serial) or MPI_Abort() (if parallel).
IndexTM< int, SpaceDim > convertIntVect2IndexTM(const IntVect &a_intVect) const