chombo-discharge
CD_EBCoarAve.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_EBCoarAve_H
13 #define CD_EBCoarAve_H
14 
15 // Chombo includes
16 #include <AggStencil.H>
17 #include <EBLevelGrid.H>
18 #include <VoFIterator.H>
19 #include <FaceIterator.H>
20 
21 // Our includes
22 #include <CD_Average.H>
23 #include <CD_NamespaceHeader.H>
24 
30 class EBCoarAve
31 {
32 public:
36  enum class Type
37  {
38  Arithmetic,
39  Conservative,
40  Harmonic
41  };
42 
46  EBCoarAve() noexcept;
47 
51  EBCoarAve(const EBCoarAve& a_other) = delete;
52 
64  EBCoarAve(const DisjointBoxLayout& a_dblFine,
65  const DisjointBoxLayout& a_dblCoar,
66  const EBISLayout& a_ebislFine,
67  const EBISLayout& a_ebislCoar,
68  const ProblemDomain& a_domainCoar,
69  const int& a_refRat,
70  const EBIndexSpace* a_ebisPtr) noexcept;
71 
79  EBCoarAve(const EBLevelGrid& a_eblgFine,
80  const EBLevelGrid& a_eblgCoar,
81  const EBLevelGrid& a_eblgCoFi,
82  const int& a_refRat) noexcept;
83 
87  virtual ~EBCoarAve() noexcept;
88 
96  virtual void
97  define(const EBLevelGrid& a_eblgFine,
98  const EBLevelGrid& a_eblgCoar,
99  const EBLevelGrid& a_eblgCoFi,
100  const int& a_refRat) noexcept;
101 
105  virtual void
106  operator=(const EBCoarAve& fabin) = delete;
107 
115  virtual void
116  averageData(LevelData<EBCellFAB>& a_coarData,
117  const LevelData<EBCellFAB>& a_fineData,
118  const Interval& a_variables,
119  const Average& a_average) const noexcept;
120 
128  virtual void
129  averageData(LevelData<EBFluxFAB>& a_coarData,
130  const LevelData<EBFluxFAB>& a_fineData,
131  const Interval& a_variables,
132  const Average& a_average) const noexcept;
133 
141  virtual void
142  averageData(LevelData<BaseIVFAB<Real>>& a_coarData,
143  const LevelData<BaseIVFAB<Real>>& a_fineData,
144  const Interval& a_variables,
145  const Average& a_average) const noexcept;
146 
147 protected:
152 
156  int m_refRat;
157 
161  EBLevelGrid m_eblgFine;
162 
166  EBLevelGrid m_eblgCoar;
167 
171  EBLevelGrid m_eblgCoFi;
172 
176  mutable std::map<IntVect, Copier> m_cellCopiers;
177 
181  mutable std::map<IntVect, Copier> m_faceCopiers;
182 
186  mutable std::map<IntVect, Copier> m_ebCopiers;
187 
191  LayoutData<IntVectSet> m_irregSetsCoFi;
192 
196  mutable LayoutData<VoFIterator> m_irregCellsCoFi;
197 
201  mutable LayoutData<std::map<int, FaceIterator>> m_irregFacesCoFi;
202 
206  LayoutData<BaseIVFAB<VoFStencil>> m_cellArithmeticStencils;
207 
213  LayoutData<BaseIVFAB<VoFStencil>> m_cellHarmonicStencils;
214 
218  LayoutData<BaseIVFAB<VoFStencil>> m_cellConservativeStencils;
219 
223  LayoutData<std::map<int, BaseIFFAB<FaceStencil>>> m_faceArithmeticStencils;
224 
228  LayoutData<std::map<int, BaseIFFAB<FaceStencil>>> m_faceHarmonicStencils;
229 
233  LayoutData<std::map<int, BaseIFFAB<FaceStencil>>> m_faceConservativeStencils;
234 
238  LayoutData<BaseIVFAB<VoFStencil>> m_ebArithmeticStencils;
239 
243  LayoutData<BaseIVFAB<VoFStencil>> m_ebHarmonicStencils;
244 
248  LayoutData<BaseIVFAB<VoFStencil>> m_ebConservativeStencils;
249 
253  virtual void
254  defineCellStencils() noexcept;
255 
259  virtual void
260  defineFaceStencils() noexcept;
261 
265  virtual void
266  defineEBStencils() noexcept;
267 
271  virtual void
272  defineBuffers() noexcept;
273 
282  virtual void
283  arithmeticAverage(EBCellFAB& a_coarData,
284  const EBCellFAB& a_fineData,
285  const DataIndex& a_datInd,
286  const int& a_coarVar,
287  const int& a_fineVar) const noexcept;
296  virtual void
297  harmonicAverage(EBCellFAB& a_coarData,
298  const EBCellFAB& a_fineData,
299  const DataIndex& a_datInd,
300  const int& a_coarVar,
301  const int& a_fineVar) const noexcept;
302 
311  virtual void
312  conservativeAverage(EBCellFAB& a_coarData,
313  const EBCellFAB& a_fineData,
314  const DataIndex& a_datInd,
315  const int& a_coarVar,
316  const int& a_fineVar) const noexcept;
317 
327  virtual void
328  arithmeticAverage(EBFaceFAB& a_coarData,
329  const EBFaceFAB& a_fineData,
330  const DataIndex& a_datInd,
331  const int& a_fineVar,
332  const int& a_coarVar,
333  const int& a_dir) const noexcept;
334 
344  virtual void
345  harmonicAverage(EBFaceFAB& a_coarData,
346  const EBFaceFAB& a_fineData,
347  const DataIndex& a_datInd,
348  const int& a_coarVar,
349  const int& a_fineVar,
350  const int& a_dir) const noexcept;
351 
361  virtual void
362  conservativeAverage(EBFaceFAB& a_coarData,
363  const EBFaceFAB& a_fineData,
364  const DataIndex& a_datInd,
365  const int& a_coarVar,
366  const int& a_fineVar,
367  const int& a_dir) const noexcept;
368 
377  virtual void
378  arithmeticAverage(BaseIVFAB<Real>& a_coarData,
379  const BaseIVFAB<Real>& a_fineData,
380  const DataIndex& a_datInd,
381  const int& a_coarVar,
382  const int& a_fineVar) const noexcept;
383 
392  virtual void
393  harmonicAverage(BaseIVFAB<Real>& a_coarData,
394  const BaseIVFAB<Real>& a_fineData,
395  const DataIndex& a_datInd,
396  const int& a_coarVar,
397  const int& a_fineVar) const noexcept;
398 
407  virtual void
408  conservativeAverage(BaseIVFAB<Real>& a_coarData,
409  const BaseIVFAB<Real>& a_fineData,
410  const DataIndex& a_datInd,
411  const int& a_coarVar,
412  const int& a_fineVar) const noexcept;
413 };
414 
415 #include <CD_NamespaceFooter.H>
416 
417 #endif
Declaration of averaging methods.
Average
Various averaging methods.
Definition: CD_Average.H:24
Class which replaces data at coarse level of refinement with average at fine level of refinement.
Definition: CD_EBCoarAve.H:31
LayoutData< BaseIVFAB< VoFStencil > > m_cellConservativeStencils
Stencils for conservative coarsening of volume data.
Definition: CD_EBCoarAve.H:218
virtual void defineCellStencils() noexcept
Define stencils for the various coarsening functions of cell data.
Definition: CD_EBCoarAve.cpp:119
int m_refRat
Refinement ratio.
Definition: CD_EBCoarAve.H:156
LayoutData< BaseIVFAB< VoFStencil > > m_ebConservativeStencils
Stencils for conservative coarsening of EB data.
Definition: CD_EBCoarAve.H:248
virtual void harmonicAverage(EBCellFAB &a_coarData, const EBCellFAB &a_fineData, const DataIndex &a_datInd, const int &a_coarVar, const int &a_fineVar) const noexcept
Do a harmonic average of cell-centered data when coarsening.
Definition: CD_EBCoarAve.cpp:498
EBLevelGrid m_eblgCoFi
Coarsened fine grids.
Definition: CD_EBCoarAve.H:171
virtual void define(const EBLevelGrid &a_eblgFine, const EBLevelGrid &a_eblgCoar, const EBLevelGrid &a_eblgCoFi, const int &a_refRat) noexcept
Define function – puts operator in usable state.
Definition: CD_EBCoarAve.cpp:78
LayoutData< std::map< int, FaceIterator > > m_irregFacesCoFi
Irregular faces on the coarsened fine layout.
Definition: CD_EBCoarAve.H:201
EBLevelGrid m_eblgCoar
Coarse grids.
Definition: CD_EBCoarAve.H:166
virtual void defineFaceStencils() noexcept
Define stencils for the various coarsening functions of face data.
Definition: CD_EBCoarAve.cpp:195
LayoutData< BaseIVFAB< VoFStencil > > m_ebHarmonicStencils
Stencils for harmonic coarsening of EB data.
Definition: CD_EBCoarAve.H:243
std::map< IntVect, Copier > m_ebCopiers
Pre-built copier for copying from m_eblgCoFi to m_eblgCoar.
Definition: CD_EBCoarAve.H:186
std::map< IntVect, Copier > m_faceCopiers
Pre-built copier for copying from m_eblgCoFi to m_eblgCoar.
Definition: CD_EBCoarAve.H:181
virtual void defineEBStencils() noexcept
Define stencils for the various coarsening functions of EB data.
Definition: CD_EBCoarAve.cpp:277
LayoutData< VoFIterator > m_irregCellsCoFi
Irregular cells on the coarsened fine layout.
Definition: CD_EBCoarAve.H:196
EBCoarAve() noexcept
Default constructor. Must call define afterwards.
Definition: CD_EBCoarAve.cpp:23
virtual void conservativeAverage(EBCellFAB &a_coarData, const EBCellFAB &a_fineData, const DataIndex &a_datInd, const int &a_coarVar, const int &a_fineVar) const noexcept
Do a conservative average of cell-centered data when coarsening.
Definition: CD_EBCoarAve.cpp:561
Type
Type of coarsening supported.
Definition: CD_EBCoarAve.H:37
EBLevelGrid m_eblgFine
Fine grids.
Definition: CD_EBCoarAve.H:161
LayoutData< IntVectSet > m_irregSetsCoFi
Irregular cells on the coarsened fine layout.
Definition: CD_EBCoarAve.H:191
LayoutData< BaseIVFAB< VoFStencil > > m_cellArithmeticStencils
Stencils for arithmetic coarsening of volume data.
Definition: CD_EBCoarAve.H:206
virtual void averageData(LevelData< EBCellFAB > &a_coarData, const LevelData< EBCellFAB > &a_fineData, const Interval &a_variables, const Average &a_average) const noexcept
Do an average of cell data.
Definition: CD_EBCoarAve.cpp:366
LayoutData< BaseIVFAB< VoFStencil > > m_cellHarmonicStencils
Stencils for harmonic coarsening of volume data.
Definition: CD_EBCoarAve.H:213
LayoutData< BaseIVFAB< VoFStencil > > m_ebArithmeticStencils
Stencils for arithmetic coarsening of EB data.
Definition: CD_EBCoarAve.H:238
virtual void arithmeticAverage(EBCellFAB &a_coarData, const EBCellFAB &a_fineData, const DataIndex &a_datInd, const int &a_coarVar, const int &a_fineVar) const noexcept
Do an arithmetic average of cell-centered data when coarsening.
Definition: CD_EBCoarAve.cpp:438
std::map< IntVect, Copier > m_cellCopiers
Pre-built copier for copying from m_eblgCoFi to m_eblgCoar.
Definition: CD_EBCoarAve.H:176
LayoutData< std::map< int, BaseIFFAB< FaceStencil > > > m_faceHarmonicStencils
Stencils for harmonic coarsening of face data.
Definition: CD_EBCoarAve.H:228
LayoutData< std::map< int, BaseIFFAB< FaceStencil > > > m_faceArithmeticStencils
Stencils for arithmetic coarsening of face data.
Definition: CD_EBCoarAve.H:223
bool m_isDefined
Defined or not.
Definition: CD_EBCoarAve.H:151
virtual void defineBuffers() noexcept
Define buffer storage.
Definition: CD_EBCoarAve.cpp:360
LayoutData< std::map< int, BaseIFFAB< FaceStencil > > > m_faceConservativeStencils
Stencils for conservative coarsening of face data.
Definition: CD_EBCoarAve.H:233