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