Chombo + EB  3.2
EBAMRTestCommon.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 _EBAMRTESTCOMMON_H_
12 #define _EBAMRTESTCOMMON_H_
13 
14 #include "IntVect.H"
15 #include "IntVectSet.H"
16 #include "Box.H"
17 #include "DisjointBoxLayout.H"
18 #include "ParmParse.H"
19 #include "EBIndexSpace.H"
20 #include "EBISLayout.H"
21 #include "BoxIterator.H"
22 #include "ParmParse.H"
23 #include "BRMeshRefine.H"
24 #include "LoadBalance.H"
25 #include "GeometryShop.H"
26 #include "PolyGeom.H"
27 #include "LevelData.H"
28 #include "EBCellFAB.H"
29 #include "EBCellFactory.H"
30 #include "VoFIterator.H"
31 #include "EBArith.H"
32 #include "AllRegularService.H"
33 #include "PlaneIF.H"
34 #include "SphereIF.H"
35 #include "MultiSphereIF.H"
36 #include "EBTensorCFInterp.H"
37 #include "EBAMRIO.H"
38 #include "EBLevelGrid.H"
39 
40 #include "NamespaceHeader.H"
41 /**********/
42 ///
43 /**
44  */
46 {
47 public:
48  ///
49  /**
50  */
51  virtual void veloVal(Real a_vel[SpaceDim], const RealVect& a_point) = 0;
52 
53  ///
54  /**
55  */
56  virtual void gradVal(Real a_grad[SpaceDim*SpaceDim], const RealVect& a_point) = 0;
57 
59  {;}
60 
61  virtual ~BaseAnalytic()
62  {;}
63 };
64 
65 ///
66 /**
67  */
69 {
70 public:
71  ///
72  /**
73  */
74  virtual void veloVal(Real a_vel[SpaceDim], const RealVect& a_point)
75  {
76  for (int idir = 0; idir < SpaceDim; idir++)
77  {
78  a_vel[idir] = 0;
79  for (int jdir = 0; jdir < SpaceDim; jdir++)
80  {
81  a_vel[idir] += m_coeff[jdir]*a_point[jdir];
82  }
83  }
84  }
85 
86  ///
87  /**
88  */
89  virtual void gradVal(Real a_grad[SpaceDim*SpaceDim], const RealVect& a_point)
90  {
91  for (int idir = 0; idir < SpaceDim; idir++)
92  {
93  for (int jdir = 0; jdir < SpaceDim; jdir++)
94  {
95  int iindex = TensorCFInterp::gradIndex(idir, jdir);
96  a_grad[iindex] = m_coeff[jdir];
97  }
98  }
99 
100  }
102  {
103  for (int idir = 0; idir < SpaceDim; idir++)
104  {
105  m_coeff[idir] = Real(idir + 1);
106  }
107  }
108  virtual ~LinearAnalytic()
109  {;}
110 
112 };
113 
114 ///
115 /**
116  */
118 {
119 public:
120  ///
121  /**
122  */
123  virtual void veloVal(Real a_vel[SpaceDim], const RealVect& a_point)
124  {
125  for (int idir = 0; idir < SpaceDim; idir++)
126  {
127  for (int jdir = 0; jdir < SpaceDim; jdir++)
128  {
129  a_vel[idir] = m_coeff[jdir];
130  }
131  }
132  }
133 
134  ///
135  /**
136  */
137  virtual void gradVal(Real a_grad[SpaceDim*SpaceDim], const RealVect& a_point)
138  {
139  for (int ivar = 0; ivar < SpaceDim; ivar++)
140  {
141  for (int jdir = 0; jdir < SpaceDim; jdir++)
142  {
143  int iindex = TensorCFInterp::gradIndex(ivar, jdir);
144  a_grad[iindex] = 0.;
145  }
146  }
147 
148  }
150  {
151  for (int idir = 0; idir < SpaceDim; idir++)
152  {
153  m_coeff[idir] = Real(idir + 1);
154  }
155  }
156  virtual ~ConstAnalytic()
157  {;}
158 
160 };
161 
162 
163 ///
164 /**
165  */
167 {
168 public:
169  ///
170  /**
171  */
172  virtual void veloVal(Real a_vel[SpaceDim], const RealVect& a_point)
173  {
174  for (int ivar = 0; ivar < SpaceDim; ivar++)
175  {
176  a_vel[ivar] = 0;
177  for (int jdir = 0; jdir < SpaceDim; jdir++)
178  {
179  a_vel[ivar] += m_coeff[jdir]*a_point[jdir]*a_point[jdir];
180  }
181  }
182  }
183 
184  ///
185  /**
186  */
187  virtual void gradVal(Real a_grad[SpaceDim*SpaceDim], const RealVect& a_point)
188  {
189  for (int ivar = 0; ivar < SpaceDim; ivar++)
190  {
191  for (int jdir = 0; jdir < SpaceDim; jdir++)
192  {
193  int iindex = TensorCFInterp::gradIndex(ivar, jdir);
194  a_grad[iindex] = 2.*m_coeff[jdir]*a_point[jdir];
195  }
196  }
197 
198  }
199 
200  ///
201  /**
202  */
204  {
205  for (int ivar = 0; ivar < SpaceDim; ivar++)
206  {
207  m_coeff[ivar] = Real(ivar + 1);
208  }
209  }
210  virtual ~QuadAnalytic()
211  {;}
212 
214 };
215 /**********/
217 {
218 public:
219  ///
220  /**
221  */
222  virtual void veloVal(Real a_vel[SpaceDim], const RealVect& a_point)
223  {
224  for (int ivar = 0; ivar < SpaceDim; ivar++)
225  {
226  for (int jdir = 0; jdir < SpaceDim; jdir++)
227  {
228  a_vel[ivar] += m_coeff[jdir]*a_point[jdir]*a_point[jdir]*a_point[jdir];
229  }
230  }
231  }
232 
233  ///
234  /**
235  */
236  virtual void gradVal(Real a_grad[SpaceDim*SpaceDim], const RealVect& a_point)
237  {
238  for (int ivar = 0; ivar < SpaceDim; ivar++)
239  {
240  for (int jdir = 0; jdir < SpaceDim; jdir++)
241  {
242  int iindex = TensorCFInterp::gradIndex(ivar, jdir);
243  a_grad[iindex] = 3.*m_coeff[jdir]*a_point[jdir]*a_point[jdir];
244  }
245  }
246 
247  }
248 
250  {
251  for (int ivar = 0; ivar < SpaceDim; ivar++)
252  {
253  m_coeff[ivar] = Real(ivar + 1);
254  }
255  }
256  virtual ~CubeAnalytic()
257  {;}
258 
260 };
261 
262 ///
263 /**
264  */
266 {
267 public:
268  ///
269  /**
270  */
271  static int compareError(const LevelData<EBCellFAB>& a_errorFine,
272  const EBISLayout& a_ebislFine,
273  const DisjointBoxLayout& a_gridsFine,
274  const Box& a_domainFine,
275  const LevelData<EBCellFAB>& a_errorCoar,
276  const EBISLayout& a_ebislCoar,
277  const DisjointBoxLayout& a_gridsCoar,
278  const Box& a_domainCoar);
279 
280  ///
281  /**
282  */
283  static int makeEBISL(EBISLayout& a_ebisl,
284  const DisjointBoxLayout& a_grids,
285  const Box& a_domain,
286  const int& a_nghost);
287 
288  ///
289  /**
290  */
291  static int
292  makeHalfLayouts(DisjointBoxLayout& a_gridsFine,
293  EBISLayout& a_ebislFine,
294  DisjointBoxLayout& a_gridsCoar,
295  EBISLayout& a_ebislCoar,
296  const Box& a_domainFine,
297  const Box& a_domainCoar,
298  int a_refrat, int a_halfDir);
299 
300  ///
301  /**
302  */
303  static int makeGeometry(Box& a_domain,
304  RealVect& a_dx);
305 
306  ///
307  /**
308  */
309  static int
310  checkForZero(const LevelData<EBCellFAB>& a_errorVelo,
311  const DisjointBoxLayout& a_gridsFine,
312  const EBISLayout& a_ebislFine,
313  const Box& a_domainFine,
314  string a_funcname);
315 
316 
317  ///
318  /**
319  */
320  static void
321  outputError(const LevelData<EBCellFAB>& a_errorFine,
322  const LevelData<EBCellFAB>& a_errorCoar,
323  const DisjointBoxLayout& a_gridsFine,
324  const DisjointBoxLayout& a_gridsCoar,
325  const Box& a_domainFine,
326  const Box& a_domainCoar,
327  const string& a_fileFine,
328  const string& a_fileCoar);
329 };
330 
331 #include "NamespaceFooter.H"
332 
333 #endif
BaseAnalytic()
Definition: EBAMRTestCommon.H:58
Definition: EBAMRTestCommon.H:166
QuadAnalytic()
Definition: EBAMRTestCommon.H:203
static int makeHalfLayouts(DisjointBoxLayout &a_gridsFine, EBISLayout &a_ebislFine, DisjointBoxLayout &a_gridsCoar, EBISLayout &a_ebislCoar, const Box &a_domainFine, const Box &a_domainCoar, int a_refrat, int a_halfDir)
RealVect m_coeff
Definition: EBAMRTestCommon.H:159
LinearAnalytic()
Definition: EBAMRTestCommon.H:101
virtual void gradVal(Real a_grad[SpaceDim *SpaceDim], const RealVect &a_point)
Definition: EBAMRTestCommon.H:89
static int makeGeometry(Box &a_domain, RealVect &a_dx)
static int gradIndex(int ivar, int gradDir)
returns component in gradient for variable ivar in direction gradDir
Definition: TensorCFInterp.H:142
virtual ~QuadAnalytic()
Definition: EBAMRTestCommon.H:210
const int SpaceDim
Definition: SPACE.H:38
static int makeEBISL(EBISLayout &a_ebisl, const DisjointBoxLayout &a_grids, const Box &a_domain, const int &a_nghost)
RealVect m_coeff
Definition: EBAMRTestCommon.H:259
static int compareError(const LevelData< EBCellFAB > &a_errorFine, const EBISLayout &a_ebislFine, const DisjointBoxLayout &a_gridsFine, const Box &a_domainFine, const LevelData< EBCellFAB > &a_errorCoar, const EBISLayout &a_ebislCoar, const DisjointBoxLayout &a_gridsCoar, const Box &a_domainCoar)
virtual void veloVal(Real a_vel[SpaceDim], const RealVect &a_point)
Definition: EBAMRTestCommon.H:172
RealVect m_coeff
Definition: EBAMRTestCommon.H:213
virtual void veloVal(Real a_vel[SpaceDim], const RealVect &a_point)
Definition: EBAMRTestCommon.H:222
Definition: EBAMRTestCommon.H:68
virtual void veloVal(Real a_vel[SpaceDim], const RealVect &a_point)
Definition: EBAMRTestCommon.H:123
virtual void gradVal(Real a_grad[SpaceDim *SpaceDim], const RealVect &a_point)
Definition: EBAMRTestCommon.H:236
Definition: EBAMRTestCommon.H:265
virtual void gradVal(Real a_grad[SpaceDim *SpaceDim], const RealVect &a_point)=0
double Real
Definition: REAL.H:33
static void outputError(const LevelData< EBCellFAB > &a_errorFine, const LevelData< EBCellFAB > &a_errorCoar, const DisjointBoxLayout &a_gridsFine, const DisjointBoxLayout &a_gridsCoar, const Box &a_domainFine, const Box &a_domainCoar, const string &a_fileFine, const string &a_fileCoar)
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
Definition: EBAMRTestCommon.H:45
virtual ~CubeAnalytic()
Definition: EBAMRTestCommon.H:256
RealVect m_coeff
Definition: EBAMRTestCommon.H:111
virtual void gradVal(Real a_grad[SpaceDim *SpaceDim], const RealVect &a_point)
Definition: EBAMRTestCommon.H:187
Definition: EBAMRTestCommon.H:117
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
virtual ~ConstAnalytic()
Definition: EBAMRTestCommon.H:156
virtual void veloVal(Real a_vel[SpaceDim], const RealVect &a_point)
Definition: EBAMRTestCommon.H:74
ConstAnalytic()
Definition: EBAMRTestCommon.H:149
virtual ~LinearAnalytic()
Definition: EBAMRTestCommon.H:108
static int checkForZero(const LevelData< EBCellFAB > &a_errorVelo, const DisjointBoxLayout &a_gridsFine, const EBISLayout &a_ebislFine, const Box &a_domainFine, string a_funcname)
Definition: EBISLayout.H:39
Definition: EBAMRTestCommon.H:216
virtual void veloVal(Real a_vel[SpaceDim], const RealVect &a_point)=0
virtual void gradVal(Real a_grad[SpaceDim *SpaceDim], const RealVect &a_point)
Definition: EBAMRTestCommon.H:137
CubeAnalytic()
Definition: EBAMRTestCommon.H:249
virtual ~BaseAnalytic()
Definition: EBAMRTestCommon.H:61