27#include <Kokkos_Core.hpp>
38#define CHECK(cond, ...) \
41 std::fprintf(stderr, "CHECK failed: %s at %s:%d ", #cond, __FILE__, __LINE__); \
42 std::fprintf(stderr, __VA_ARGS__); \
43 std::fprintf(stderr, "\n"); \
49using DV = Kokkos::View<double*, CCMem>;
50constexpr bool kHost = std::is_same_v<CCMem, Kokkos::HostSpace>;
51constexpr double kPi = 3.14159265358979323846;
61 Box(
int nx,
int ny,
int nz,
double hx,
double hy,
double hz) {
62 n[0] = nx, n[1] = ny, n[2] = nz;
63 h[0] = hx, h[1] = hy, h[2] = hz;
64 for (
int a = 0; a < 3; ++a)
66 st[0] = 1, st[1] = e[0], st[2] = (long)e[0] * e[1];
67 cells = (long)e[0] * e[1] * e[2];
68 const double hr = std::min(hx, std::min(hy, hz));
69 for (
int a = 0; a < 3; ++a)
70 w[a] = (hr / h[a]) * (hr / h[a]);
72 long idx(
int x,
int y,
int z)
const {
return (
long)x + (long)y * st[1] + (
long)z * st[2]; }
73 bool inner(
int x,
int y,
int z)
const {
74 return x >= g && x < e[0] - g && y >= g && y < e[1] - g && z >= g && z < e[2] - g;
76 C3 c3()
const {
return C3{e[0], e[1], e[2]}; }
78 void pos(
int c,
int x,
int y,
int z,
double* X)
const {
79 const int q[3] = {x, y, z};
80 for (
int a = 0; a < 3; ++a)
81 X[a] = (q[a] - g + ((a == c) ? 0.0 : 0.5)) * h[a];
84 void wrap(std::vector<double>& f)
const {
85 for (
int z = 0; z < e[2]; ++z)
86 for (
int y = 0; y < e[1]; ++y)
87 for (
int x = 0; x < e[0]; ++x) {
90 auto wr = [&](
int q,
int a) {
return g + (((q - g) % n[a]) + n[a]) % n[a]; };
91 f[idx(x, y, z)] = f[idx(wr(x, 0), wr(y, 1), wr(z, 2))];
96DV toDev(
const std::vector<double>& h,
const char* name) {
98 auto m = Kokkos::create_mirror_view(d);
99 for (std::size_t i = 0;
i <
h.size(); ++
i)
101 Kokkos::deep_copy(d, m);
104std::vector<double>
toHost(
const DV& d) {
105 auto m = Kokkos::create_mirror_view(d);
106 Kokkos::deep_copy(m, d);
107 std::vector<double>
h(
d.extent(0));
108 for (std::size_t i = 0;
i <
h.size(); ++
i)
125std::vector<double> kernelT(
const Box& b,
int c,
const std::vector<double>* v,
const DV& mu,
126 const std::vector<std::uint8_t>* reg =
nullptr,
bool skipLo =
false) {
127 DV bb(
"bb",
b.cells), rs(
"rs",
b.cells);
128 Kokkos::deep_copy(rs, 1.0);
133 for (
int a = 0;
a < 3; ++
a) {
135 auto m = Kokkos::create_mirror_view(r);
136 for (
long i = 0;
i <
b.cells; ++
i)
138 Kokkos::deep_copy(r, m);
141 addFullStressRhs<VarFaceProps, true>(c, bb,
CCConst(rs), vv,
props(b, mu, c),
b.c3(),
b.g,
144 addFullStressRhs<VarFaceProps, false>(c, bb,
CCConst(rs), vv,
props(b, mu, c),
b.c3(),
b.g,
152std::vector<double> oracleT(
const Box& b,
int c,
const std::vector<double>* v,
153 const std::vector<double>& mu,
154 const std::vector<std::uint8_t>* reg =
nullptr,
bool skipLo =
false) {
155 std::vector<double>
T(
b.cells, 0.0);
156 const long sc =
b.st[
c];
157 auto beta = [&](
long i,
long j) {
162 return 0.5 * (0.5 * (mu[
i] + mu[
j]) + 0.5 * (mu[
i -
sc] + mu[
j -
sc]));
164 auto R = [&](
int a,
long i) {
return reg ? (bool)reg[a][i] : true; };
165 auto N = [&](
long k) {
166 return R(c, k) &&
R(c, k + sc) ? beta(k, k + sc) * (
v[
c][
k +
sc] -
v[
c][
k]) : 0.0;
168 auto Sp = [&](
long i,
int a) {
169 const long sa =
b.st[
a];
170 const bool inc =
R(c, i) &&
R(c, i + sa) &&
R(a, i + sa) &&
R(a, i + sa - sc);
171 return inc ? beta(i, i + sa) * (
v[
a][
i + sa] -
v[
a][
i + sa -
sc]) : 0.0;
173 auto Sm = [&](
long i,
int a) {
174 const long sa =
b.st[
a];
175 const bool inc =
R(c, i) &&
R(c, i - sa) &&
R(a, i) &&
R(a, i - sc);
176 return inc ? beta(i, i - sa) * (
v[
a][
i] -
v[
a][
i -
sc]) : 0.0;
178 const int a1 = (
c == 0) ? 1 : 0,
a2 = (
c == 2) ? 1 : 2;
179 for (
int z =
b.g; z <
b.e[2] -
b.g; ++z)
180 for (
int y =
b.g; y <
b.e[1] -
b.g; ++y)
181 for (
int x =
b.g; x <
b.e[0] -
b.g; ++x) {
182 const int q[3] = {x, y, z};
183 if (skipLo && q[c] ==
b.g)
185 const long i =
b.idx(x, y, z);
188 T[
i] =
b.w[
c] * (((
N(i) -
N(i - sc)) + (Sp(i, a1) - Sm(i, a1))) + (Sp(i, a2) - Sm(i, a2)));
194std::vector<double> laplacian(
const Box& b,
int c,
const std::vector<double>& vc,
const DV& mu) {
195 DV AC(
"AC",
b.cells), AW(
"AW",
b.cells), AE(
"AE",
b.cells), AS(
"AS",
b.cells), AN(
"AN",
b.cells),
196 AB(
"AB",
b.cells), AT(
"AT",
b.cells);
197 ibmBuildDiffusionVar(
AC, AW, AE, AS, AN, AB, AT,
b.e[0],
b.e[1],
b.e[2],
b.g,
props(b, mu, c),
198 b.w[0],
b.w[1],
b.w[2]);
202 std::vector<double>
L(
b.cells, 0.0);
203 for (
int z =
b.g; z <
b.e[2] -
b.g; ++z)
204 for (
int y =
b.g; y <
b.e[1] -
b.g; ++y)
205 for (
int x =
b.g; x <
b.e[0] -
b.g; ++x) {
206 const long i =
b.idx(x, y, z);
207 L[
i] = -(ac[
i] * vc[
i] + aw[
i] * vc[
i - 1] + ae[
i] * vc[
i + 1] + as[
i] * vc[
i -
b.st[1]] +
208 an[
i] * vc[
i +
b.st[1]] + ab[
i] * vc[
i -
b.st[2]] + at[
i] * vc[
i +
b.st[2]]);
213double maxAbsInner(
const Box& b,
const std::vector<double>& f) {
215 for (
int z =
b.g; z <
b.e[2] -
b.g; ++z)
216 for (
int y =
b.g; y <
b.e[1] -
b.g; ++y)
217 for (
int x =
b.g; x <
b.e[0] -
b.g; ++x)
218 m = std::max(m, std::fabs(f[
b.idx(x, y, z)]));
224 std::mt19937_64
rng(7);
225 std::uniform_real_distribution<double>
U(-1.0, 1.0),
M(0.0, 1.0);
228 for (
int aniso = 0; aniso < 2; ++aniso)
230 for (
int skip = 0; skip < 2; ++skip) {
231 Box
b(7, 6, 5, 1.0, aniso ? 1.5 : 1.0, aniso ? 2.0 : 1.0);
232 std::vector<double>
v[3], mu(
b.cells);
233 std::vector<std::uint8_t> reg[3];
234 for (
int a = 0;
a < 3; ++
a) {
235 v[
a].resize(
b.cells);
236 reg[
a].resize(
b.cells);
237 for (
long i = 0;
i <
b.cells; ++
i) {
239 reg[
a][
i] =
M(rng) < 0.8 ? 1 : 0;
242 for (
long i = 0;
i <
b.cells; ++
i)
243 mu[i] = std::pow(10.0, 3.0 *
M(rng));
244 const DV muD = toDev(mu,
"mu");
245 for (
int c = 0;
c < 3; ++
c) {
246 const auto k = kernelT(b, c, v, muD, solid ? reg :
nullptr, skip);
247 const auto o = oracleT(b, c, v, mu, solid ? reg :
nullptr, skip);
249 for (
long i = 0;
i <
b.cells; ++
i) {
252 worst = std::max(worst, std::fabs(k[i] - o[i]) / s);
256 std::printf(
"(o) kernel vs host oracle: %ld differing values, max rel %.3e (%s)\n", bitDiff,
257 worst, kHost ?
"host: bitwise required" :
"device: <= 1e-13");
259 CHECK(bitDiff == 0,
"kernel != oracle bitwise on host");
261 CHECK(worst <= 1e-13,
"kernel vs oracle %.3e", worst);
265std::vector<double> muSphere(
const Box& b,
bool sharp) {
266 std::vector<double> mu(
b.cells);
267 const double L[3] = {
b.n[0] *
b.h[0],
b.n[1] *
b.h[1],
b.n[2] *
b.h[2]};
268 const double R = 0.3 * std::min(L[0], std::min(L[1], L[2]));
269 const double hm = std::max(
b.h[0], std::max(
b.h[1],
b.h[2]));
270 const double mo = 1.0, mi = 0.1;
271 for (
int z = 0;
z <
b.e[2]; ++
z)
272 for (
int y = 0;
y <
b.e[1]; ++
y)
273 for (
int x = 0;
x <
b.e[0]; ++
x) {
275 b.pos(3, x, y, z, X);
276 const double r = std::sqrt((X[0] - 0.47 * L[0]) * (X[0] - 0.47 * L[0]) +
277 (X[1] - 0.52 * L[1]) * (X[1] - 0.52 * L[1]) +
278 (X[2] - 0.5 * L[2]) * (X[2] - 0.5 * L[2]));
280 sharp ? (
r <
R ? 1.0 : 0.0) : 0.5 * (1.0 - std::tanh((
r -
R) / (2.0 * hm)));
281 mu[
b.idx(x, y, z)] = mi * C + mo * (1.0 - C);
287void fillVel(
const Box& b, std::vector<double>* v,
F u) {
288 for (
int c = 0;
c < 3; ++
c) {
289 v[
c].assign(
b.cells, 0.0);
290 for (
int z = 0;
z <
b.e[2]; ++
z)
291 for (
int y = 0;
y <
b.e[1]; ++
y)
292 for (
int x = 0;
x <
b.e[0]; ++
x) {
294 b.pos(c, x, y, z, X);
295 v[
c][
b.idx(x, y, z)] =
u(c, X) /
b.h[
c];
302 for (
int aniso = 0; aniso < 2; ++aniso)
303 for (
int sharp = 0; sharp < 2; ++sharp) {
304 Box
b(20, 18, 16, 0.1, aniso ? 0.15 : 0.1, aniso ? 0.2 : 0.1);
305 const auto mu = muSphere(b, sharp);
306 const DV muD = toDev(mu,
"mu");
307 const double Om[3] = {0.7, -1.1, 1.3},
X0[3] = {0.9, 1.1, 0.7};
308 std::vector<double>
v[3];
309 fillVel(b, v, [&](
int c,
const double* X) {
310 const double r[3] = {
X[0] -
X0[0],
X[1] -
X0[1],
X[2] -
X0[2]};
311 const double u[3] = {Om[1] *
r[2] - Om[2] *
r[1], Om[2] *
r[0] - Om[0] *
r[2],
312 Om[0] *
r[1] - Om[1] *
r[0]};
315 double mL = 0.0, mS = 0.0;
316 for (
int c = 0;
c < 3; ++
c) {
317 const auto L = laplacian(b, c, v[c], muD),
T = kernelT(b, c, v, muD);
318 std::vector<double>
S(
b.cells);
319 for (
long i = 0;
i <
b.cells; ++
i)
324 std::printf(
"(a) rotation %s %s: max|L| %.3e max|L+T| %.3e ratio %.3e\n",
325 aniso ?
"aniso 1:1.5:2" :
"iso", sharp ?
"sharp" :
"tanh ", mL, mS, mS / mL);
326 CHECK(mS <= 1e-12 * mL && mL > 1e3 * mS,
"rotation not cancelled");
331void testStrainShear() {
332 for (
int aniso = 0; aniso < 2; ++aniso) {
333 Box
b(12, 10, 8, 0.1, aniso ? 0.15 : 0.1, aniso ? 0.2 : 0.1);
334 const auto mu = muSphere(b,
true);
335 const DV muD = toDev(mu,
"mu");
336 const double gam = 0.375;
338 std::vector<double>
v[3];
339 fillVel(b, v, [&](
int c,
const double* X) {
340 return c == 0 ? gam *
X[0] : (
c == 1 ? -gam *
X[1] : 0.0);
342 double errS = 0.0, errL = 0.0;
343 for (
int c = 0;
c < 2; ++
c) {
344 const auto L = laplacian(b, c, v[c], muD),
T = kernelT(b, c, v, muD);
345 const double sg = (
c == 0) ? gam : -gam;
347 for (
int z =
b.g; z <
b.e[2] -
b.g; ++z)
348 for (
int y =
b.g; y <
b.e[1] -
b.g; ++y)
349 for (
int x =
b.g; x <
b.e[0] -
b.g; ++x) {
350 const long i =
b.idx(x, y, z);
351 const double ex =
b.w[
c] *
sg * (mu[
i] - mu[
i -
b.st[
c]]);
352 scale = std::max(scale, std::fabs(ex));
353 errS = std::max(errS, std::fabs((L[i] + T[i]) - 2.0 * ex));
354 errL = std::max(errL, std::fabs(L[i] - ex));
360 fillVel(b, v, [&](
int c,
const double* X) {
return c == 0 ? gam *
X[1] : 0.0; });
361 const auto Ly = laplacian(b, 1, v[1], muD), Ty = kernelT(b, 1, v, muD);
362 double errT = 0.0,
scale = 0.0, mLy = 0.0;
363 for (
int z =
b.g; z <
b.e[2] -
b.g; ++z)
364 for (
int y =
b.g; y <
b.e[1] -
b.g; ++y)
365 for (
int x =
b.g; x <
b.e[0] -
b.g; ++x) {
366 const long i =
b.idx(x, y, z);
369 const long sy =
b.st[1];
370 auto beta = [&](
long p,
long q) {
371 return 0.5 * (0.5 * (mu[
p] + mu[
q]) + 0.5 * (mu[
p - sy] + mu[
q - sy]));
373 const double ex =
b.w[1] * gam * (
b.h[1] /
b.h[0]) * (beta(i, i + 1) - beta(i, i - 1));
374 scale = std::max(scale, std::fabs(ex));
375 errT = std::max(errT, std::fabs(Ty[i] - ex));
376 mLy = std::max(mLy, std::fabs(Ly[i]));
380 "(b) strain %s: |L+T - 2x|/s %.3e |L - x|/s %.3e (c) shear: |T_y - id|/s %.3e "
382 aniso ?
"aniso" :
"iso ", errS, errL, errT, mLy);
383 CHECK(errS <= 1e-13 && errL <= 1e-13,
"pure strain identity");
384 CHECK(errT <= 1e-13 && mLy == 0.0,
"simple shear identity");
390 std::mt19937_64
rng(2026);
391 std::uniform_real_distribution<double>
U(-1.0, 1.0),
M(0.0, 1.0);
392 double wTel = 0.0, wSym = 0.0, wEn = 1e300, wSymS = 0.0;
393 for (
int t = 0;
t < 100; ++
t) {
394 const bool aniso = (
t % 2) == 1;
395 Box
b(6, 8, 6, 1.0, aniso ? 1.5 : 1.0, aniso ? 2.0 : 1.0);
396 const double ratio = std::pow(10.0, 3.0 *
M(rng));
397 std::vector<double> mu(
b.cells),
u[3],
v[3];
398 for (
long i = 0;
i <
b.cells; ++
i)
399 mu[i] = 1.0 + (ratio - 1.0) * (
M(rng) < 0.5 ?
M(rng) : 0.0);
401 for (
int c = 0;
c < 3; ++
c) {
402 u[
c].resize(
b.cells);
403 v[
c].resize(
b.cells);
404 for (
long i = 0;
i <
b.cells; ++
i) {
411 const DV muD = toDev(mu,
"mu");
412 double vTu = 0.0, uTv = 0.0, uKu = 0.0, uTu = 0.0, sAbs = 0.0;
413 for (
int c = 0;
c < 3; ++
c) {
414 const auto Tu = kernelT(b, c, u, muD), Tv = kernelT(b, c, v, muD);
415 const auto Lu = laplacian(b, c, u[c], muD);
416 double sum = 0.0, sab = 0.0;
417 for (
long i = 0;
i <
b.cells; ++
i) {
419 sab += std::fabs(Tu[i]);
420 vTu +=
v[
c][
i] * Tu[
i] /
b.w[
c];
421 uTv +=
u[
c][
i] * Tv[
i] /
b.w[
c];
422 uTu +=
u[
c][
i] * Tu[
i] /
b.w[
c];
423 uKu += -
u[
c][
i] * Lu[
i] /
b.w[
c];
425 wTel = std::max(wTel, std::fabs(sum) / sab);
428 wSym = std::max(wSym, std::fabs(vTu - uTv) / std::fabs(vTu));
429 wEn = std::min(wEn, std::min(uKu + uTu, uKu - uTu) / uKu);
431 std::vector<std::uint8_t> reg[3];
432 for (
int a = 0;
a < 3; ++
a) {
433 reg[
a].resize(
b.cells);
434 std::vector<double>
r(
b.cells);
435 for (
long i = 0;
i <
b.cells; ++
i)
436 r[i] =
M(rng) < 0.85 ? 1.0 : 0.0;
438 for (
long i = 0;
i <
b.cells; ++
i)
439 reg[a][i] = (std::uint8_t)
r[
i];
441 double svTu = 0.0, suTv = 0.0;
442 for (
int c = 0;
c < 3; ++
c) {
443 const auto Tu = kernelT(b, c, u, muD, reg), Tv = kernelT(b, c, v, muD, reg);
444 for (
long i = 0;
i <
b.cells; ++
i) {
445 svTu +=
v[
c][
i] * Tu[
i] /
b.w[
c];
446 suTv +=
u[
c][
i] * Tv[
i] /
b.w[
c];
449 wSymS = std::max(wSymS, std::fabs(svTu - suTv) / std::fabs(svTu));
452 "(d) 100 random periodic: telescoping %.3e (<=1e-13) W-symmetry %.3e (<=1e-12) "
453 "min <u,(K+-T)u>/<u,Ku> %.3e (>=-1e-12) solid-mask symmetry %.3e (<=1e-12)\n",
454 wTel, wSym, wEn, wSymS);
455 CHECK(wTel <= 1e-13,
"telescoping");
456 CHECK(wSym <= 1e-12,
"W-symmetry");
457 CHECK(wEn >= -1e-12,
"energy bound");
458 CHECK(wSymS <= 1e-12,
"solid-mask symmetry");
463 static constexpr double mu0 = 1.0, k = 2.0 * kPi;
465 static double mu(
const double* X) {
466 return mu0 * (1.0 + 0.5 * std::sin(k * X[0]) * std::sin(k * X[1]) * std::cos(k * X[2]));
468 static void gradMu(
const double* X,
double* g) {
469 const double sx = std::sin(k * X[0]), cx = std::cos(k * X[0]), sy = std::sin(k * X[1]),
470 cy = std::cos(k * X[1]),
sz = std::sin(k * X[2]), cz = std::cos(k * X[2]);
471 g[0] = mu0 * 0.5 * k * cx * sy * cz;
472 g[1] = mu0 * 0.5 * k *
sx * cy * cz;
473 g[2] = -mu0 * 0.5 * k *
sx * sy *
sz;
476 static constexpr double A[3] = {1.0, 1.0, -2.0};
477 static double u(
int c,
const double* X) {
479 for (
int a = 0;
a < 3; ++
a)
480 p *= (a == c) ? std::sin(k * X[a]) : std::cos(k *
X[
a]);
484 static double du(
int c,
int a,
const double* X) {
486 for (
int b = 0;
b < 3; ++
b) {
488 p *= (
b ==
c) ? std::cos(k * X[b]) : -std::sin(k * X[b]);
490 p *= (
b ==
c) ? std::sin(k * X[b]) : std::cos(k * X[b]);
495 static double full(
int c,
const double* X) {
498 double f = mu(X) * (-3.0 * k * k) *
u(c, X);
499 for (
int a = 0;
a < 3; ++
a)
500 f += g[a] * (
du(c, a, X) +
du(a, c, X));
505void testConvergence() {
506 const int Ns[3] = {32, 64, 128};
508 for (
int r = 0;
r < 3; ++
r) {
510 const double h = 1.0 /
N;
511 Box
b(
N,
N,
N, h, h, h);
512 std::vector<double> mu(
b.cells),
v[3];
513 for (
int z = 0;
z <
b.e[2]; ++
z)
514 for (
int y = 0;
y <
b.e[1]; ++
y)
515 for (
int x = 0;
x <
b.e[0]; ++
x) {
517 b.pos(3, x, y, z, X);
518 mu[
b.idx(x, y, z)] = Smooth::mu(X);
521 [](
int c,
const double* X) {
return Smooth::u(c, X); });
522 const DV muD = toDev(mu,
"mu");
524 for (
int c = 0;
c < 3; ++
c) {
525 const auto L = laplacian(b, c, v[c], muD),
T = kernelT(b, c, v, muD);
526 for (
int z =
b.g; z <
b.e[2] -
b.g; ++z)
527 for (
int y =
b.g; y <
b.e[1] -
b.g; ++y)
528 for (
int x =
b.g; x <
b.e[0] -
b.g; ++x) {
529 const long i =
b.idx(x, y, z);
531 b.pos(c, x, y, z, X);
532 const double ex = Smooth::full(c, X);
534 eF[
r] = std::max(eF[r], std::fabs((L[i] + T[i]) / h - ex));
535 eL[
r] = std::max(eL[r], std::fabs(L[i] / h - ex));
539 const double oF1 = std::log2(eF[0] / eF[1]), oF2 = std::log2(eF[1] / eF[2]);
540 const double oL1 = std::log2(eL[0] / eL[1]), oL2 = std::log2(eL[1] / eL[2]);
542 "(e) smooth: full err %.3e %.3e %.3e order %.3f %.3f (>=1.9); Laplacian err %.3e "
543 "%.3e %.3e order %.3f %.3f (<0.5)\n",
544 eF[0], eF[1], eF[2], oF1, oF2, eL[0], eL[1], eL[2], oL1, oL2);
545 CHECK(oF1 >= 1.9 && oF2 >= 1.9,
"full-stress order");
546 CHECK(oL1 < 0.5 && oL2 < 0.5,
"Laplacian alone converges?");
551 Box
b(6, 5, 4, 1.0, 1.0, 1.0);
552 std::vector<double> mu(
b.cells, 0.37);
553 double lo = 0.0, hi = 0.0;
556 mu[
b.idx(
b.g - 1,
b.g,
b.g)] = 0.5;
557 mu[
b.idx(0, 0, 0)] = 9.0;
558 double lo2 = 0.0, hi2 = 0.0;
560 std::printf(
"(f) uniform: min %.17g max %.17g (equal: %s); ring value seen: max %.3g\n", lo, hi,
561 lo == hi ?
"yes" :
"NO", hi2);
562 CHECK(lo == hi && lo == 0.37,
"uniform range");
563 CHECK(lo2 == 0.37 && hi2 == 0.5,
"range covers [g-1, e-g+1) only");
567int main(
int argc,
char** argv) {
568 Kokkos::initialize(argc, argv);
578 std::printf(
"full_stress_operator: %s (%d failures)\n",
failures ?
"FAIL" :
"PASS",
failures);
flow — portable (Kokkos) Robust-Scaled cut-cell IBM primitives + per-cut-cell overlay build.
flow — face/cell material-property accessors for the variable-coefficient momentum operator.
flow — the transpose half of the full deviatoric viscous stress on the staggered grid.
Kokkos::View< const double *, CCMem > CCConst
void ibmBuildDiffusionVar(MV AC, MV AW, MV AE, MV AS, MV AN, MV AB, MV AT, int ex, int ey, int ez, int g, FaceProps fp, double wx=1.0, double wy=1.0, double wz=1.0)
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)³.
double maxAbsInner(CCConst a, C3 e, int g)
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.
std::vector< typename V::non_const_value_type > toHost(const V &f)
static int wrap(int a, int n)
static constexpr double AC
static constexpr double F
Kokkos::View< double *, IMem > DV
static constexpr double U
static constexpr double R