chombo-discharge
Loading...
Searching...
No Matches
CD_MFHelmholtzJumpBC.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
12
13#ifndef CD_MFHELMHOLTZJUMPBC_H
14#define CD_MFHELMHOLTZJUMPBC_H
15
16// Chombo includes
17#include <MFCellFAB.H>
18#include <EBISBox.H>
19#include <LayoutData.H>
20#include <Stencils.H>
21#include <AggStencil.H>
22#include <EBCellFAB.H>
23#include <BaseIVFAB.H>
24
25// Our includes
26#include <CD_Location.H>
27#include <CD_MFLevelGrid.H>
28#include <CD_VofUtils.H>
29#include <CD_MFInterfaceFAB.H>
30#include <CD_MFBaseIVFAB.H>
31#include <CD_NamespaceHeader.H>
32
45{
46public:
50 using BcoefPtr = RefCountedPtr<LevelData<MFBaseIVFAB>>;
51
55 using AmrMask = RefCountedPtr<LevelData<BaseFab<bool>>>;
56
61
77 MFHelmholtzJumpBC(Location::Cell a_dataLocation,
78 const MFLevelGrid& a_mflg,
79 const BcoefPtr& a_Bcoef,
80 const AmrMask& a_validCells,
81 Real a_dx,
82 int a_order,
83 int a_weight,
84 int a_radius,
85 int a_ghostCF,
86 IntVect a_ghostPhi,
87 bool a_dropOrder);
88
92 MFHelmholtzJumpBC(const MFHelmholtzJumpBC& a_other) = delete;
93
97 virtual ~MFHelmholtzJumpBC();
98
103 operator=(const MFHelmholtzJumpBC& a_other) = delete;
104
107 operator=(MFHelmholtzJumpBC&&) = delete;
108
113 void
114 setBco(const RefCountedPtr<LevelData<MFBaseIVFAB>>& a_Bcoef);
115
120 bool
121 isMultiPhase() const noexcept;
122
127 int
128 getOrder() const;
129
134 int
135 getWeight() const;
136
141 int
142 getRadius() const;
143
150 virtual void
151 matchBC(LevelData<BaseIVFAB<Real>>& a_jump, const LevelData<MFCellFAB>& a_phi, bool a_homogeneousPhysBC) const;
152
160 virtual void
161 matchBC(BaseIVFAB<Real>& a_jump, const MFCellFAB& a_phi, bool a_homogeneousPhysBC, const DataIndex& a_dit) const;
162
169 virtual const BaseIVFAB<Real>&
170 getBndryPhi(int a_phase, const DataIndex& a_dit) const;
171
178 virtual VoFIterator&
179 getSinglePhaseVofs(int a_phase, const DataIndex& a_dit) const;
180
187 virtual VoFIterator&
188 getMultiPhaseVofs(int a_phase, const DataIndex& a_dit) const;
189
194 virtual const LayoutData<MFInterfaceFAB<VoFStencil>>&
195 getGradPhiStencils() const noexcept;
196
201 virtual const LayoutData<MFInterfaceFAB<Real>>&
202 getGradPhiWeights() const noexcept;
203
207 virtual void
208 resetBC() const;
209
210protected:
214 static constexpr int m_comp = 0;
215
219 static constexpr int m_nComp = 1;
220
225
230
234 RefCountedPtr<LevelData<MFBaseIVFAB>> m_Bcoef;
235
239 RefCountedPtr<LevelData<BaseFab<bool>>> m_validCells;
240
244 Real m_dx;
245
250
255
260
265
270
274 IntVect m_ghostPhi;
275
280
285
289 mutable LayoutData<MFInterfaceFAB<Real>> m_boundaryPhi;
290
294 mutable std::map<int, std::shared_ptr<LayoutData<VoFIterator>>> m_singlePhaseVofs;
295
299 mutable std::map<int, std::shared_ptr<LayoutData<VoFIterator>>> m_multiPhaseVofs;
300
304 LayoutData<IntVectSet> m_ivs;
305
309 LayoutData<MFInterfaceFAB<VoFStencil>> m_gradPhiStencils;
310
315
319 LayoutData<MFInterfaceFAB<VoFStencil>> m_avgStencils;
320
324 LayoutData<MFInterfaceFAB<Vector<VolIndex>>> m_avgVoFs;
325
329 LayoutData<MFInterfaceFAB<Real>> m_denom;
330
334 LayoutData<MFInterfaceFAB<Real>> m_avgWeights;
335
339 LayoutData<RefCountedPtr<AggStencil<EBCellFAB, BaseIVFAB<Real>>>> m_aggStencils[2];
340
344 void
346
350 void
352
356 void
358
369 virtual bool
370 getLeastSquaresBoundaryGradStencil(std::pair<Real, VoFStencil>& a_stencil,
371 const VolIndex& a_vof,
372 const EBISBox& a_ebisbox,
373 VofUtils::Neighborhood a_neighborhood,
374 int a_order) const;
375
384 inline bool
385 isStencilValidCF(const VoFStencil& a_stencil, const DataIndex& a_dit) const;
386
393 inline Real
394 applyStencil(const VoFStencil& a_stencil, const EBCellFAB& a_phi) const;
395};
396
397#include <CD_NamespaceFooter.H>
398
399#include <CD_MFHelmholtzJumpBCImplem.H>
400
401#endif
Declaration of cell positions.
Declaration of a multiphase BaseIVFAB<Real>.
Declaration of a class that allocates irregular data holders over the interface between two phases.
Declaration of a wrapper for wrapping multifluid EBLevelGrids.
Various functions for getting Vofs near cut-cells.
Multiphase BaseIVFAB<Real>.
Definition CD_MFBaseIVFAB.H:30
static constexpr int m_comp
Component where stencils are stored.
Definition CD_MFHelmholtzJumpBC.H:214
Real m_dx
Grid resolution.
Definition CD_MFHelmholtzJumpBC.H:244
LayoutData< MFInterfaceFAB< VoFStencil > > m_avgStencils
Average stencil.
Definition CD_MFHelmholtzJumpBC.H:319
LayoutData< MFInterfaceFAB< Real > > m_boundaryPhi
Value of phi on the boundary.
Definition CD_MFHelmholtzJumpBC.H:289
LayoutData< MFInterfaceFAB< Real > > m_denom
Denominator 1/(bp*wp + bq*wq) for all interface cells.
Definition CD_MFHelmholtzJumpBC.H:329
RefCountedPtr< LevelData< MFBaseIVFAB > > BcoefPtr
Alias to cut down on typing.
Definition CD_MFHelmholtzJumpBC.H:50
virtual bool getLeastSquaresBoundaryGradStencil(std::pair< Real, VoFStencil > &a_stencil, const VolIndex &a_vof, const EBISBox &a_ebisbox, VofUtils::Neighborhood a_neighborhood, int a_order) const
Get stencil with specified order.
Definition CD_MFHelmholtzJumpBC.cpp:504
int m_ghostCF
Number of grid cells that were filled over the CF.
Definition CD_MFHelmholtzJumpBC.H:264
virtual const BaseIVFAB< Real > & getBndryPhi(int a_phase, const DataIndex &a_dit) const
Get phi on the boundary.
Definition CD_MFHelmholtzJumpBC.cpp:87
virtual const LayoutData< MFInterfaceFAB< Real > > & getGradPhiWeights() const noexcept
Get constant weights involved when computing dphi/dn at the boundary.
Definition CD_MFHelmholtzJumpBC.cpp:111
LayoutData< MFInterfaceFAB< Real > > m_gradPhiWeights
Raw weights for dphi/dn.
Definition CD_MFHelmholtzJumpBC.H:314
Real applyStencil(const VoFStencil &a_stencil, const EBCellFAB &a_phi) const
Apply a stencil and return the result.
Definition CD_MFHelmholtzJumpBCImplem.H:70
RefCountedPtr< LevelData< MFBaseIVFAB > > m_Bcoef
B-coefficient.
Definition CD_MFHelmholtzJumpBC.H:234
bool isMultiPhase() const noexcept
Is multiphase or not.
Definition CD_MFHelmholtzJumpBC.cpp:128
int m_numPhases
Number of phases.
Definition CD_MFHelmholtzJumpBC.H:269
void setBco(const RefCountedPtr< LevelData< MFBaseIVFAB > > &a_Bcoef)
Set B-coefficient. This updates the stencils.
Definition CD_MFHelmholtzJumpBC.cpp:117
int m_order
Stencil order.
Definition CD_MFHelmholtzJumpBC.H:249
LayoutData< RefCountedPtr< AggStencil< EBCellFAB, BaseIVFAB< Real > > > > m_aggStencils[2]
Agg stencils for making matching go faster.
Definition CD_MFHelmholtzJumpBC.H:339
virtual const LayoutData< MFInterfaceFAB< VoFStencil > > & getGradPhiStencils() const noexcept
Get stencils for computing dphi/dn at the boundary.
Definition CD_MFHelmholtzJumpBC.cpp:105
MFHelmholtzJumpBC & operator=(const MFHelmholtzJumpBC &a_other)=delete
Disallowed assignment constructor.
int m_radius
Stencil order.
Definition CD_MFHelmholtzJumpBC.H:259
int getWeight() const
Return stencil weight (for least squares).
Definition CD_MFHelmholtzJumpBC.cpp:75
MFHelmholtzJumpBC(const MFHelmholtzJumpBC &a_other)=delete
Disallowed copy constructor.
LayoutData< MFInterfaceFAB< Real > > m_avgWeights
Average weights.
Definition CD_MFHelmholtzJumpBC.H:334
Location::Cell m_dataLocation
Data centering.
Definition CD_MFHelmholtzJumpBC.H:224
MFHelmholtzJumpBC()=delete
Disallowed weak construction.
IntVect m_ghostPhi
Number of ghost cells in phi (must be exact match in order to use AggStencil).
Definition CD_MFHelmholtzJumpBC.H:274
virtual VoFIterator & getMultiPhaseVofs(int a_phase, const DataIndex &a_dit) const
Return vof iterator which iterates over multi-phase cells on a specified phase and box.
Definition CD_MFHelmholtzJumpBC.cpp:99
RefCountedPtr< LevelData< BaseFab< bool > > > AmrMask
Alias to cut down on typing.
Definition CD_MFHelmholtzJumpBC.H:55
void defineIterators()
Define function. Builds stencils.
Definition CD_MFHelmholtzJumpBC.cpp:447
bool isStencilValidCF(const VoFStencil &a_stencil, const DataIndex &a_dit) const
Check if stencil is valid.
Definition CD_MFHelmholtzJumpBCImplem.H:24
void defineStencils()
Define function. Builds stencils.
Definition CD_MFHelmholtzJumpBC.cpp:136
void buildAverageStencils()
Brief the average stencils.
Definition CD_MFHelmholtzJumpBC.cpp:300
virtual void resetBC() const
Set everything to zero. This is a debugging function.
Definition CD_MFHelmholtzJumpBC.cpp:561
static constexpr int m_nComp
Number of components in stencil.
Definition CD_MFHelmholtzJumpBC.H:219
int getRadius() const
Return stencil radius (for least squares).
Definition CD_MFHelmholtzJumpBC.cpp:81
RefCountedPtr< LevelData< BaseFab< bool > > > m_validCells
Valid grid cells.
Definition CD_MFHelmholtzJumpBC.H:239
LayoutData< IntVectSet > m_ivs
IntVectSet over which we run the "averaging".
Definition CD_MFHelmholtzJumpBC.H:304
MFLevelGrid m_mflg
Grids.
Definition CD_MFHelmholtzJumpBC.H:229
LayoutData< MFInterfaceFAB< VoFStencil > > m_gradPhiStencils
Raw stencils for dphi/dn.
Definition CD_MFHelmholtzJumpBC.H:309
virtual ~MFHelmholtzJumpBC()
Destructor. Does nothing.
Definition CD_MFHelmholtzJumpBC.cpp:63
bool m_dropOrder
Drop order or not.
Definition CD_MFHelmholtzJumpBC.H:284
virtual void matchBC(LevelData< BaseIVFAB< Real > > &a_jump, const LevelData< MFCellFAB > &a_phi, bool a_homogeneousPhysBC) const
Match the BC.
Definition CD_MFHelmholtzJumpBC.cpp:580
std::map< int, std::shared_ptr< LayoutData< VoFIterator > > > m_multiPhaseVofs
Iterators for multi-phase cells. The integer index is the phase.
Definition CD_MFHelmholtzJumpBC.H:299
int getOrder() const
Return stencil order.
Definition CD_MFHelmholtzJumpBC.cpp:69
LayoutData< MFInterfaceFAB< Vector< VolIndex > > > m_avgVoFs
Target vofs for average stencils.
Definition CD_MFHelmholtzJumpBC.H:324
virtual VoFIterator & getSinglePhaseVofs(int a_phase, const DataIndex &a_dit) const
Return vof iterator which iterates over single-phase cells on a specific phase and box.
Definition CD_MFHelmholtzJumpBC.cpp:93
bool m_multiPhase
Multiphase or not.
Definition CD_MFHelmholtzJumpBC.H:279
int m_weight
Stencil order.
Definition CD_MFHelmholtzJumpBC.H:254
std::map< int, std::shared_ptr< LayoutData< VoFIterator > > > m_singlePhaseVofs
Iterators for single-phase cells. The integer index is the phase.
Definition CD_MFHelmholtzJumpBC.H:294
Class for holding BaseIVFAB<T> on the interface between two phases.
Definition CD_MFInterfaceFAB.H:31
Wrapper class for holding multifluid EBLevelGrids.
Definition CD_MFLevelGrid.H:30
Static class which contains some routines for fetching VoFs using various algorithms....
Definition CD_VofUtils.H:35
Namespace for encapsulating various data centerings.
Definition CD_Location.H:25
Cell
Enum for distinguishing between cell locations.
Definition CD_Location.H:31