chombo-discharge
Loading...
Searching...
No Matches
CD_PetscHelmholtzEBStencils.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#ifdef CH_USE_PETSC
14
15#ifndef CD_PETSCHELMHOLTZEBSTENCILS_H
16#define CD_PETSCHELMHOLTZEBSTENCILS_H
17
18// Chombo includes
19#include <RefCountedPtr.H>
20#include <RealVect.H>
21#include <Vector.H>
22#include <LayoutData.H>
23#include <BaseIVFAB.H>
24
25// Our includes
26#include <CD_PetscGrid.H>
27#include <CD_PetscStencil.H>
29#include <CD_VofUtils.H>
30#include <CD_NamespaceHeader.H>
31
61{
62public:
66 PetscHelmholtzEBStencils() noexcept;
67
71 virtual ~PetscHelmholtzEBStencils() noexcept;
72
78
84
91 operator=(const PetscHelmholtzEBStencils& a_other) = delete;
92
99 operator=(const PetscHelmholtzEBStencils&& a_other) = delete;
100
106 virtual long long
107 getNumCellsWithoutStencil() const noexcept;
108
113 virtual void
114 setOrder(const int a_order) noexcept;
115
120 virtual void
121 setWeight(const int a_weight) noexcept;
122
128 virtual void
129 clear() noexcept;
130
141 virtual void
142 define(const RefCountedPtr<PetscGrid>& a_petscGrid,
143 const Vector<MFMultigridInterpolator>& a_interpolators,
144 const RealVect& a_probLo,
145 const Vector<Real>& a_dx) noexcept;
146
147protected:
152
157
162
167
172
176 RefCountedPtr<PetscGrid> m_petscGrid;
177
182
186 RealVect m_probLo;
187
191 Vector<Real> m_dx;
192
197 Vector<RefCountedPtr<LayoutData<BaseIVFAB<PetscStencil>>>> m_derivStencils[2];
198
203 Vector<RefCountedPtr<LayoutData<BaseIVFAB<Real>>>> m_derivWeights[2];
204
214 virtual void
215 getNormalDerivativeStencil(Real& a_boundaryWeight,
216 PetscStencil& a_stencil,
217 const int a_phase,
218 const int a_level,
219 const DataIndex& a_din,
220 const VolIndex& a_vof) const noexcept;
221
233 virtual void
234 computeNormalDerivativeStencil(Real& a_boundaryWeight,
235 PetscStencil& a_stencil,
236 const int a_phase,
237 const int a_level,
238 const DataIndex& a_din,
239 const VolIndex& a_vof) const noexcept;
240
256 virtual bool
257 getLeastSquaresStencil(Real& a_boundaryWeight,
258 PetscStencil& a_stencil,
259 const int a_phase,
260 const int a_level,
261 const DataIndex& a_din,
262 const VolIndex& a_vof,
263 const VofUtils::Neighborhood a_neighborhood,
264 const int a_order) const noexcept;
265
274 virtual RealVect
275 getBoundaryPosition(const int a_phase,
276 const int a_level,
277 const DataIndex& a_din,
278 const VolIndex& a_vof) const noexcept;
279};
280
281#include <CD_NamespaceFooter.H>
282
283#endif
284
285#endif
Declaration of a wrapper class for holding multifluid EBMultigridInterpolators.
File containing declaration of PetscGrid.
Declaration of a simple stencil class for PETSc.
Various functions for getting Vofs near cut-cells.
Wrapper class for holding multifluid EBMultigridInterpolators.
Definition CD_MFMultigridInterpolator.H:27
Class which maps a multifluid cut-cell AMR hierarchy to PETSc.
Definition CD_PetscGrid.H:47
bool m_verbose
Verbose output or not.
Definition CD_PetscHelmholtzEBStencils.H:161
virtual long long getNumCellsWithoutStencil() const noexcept
Get the number of cut cells, summed over phases, levels and ranks, that have an EB face but no stenci...
Definition CD_PetscHelmholtzEBStencils.cpp:481
virtual void getNormalDerivativeStencil(Real &a_boundaryWeight, PetscStencil &a_stencil, const int a_phase, const int a_level, const DataIndex &a_din, const VolIndex &a_vof) const noexcept
Get the stored one-sided normal derivative at the EB face of a cut cell.
Definition CD_PetscHelmholtzEBStencils.cpp:194
virtual void computeNormalDerivativeStencil(Real &a_boundaryWeight, PetscStencil &a_stencil, const int a_phase, const int a_level, const DataIndex &a_din, const VolIndex &a_vof) const noexcept
Compute the one-sided normal derivative at the EB face of a cut cell.
Definition CD_PetscHelmholtzEBStencils.cpp:215
long long m_numCellsWithoutStencil
Number of cut cells, summed over phases, levels and ranks, that have an EB face but no stencil.
Definition CD_PetscHelmholtzEBStencils.H:156
int m_order
Highest order of the stencils, or -1 if not set.
Definition CD_PetscHelmholtzEBStencils.H:166
PetscHelmholtzEBStencils(const PetscHelmholtzEBStencils &&a_other)=delete
Disallowed move constructor.
RefCountedPtr< PetscGrid > m_petscGrid
PETSc grid.
Definition CD_PetscHelmholtzEBStencils.H:176
Vector< MFMultigridInterpolator > m_interpolators
Coarse-fine ghost cell interpolators of both phases, on each level.
Definition CD_PetscHelmholtzEBStencils.H:181
virtual ~PetscHelmholtzEBStencils() noexcept
Destructor.
Definition CD_PetscHelmholtzEBStencils.cpp:42
Vector< RefCountedPtr< LayoutData< BaseIVFAB< Real > > > > m_derivWeights[2]
The weights w_B of the boundary value in the one-sided normal derivatives.
Definition CD_PetscHelmholtzEBStencils.H:203
bool m_isDefined
Is defined or not.
Definition CD_PetscHelmholtzEBStencils.H:151
virtual void setWeight(const int a_weight) noexcept
Set the least-squares weighting.
Definition CD_PetscHelmholtzEBStencils.cpp:62
Vector< RefCountedPtr< LayoutData< BaseIVFAB< PetscStencil > > > > m_derivStencils[2]
The stencils of the one-sided normal derivatives, over PETSc rows.
Definition CD_PetscHelmholtzEBStencils.H:197
virtual RealVect getBoundaryPosition(const int a_phase, const int a_level, const DataIndex &a_din, const VolIndex &a_vof) const noexcept
Get the physical position of the centroid of the EB face of a cut cell.
Definition CD_PetscHelmholtzEBStencils.cpp:463
virtual void setOrder(const int a_order) noexcept
Set the order of the stencils.
Definition CD_PetscHelmholtzEBStencils.cpp:51
virtual void clear() noexcept
Release the stored stencils, the grids and the interpolators, so that the object can be defined again...
Definition CD_PetscHelmholtzEBStencils.cpp:73
Vector< Real > m_dx
Grid resolution on each level.
Definition CD_PetscHelmholtzEBStencils.H:191
PetscHelmholtzEBStencils & operator=(const PetscHelmholtzEBStencils &a_other)=delete
Disallowed copy assignment operator.
PetscHelmholtzEBStencils() noexcept
Default constructor. Must subsequently set the order and the weight, and call define.
Definition CD_PetscHelmholtzEBStencils.cpp:28
int m_weight
Least-squares weighting, or -1 if not set.
Definition CD_PetscHelmholtzEBStencils.H:171
PetscHelmholtzEBStencils(const PetscHelmholtzEBStencils &a_other)=delete
Disallowed copy constructor.
virtual bool getLeastSquaresStencil(Real &a_boundaryWeight, PetscStencil &a_stencil, const int a_phase, const int a_level, const DataIndex &a_din, const VolIndex &a_vof, const VofUtils::Neighborhood a_neighborhood, const int a_order) const noexcept
Try to compute the one-sided normal derivative at the EB face of a cut cell, for one neighbourhood an...
Definition CD_PetscHelmholtzEBStencils.cpp:263
virtual void define(const RefCountedPtr< PetscGrid > &a_petscGrid, const Vector< MFMultigridInterpolator > &a_interpolators, const RealVect &a_probLo, const Vector< Real > &a_dx) noexcept
Define over the AMR hierarchy, and compute the one-sided normal derivative stencils of every cut cell...
Definition CD_PetscHelmholtzEBStencils.cpp:95
PetscHelmholtzEBStencils & operator=(const PetscHelmholtzEBStencils &&a_other)=delete
Disallowed move assignment operator.
RealVect m_probLo
Lower-left corner of the computational domain.
Definition CD_PetscHelmholtzEBStencils.H:186
A linear stencil over global PETSc rows, i.e. a list of (row, weight) pairs.
Definition CD_PetscStencil.H:43
Static class which contains some routines for fetching VoFs using various algorithms....
Definition CD_VofUtils.H:35