22#ifndef PECLET_FLOW_STAR_ELIMINATION_HPP
23#define PECLET_FLOW_STAR_ELIMINATION_HPP
25#include <Kokkos_Core.hpp>
36 Kokkos::View<int*, CCMem>
cell;
37 Kokkos::View<float*, CCMem>
a;
42 ov.
cell = Kokkos::View<int*, CCMem>(
"star_cell", n);
43 ov.
a = Kokkos::View<float*, CCMem>(
"star_a", 6 * n);
49 return v < 0 ? v + n : v;
58 const StarOverlay& ov, Kokkos::View<int, CCMem> counter) {
60 Kokkos::deep_copy(counter, 0);
61 const bool fill = ov.
cell.extent(0) > 0;
62 using MD = Kokkos::MDRangePolicy<CCExec, Kokkos::Rank<3>>;
64 "peclet::flow::star_build",
MD(
space, {0, 0, 0}, {
nn.x,
nn.y,
nn.z}),
67 const long st[3] = {
sx,
sy,
sz};
74 for (
int a2 = 0;
a2 < 3; ++
a2) {
76 const bool fp = sdf(
i + st[
a2]) >= 0.0,
fm = sdf(
i - st[
a2]) >= 0.0;
77 av[2 *
a2] = (
fp && op > 0.0) ? (
float)op : 0.0f;
78 av[2 *
a2 + 1] = (
fm &&
om > 0.0) ? (
float)
om : 0.0f;
83 const int slot = Kokkos::atomic_fetch_add(&counter(), 1);
86 for (
int k = 0;
k < 6; ++
k)
91 auto h = Kokkos::create_mirror_view(counter);
92 Kokkos::deep_copy(
h, counter);
104 Kokkos::parallel_for(
105 "peclet::flow::star_apply", Kokkos::RangePolicy<CCExec>(
space, 0,
nOv),
107 const int inner = ov.
cell(s);
108 const int ix = inner %
nn.x,
iy = (inner /
nn.x) %
nn.y,
iz = inner / (
nn.x *
nn.y);
115 double D = 0.0,
num = 0.0;
117 for (
int k = 0;
k < 6; ++
k) {
118 const double a = ov.
a(s * 6 +
k);
126 for (
int k = 0;
k < 6; ++
k) {
127 const double a = ov.
a(s * 6 +
k);
148 Kokkos::parallel_for(
149 "peclet::flow::star_correct_faces", Kokkos::RangePolicy<CCExec>(
space, 0,
nOv),
151 const int inner = ov.
cell(s);
152 const int ix = inner %
nn.x,
iy = (inner /
nn.x) %
nn.y,
iz = inner / (
nn.x *
nn.y);
163 double D = 0.0,
num = 0.0;
164 for (
int k = 0;
k < 6; ++
k) {
165 const double a = ov.
a(s * 6 +
k);
173 for (
int k = 0;
k < 6; ++
k) {
174 if (ov.
a(s * 6 +
k) <= 0.0)
176 const int a2 =
k / 2;
flow — portable (Kokkos) cut-cell pressure-operator face openness from an SDF.
StarOverlay starMakeOverlay(long n)
int buildStarOverlay(CCConst sdf, CCConst ox, CCConst oy, CCConst oz, C3 ext, int g, C3 nn, const StarOverlay &ov, Kokkos::View< int, CCMem > counter)
Count + fill the star overlay from the cell-centered sdf and the ORIGINAL (unfiltered) apertures on t...
void starApplyDelta(CCField y, CCConst x, const StarOverlay &ov, int nOv, C3 nn, C3 extY, int gY, C3 extX, int gX)
y += S_star x over the inner cells of the (extY, gY) block, x read from the (extX,...
void starCorrectFaces(CCField uf, CCField vf, CCField wf, CCConst phi, const StarOverlay &ov, int nOv, C3 nn, C3 ext, int g, C3 extP, int gP)
Fix the face correction at fluid|solid faces: projectCorrect applied -(phi_hi - phi_lo) with the soli...
void ibmFillEntry(const OV &o, int list_idx, int c_idx, float sdf_c, const float sdf_n[6], int bc_type, const float *thEx)
Kokkos::View< double *, CCMem > CCField
int starWrap(int v, int n)
Kokkos::DefaultExecutionSpace CCExec
Kokkos::View< const double *, CCMem > CCConst
One entry per eliminated solid-centered cell: packed INNER flat index + the apertures of its (up to 6...
Kokkos::View< float *, CCMem > a
Kokkos::View< int *, CCMem > cell