chombo-discharge
CD_EBFluxRedistribution.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_EBFluxRedistribution_H
13 #define CD_EBFluxRedistribution_H
14 
15 // Chombo includes
16 #include <EBLevelGrid.H>
17 #include <LevelData.H>
18 #include <EBCellFAB.H>
19 #include <BaseIVFAB.H>
20 
21 // Our includes
22 #include <CD_NamespaceHeader.H>
23 
43 {
44 public:
48  EBFluxRedistribution() noexcept;
49 
53  EBFluxRedistribution(const EBFluxRedistribution& a_other) = delete;
54 
68  EBFluxRedistribution(const EBLevelGrid& a_eblgCoar,
69  const EBLevelGrid& a_eblgCoarsened,
70  const EBLevelGrid& a_eblg,
71  const EBLevelGrid& a_eblgRefined,
72  const EBLevelGrid& a_eblgFine,
73  const int a_refToCoar,
74  const int a_refToFine,
75  const bool a_redistributeOutside) noexcept;
76 
80  virtual ~EBFluxRedistribution() noexcept;
81 
95  virtual void
96  define(const EBLevelGrid& a_eblgCoar,
97  const EBLevelGrid& a_eblgCoarsened,
98  const EBLevelGrid& a_eblg,
99  const EBLevelGrid& a_eblgRefined,
100  const EBLevelGrid& a_eblgFine,
101  const int a_refToCoar,
102  const int a_refToFine,
103  const bool a_redistributeOutside) noexcept;
104 
118  virtual void
119  redistributeAMR(LevelData<EBCellFAB>* a_phiCoar,
120  LevelData<EBCellFAB>* a_phi,
121  LevelData<EBCellFAB>* a_phiFine,
122  const LevelData<BaseIVFAB<Real>>& a_deltaM,
123  const Real a_scaleCoar,
124  const Real a_scale,
125  const Real a_scaleFine,
126  const Interval& a_variables) const noexcept;
127 
135  virtual void
136  redistributeCoar(LevelData<EBCellFAB>& a_phiCoar,
137  const LevelData<BaseIVFAB<Real>>& a_deltaM,
138  const Real& a_scaleCoar,
139  const Interval& a_variables) const noexcept;
140 
148  virtual void
149  redistributeLevel(LevelData<EBCellFAB>& a_phi,
150  const LevelData<BaseIVFAB<Real>>& a_deltaM,
151  const Real& a_scale,
152  const Interval& a_variables) const noexcept;
153 
161  virtual void
162  redistributeFine(LevelData<EBCellFAB>& a_phiFine,
163  const LevelData<BaseIVFAB<Real>>& a_deltaM,
164  const Real& a_scaleFine,
165  const Interval& a_variables) const noexcept;
166 
167 protected:
172 
177 
181  bool m_hasCoar;
182 
186  bool m_hasFine;
187 
192 
197 
202 
206  EBLevelGrid m_eblgCoar;
207 
211  EBLevelGrid m_eblgCoarsened;
212 
216  EBLevelGrid m_eblg;
217 
221  EBLevelGrid m_eblgRefined;
222 
226  EBLevelGrid m_eblgFine;
227 
231  Copier m_coarCopier;
232 
237 
241  Copier m_fineCopier;
242 
247  LayoutData<BaseIVFAB<VoFStencil>> m_redistStencilsCoar;
248 
253  LayoutData<BaseIVFAB<VoFStencil>> m_redistStencilsLevel;
254 
259  LayoutData<BaseIVFAB<VoFStencil>> m_redistStencilsFine;
260 
264  mutable LayoutData<VoFIterator> m_vofit;
265 
269  virtual void
270  defineStencils() noexcept;
271 
275  virtual void
276  defineBuffers() noexcept;
277 
282  virtual void
283  defineValidCells(LevelData<BaseFab<bool>>& a_validCells) const noexcept;
284 
289  virtual void
290  defineInterfaceCells(LevelData<BaseFab<bool>>& a_interfaceCells) const noexcept;
291 };
292 
293 #include <CD_NamespaceFooter.H>
294 
295 #endif
Class for redistribution ala Chombo's flux redistribution.
Definition: CD_EBFluxRedistribution.H:43
int m_refToCoar
Refinement factor between this level and the coarse level.
Definition: CD_EBFluxRedistribution.H:191
virtual void redistributeAMR(LevelData< EBCellFAB > *a_phiCoar, LevelData< EBCellFAB > *a_phi, LevelData< EBCellFAB > *a_phiFine, const LevelData< BaseIVFAB< Real >> &a_deltaM, const Real a_scaleCoar, const Real a_scale, const Real a_scaleFine, const Interval &a_variables) const noexcept
Redistribute the input quantity into the coarse level, this level, and the fine level.
Definition: CD_EBFluxRedistribution.cpp:444
virtual void redistributeCoar(LevelData< EBCellFAB > &a_phiCoar, const LevelData< BaseIVFAB< Real >> &a_deltaM, const Real &a_scaleCoar, const Interval &a_variables) const noexcept
Redistribute the input quantity to the coarse level.
Definition: CD_EBFluxRedistribution.cpp:474
bool m_hasCoar
Has coarse level or not.
Definition: CD_EBFluxRedistribution.H:181
EBFluxRedistribution() noexcept
Weak constructor. Need to call define afterwards.
Definition: CD_EBFluxRedistribution.cpp:25
bool m_hasFine
Has fine level or not.
Definition: CD_EBFluxRedistribution.H:186
int m_refToFine
Refinement factor between this level and the fine level.
Definition: CD_EBFluxRedistribution.H:196
virtual void defineInterfaceCells(LevelData< BaseFab< bool >> &a_interfaceCells) const noexcept
Define the cells on the coarse side of the CF interface that we would redistribute to.
Definition: CD_EBFluxRedistribution.cpp:369
LayoutData< BaseIVFAB< VoFStencil > > m_redistStencilsFine
Stencils for redistribution into valid grid cells on the fine level.
Definition: CD_EBFluxRedistribution.H:259
bool m_redistributeOutside
If true, redistribute to the outside. Otherwise, do interior redistribution.
Definition: CD_EBFluxRedistribution.H:176
virtual void defineBuffers() noexcept
Define buffer storages.
Definition: CD_EBFluxRedistribution.cpp:413
virtual void redistributeFine(LevelData< EBCellFAB > &a_phiFine, const LevelData< BaseIVFAB< Real >> &a_deltaM, const Real &a_scaleFine, const Interval &a_variables) const noexcept
Redistribute the input quantity to the coarse level.
Definition: CD_EBFluxRedistribution.cpp:594
virtual void redistributeLevel(LevelData< EBCellFAB > &a_phi, const LevelData< BaseIVFAB< Real >> &a_deltaM, const Real &a_scale, const Interval &a_variables) const noexcept
Redistribute the input quantity to this level.
Definition: CD_EBFluxRedistribution.cpp:534
virtual void defineStencils() noexcept
Define redistribution stencils.
Definition: CD_EBFluxRedistribution.cpp:125
EBLevelGrid m_eblgFine
Fine grids.
Definition: CD_EBFluxRedistribution.H:226
virtual ~EBFluxRedistribution() noexcept
Destructor (does nothing)
Definition: CD_EBFluxRedistribution.cpp:53
virtual void defineValidCells(LevelData< BaseFab< bool >> &a_validCells) const noexcept
Define the valid region of this level.
Definition: CD_EBFluxRedistribution.cpp:299
int m_redistRadius
Redistribution radius. Always one.
Definition: CD_EBFluxRedistribution.H:201
bool m_isDefined
Is defined or not.
Definition: CD_EBFluxRedistribution.H:171
Copier m_fineCopier
Copier for copying from the refinement of this level to the fine level.
Definition: CD_EBFluxRedistribution.H:241
LayoutData< BaseIVFAB< VoFStencil > > m_redistStencilsCoar
Stencils for redistribution into valid grid cells on the coarse level.
Definition: CD_EBFluxRedistribution.H:247
Copier m_levelCopier
Copier for adding data from this level to this level (yes, really).
Definition: CD_EBFluxRedistribution.H:236
virtual void define(const EBLevelGrid &a_eblgCoar, const EBLevelGrid &a_eblgCoarsened, const EBLevelGrid &a_eblg, const EBLevelGrid &a_eblgRefined, const EBLevelGrid &a_eblgFine, const int a_refToCoar, const int a_refToFine, const bool a_redistributeOutside) noexcept
Define fucntion. Puts object in usable state.
Definition: CD_EBFluxRedistribution.cpp:59
EBLevelGrid m_eblgCoar
Grids on coarser level.
Definition: CD_EBFluxRedistribution.H:206
LayoutData< VoFIterator > m_vofit
Iterator for going through all cells on this level that we redistribute from.
Definition: CD_EBFluxRedistribution.H:264
Copier m_coarCopier
Copier for copying from the coarsening of this level to the coarse level.
Definition: CD_EBFluxRedistribution.H:231
EBLevelGrid m_eblgCoarsened
Grids on this level that are a refinement of the coarser level.
Definition: CD_EBFluxRedistribution.H:211
EBFluxRedistribution(const EBFluxRedistribution &a_other)=delete
Copy constructor is not allowed.
EBLevelGrid m_eblgRefined
Grids on this level that are a coarsening of the fine level.
Definition: CD_EBFluxRedistribution.H:221
LayoutData< BaseIVFAB< VoFStencil > > m_redistStencilsLevel
Stencils for redistribution into valid grid cells on this level.
Definition: CD_EBFluxRedistribution.H:253
EBLevelGrid m_eblg
Grids on this level.
Definition: CD_EBFluxRedistribution.H:216