Chombo + EB + MF  3.2
AggEBPWLFillPatch.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 june 1, 2011
12 
13 #ifndef _AGGEBPWLFILLPATCH_H_
14 #define _AGGEBPWLFILLPATCH_H_
15 
16 #include "REAL.H"
17 #include "FArrayBox.H"
18 #include "LevelData.H"
19 #include "DisjointBoxLayout.H"
20 #include "EBISLayout.H"
21 #include "EBCellFAB.H"
22 #include "Interval.H"
23 #include "Stencils.H"
25 #include "AggStencil.H"
26 #include "EBIndexSpace.H"
27 #include "EBLevelGrid.H"
28 #include "NamespaceHeader.H"
29 
30 ///
31 /**
32  Fills one layer of fine level ghost cells
33  by piecewise linear interpolation
34  from the coarse level.
35 */
37 {
38 public:
39  ///
40  /**
41  Default constructor. User must subsequently call define().
42  */
44 
45  ///
46  virtual ~AggEBPWLFillPatch();
47 
48  ///
49  /**
50  Defining constructor. Constructs a valid object.
51  Equivalent to default construction followed by define().
52 
53  {\bf Arguments:}\\
54  dblFine, dblCoar: The fine and coarse layouts
55  of the data.\\
56  ebislFine, ebislCoar: The fine and coarse layouts
57  of the geometric description.\\
58  nref: The refinement ratio between the two levels. \\
59  nvar: The number of variables contained in the data
60  at each VoF.\\
61  radius: the total number of
62  ghost cells filled.
63  forceNoEBCF = true promises that the embedded boundary
64  will not cross the coarse-fine interface. This will save you
65  a lot of compute time if you are certain you are tagging all irregulkar cells.
66  */
67  AggEBPWLFillPatch(const DisjointBoxLayout& a_dblFine,
68  const DisjointBoxLayout& a_dblCoar,
69  const EBISLayout& a_ebislFine,
70  const EBISLayout& a_ebislCoar,
71  const ProblemDomain& a_domainCoar,
72  const int& a_nref,
73  const int& a_nvar,
74  const int& a_radius,
75  const IntVect& a_ghost,
76  const bool& a_forceNoEBCF = false,
77  const EBIndexSpace* const a_eb = Chombo_EBIS::instance());
78 
79 
80  /// saner interface
81  AggEBPWLFillPatch(const EBLevelGrid & a_eblgFine,
82  const EBLevelGrid & a_eblgCoar,
83  const int& a_nref,
84  const int& a_nvar,
85  const int& a_radius,
86  const IntVect& a_ghost,
87  const bool& a_forceNoEBCF = false,
88  const EBIndexSpace* const a_eb = Chombo_EBIS::instance())
89  {
91  define(a_eblgFine.getDBL(),
92  a_eblgCoar.getDBL(),
93  a_eblgFine.getEBISL(),
94  a_eblgCoar.getEBISL(),
95  a_eblgCoar.getDomain(),
96  a_nref, a_nvar, a_radius, a_ghost, a_forceNoEBCF, a_eb);
97  }
98 
99 
100  ///
101  /**
102  Defines this object. Existing information is overriden.
103 
104  {\bf Arguments:}\\
105  dblFine, dblCoar: The fine and coarse layouts
106  of the data.\\
107  ebislFine, ebislCoar: The fine and coarse layouts
108  of the geometric description.\\
109  nref: The refinement ratio between the two levels. \\
110  nvar: The number of variables contained in the data
111  at each VoF.
112  radius: the total number of
113  ghost cells filled.
114  forceNoEBCF = true promises that the embedded boundary
115  will not cross the coarse-fine interface. This will save you
116  a lot of compute time if you are certain you are tagging all irregulkar cells.
117  */
118  void define(const DisjointBoxLayout& a_dblFine,
119  const DisjointBoxLayout& a_dblCoar,
120  const EBISLayout& a_ebislFine,
121  const EBISLayout& a_ebislCoar,
122  const ProblemDomain& a_domainCoar,
123  const int& a_nref,
124  const int& a_nvar,
125  const int& a_radius,
126  const IntVect& a_ghost,
127  const bool& a_forceNoEBCF = false,
128  const EBIndexSpace* const a_eb = Chombo_EBIS::instance());
129 
130  ///
131  /**
132  Returns true if this object was created with the defining
133  constructor or if define() has been called.
134  */
135  bool isDefined() const
136  {
137  return m_isDefined;
138  }
139 
140  ///
141  /**
142  Interpolate the fine data from the coarse data
143  over the intersection
144  of the fine layout with the refined coarse layout. \\
145  {\bf Arguments:}\\
146  coarDataOld: The data over the coarse layout at coarse time old.\\
147  coarDatanew: The data over the coarse layout at coarse time new.\\
148  fineData: The data over the fine layout. \\
149  Error occurs unless coarTimeOld <= fineTime <= coarTimeNew \\
150  Fine and coarse data must
151  have the same number of variables.\\
152  variables: The variables to interpolate. Those not
153  in this range will be left alone. This range of variables
154  must be in both the coarse and fine data.
155  */
156  virtual void
157  interpolate(LevelData<EBCellFAB>& a_fineData,
158  const LevelData<EBCellFAB>& a_coarDataOld,
159  const LevelData<EBCellFAB>& a_coarDataNew,
160  const Real& a_coarTimeOld,
161  const Real& a_coarTimeNew,
162  const Real& a_fineTime,
163  const Interval& a_variables) const;
164 
165 protected:
166 
167  //internal use only functions
168 
169  virtual void
171  const DisjointBoxLayout& a_dblCoar);
172 
173  void getOffsets(const LayoutData< Vector<VolIndex> >& a_srcVoFsCoar,
174  const LayoutData<IntVectSet>& a_irregRegionsFine,
175  const LayoutData<Vector<VoFStencil> > a_loStencils[SpaceDim],
176  const LayoutData<Vector<VoFStencil> > a_hiStencils[SpaceDim],
177  const LayoutData<IntVectSet> a_coarLoInterp[SpaceDim],
178  const LayoutData<IntVectSet> a_coarHiInterp[SpaceDim],
179  const LayoutData<IntVectSet> a_coarCeInterp[SpaceDim]);
180 
181 
182  void
183  interpolateFAB(EBCellFAB& a_fine,
184  const EBCellFAB& a_coarOld,
185  const EBCellFAB& a_coarNew,
186  const Real& a_coarTimeOld,
187  const Real& a_coarTimeNew,
188  const Real& a_fineTime,
189  const DataIndex& a_datInd,
190  const Interval& a_variables) const;
191 
192  void
193  makeStencils();
194 
195  void defineSlopeHolders(const LayoutData<IntVectSet>& a_irregRegionsCoFi);
196 
197  void
198  getIVS(LayoutData<IntVectSet>& a_irregRegionsFine,
199  LayoutData<IntVectSet>& a_irregRegionsCoFi,
200  LayoutData< Vector<VolIndex> >& a_srcVoFs);
201 
202  void
203  defineAggStencils(LayoutData<Vector<VoFStencil> > a_loStencils[SpaceDim],
204  LayoutData<Vector<VoFStencil> > a_hiStencils[SpaceDim],
205  const LayoutData< Vector<VolIndex> >& a_srcVoFs);
206  void
207  getLoHiCenIVS(LayoutData<IntVectSet> a_coarLoInterp[SpaceDim],
208  LayoutData<IntVectSet> a_coarHiInterp[SpaceDim],
209  LayoutData<IntVectSet> a_coarCeInterp[SpaceDim]);
210 
211  void
212  getSten(LayoutData<Vector<VoFStencil> > a_loStencils[SpaceDim],
213  LayoutData<Vector<VoFStencil> > a_hiStencils[SpaceDim],
214  LayoutData<IntVectSet> a_coarLoInterp[SpaceDim],
215  LayoutData<IntVectSet> a_coarHiInterp[SpaceDim],
216  LayoutData<IntVectSet> a_coarCeInterp[SpaceDim],
217  const LayoutData< Vector<VolIndex> >& a_srcVoFs);
218 
219  void getSlopes(const EBCellFAB& a_coarDataOld,
220  const EBCellFAB& a_coarDataNew,
221  const DataIndex& a_dit,
222  const Interval& a_variables) const;
223 
224  void deltaMinMod(Real& a_slope, Real& a_slopeLo, Real& a_slopeHi) const;
225 
226  void setDefaultValues();
227 
228  struct
229  {
230  size_t offset;
231  int dataID;
232  } typedef access_t;
233 
234  struct
235  {
236  access_t dest_access; //offsets for fine data
237  int slop_index; //index into vector of slope offsetsf
240  } typedef fine_logic_t;
241 
242  struct
243  {
244  access_t slop_access; //offsets for slope data
245  access_t data_access; //offsets for coarsened fine data
246  bool has_lo[SpaceDim]; //whether there is a lo slope stencil
247  bool has_hi[SpaceDim]; //whether there is a hi slope stencil
248  bool ivs_lo[SpaceDim]; //whether inside ivs centered
249  bool ivs_hi[SpaceDim]; //whether inside ivs centered
250  bool ivs_ce[SpaceDim]; //whether inside ivs centered
251  } typedef coar_logic_t;
252 
253  //data to provide fast access to fine points and their associated slopes
255  //data so we can do the wacky delta minmod thing fast.
257 
260 
261  //non-EB fill patch
263 
264  //ghost cells in solution
266  //domain at the coarse levle
268  //layouts
274 
275 
278 
279  int m_refRat;
280  int m_nComp;
281  int m_radius;
283 
284  //building this pig for speed only. this is scratch data for slopes
291 
294 
295 private:
296  //disallowed for all the usual reasons. No code specified because Jeff says that is better.
297  AggEBPWLFillPatch(const AggEBPWLFillPatch& ebcin);
298 
299  void operator=(const AggEBPWLFillPatch& fabin);
300 
301 };
302 
303 #include "NamespaceFooter.H"
304 #endif
void getLoHiCenIVS(LayoutData< IntVectSet > a_coarLoInterp[SpaceDim], LayoutData< IntVectSet > a_coarHiInterp[SpaceDim], LayoutData< IntVectSet > a_coarCeInterp[SpaceDim])
access_t data_access
Definition: AggEBPWLFillPatch.H:245
IntVect m_ghost
Definition: AggEBPWLFillPatch.H:265
EBISLayout getEBISL() const
Definition: EBLevelGrid.H:93
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
Definition: EBIndexSpace.H:50
virtual ~AggEBPWLFillPatch()
Fills ghost cells by linear interpolation in space and time.
Definition: PiecewiseLinearFillPatch.H:128
DisjointBoxLayout m_coarGrids
Definition: AggEBPWLFillPatch.H:271
LayoutData< Vector< fine_logic_t > > m_fineOffsets
Definition: AggEBPWLFillPatch.H:254
IntVect fineiv
Definition: AggEBPWLFillPatch.H:239
Data that maintains a one-to-one mapping of T to the boxes in a BoxLayout.
Definition: BoxLayout.H:26
const ProblemDomain & getDomain() const
Definition: EBLevelGrid.H:132
int m_nComp
Definition: AggEBPWLFillPatch.H:280
size_t offset
Definition: AggEBPWLFillPatch.H:230
LayoutData< BaseIVFAB< Real > > m_slopeLoNew[SpaceDim]
Definition: AggEBPWLFillPatch.H:288
LayoutData< BaseIVFAB< Real > > m_slopeHiNew[SpaceDim]
Definition: AggEBPWLFillPatch.H:289
Definition: AggEBPWLFillPatch.H:234
Definition: AggEBPWLFillPatch.H:36
Definition: EBLevelGrid.H:30
void getSten(LayoutData< Vector< VoFStencil > > a_loStencils[SpaceDim], LayoutData< Vector< VoFStencil > > a_hiStencils[SpaceDim], LayoutData< IntVectSet > a_coarLoInterp[SpaceDim], LayoutData< IntVectSet > a_coarHiInterp[SpaceDim], LayoutData< IntVectSet > a_coarCeInterp[SpaceDim], const LayoutData< Vector< VolIndex > > &a_srcVoFs)
DisjointBoxLayout getDBL() const
Definition: EBLevelGrid.H:86
void defineAggStencils(LayoutData< Vector< VoFStencil > > a_loStencils[SpaceDim], LayoutData< Vector< VoFStencil > > a_hiStencils[SpaceDim], const LayoutData< Vector< VolIndex > > &a_srcVoFs)
ProblemDomain m_coarDomain
Definition: AggEBPWLFillPatch.H:267
bool m_forceNoEBCF
Definition: AggEBPWLFillPatch.H:258
DisjointBoxLayout m_coarsenedFineGrids
Definition: AggEBPWLFillPatch.H:269
EBISLayout m_coarsenedFineEBISL
Definition: AggEBPWLFillPatch.H:272
virtual void definePieceWiseLinearFillPatch(const DisjointBoxLayout &a_dblfine, const DisjointBoxLayout &a_dblCoar)
LayoutData< BaseIVFAB< Real > > m_slopeCeOld[SpaceDim]
Definition: AggEBPWLFillPatch.H:287
LevelData< EBCellFAB > m_coarOnFDataOld
Definition: AggEBPWLFillPatch.H:276
const int SpaceDim
Definition: SPACE.H:38
bool m_isDefined
Definition: AggEBPWLFillPatch.H:259
LayoutData< RefCountedPtr< AggStencil< EBCellFAB, BaseIVFAB< Real > > > > m_stenHi[SpaceDim]
Definition: AggEBPWLFillPatch.H:293
int dataID
Definition: AggEBPWLFillPatch.H:231
static EBIndexSpace * instance()
void defineSlopeHolders(const LayoutData< IntVectSet > &a_irregRegionsCoFi)
PiecewiseLinearFillPatch * m_patcher
Definition: AggEBPWLFillPatch.H:262
bool isDefined() const
Definition: AggEBPWLFillPatch.H:135
Structure for passing component ranges in code.
Definition: Interval.H:23
IntVect coariv
Definition: AggEBPWLFillPatch.H:238
Definition: EBCellFAB.H:29
double Real
Definition: REAL.H:33
void deltaMinMod(Real &a_slope, Real &a_slopeLo, Real &a_slopeHi) const
LayoutData< Vector< coar_logic_t > > m_coarOffsets
Definition: AggEBPWLFillPatch.H:256
LevelData< EBCellFAB > m_coarOnFDataNew
Definition: AggEBPWLFillPatch.H:277
void getIVS(LayoutData< IntVectSet > &a_irregRegionsFine, LayoutData< IntVectSet > &a_irregRegionsCoFi, LayoutData< Vector< VolIndex > > &a_srcVoFs)
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
access_t slop_access
Definition: AggEBPWLFillPatch.H:244
void interpolateFAB(EBCellFAB &a_fine, const EBCellFAB &a_coarOld, const EBCellFAB &a_coarNew, const Real &a_coarTimeOld, const Real &a_coarTimeNew, const Real &a_fineTime, const DataIndex &a_datInd, const Interval &a_variables) const
Definition: DataIndex.H:114
access_t dest_access
Definition: AggEBPWLFillPatch.H:236
void getSlopes(const EBCellFAB &a_coarDataOld, const EBCellFAB &a_coarDataNew, const DataIndex &a_dit, const Interval &a_variables) const
Definition: AggEBPWLFillPatch.H:242
AggEBPWLFillPatch(const EBLevelGrid &a_eblgFine, const EBLevelGrid &a_eblgCoar, const int &a_nref, const int &a_nvar, const int &a_radius, const IntVect &a_ghost, const bool &a_forceNoEBCF=false, const EBIndexSpace *const a_eb=Chombo_EBIS::instance())
saner interface
Definition: AggEBPWLFillPatch.H:81
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
LayoutData< BaseIVFAB< Real > > m_slopeCeNew[SpaceDim]
Definition: AggEBPWLFillPatch.H:290
LayoutData< RefCountedPtr< AggStencil< EBCellFAB, BaseIVFAB< Real > > > > m_stenLo[SpaceDim]
Definition: AggEBPWLFillPatch.H:292
EBISLayout m_fineEBISL
Definition: AggEBPWLFillPatch.H:273
Definition: AggEBPWLFillPatch.H:228
int m_refRat
Definition: AggEBPWLFillPatch.H:279
DisjointBoxLayout m_fineGrids
Definition: AggEBPWLFillPatch.H:270
Definition: EBISLayout.H:39
LayoutData< BaseIVFAB< Real > > m_slopeHiOld[SpaceDim]
Definition: AggEBPWLFillPatch.H:286
int slop_index
Definition: AggEBPWLFillPatch.H:237
void operator=(const AggEBPWLFillPatch &fabin)
void getOffsets(const LayoutData< Vector< VolIndex > > &a_srcVoFsCoar, const LayoutData< IntVectSet > &a_irregRegionsFine, const LayoutData< Vector< VoFStencil > > a_loStencils[SpaceDim], const LayoutData< Vector< VoFStencil > > a_hiStencils[SpaceDim], const LayoutData< IntVectSet > a_coarLoInterp[SpaceDim], const LayoutData< IntVectSet > a_coarHiInterp[SpaceDim], const LayoutData< IntVectSet > a_coarCeInterp[SpaceDim])
int m_coarGhostRad
Definition: AggEBPWLFillPatch.H:282
virtual void interpolate(LevelData< EBCellFAB > &a_fineData, const LevelData< EBCellFAB > &a_coarDataOld, const LevelData< EBCellFAB > &a_coarDataNew, const Real &a_coarTimeOld, const Real &a_coarTimeNew, const Real &a_fineTime, const Interval &a_variables) const
int m_radius
Definition: AggEBPWLFillPatch.H:281
LayoutData< BaseIVFAB< Real > > m_slopeLoOld[SpaceDim]
Definition: AggEBPWLFillPatch.H:285
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 int &a_radius, const IntVect &a_ghost, const bool &a_forceNoEBCF=false, const EBIndexSpace *const a_eb=Chombo_EBIS::instance())