chombo-discharge
CD_EBReflux.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_EBReflux_H
13 #define CD_EBReflux_H
14 
15 // Std includes
16 #include <map>
17 
18 // Chombo includes
19 #include <Copier.H>
20 #include <EBLevelGrid.H>
21 
22 // Our includes
23 #include <CD_NamespaceHeader.H>
24 
36 class EBReflux
37 {
38 public:
42  EBReflux() noexcept;
43 
47  EBReflux(const EBReflux& a_other) = delete;
48 
56  EBReflux(const EBLevelGrid& a_eblg,
57  const EBLevelGrid& a_eblgFine,
58  const EBLevelGrid& a_eblgCoFi,
59  const int a_refRat) noexcept;
60 
64  virtual ~EBReflux() noexcept;
65 
73  virtual void
74  define(const EBLevelGrid& a_eblg,
75  const EBLevelGrid& a_eblgFine,
76  const EBLevelGrid& a_eblgCoFi,
77  const int a_refRat) noexcept;
78 
90  virtual void
91  reflux(LevelData<EBCellFAB>& a_Lphi,
92  const LevelData<EBFluxFAB>& a_flux,
93  const LevelData<EBFluxFAB>& a_fineFlux,
94  const Interval a_variables,
95  const Real a_scaleCoarFlux,
96  const Real a_scaleFineFlux) const noexcept;
97 
98 protected:
103 
107  int m_refRat;
108 
112  EBLevelGrid m_eblgFine;
113 
117  EBLevelGrid m_eblg;
118 
122  EBLevelGrid m_eblgCoFi;
123 
127  Copier m_copier;
128 
132  LayoutData<std::map<std::pair<int, Side::LoHiSide>, BaseIFFAB<FaceStencil>>> m_fluxCoarseningStencils;
133 
137  LayoutData<std::map<std::pair<int, Side::LoHiSide>, DenseIntVectSet>> m_regularCoarseFineRegions;
138 
142  mutable LayoutData<std::map<std::pair<int, Side::LoHiSide>, FaceIterator>> m_fluxCoarseningRegions;
143 
148  mutable LayoutData<std::map<std::pair<int, Side::LoHiSide>, VoFIterator>> m_irregularCoarseFineRegions;
149 
153  virtual void
154  defineRegionsCF() noexcept;
155 
159  virtual void
160  defineStencils() noexcept;
161 
165  virtual void
166  defineBuffers() noexcept;
167 
176  virtual void
177  coarsenFluxesCF(LevelData<EBFluxFAB>& a_coarFluxes,
178  const LevelData<EBFluxFAB>& a_fineFluxes,
179  const int a_coarVar,
180  const int a_fineVar) const noexcept;
181 
194  virtual void
195  refluxIntoCoarse(LevelData<EBCellFAB>& a_Lphi,
196  const LevelData<EBFluxFAB>& a_oldFluxes,
197  const LevelData<EBFluxFAB>& a_newFluxes,
198  const int a_phiVar,
199  const int a_oldFluxVar,
200  const int a_newFluxVar,
201  const Real a_scaleCoarFlux,
202  const Real a_scaleFineFlux) const noexcept;
203 };
204 
205 #include <CD_NamespaceFooter.H>
206 
207 #endif
Class which can do refluxing across a coarse-fine interface.
Definition: CD_EBReflux.H:37
EBLevelGrid m_eblgFine
Fine grids.
Definition: CD_EBReflux.H:112
LayoutData< std::map< std::pair< int, Side::LoHiSide >, VoFIterator > > m_irregularCoarseFineRegions
Cut-cells in each patch that lie on the coarse-fine interface.
Definition: CD_EBReflux.H:148
virtual void define(const EBLevelGrid &a_eblg, const EBLevelGrid &a_eblgFine, const EBLevelGrid &a_eblgCoFi, const int a_refRat) noexcept
Define method. Puts object in usable state.
Definition: CD_EBReflux.cpp:46
virtual void defineStencils() noexcept
Define the stencils required for coarsening the fine-grid fluxes onto the coarse grid.
Definition: CD_EBReflux.cpp:189
int m_refRat
Refinement factor between fine and coarse level.
Definition: CD_EBReflux.H:107
virtual void defineBuffers() noexcept
Define buffers.
Definition: CD_EBReflux.cpp:260
LayoutData< std::map< std::pair< int, Side::LoHiSide >, BaseIFFAB< FaceStencil > > > m_fluxCoarseningStencils
Stencils for conservatively coarsening fine-grid fluxes onto the coarse grid.
Definition: CD_EBReflux.H:132
virtual void reflux(LevelData< EBCellFAB > &a_Lphi, const LevelData< EBFluxFAB > &a_flux, const LevelData< EBFluxFAB > &a_fineFlux, const Interval a_variables, const Real a_scaleCoarFlux, const Real a_scaleFineFlux) const noexcept
Reflux into the coarse data.
Definition: CD_EBReflux.cpp:269
EBReflux() noexcept
Disallowed constructor.
Definition: CD_EBReflux.cpp:23
EBLevelGrid m_eblg
Grid on this level.
Definition: CD_EBReflux.H:117
Copier m_copier
Copier for copying from the coarsened fine grids to the coarse grids.
Definition: CD_EBReflux.H:127
EBReflux(const EBReflux &a_other)=delete
Disallowed copy constructor.
virtual ~EBReflux() noexcept
Destructor (does nothing)
Definition: CD_EBReflux.cpp:40
LayoutData< std::map< std::pair< int, Side::LoHiSide >, DenseIntVectSet > > m_regularCoarseFineRegions
Regular coarse-fine regions for coarse-grid patches.
Definition: CD_EBReflux.H:137
virtual void refluxIntoCoarse(LevelData< EBCellFAB > &a_Lphi, const LevelData< EBFluxFAB > &a_oldFluxes, const LevelData< EBFluxFAB > &a_newFluxes, const int a_phiVar, const int a_oldFluxVar, const int a_newFluxVar, const Real a_scaleCoarFlux, const Real a_scaleFineFlux) const noexcept
Reflux data into a_Lphi.
Definition: CD_EBReflux.cpp:426
bool m_isDefined
Is defined or not.
Definition: CD_EBReflux.H:102
LayoutData< std::map< std::pair< int, Side::LoHiSide >, FaceIterator > > m_fluxCoarseningRegions
Stencils for conservatively coarsening fine-grid fluxes onto the coarse grid.
Definition: CD_EBReflux.H:142
EBLevelGrid m_eblgCoFi
Coarsened fine grids.
Definition: CD_EBReflux.H:122
virtual void defineRegionsCF() noexcept
Define coarse-fine interface regions so that we can compute things later.
Definition: CD_EBReflux.cpp:66
virtual void coarsenFluxesCF(LevelData< EBFluxFAB > &a_coarFluxes, const LevelData< EBFluxFAB > &a_fineFluxes, const int a_coarVar, const int a_fineVar) const noexcept
Coarsen the input fine fluxes onto the coarse fluxes.
Definition: CD_EBReflux.cpp:310