24#ifndef PECLET_FLOW_FULL_STRESS_HPP
25#define PECLET_FLOW_FULL_STRESS_HPP
28#include <Kokkos_Core.hpp>
36using RegMask = Kokkos::View<std::uint8_t*, CCMem>;
37using RegConst = Kokkos::View<const std::uint8_t*, CCMem>;
48template <
class FaceProps,
bool kSol
id>
50 C3 e,
int g,
double wc,
bool skipLoC,
52 const long st[3] = {1L, (long)e.x, (
long)e.x * e.y};
53 const int a1 = (c == 0) ? 1 : 0, a2 = (c == 2) ? 1 : 2;
54 const long sc = st[c], s1 = st[a1], s2 = st[a2];
55 const CCConst vc = v[c], va1 = v[a1], va2 = v[a2];
56 const RegConst rc = reg[c], ra1 = reg[a1], ra2 = reg[a2];
57 const int lo[3] = {g + ((skipLoC && c == 0) ? 1 : 0), g + ((skipLoC && c == 1) ? 1 : 0),
58 g + ((skipLoC && c == 2) ? 1 : 0)};
60 "peclet::flow::full_stress_rhs",
C3{
lo[0],
lo[1],
lo[2]},
C3{
e.x -
g,
e.y -
g,
e.z -
g},
61 KOKKOS_LAMBDA(
int x,
int y,
int z) {
62 const long i = (long)x + (
long)
y *
st[1] + (long)z * st[2];
68 double nP = fp.beta(i, i + sc) * (vc(i + sc) - vc(i));
69 double nM = fp.beta(i - sc, i) * (vc(i) - vc(i - sc));
71 double p1 = fp.beta(i, i + s1) * (va1(i + s1) - va1(i + s1 - sc));
72 double m1 = fp.beta(i, i - s1) * (va1(i) - va1(i - sc));
73 double p2 = fp.beta(i, i + s2) * (va2(i + s2) - va2(i + s2 - sc));
74 double m2 = fp.beta(i, i - s2) * (va2(i) - va2(i - sc));
80 if (!(
rc(i + s1) && ra1(i + s1) && ra1(i + s1 - sc)))
82 if (!(
rc(i - s1) && ra1(i) && ra1(i - sc)))
84 if (!(
rc(i + s2) && ra2(i + s2) && ra2(i + s2 - sc)))
86 if (!(
rc(i - s2) && ra2(i) && ra2(i - sc)))
89 const double t = wc * (((nP - nM) + (p1 -
m1)) + (p2 -
m2));
99 Kokkos::MinMaxScalar<double> r;
100 Kokkos::parallel_reduce(
101 "peclet::flow::full_stress_mu_range",
102 MDRange3<CCExec>(space, {g - 1, g - 1, g - 1}, {e.x - g + 1, e.y - g + 1, e.z - g + 1}),
103 KOKKOS_LAMBDA(
int x,
int y,
int z, Kokkos::MinMaxScalar<double>& acc) {
104 const long i = (long)x + (
long)y * e.x + (long)z * (
long)e.x * e.y;
105 const double m = mu(i);
111 Kokkos::MinMax<double>(r));
flow — portable (Kokkos) cut-cell pressure-operator face openness from an SDF.
Kokkos::DefaultExecutionSpace CCExec
Kokkos::MDRangePolicy< Exec, Kokkos::Rank< 3, Kokkos::Iterate::Left, Kokkos::Iterate::Left > > MDRange3
3-D range, x (the first index) fastest (both the tile order and the order within a tile).
Kokkos::View< const double *, CCMem > CCConst
Kokkos::View< const std::uint8_t *, CCMem > RegConst
void addFullStressRhs(int c, CCField bb, CCConst rs, const CCConst(&v)[3], FaceProps fp, C3 e, int g, double wc, bool skipLoC, const RegConst(®)[3]={RegConst(), RegConst(), RegConst()})
Add rs_c · T_c(uⁿ) to the momentum RHS bb of component c over the inner cells [g, e−g)³.
Kokkos::View< double *, CCMem > CCField
void ccFor3(const char *name, C3 lo, C3 hi, F f)
void muRangeInner(CCConst mu, C3 e, int g, double &lo, double &hi)
The local min and max of mu over [g−1, e−g+1)³ — the inner cells plus the one ghost ring the transpos...
Kokkos::View< std::uint8_t *, CCMem > RegMask
Per-component regular-node mask (§5.4): 1 = a velocity node with neither a solid nor a cut row.
Kokkos::View< const double *, CCMem > CCConst
Kokkos::View< const std::uint8_t *, CCMem > RegConst