core 1.5.0
Shared MPI block decomposition, asynchronous ghost-layer exchange, SDF geometry, load balancing (header-only C++20)
Loading...
Searching...
No Matches
cutcell.hpp
Go to the documentation of this file.
1
76#ifndef PECLET_CORE_VOF_CUTCELL_HPP
77#define PECLET_CORE_VOF_CUTCELL_HPP
78
79#include <Kokkos_Core.hpp>
80
81namespace peclet::core::vof {
82
85inline constexpr double kVofEpsFloor = 1.0 / 64.0;
86
90inline constexpr double kVofCourantEpsFloor = 0.1;
91
94enum VofCellKind : unsigned char {
97};
98
102 if (solid)
103 return 0.0;
104 return eps > kVofEpsFloor ? eps : kVofEpsFloor;
105}
106
109KOKKOS_INLINE_FUNCTION bool vofIsSolidCell(double eps, const double oLo[3], const double oHi[3]) {
110 if (eps > 0.0)
111 return false;
112 for (int d = 0; d < 3; ++d)
113 if (oLo[d] > 0.0 || oHi[d] > 0.0)
114 return false;
115 return true;
116}
117
121 return openness * rawFlux;
122}
123
145 double cDon) {
146 double hi = epsDon * cDon;
147 if (sweep < hi)
148 hi = sweep;
149 double lo = sweep - epsDon * (1.0 - cDon);
150 if (lo < 0.0)
151 lo = 0.0;
152 if (lo > hi)
153 lo = hi; // a donor thinner than the swept volume: give everything it has
154 return fluxMag > hi ? hi : (fluxMag < lo ? lo : fluxMag);
155}
156
175KOKKOS_INLINE_FUNCTION double vofCutCourant(double openness, double a, double eps) {
176 const double e = eps > kVofCourantEpsFloor ? eps : kVofCourantEpsFloor;
177 const double aa = a < 0.0 ? -a : a;
178 const double cut = openness * aa / e;
179 return aa > cut ? aa : cut;
180}
181
184KOKKOS_INLINE_FUNCTION double vofClipCut(double c, double epsEff, double& moved) {
185 const double cc = c < 0.0 ? 0.0 : (c > 1.0 ? 1.0 : c);
186 moved = epsEff * (cc - c);
187 return cc;
188}
189
195enum VofFillState : unsigned char {
199};
200
203KOKKOS_INLINE_FUNCTION bool vofFillReadable(unsigned char state, int k) {
205}
206
209 if (i < g)
210 return g - i;
211 if (i >= g + n)
212 return i - (g + n) + 1;
213 return 0;
214}
215
217KOKKOS_INLINE_FUNCTION int vofGhostDepth(int x, int y, int z, int g, int nx, int ny, int nz) {
218 const int a = vofGhostDepth1(x, g, nx), b = vofGhostDepth1(y, g, ny),
219 c = vofGhostDepth1(z, g, nz);
220 const int m = a > b ? a : b;
221 return m > c ? m : c;
222}
223
224} // namespace peclet::core::vof
225
226#endif // PECLET_CORE_VOF_CUTCELL_HPP
double vofCutFluxClamp(double fluxMag, double sweep, double epsDon, double cDon)
Weymouth's admissible flux interval, generalized to a cut donor cell — the cut-cell twin of momentum_...
Definition cutcell.hpp:144
VofFillState
Band-fill state, stored per cell on the colour block.
Definition cutcell.hpp:195
@ kVofFillPass0
pass k marks kVofFillPass0 + k, i.e. 2, 3, 4
Definition cutcell.hpp:198
double vofCutCourant(double openness, double a, double eps)
The boundedness-relevant Courant number of a face against a cell (rule 2).
Definition cutcell.hpp:175
constexpr double kVofCourantEpsFloor
Below this the interface-local Courant number stops being amplified by 1/eps (rule 2): a cut cell at ...
Definition cutcell.hpp:90
double vofCutFlux(double openness, double rawFlux)
The openness-weighted geometric flux (1): one number per face, used with opposite signs by the two ne...
Definition cutcell.hpp:120
bool vofIsSolidCell(double eps, const double oLo[3], const double oHi[3])
Is this cell SOLID? eps == 0 and every one of the six faces closed.
Definition cutcell.hpp:109
constexpr double kVofEpsFloor
The smallest fluid volume buildCellFraction's 4³ subsampling can resolve (one subcell of 64).
Definition cutcell.hpp:85
bool vofFillReadable(unsigned char state, int k)
Is state readable by pass k (1-based)? Fluid always; a solid cell only if an EARLIER pass filled it.
Definition cutcell.hpp:203
VofCellKind
Cell classification on the colour block.
Definition cutcell.hpp:94
@ kVofSolid
eps == 0 AND all six faces closed: no colour, filled for the stencils
Definition cutcell.hpp:96
@ kVofFluid
carries colour; eps_eff > 0; at least one open face OR eps > 0
Definition cutcell.hpp:95
double vofEpsEff(double eps, bool solid)
The effective fluid volume of a cell (rule 1).
Definition cutcell.hpp:101
int vofGhostDepth(int x, int y, int z, int g, int nx, int ny, int nz)
Ghost depth of a cell = the max over the three axes.
Definition cutcell.hpp:217
double vofClipCut(double c, double epsEff, double &moved)
The clip of rule 3, returned as the CLIPPED value; moved receives the liquid VOLUME the clip created ...
Definition cutcell.hpp:184
int vofGhostDepth1(int i, int g, int n)
Ghost depth of an index on one axis of an extended block: 0 for an inner cell, growing outward.
Definition cutcell.hpp:208
Kokkos::View< T *, MemSpace > View
1D device array.
Definition view.hpp:26