chombo-discharge
Loading...
Searching...
No Matches
CD_EBCoarseFineParticleMesh.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_EBCOARSEFINEPARTICLEMESH_H
14#define CD_EBCOARSEFINEPARTICLEMESH_H
15
16// Chombo includes
17#include <DisjointBoxLayout.H>
18#include <EBLevelGrid.H>
19#include <EBCellFAB.H>
20#include <ProblemDomain.H>
21
22// Our includes
23#include <CD_EBCoarAve.H>
24#include <CD_NamespaceHeader.H>
25
42{
43public:
48 {
49 Arithmetic,
50 Conservative
51 };
52
56 EBCoarseFineParticleMesh() noexcept;
57
65 EBCoarseFineParticleMesh(const EBLevelGrid& a_eblgCoar,
66 const EBLevelGrid& a_eblgFine,
67 const int a_refRat,
68 const IntVect a_ghost) noexcept;
69
73 virtual ~EBCoarseFineParticleMesh() noexcept;
74
82 virtual void
83 define(const EBLevelGrid& a_eblgCoar,
84 const EBLevelGrid& a_eblgFine,
85 const int a_refRat,
86 const IntVect a_ghost) noexcept;
87
97 virtual void
98 addFineGhostsToCoarse(LevelData<EBCellFAB>& a_coarData, const LevelData<EBCellFAB>& a_fineData) const noexcept;
99
108 virtual void
109 addFiCoDataToFine(LevelData<EBCellFAB>& a_fineData, const LevelData<EBCellFAB>& a_fiCoData) const noexcept;
110
119 virtual void
120 addInvalidCoarseToFine(LevelData<EBCellFAB>& a_fineData, const LevelData<EBCellFAB>& a_coarData) const noexcept;
121
126 virtual void
127 exchangeAndAddFiCoData(LevelData<EBCellFAB>& a_fiCoData) const noexcept;
128
136 virtual void
137 restrictAndAddFiCoDataToCoar(LevelData<EBCellFAB>& a_coarData,
138 const LevelData<EBCellFAB>& a_fiCoData,
139 const EBCoarseFineParticleMesh::Average a_average) const noexcept;
140
145 const EBLevelGrid&
146 getEblgFiCo() const;
147
152 template <int NCOMP>
153 LevelData<EBCellFAB>&
154 getBufferFiCo() const noexcept;
155
156protected:
160 static constexpr int m_comp = 0;
161
165 static constexpr int m_nComp = 1;
166
171
176
180 EBLevelGrid m_eblgCoar;
181
185 EBLevelGrid m_eblgFine;
186
190 EBLevelGrid m_eblgFiCo;
191
195 EBLevelGrid m_eblgCoFi;
196
202
208
215
222
226 mutable LevelData<EBCellFAB> m_bufferFiCoReal;
227
231 mutable LevelData<EBCellFAB> m_bufferFiCoRealVect;
232
236 mutable LayoutData<VoFIterator> m_vofIterFineGhosts;
237
242 mutable LayoutData<VoFIterator> m_vofIterCoFiGhosts;
243
247 mutable LayoutData<VoFIterator> m_vofIterCoar;
248
253 LayoutData<BaseIVFAB<VoFStencil>> m_cellArithmeticStencils;
254
259 LayoutData<BaseIVFAB<VoFStencil>> m_cellConservativeStencils;
260
265
269 IntVect m_ghost;
270
274 void
275 defineVoFIterators() noexcept;
276
280 void
281 defineStencils() noexcept;
282
286 void
287 defineBufferFiCo() noexcept;
288
295 void
296 conservativeAverageAndAdd(EBCellFAB& a_coarData, const EBCellFAB& a_fineData, const DataIndex& a_din) const noexcept;
297
304 void
305 arithmeticAverageAndAdd(EBCellFAB& a_coarData, const EBCellFAB& a_fineData, const DataIndex& a_din) const noexcept;
306};
307
308#include <CD_NamespaceFooter.H>
309
310#endif
Average
Various averaging methods.
Definition CD_Average.H:25
Declaration of conservative coarsening utility.
A class for handling particle deposition clouds that hang over refinement boundaries....
Definition CD_EBCoarseFineParticleMesh.H:42
Copier m_copierFiCoToFiCo
Copier for that moves data from valid+ghost -> valid on the refined coarse level.
Definition CD_EBCoarseFineParticleMesh.H:221
LayoutData< VoFIterator > m_vofIterCoar
VoFIterator for coarse cells.
Definition CD_EBCoarseFineParticleMesh.H:247
EBLevelGrid m_eblgFine
Fine EBLevelGrid.
Definition CD_EBCoarseFineParticleMesh.H:185
void arithmeticAverageAndAdd(EBCellFAB &a_coarData, const EBCellFAB &a_fineData, const DataIndex &a_din) const noexcept
Arithmetically average and add data from the refined coarse data to the coarse data.
Definition CD_EBCoarseFineParticleMesh.cpp:668
EBLevelGrid m_eblgFiCo
Refined coarse EBLevelGrid.
Definition CD_EBCoarseFineParticleMesh.H:190
virtual void addFineGhostsToCoarse(LevelData< EBCellFAB > &a_coarData, const LevelData< EBCellFAB > &a_fineData) const noexcept
Coarsen the fine-level ghost cells and add them to the coarse level.
Definition CD_EBCoarseFineParticleMesh.cpp:263
bool m_verbose
Verbose or not. Useful for debugging.
Definition CD_EBCoarseFineParticleMesh.H:175
LayoutData< BaseIVFAB< VoFStencil > > m_cellConservativeStencils
Stencils for conservative coarsening of volume data.
Definition CD_EBCoarseFineParticleMesh.H:259
EBLevelGrid m_eblgCoar
Coarse EBLevelGrid.
Definition CD_EBCoarseFineParticleMesh.H:180
void defineVoFIterators() noexcept
Define the vof iterators.
Definition CD_EBCoarseFineParticleMesh.cpp:105
Copier m_copierFiCoToFineNoGhosts
Copier for copying data from the refined coarse level to the fine level.
Definition CD_EBCoarseFineParticleMesh.H:214
LayoutData< VoFIterator > m_vofIterCoFiGhosts
VoFIterator for coarse grid cells that are coarsenings of fine-grid ghost irregular cells.
Definition CD_EBCoarseFineParticleMesh.H:242
virtual void addFiCoDataToFine(LevelData< EBCellFAB > &a_fineData, const LevelData< EBCellFAB > &a_fiCoData) const noexcept
Add the valid+ghost cells on the refined coarse level to the valid cells on the fine level.
Definition CD_EBCoarseFineParticleMesh.cpp:427
LayoutData< BaseIVFAB< VoFStencil > > m_cellArithmeticStencils
Stencils for arithmetic coarsening of volume data.
Definition CD_EBCoarseFineParticleMesh.H:253
LevelData< EBCellFAB > m_bufferFiCoRealVect
Buffer storage on the refined coarse level. One component only.
Definition CD_EBCoarseFineParticleMesh.H:231
void defineStencils() noexcept
Define the vof iterators.
Definition CD_EBCoarseFineParticleMesh.cpp:176
void defineBufferFiCo() noexcept
Define the buffer storages.
Definition CD_EBCoarseFineParticleMesh.cpp:248
LayoutData< VoFIterator > m_vofIterFineGhosts
VoFIterator for fine-grid irregular ghost cells.
Definition CD_EBCoarseFineParticleMesh.H:236
virtual void restrictAndAddFiCoDataToCoar(LevelData< EBCellFAB > &a_coarData, const LevelData< EBCellFAB > &a_fiCoData, const EBCoarseFineParticleMesh::Average a_average) const noexcept
Coarsen the data on the refined coarse grid to the coarse grid. The grids must be defined over the sa...
Definition CD_EBCoarseFineParticleMesh.cpp:559
static constexpr int m_nComp
Maximum number of components.
Definition CD_EBCoarseFineParticleMesh.H:165
virtual void addInvalidCoarseToFine(LevelData< EBCellFAB > &a_fineData, const LevelData< EBCellFAB > &a_coarData) const noexcept
Function which piecewise interpolates the data underneath the fine grid and adds it to the fine grid.
Definition CD_EBCoarseFineParticleMesh.cpp:447
bool m_isDefined
Is defined or not.
Definition CD_EBCoarseFineParticleMesh.H:170
LevelData< EBCellFAB > m_bufferFiCoReal
Buffer storage on the refined coarse level. One component only.
Definition CD_EBCoarseFineParticleMesh.H:226
virtual void define(const EBLevelGrid &a_eblgCoar, const EBLevelGrid &a_eblgFine, const int a_refRat, const IntVect a_ghost) noexcept
Define function.
Definition CD_EBCoarseFineParticleMesh.cpp:52
EBLevelGrid m_eblgCoFi
Coarsening of m_eblgFine.
Definition CD_EBCoarseFineParticleMesh.H:195
EBCoarseFineParticleMesh() noexcept
Default constructor. Leaves object in undefined state and subsequently requires a call to define.
Definition CD_EBCoarseFineParticleMesh.cpp:30
IntVect m_ghost
Number of ghost cells in data holders.
Definition CD_EBCoarseFineParticleMesh.H:269
virtual void exchangeAndAddFiCoData(LevelData< EBCellFAB > &a_fiCoData) const noexcept
Function which performs an exchange+add operation on the refined coarse data.
Definition CD_EBCoarseFineParticleMesh.cpp:542
Copier m_copierCoFiToCoarIncludeGhosts
Copier for copying data from the coarsened fine level to the coarse level.
Definition CD_EBCoarseFineParticleMesh.H:207
Average
Simple enum for switch between arithmetic and conservative averaging.
Definition CD_EBCoarseFineParticleMesh.H:48
Copier m_copierFiCoToFineIncludeGhosts
Copier for copying data from the refined coarse level to the fine level.
Definition CD_EBCoarseFineParticleMesh.H:201
static constexpr int m_comp
Default component.
Definition CD_EBCoarseFineParticleMesh.H:160
int m_refRat
Refinement ratio between the two levels.
Definition CD_EBCoarseFineParticleMesh.H:264
void conservativeAverageAndAdd(EBCellFAB &a_coarData, const EBCellFAB &a_fineData, const DataIndex &a_din) const noexcept
Conservatively average and add data from the refined coarse data to the coarse data.
Definition CD_EBCoarseFineParticleMesh.cpp:610
LevelData< EBCellFAB > & getBufferFiCo() const noexcept
Get buffer storage on the refined coarse level.
const EBLevelGrid & getEblgFiCo() const
Get the refined version of the coarse eblevelgrid.
Definition CD_EBCoarseFineParticleMesh.cpp:390