Chombo + EB  3.0
EBQuadCFInterp.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 // dtgraves fri, sept 14, 2001
12 // mfbarad made it eb aware in June, 2005
13 // and on and on...
14 
15 #ifndef _EBQUADCFINTERP_H_
16 #define _EBQUADCFINTERP_H_
17 
18 #include "REAL.H"
19 #include "FArrayBox.H"
20 #include "LevelData.H"
21 #include "DisjointBoxLayout.H"
22 #include "EBIndexSpace.H"
23 #include "EBISLayout.H"
24 #include "EBCellFAB.H"
25 #include "Interval.H"
26 #include "Stencils.H"
27 #include "QuadCFInterp.H"
28 #include "BaseIVFAB.H"
29 #include "CornerCopier.H"
30 #include "VoFIterator.H"
31 #include "EBCFData.H"
32 #include "NamespaceHeader.H"
33 
34 ///
35 /**
36  Fills one layer of fine level ghost cells
37  by piecewise linear interpolation
38  from the coarse level.
39  */
41 {
42 public:
43  ///
44  /**
45  Default constructor. User must subsequently call define().
46  */
48 
49  ///
50  virtual ~EBQuadCFInterp();
51 
52  ///
53  /**
54  Defining constructor. Constructs a valid object.
55  Equivalent to default construction followed by define().
56 
57  {\bf Arguments:}\\
58  dblFine, dblCoar: The fine and coarse layouts
59  of the data. \\
60  ebislFine, ebislCoar: The fine and coarse layouts
61  of the geometric description.\\
62  nref: The refinement ratio between the two levels. \\
63  nvar: The number of variables contained in the data
64  at each VoF. \\
65  Set doEBCFCrossing=false if you are sure that tall
66  irregular cells are on the finest grid.
67  */
68  EBQuadCFInterp(const DisjointBoxLayout& a_dblFine,
69  const DisjointBoxLayout& a_dblCoar,
70  const EBISLayout& a_ebislFine,
71  const EBISLayout& a_ebislCoar,
72  const ProblemDomain& a_domainCoar,
73  const int& a_nref,
74  const int& a_nvar,
75  const LayoutData<IntVectSet>& a_cfivs,
76  const EBIndexSpace* const a_ebisPtr = Chombo_EBIS::instance(),
77  bool a_doEBCFCrossing = true);
78 
79  ///
80  /**
81  Defines this object. Existing information is overriden.
82 
83  {\bf Arguments:}\\
84  dblFine, dblCoar: The fine and coarse layouts
85  of the data.\\
86  ebislFine, ebislCoar: The fine and coarse layouts
87  of the geometric description.\\
88  nref: The refinement ratio between the two levels. \\
89  nvar: The number of variables contained in the data
90  at each VoF. \\
91  Set doEBCFCrossing=false if you are sure that tall
92  irregular cells are on the finest grid.
93  */
94  void define(const DisjointBoxLayout& a_dblFine,
95  const DisjointBoxLayout& a_dblCoar,
96  const EBISLayout& a_ebislFine,
97  const EBISLayout& a_ebislCoar,
98  const ProblemDomain& a_domainCoar,
99  const int& a_nref,
100  const int& a_nvar,
101  const LayoutData<IntVectSet>& a_cfivs,
102  const EBIndexSpace* const a_ebisPtr = Chombo_EBIS::instance(),
103  bool a_doEBCFCrossing = true);
104 
105 
106  ///
107  /**
108  Interpolate the fine data from the coarse data
109  over the intersection
110  of the fine layout with the refined coarse layout. \\
111  {\bf Arguments:}\\
112  coarDataOld: The data over the coarse layout.\\
113  fineData: The data over the fine layout. \\
114  Fine and coarse data must
115  have the same number of variables.\\
116  variables: The variables to interpolate. Those not
117  in this range will be left alone. This range of variables
118  must be in both the coarse and fine data.
119  {\bf This routine assumes that coarse data that lives under finer
120  grids has been coarsened from the finer data to O(h^3). If embedded boundaries
121  cross coarse fine boundaries and this is not the case, O(1) errors will happen}
122  */
123  void
124  interpolate(LevelData<EBCellFAB>& a_fineData,
125  const LevelData<EBCellFAB>& a_coarData,
126  const Interval& a_variables,
127  bool a_doOnlyRegularInterp = false);
128 
129  bool isDefined() const;
130 
131  ///
132  /**
133  Use the stencils to actually do EB aware interpolation
134  */
135  void interpEBCFCrossing(LevelData<EBCellFAB>& a_fineData,
136  const LevelData<EBCellFAB>& a_coarData,
137  const Interval& a_variables);
138 
139  ///
140  /**
141  Use the corner-stencils to actually do EB aware interpolation
142  Use coarse value when stencil is empty.
143  */
144  void interpEBCFCorners(LevelData<EBCellFAB>& a_fineData,
145  const LevelData<EBCellFAB>& a_coarData,
146  const Interval& a_variables);
147 
148  //need this because ebtensorcfi needs it
150  {return m_ebcfdata;}
151 
152 protected:
153 
154  ///
155  /**
156  Builds the IntVectSets for where we need to do
157  EB aware CF interpolation.
158  Returns a bool that indicates if we need to do EB aware CF interp
159  */
160  bool getEBCFIVS(const LayoutData<IntVectSet>& a_cfivs);
161 
162  ///
163  /**
164  Builds a stencil for each vof that needs an
165  EB aware CF interpolation
166  */
167  void buildEBCFStencils();
168 
169  ///
170  /**
171  Builds a stencil for each corner-vof that needs an
172  EB aware CF interpolation
173  */
174  void buildEBCFCornerStencils(const LayoutData<IntVectSet>& a_cfivs);
175 
176 
177 
179 
180 
182 
185 
186  //These are the stencils that interpolate with phistar to get ghost val
187  //phiStar is indexed at the same point as the ghost phi
188  //(UNLIKE in regular, non eb quadcfinterp) but lives between
189  //coarse cell centers (just like in non-eb quadcfinterp)
194 
195  //fine index space fine layout
198 
199  // Copier object to handle corner cells
201 
203  int m_refRat;
207 private:
208 
209  //disallowed for all the usual reasons
211  {
212  MayDay::Error("ebqcfi 2 invalid operator");
213  }
214  void operator=(const EBQuadCFInterp& fabin)
215  {
216  MayDay::Error("ebqcfi 3 invalid operator");
217  }
218 };
219 
220 #include "NamespaceFooter.H"
221 #endif
static IntVect s_ivDebCoar
Definition: EBQuadCFInterp.H:205
LayoutData< BaseIVFAB< VoFStencil > > m_coarStencilHi[SpaceDim]
Definition: EBQuadCFInterp.H:184
CornerCopier m_cornerCopier
Definition: EBQuadCFInterp.H:200
LayoutData< BaseIVFAB< VoFStencil > > m_coarStencilLo[SpaceDim]
Definition: EBQuadCFInterp.H:183
LayoutData< BaseIVFAB< VoFStencil > > m_stencilCorners
Definition: EBQuadCFInterp.H:192
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
Definition: EBIndexSpace.H:260
virtual ~EBQuadCFInterp()
LayoutData< IntVectSet > m_ebcfivsHi[SpaceDim]
Definition: EBQuadCFInterp.H:197
void define(const DisjointBoxLayout &a_dblFine, const DisjointBoxLayout &a_dblCoar, const EBISLayout &a_ebislFine, const EBISLayout &a_ebislCoar, const ProblemDomain &a_domainCoar, const int &a_nref, const int &a_nvar, const LayoutData< IntVectSet > &a_cfivs, const EBIndexSpace *const a_ebisPtr=Chombo_EBIS::instance(), bool a_doEBCFCrossing=true)
bool isDefined() const
LayoutData< BaseIVFAB< VoFStencil > > m_fineStencilLo[SpaceDim]
Definition: EBQuadCFInterp.H:190
LayoutData< IntVectSet > m_ebcfivsLo[SpaceDim]
Definition: EBQuadCFInterp.H:196
void operator=(const EBQuadCFInterp &fabin)
Definition: EBQuadCFInterp.H:214
LevelData< EBCellFAB > m_ebBufferCoarsenedFine
Definition: EBQuadCFInterp.H:181
void interpolate(LevelData< EBCellFAB > &a_fineData, const LevelData< EBCellFAB > &a_coarData, const Interval &a_variables, bool a_doOnlyRegularInterp=false)
const int SpaceDim
Definition: SPACE.H:39
void interpEBCFCrossing(LevelData< EBCellFAB > &a_fineData, const LevelData< EBCellFAB > &a_coarData, const Interval &a_variables)
static EBIndexSpace * instance()
RefCountedPtr< EBCFData > m_ebcfdata
Definition: EBQuadCFInterp.H:178
bool m_doEBCFCrossing
Definition: EBQuadCFInterp.H:202
LayoutData< BaseIVFAB< VoFStencil > > m_stencilEdges
Definition: EBQuadCFInterp.H:193
Structure for passing component ranges in code.
Definition: Interval.H:23
static IntVect s_ivDebFine
Definition: EBQuadCFInterp.H:204
int m_refRat
Definition: EBQuadCFInterp.H:203
void interpEBCFCorners(LevelData< EBCellFAB > &a_fineData, const LevelData< EBCellFAB > &a_coarData, const Interval &a_variables)
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:31
Definition: EBQuadCFInterp.H:40
void buildEBCFCornerStencils(const LayoutData< IntVectSet > &a_cfivs)
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.
void buildEBCFStencils()
ProblemDomain m_domainCoar
Definition: EBQuadCFInterp.H:206
ProblemDomain m_domainFine
Definition: EBQuadCFInterp.H:206
LayoutData< BaseIVFAB< VoFStencil > > m_fineStencilHi[SpaceDim]
Definition: EBQuadCFInterp.H:191
bool getEBCFIVS(const LayoutData< IntVectSet > &a_cfivs)
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
An even stranger (than Copier) thing to copy from ghost cells to corner ghost cells.
Definition: CornerCopier.H:31
RefCountedPtr< EBCFData > getEBCFData() const
Definition: EBQuadCFInterp.H:149
Definition: EBISLayout.H:39
EBQuadCFInterp(const EBQuadCFInterp &ebcin)
Definition: EBQuadCFInterp.H:210
Quadratic coarse-fine interpolation utility.
Definition: QuadCFInterp.H:36