chombo-discharge
CD_EBLeastSquaresMultigridInterpolator.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2021 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_EBLeastSquaresMultigridInterpolator_H
13 #define CD_EBLeastSquaresMultigridInterpolator_H
14 
15 // Std includes
16 #include <map>
17 
18 // Chombo includes
19 #include <EBLevelGrid.H>
20 #include <QuadCFInterp.H>
21 #include <AggStencil.H>
22 
23 // Our includes
24 #include <CD_Location.H>
26 #include <CD_CoarseInterpQuadCF.H>
27 #include <CD_NamespaceHeader.H>
28 
48 {
49 public:
54 
59 
64 
77  EBLeastSquaresMultigridInterpolator(const EBLevelGrid& a_eblgFine,
78  const EBLevelGrid& a_eblgCoFi,
79  const EBLevelGrid& a_eblgCoar,
80  const CellLocation a_dataLocation,
81  const IntVect& a_ghostVector,
82  const int a_refRat,
83  const int a_ghostCF,
84  const int a_order,
85  const int a_weighting = 0) noexcept;
86 
90  virtual ~EBLeastSquaresMultigridInterpolator() noexcept;
91 
95  virtual int
96  getGhostCF() const noexcept override;
97 
104  virtual void
105  coarseFineInterp(LevelData<EBCellFAB>& a_phiFine,
106  const LevelData<EBCellFAB>& a_phiCoar,
107  const Interval a_variables) const noexcept override;
108 
114  virtual void
115  coarseFineInterpH(LevelData<EBCellFAB>& a_phiFine, const Interval a_variables) const noexcept override;
116 
126  virtual void
127  coarseFineInterpH(EBCellFAB& a_phiFine, const Interval a_variables, const DataIndex& a_dit) const noexcept override;
128 
129 protected:
133  static constexpr int m_stenComp = 0;
134 
138  static constexpr int m_numStenComp = 1;
139 
143  static constexpr int m_comp = 0;
144 
149 
153  EBLevelGrid m_eblgFine;
154 
158  EBLevelGrid m_eblgCoar;
159 
163  EBLevelGrid m_eblgCoFi;
164 
168  Copier m_copier;
169 
173  mutable LayoutData<VoFIterator> m_ghostIterFine;
174 
179 
184 
190 
194  int m_refRat;
195 
201 
205  int m_order;
206 
210  int m_weight;
211 
216  LayoutData<IntVectSet> m_ghostCells;
217 
221  LayoutData<BaseIVFAB<VoFStencil>> m_fineStencils;
222 
226  LayoutData<BaseIVFAB<VoFStencil>> m_coarStencils;
227 
234  LayoutData<RefCountedPtr<AggStencil<EBCellFAB, EBCellFAB>>> m_aggFineStencils;
235 
241  LayoutData<RefCountedPtr<AggStencil<EBCellFAB, EBCellFAB>>> m_aggCoarStencils;
242 
248  LayoutData<std::map<std::pair<int, Side::LoHiSide>, Box>> m_cfivs;
249 
253  LayoutData<CoarseInterpQuadCF> m_loCoarseInterpCF[SpaceDim];
254 
258  LayoutData<CoarseInterpQuadCF> m_hiCoarseInterpCF[SpaceDim];
259 
263  virtual void
264  defineGhostRegions() noexcept;
265 
269  virtual void
270  defineBuffers() noexcept;
271 
275  virtual void
276  defineCoarseInterp() noexcept;
277 
281  virtual void
282  defineStencilsEBCF() noexcept;
283 
287  virtual void
288  makeAggStencils() noexcept;
289 
307  virtual bool
308  getStencil(VoFStencil& a_stencilFine,
309  VoFStencil& a_stencilCoar,
310  const CellLocation& a_dataLocation,
311  const VolIndex& a_ghostVofFine,
312  const VolIndex& a_ghostVofCoar,
313  const EBISBox& a_ebisboxFine,
314  const EBISBox& a_ebisboxCoar,
315  const DenseIntVectSet& a_validFineCells,
316  const DenseIntVectSet& a_validCoarCells,
317  const Real& a_dxFine,
318  const Real& a_dxCoar,
319  const int& a_order,
320  const int& a_weight) const noexcept;
321 
329  virtual void
330  regularCoarseFineInterp(LevelData<EBCellFAB>& a_finePhi,
331  const LevelData<EBCellFAB>& a_coarPhi,
332  const int a_fineVar,
333  const int a_coarVar) const noexcept;
334 };
335 
336 #include <CD_NamespaceFooter.H>
337 
338 #endif
Supporting class for doing the coarse-side interpolation for multigrid.
Declaration of a class that can interpolate more ghost cells near the coarse-fine boundary near the E...
Declaration of cell positions.
Class for computing the required Taylor terms for doing the orthogonal extrapolation to the ghost cel...
Definition: CD_CoarseInterpQuadCF.H:33
Multigrid interpolator class.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:48
virtual void coarseFineInterpH(LevelData< EBCellFAB > &a_phiFine, const Interval a_variables) const noexcept override
Do homogeneous interpolation.
Definition: CD_EBLeastSquaresMultigridInterpolator.cpp:155
virtual void defineGhostRegions() noexcept
Define ghost cells to be filled in range m_ghostCF from each cut-cell.
Definition: CD_EBLeastSquaresMultigridInterpolator.cpp:236
static constexpr int m_numStenComp
Number of variables in stencil data layouts.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:138
Copier m_copier
Copier for making copying into m_grownCoarData go faster.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:168
virtual int getGhostCF() const noexcept override
Return number of ghost cells across CF interface.
Definition: CD_EBLeastSquaresMultigridInterpolator.cpp:87
LayoutData< RefCountedPtr< AggStencil< EBCellFAB, EBCellFAB > > > m_aggFineStencils
Fine grid interpolation stencils.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:234
EBLevelGrid m_eblgFine
Fine grids.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:153
IntVect m_ghostVectorCoFi
Number of ghost cells on the coarsened-fine grids. Needed because the fine grids need some of the coa...
Definition: CD_EBLeastSquaresMultigridInterpolator.H:189
LayoutData< std::map< std::pair< int, Side::LoHiSide >, Box > > m_cfivs
Regular coarse-fine interface boxes.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:248
EBLeastSquaresMultigridInterpolator(const EBLeastSquaresMultigridInterpolator &a_other)=delete
Disallowed copy constructor.
LayoutData< BaseIVFAB< VoFStencil > > m_coarStencils
Coarse-grid interpolation stencils.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:226
virtual void coarseFineInterp(LevelData< EBCellFAB > &a_phiFine, const LevelData< EBCellFAB > &a_phiCoar, const Interval a_variables) const noexcept override
Do inhomogeneous interpolation.
Definition: CD_EBLeastSquaresMultigridInterpolator.cpp:98
virtual void regularCoarseFineInterp(LevelData< EBCellFAB > &a_finePhi, const LevelData< EBCellFAB > &a_coarPhi, const int a_fineVar, const int a_coarVar) const noexcept
Do regular coarse-fine interpolation as if the EB is not there.
Definition: CD_EBLeastSquaresMultigridInterpolator.cpp:710
LayoutData< IntVectSet > m_ghostCells
Ghost cells that will be interpolated near the cut-cells.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:216
int m_refRat
Refinement factor between fine and coarse level.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:194
bool m_isDefined
Is defined or not.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:178
EBLevelGrid m_eblgCoFi
Coarsened fine grids.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:163
int m_order
Interpolation order.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:205
LayoutData< CoarseInterpQuadCF > m_loCoarseInterpCF[SpaceDim]
For doing the coarse-side interpolation near the AMR interface.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:253
virtual bool getStencil(VoFStencil &a_stencilFine, VoFStencil &a_stencilCoar, const CellLocation &a_dataLocation, const VolIndex &a_ghostVofFine, const VolIndex &a_ghostVofCoar, const EBISBox &a_ebisboxFine, const EBISBox &a_ebisboxCoar, const DenseIntVectSet &a_validFineCells, const DenseIntVectSet &a_validCoarCells, const Real &a_dxFine, const Real &a_dxCoar, const int &a_order, const int &a_weight) const noexcept
Build an interpolation stencil.
Definition: CD_EBLeastSquaresMultigridInterpolator.cpp:507
LayoutData< CoarseInterpQuadCF > m_hiCoarseInterpCF[SpaceDim]
For doing the coarse-side interpolation near the AMR interface.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:258
LayoutData< VoFIterator > m_ghostIterFine
Iterator over ghost cells.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:173
virtual void makeAggStencils() noexcept
Build the AggStencil objects for faster stencil aggregation.
Definition: CD_EBLeastSquaresMultigridInterpolator.cpp:662
LayoutData< BaseIVFAB< VoFStencil > > m_fineStencils
Fine-grid interpolation stencils.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:221
IntVect m_ghostVectorFine
Minimum number of ghost cells in input data.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:183
EBLeastSquaresMultigridInterpolator()=delete
Disallowed constructor.
virtual void defineStencilsEBCF() noexcept
Define stencils for interpolation across the EBCF refinement boundary.
Definition: CD_EBLeastSquaresMultigridInterpolator.cpp:351
CellLocation m_dataLocation
How to interpret data locations.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:148
virtual void defineBuffers() noexcept
Define buffer data holder.
Definition: CD_EBLeastSquaresMultigridInterpolator.cpp:313
int m_weight
Least squares weighting factor.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:210
static constexpr int m_stenComp
Component that interpolation stencil is stored at.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:133
EBLevelGrid m_eblgCoar
Coarse grids.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:158
LayoutData< RefCountedPtr< AggStencil< EBCellFAB, EBCellFAB > > > m_aggCoarStencils
Coarse-grid interpolation stencils.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:241
int m_ghostCF
Number of ghost cells to fill across coarse-fine interface.
Definition: CD_EBLeastSquaresMultigridInterpolator.H:200
static constexpr int m_comp
Component number. Used for setting interval when data is copied into EBLeastSquaresMultigridInterpola...
Definition: CD_EBLeastSquaresMultigridInterpolator.H:143
virtual void defineCoarseInterp() noexcept
Define the coarse-sided interpolation stencils for doing the orthogonal derivatives.
Definition: CD_EBLeastSquaresMultigridInterpolator.cpp:321
Multigrid interpolator class.
Definition: CD_EBMGLeastSquaresInterpolator.H:48
Cell
Enum for distinguishing between cell locations.
Definition: CD_Location.H:30