15#ifndef PECLET_FLOW_PROPERTY_CLOSURES_HPP
16#define PECLET_FLOW_PROPERTY_CLOSURES_HPP
19#include <Kokkos_Core.hpp>
45 std::array<double, 4>
p{{0, 0, 0, 0}};
51 std::array<double, 4>
pPhys{{0, 0, 0, 0}};
62 const double p0 = cl.
p[0], p1 = cl.
p[1], p2 = cl.
p[2], p3 = cl.
p[3];
63 const bool haveIn1 = (in1.data() !=
nullptr) && (in1.extent(0) == out.extent(0));
65 const int nTab = cl.
nTab;
67 "peclet::flow::apply_closure", MD(space, {g, g, g}, {e.x - g, e.y - g, e.z - g}),
68 KOKKOS_LAMBDA(
int x,
int y,
int z) {
69 const long i = (long)x + (
long)y * e.x + (long)z * (
long)e.x * e.y;
73 v = p0 + p1 * in0(i) + (haveIn1 ? p2 * in1(i) : 0.0);
76 v = p0 * p1 * p2 * (in0(i) - p3);
79 v = p0 * Kokkos::exp(p1 * (1.0 / in0(i) - 1.0 / p2));
82 const double s = in0(i);
85 }
else if (s <= tx(0)) {
87 }
else if (s >= tx(nTab - 1)) {
90 int lo = 0, hi = nTab - 1;
92 const int mid = (lo + hi) / 2;
98 const double t = (s - tx(lo)) / (tx(hi) - tx(lo));
99 v = ty(lo) + t * (ty(hi) - ty(lo));
128 const double p0c = cl.
p[0], p1c = cl.
p[1], p2c = cl.
p[2], p3c = cl.
p[3];
129 const bool haveIn1 = (in1.data() !=
nullptr) && (in1.extent(0) == out.extent(0));
131 const int nTab = cl.
nTab;
132 const int dims[3] = {e.x, e.y, e.z};
133 const long st[3] = {1, (long)e.x, (
long)e.x * e.y};
134 const int b = (a + 1) % 3, c = (a + 2) % 3;
135 const long sa = st[a], sb = st[b], sc = st[c];
136 const int lo = (side == 0) ? 0 : (dims[a] - g);
138 Kokkos::parallel_for(
139 "peclet::flow::apply_closure_face_ghost", MD(space, {0, 0}, {dims[b], dims[c]}),
140 KOKKOS_LAMBDA(
int j0,
int j1) {
141 const long base = (long)j0 * sb + (
long)j1 * sc;
142 for (
int k = 0; k < g; ++k) {
143 const long i = base + (long)(lo + k) * sa;
147 v = p0c + p1c * in0(i) + (haveIn1 ? p2c * in1(i) : 0.0);
150 v = p0c * p1c * p2c * (in0(i) - p3c);
153 v = p0c * Kokkos::exp(p1c * (1.0 / in0(i) - 1.0 / p2c));
156 const double sv = in0(i);
159 }
else if (
sv <= tx(0)) {
161 }
else if (
sv >= tx(nTab - 1)) {
164 int l = 0, h = nTab - 1;
166 const int mid = (l + h) / 2;
172 const double t = (
sv - tx(l)) / (tx(h) - tx(l));
173 v = ty(l) + t * (ty(h) - ty(l));
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
void applyClosureFaceGhost(const Closure &cl, C3 e, int g, int a, int side)
Kokkos::View< double *, CCMem > CCField
void applyClosure(const Closure &cl, C3 e, int g)
Kokkos::MDRangePolicy< Exec, Kokkos::Rank< 2, Kokkos::Iterate::Left, Kokkos::Iterate::Left > > MDRange2
2-D range, first index fastest (both the tile order and the order within a tile).
flow — the multidimensional iteration policies: iteration order follows storage.
std::array< double, 4 > p
std::vector< double > tabYPhys
std::array< double, 4 > pPhys