chombo-discharge
Loading...
Searching...
No Matches
CD_EBGhostCellInterpolator.H
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021-2026 SINTEF Energy Research
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
13#ifndef CD_EBGHOSTCELLINTERPOLATOR_H
14#define CD_EBGHOSTCELLINTERPOLATOR_H
15
16// Std includes
17#include <map>
18
19// Chombo includes
20#include <EBLevelGrid.H>
21
22// Our includes
23#include <CD_Location.H>
24#include <CD_NamespaceHeader.H>
25
35{
36public:
40 enum Type
41 {
42 PWC,
43 MinMod,
44 MonotonizedCentral,
45 Superbee
46 };
47
51 EBGhostCellInterpolator() noexcept;
52
57
67 EBGhostCellInterpolator(const EBLevelGrid& a_eblgFine,
68 const EBLevelGrid& a_eblgCoFi,
69 const EBLevelGrid& a_eblgCoar,
70 const IntVect& a_ghostVector,
71 const int a_refRat,
72 const int a_ghostCF) noexcept;
73
77 virtual ~EBGhostCellInterpolator() noexcept;
78
88 virtual void
89 define(const EBLevelGrid& a_eblgFine,
90 const EBLevelGrid& a_eblgCoFi,
91 const EBLevelGrid& a_eblgCoar,
92 const IntVect& a_ghostVector,
93 const int a_refRat,
94 const int a_ghostCF) noexcept;
95
113 virtual void
114 interpolate(LevelData<EBCellFAB>& a_phiFine,
115 const LevelData<EBCellFAB>& a_phiCoar,
116 const Interval a_variables,
117 const Type a_interpType) const noexcept;
118
119protected:
124
128 EBLevelGrid m_eblgFine;
129
133 EBLevelGrid m_eblgCoar;
134
138 EBLevelGrid m_eblgCoFi;
139
144
149
155
159 LayoutData<std::map<std::pair<int, Side::LoHiSide>, Box>> m_regularGhostRegions;
160
164 Copier m_copier;
165
175 mutable LevelData<EBCellFAB> m_coarsenedFineData;
176
182 LayoutData<BaseIVFAB<VolIndex>> m_coarsenedFineGhosts;
183
187 mutable LayoutData<VoFIterator> m_fineIrregCells;
188
192 mutable LayoutData<VoFIterator> m_coarIrregCells;
193
198 mutable LayoutData<BaseIVFAB<Real>> m_coarIrregSlopes;
199
203 virtual void
204 defineGhostRegions() noexcept;
205
209 virtual void
210 defineBuffers() noexcept;
211
221 virtual void
222 interpolateRegular(FArrayBox& a_phiFine,
223 const FArrayBox& a_phiCoar,
224 const DataIndex& a_dit,
225 const int a_fineVar,
226 const int a_coarVar,
227 const Type a_interpType) const noexcept;
228
238 virtual void
239 interpolateIrregular(EBCellFAB& a_phiFine,
240 const EBCellFAB& a_phiCoar,
241 const DataIndex& a_dit,
242 const int a_fineVar,
243 const int a_coarVar,
244 const Type a_interpType) const noexcept;
245
252 static inline Real
253 minmod(const Real& dwl, const Real& dwr) noexcept;
254
261 static Real
262 superbee(const Real& dwl, const Real& dwr) noexcept;
263
270 static inline Real
271 monotonizedCentral(const Real& dwl, const Real& dwr) noexcept;
272};
273
274#include <CD_NamespaceFooter.H>
275
276#endif
Declaration of cell positions.
Class which can interpolate ghost cells across the coarse-fine interface. To select an interpolation ...
Definition CD_EBGhostCellInterpolator.H:35
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:238
LayoutData< std::map< std::pair< int, Side::LoHiSide >, Box > > m_regularGhostRegions
Regular ghost regions to be interpolated.
Definition CD_EBGhostCellInterpolator.H:159
EBGhostCellInterpolator() noexcept
Weak constructor. Need to call define afterwards.
Definition CD_EBGhostCellInterpolator.cpp:25
LayoutData< VoFIterator > m_coarIrregCells
Coarse-grid cells on the caorse-side of the interface that are irregular cells.
Definition CD_EBGhostCellInterpolator.H:192
virtual void defineBuffers() noexcept
Define buffers.
Definition CD_EBGhostCellInterpolator.cpp:159
IntVect m_ghostVector
Minimum number of ghost cells in input data.
Definition CD_EBGhostCellInterpolator.H:143
static Real monotonizedCentral(const Real &dwl, const Real &dwr) noexcept
Monotonized central difference slope limiter.
Definition CD_EBGhostCellInterpolator.cpp:508
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:48
static Real minmod(const Real &dwl, const Real &dwr) noexcept
minmod slope function.
Definition CD_EBGhostCellInterpolator.cpp:479
Copier m_copier
Copier for making copying from m_eblgCoar to m_grownCoarData go faster.
Definition CD_EBGhostCellInterpolator.H:164
virtual void defineGhostRegions() noexcept
Define ghost regions to be interpolated.
Definition CD_EBGhostCellInterpolator.cpp:74
bool m_isDefined
Is defined or not.
Definition CD_EBGhostCellInterpolator.H:123
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:360
LayoutData< BaseIVFAB< VolIndex > > m_coarsenedFineGhosts
List of coarse-grid cells that appear through coarsening a fine-grid ghost cell.
Definition CD_EBGhostCellInterpolator.H:182
EBLevelGrid m_eblgFine
Fine grids.
Definition CD_EBGhostCellInterpolator.H:128
LayoutData< VoFIterator > m_fineIrregCells
Fine-grid ghost cells on the coarse-fine interface that overlap an irregular coarse cell.
Definition CD_EBGhostCellInterpolator.H:187
EBLevelGrid m_eblgCoar
Coarse grids.
Definition CD_EBGhostCellInterpolator.H:133
EBLevelGrid m_eblgCoFi
Coarsened fine grids.
Definition CD_EBGhostCellInterpolator.H:138
LevelData< EBCellFAB > m_coarsenedFineData
Buffer holding the coarse-grid data on the coarsened fine grids.
Definition CD_EBGhostCellInterpolator.H:175
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:174
int m_refRat
Refinement factor between fine and coarse level.
Definition CD_EBGhostCellInterpolator.H:148
Type
Type of interpolation slopes supported.
Definition CD_EBGhostCellInterpolator.H:41
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:198
int m_ghostCF
Number of ghost cells to fill across coarse-fine interface.
Definition CD_EBGhostCellInterpolator.H:154
static Real superbee(const Real &dwl, const Real &dwr) noexcept
Superbee slope limiter.
Definition CD_EBGhostCellInterpolator.cpp:491