chombo-discharge
Loading...
Searching...
No Matches
CD_MirrorDeposition.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_MIRRORDEPOSITION_H
14#define CD_MIRRORDEPOSITION_H
15
16// Chombo includes
17#include <REAL.H>
18#include <RealVect.H>
19#include <SPACE.H>
20
21// Our includes
22#include <CD_NamespaceHeader.H>
23
39
43constexpr int numTangents = SpaceDim - 1;
44
48constexpr int numShapeComp = (SpaceDim * (SpaceDim + 1)) / 2;
49
53constexpr int compStatus = 0;
54
58constexpr int compCentroid = 1;
59
63constexpr int compNormal = compCentroid + SpaceDim;
64
68constexpr int compShape = compNormal + SpaceDim;
69
73constexpr int numComp = compShape + numShapeComp;
74
82enum class Status
83{
89 None = 0,
90
94 Fitted = 1,
95
101 Planar = 2
102};
103
107enum class Refusal
108{
112 None,
113
120
125
130};
131
140inline void
141liftShapeOperator(const RealVect (&a_tangents)[numTangents],
142 const Real (&a_S)[numTangents][numTangents],
143 Real (&a_shape)[numShapeComp]) noexcept;
144
153inline int
154shapeIndex(const int a_i, const int a_j) noexcept;
155
163inline Real
164shapeEntry(const Real* a_shape, const int a_i, const int a_j) noexcept;
165
172inline RealVect
173applyShapeOperator(const Real* a_shape, const RealVect& a_vec) noexcept;
174
180inline Real
181meanCurvatureTimesTwo(const Real* a_shape) noexcept;
182
193inline Real
194gaussianCurvature(const Real* a_shape) noexcept;
195
207inline Real
208jacobian(const Real a_twoH, const Real a_K, const Real a_d, Real& a_denominator) noexcept;
209
240inline bool
241reflect(const RealVect& a_pos,
242 const Real* a_surfaceData,
243 const Real a_maxJacobian,
244 const Real a_minDenominator,
245 RealVect& a_image,
246 Real& a_jacobian,
247 Real& a_signedDistance,
248 Refusal& a_refusal) noexcept;
249
250} // namespace MirrorDeposition
251
252#include <CD_NamespaceFooter.H>
253
255
256#endif
Implementation of CD_MirrorDeposition.H.
Geometry for mirrored cut-cell deposition, i.e. the even extension of the density about an embedded b...
Definition CD_MirrorDeposition.H:38
constexpr int compCentroid
First of the SpaceDim components holding the boundary centroid, as a PHYSICAL position.
Definition CD_MirrorDeposition.H:58
Status
What a band cell's surface data is good for.
Definition CD_MirrorDeposition.H:83
@ None
No surface data. The band cell found no cut cell whose data was actually delivered to this level.
@ Planar
Centroid and normal, but the curvature fit was refused, so the shape operator is zero.
@ Fitted
Full quadratic patch: centroid, normal, and a fitted shape operator.
constexpr int numTangents
Number of tangent directions on the surface. One in 2-D, two in 3-D.
Definition CD_MirrorDeposition.H:43
int shapeIndex(const int a_i, const int a_j) noexcept
Index into the stored upper triangle of a symmetric SpaceDim x SpaceDim tensor.
Definition CD_MirrorDepositionImplem.H:26
constexpr int compStatus
Component holding the band cell's status. See MirrorDeposition::Status.
Definition CD_MirrorDeposition.H:53
Refusal
Why reflect() refused to trust its Jacobian.
Definition CD_MirrorDeposition.H:108
@ NonPositiveJacobian
The Jacobian came out non-positive, i.e. the reflection is past the surface's centre of curvature.
@ SmallDenominator
The Jacobian's denominator came too close to zero.
@ LargeJacobian
The Jacobian exceeded the permitted magnitude.
constexpr int compShape
First of the numShapeComp components holding the world-frame shape operator's upper triangle.
Definition CD_MirrorDeposition.H:68
Real shapeEntry(const Real *a_shape, const int a_i, const int a_j) noexcept
Read one entry of a world-frame shape operator stored as an upper triangle.
Definition CD_MirrorDepositionImplem.H:59
constexpr int compNormal
First of the SpaceDim components holding the unit normal, pointing INTO the fluid.
Definition CD_MirrorDeposition.H:63
constexpr int numShapeComp
Number of independent entries in a symmetric SpaceDim x SpaceDim tensor. Three in 2-D,...
Definition CD_MirrorDeposition.H:48
Real meanCurvatureTimesTwo(const Real *a_shape) noexcept
Twice the mean curvature, i.e. the first invariant of the shape operator.
Definition CD_MirrorDepositionImplem.H:83
bool reflect(const RealVect &a_pos, const Real *a_surfaceData, const Real a_maxJacobian, const Real a_minDenominator, RealVect &a_image, Real &a_jacobian, Real &a_signedDistance, Refusal &a_refusal) noexcept
Reflect a position across the quadratic surface patch stored for its cell, and weight the image.
Definition CD_MirrorDepositionImplem.H:124
Real jacobian(const Real a_twoH, const Real a_K, const Real a_d, Real &a_denominator) noexcept
The exact area/volume Jacobian of the reflection across a curved surface.
Definition CD_MirrorDepositionImplem.H:114
RealVect applyShapeOperator(const Real *a_shape, const RealVect &a_vec) noexcept
Apply a world-frame shape operator to a vector.
Definition CD_MirrorDepositionImplem.H:65
Real gaussianCurvature(const Real *a_shape) noexcept
Gaussian curvature, i.e. the second invariant of the shape operator.
Definition CD_MirrorDepositionImplem.H:95
void liftShapeOperator(const RealVect(&a_tangents)[numTangents], const Real(&a_S)[numTangents][numTangents], Real(&a_shape)[numShapeComp]) noexcept
Lift a shape operator from the tangent frame into world coordinates.
Definition CD_MirrorDepositionImplem.H:37
constexpr int numComp
Total number of components in the surface-data holder. Eight in 2-D, thirteen in 3-D.
Definition CD_MirrorDeposition.H:73