24#ifndef PECLET_FLOW_MAC_CHEB_MOMENTUM_HPP
25#define PECLET_FLOW_MAC_CHEB_MOMENTUM_HPP
27#include <Kokkos_Core.hpp>
42 CCConst solidmask,
C3 e,
int g,
double& lo,
double& hi) {
44 const bool hasMask = (solidmask.extent(0) != 0);
46 const MD pol(space, {g, g, g}, {e.x - g, e.y - g, e.z - g});
47 double rlo = 0.0, rhi = 0.0;
48 Kokkos::parallel_reduce(
49 "peclet::flow::cheb_bounds_lo", pol,
50 KOKKOS_LAMBDA(
int lx,
int ly,
int lz,
double& m) {
51 const long i = (long)lx + (
long)ly * e.x + (long)lz * (
long)e.x * e.y;
52 if (hasMask && solidmask(i) > 0.5)
54 const double ac = (double)
AC(i);
55 if (Kokkos::fabs(ac) < 1e-30)
57 const double off = (double)AW(i) + (double)AE(i) + (double)AS(i) + (double)AN(i) +
58 (double)AB(i) + (double)AT(i);
59 const double v = (ac + off) / ac;
63 Kokkos::Min<double>(rlo));
64 Kokkos::parallel_reduce(
65 "peclet::flow::cheb_bounds_hi", pol,
66 KOKKOS_LAMBDA(
int lx,
int ly,
int lz,
double& m) {
67 const long i = (long)lx + (
long)ly * e.x + (long)lz * (
long)e.x * e.y;
68 if (hasMask && solidmask(i) > 0.5)
70 const double ac = (double)
AC(i);
71 if (Kokkos::fabs(ac) < 1e-30)
73 const double off = (double)AW(i) + (double)AE(i) + (double)AS(i) + (double)AN(i) +
74 (double)AB(i) + (double)AT(i);
75 const double v = (ac - off) / ac;
79 Kokkos::Max<double>(rhi));
89 double alpha,
double beta) {
91 const bool hasMask = (solidmask.extent(0) != 0);
94 "peclet::flow::cheb_update", MD(space, {g, g, g}, {e.x - g, e.y - g, e.z - g}),
95 KOKKOS_LAMBDA(
int lx,
int ly,
int lz) {
96 const long i = (long)lx + (
long)ly * e.x + (long)lz * (
long)e.x * e.y;
97 if (hasMask && solidmask(i) > 0.5) {
102 const double ac = (double)
AC(i);
103 if (Kokkos::fabs(ac) < 1e-30)
105 const double dn = beta * d(i) + alpha * r(i) / ac;
120 void next(
int it,
double& alpha,
double& beta) {
126 const double rPrev =
rho;
flow — portable (Kokkos) geometric multigrid for the cut-cell (variable-openness) pressure Poisson.
flow — portable (Kokkos) IBM geometric fields + variable-coefficient RB-GS smoother.
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).
void ibmChebUpdate(CCField x, CCField d, CCConst r, FPC AC, CCConst solidmask, C3 e, int g, double alpha, double beta)
One Chebyshev update on the Jacobi-preconditioned system: d <- beta*d + alpha*r/AC ; x += d.
Kokkos::View< const double *, CCMem > CCConst
void ibmStencilJacobiBounds(MC AC, MC AW, MC AE, MC AS, MC AN, MC AB, MC AT, CCConst solidmask, C3 e, int g, double &lo, double &hi)
Gershgorin bounds [lo, hi] on the spectrum of the Jacobi-preconditioned cut-cell Helmholtz diag(AC)^-...
Kokkos::View< const MReal *, CCMem > FPC
Kokkos::View< double *, CCMem > CCField
flow — the multidimensional iteration policies: iteration order follows storage.
void next(int it, double &alpha, double &beta)
Coefficients for iteration it (0-based). Advances the recurrence.
ChebCoeffs(double lo, double hi)
static constexpr double AC