chombo-discharge
CD_EBGhostCellInterpolator.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2023 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_EBGhostCellInterpolator_H
13 #define CD_EBGhostCellInterpolator_H
14 
15 // Std includes
16 #include <map>
17 
18 // Chombo includes
19 #include <EBLevelGrid.H>
20 
21 // Our includes
22 #include <CD_Location.H>
23 #include <CD_NamespaceHeader.H>
24 
32 {
33 public:
37  enum Type
38  {
39  PWC,
40  MinMod,
41  MonotonizedCentral,
42  Superbee
43  };
44 
48  EBGhostCellInterpolator() noexcept;
49 
54 
65  EBGhostCellInterpolator(const EBLevelGrid& a_eblgFine,
66  const EBLevelGrid& a_eblgCoFi,
67  const EBLevelGrid& a_eblgCoar,
68  const IntVect& a_ghostVector,
69  const int a_refRat,
70  const int a_ghostCF) noexcept;
71 
75  virtual ~EBGhostCellInterpolator() noexcept;
76 
87  virtual void
88  define(const EBLevelGrid& a_eblgFine,
89  const EBLevelGrid& a_eblgCoFi,
90  const EBLevelGrid& a_eblgCoar,
91  const IntVect& a_ghostVector,
92  const int a_refRat,
93  const int a_ghostCF) noexcept;
94 
102  virtual void
103  interpolate(LevelData<EBCellFAB>& a_phiFine,
104  const LevelData<EBCellFAB>& a_phiCoar,
105  const Interval a_variables,
106  const Type a_interpType) const noexcept;
107 
108 protected:
113 
117  EBLevelGrid m_eblgFine;
118 
122  EBLevelGrid m_eblgCoar;
123 
127  EBLevelGrid m_eblgCoFi;
128 
132  IntVect m_ghostVector;
133 
137  int m_refRat;
138 
144 
148  LayoutData<std::map<std::pair<int, Side::LoHiSide>, Box>> m_regularGhostRegions;
149 
153  Copier m_copier;
154 
160  LayoutData<BaseIVFAB<VolIndex>> m_coarsenedFineGhosts;
161 
165  mutable LayoutData<VoFIterator> m_fineIrregCells;
166 
170  mutable LayoutData<VoFIterator> m_coarIrregCells;
171 
176  mutable LayoutData<BaseIVFAB<Real>> m_coarIrregSlopes;
177 
181  virtual void
182  defineGhostRegions() noexcept;
183 
187  virtual void
188  defineBuffers() noexcept;
189 
199  virtual void
200  interpolateRegular(FArrayBox& a_phiFine,
201  const FArrayBox& a_phiCoar,
202  const DataIndex& a_dit,
203  const int a_fineVar,
204  const int a_coarVar,
205  const Type a_interpType) const noexcept;
206 
216  virtual void
217  interpolateIrregular(EBCellFAB& a_phiFine,
218  const EBCellFAB& a_phiCoar,
219  const DataIndex& a_dit,
220  const int a_fineVar,
221  const int a_coarVar,
222  const Type a_interpType) const noexcept;
223 
229  inline Real
230  minmod(const Real& dwl, const Real& dwr) const noexcept;
231 
237  inline Real
238  superbee(const Real& dwl, const Real& dwr) const noexcept;
239 
245  inline Real
246  monotonizedCentral(const Real& dwl, const Real& dwr) const noexcept;
247 };
248 
249 #include <CD_NamespaceFooter.H>
250 
251 #endif
Declaration of cell positions.
Class which can interpolate ghost cells across the coarse-fine interface. To select an interpolation ...
Definition: CD_EBGhostCellInterpolator.H:32
virtual void interpolateRegular(FArrayBox &a_phiFine, const FArrayBox &a_phiCoar, const DataIndex &a_dit, const int a_fineVar, const int a_coarVar, const Type a_interpType) const noexcept
Regular interpolation, as if the EB was not there.
Definition: CD_EBGhostCellInterpolator.cpp:216
LayoutData< std::map< std::pair< int, Side::LoHiSide >, Box > > m_regularGhostRegions
Regular ghost regions to be interpolated.
Definition: CD_EBGhostCellInterpolator.H:148
Real superbee(const Real &dwl, const Real &dwr) const noexcept
Superbee slope limiter.
Definition: CD_EBGhostCellInterpolator.cpp:479
EBGhostCellInterpolator() noexcept
Weak constructor. Need to call define afterwards.
Definition: CD_EBGhostCellInterpolator.cpp:24
LayoutData< VoFIterator > m_coarIrregCells
Coarse-grid cells on the caorse-side of the interface that are irregular cells.
Definition: CD_EBGhostCellInterpolator.H:170
virtual void defineBuffers() noexcept
Define buffers.
Definition: CD_EBGhostCellInterpolator.cpp:161
IntVect m_ghostVector
Minimum number of ghost cells in input data.
Definition: CD_EBGhostCellInterpolator.H:132
virtual void define(const EBLevelGrid &a_eblgFine, const EBLevelGrid &a_eblgCoFi, const EBLevelGrid &a_eblgCoar, const IntVect &a_ghostVector, const int a_refRat, const int a_ghostCF) noexcept
Define method. Puts object in usable state.
Definition: CD_EBGhostCellInterpolator.cpp:49
Real minmod(const Real &dwl, const Real &dwr) const noexcept
minmod slope function.
Definition: CD_EBGhostCellInterpolator.cpp:467
Copier m_copier
Copier for making copying from m_eblgCoar to m_grownCoarData go faster.
Definition: CD_EBGhostCellInterpolator.H:153
virtual void defineGhostRegions() noexcept
Define ghost regions to be interpolated.
Definition: CD_EBGhostCellInterpolator.cpp:75
bool m_isDefined
Is defined or not.
Definition: CD_EBGhostCellInterpolator.H:112
virtual void interpolateIrregular(EBCellFAB &a_phiFine, const EBCellFAB &a_phiCoar, const DataIndex &a_dit, const int a_fineVar, const int a_coarVar, const Type a_interpType) const noexcept
Ghost cell interpolation near the EB, correcting slopes that broke in interpolateRegular.
Definition: CD_EBGhostCellInterpolator.cpp:344
LayoutData< BaseIVFAB< VolIndex > > m_coarsenedFineGhosts
List of coarse-grid cells that appear through coarsening a fine-grid ghost cell.
Definition: CD_EBGhostCellInterpolator.H:160
EBLevelGrid m_eblgFine
Fine grids.
Definition: CD_EBGhostCellInterpolator.H:117
LayoutData< VoFIterator > m_fineIrregCells
Fine-grid ghost cells on the coarse-fine interface that overlap an irregular coarse cell.
Definition: CD_EBGhostCellInterpolator.H:165
EBLevelGrid m_eblgCoar
Coarse grids.
Definition: CD_EBGhostCellInterpolator.H:122
EBLevelGrid m_eblgCoFi
Coarsened fine grids.
Definition: CD_EBGhostCellInterpolator.H:127
Real monotonizedCentral(const Real &dwl, const Real &dwr) const noexcept
Monotonized central difference slope limiter.
Definition: CD_EBGhostCellInterpolator.cpp:496
virtual void interpolate(LevelData< EBCellFAB > &a_phiFine, const LevelData< EBCellFAB > &a_phiCoar, const Interval a_variables, const Type a_interpType) const noexcept
Do inhomogeneous interpolation.
Definition: CD_EBGhostCellInterpolator.cpp:169
int m_refRat
Refinement factor between fine and coarse level.
Definition: CD_EBGhostCellInterpolator.H:137
Type
Type of interpolation slopes supported.
Definition: CD_EBGhostCellInterpolator.H:38
LayoutData< BaseIVFAB< Real > > m_coarIrregSlopes
Buffer data defined on the coarsened fine grids (over m_coarIrregCells). Used for holding slopes in t...
Definition: CD_EBGhostCellInterpolator.H:176
int m_ghostCF
Number of ghost cells to fill across coarse-fine interface.
Definition: CD_EBGhostCellInterpolator.H:143