15#ifndef PECLET_CORE_AMR_FV_OP_HPP
16#define PECLET_CORE_AMR_FV_OP_HPP
18#ifdef PECLET_CORE_HAVE_MORTON
27template <
int Dim,
unsigned Bits>
33 for (
int axis = 0; axis < Dim; ++axis)
34 for (
int dir = -1; dir <= 1; dir += 2) {
46template <
int Dim,
unsigned Bits>
50 const double diag = 2.0 * Dim *
inv;
55 for (
int axis = 0; axis < Dim; ++axis)
56 for (
int dir = -1; dir <= 1; dir += 2) {
64 "amr::device_jacobi_update", n,
115 const auto A =
fvView(op);
116 Kokkos::parallel_for(
123 const auto A =
fvView(op);
124 Kokkos::parallel_for(
125 "amr::fv_residual", op.
n,
137 const auto A =
fvView(op);
138 Kokkos::parallel_for(
139 "amr::fv_jacobi_compute", op.
n,
141 Kokkos::parallel_for(
142 "amr::fv_jacobi_update", op.
n,
156 double sx = 0.0,
sv = 0.0;
163 Kokkos::parallel_reduce(
164 "amr::fv_rmean", op.
n,
170 an +=
u(
i) / invVol(
i);
171 ad += 1.0 / invVol(
i);
177 const double m =
sx /
sv;
178 Kokkos::parallel_for(
193 Kokkos::parallel_for(
void laplacian(BlockOctreeView< Dim, Bits > dev, View< double > x, View< double > y, double inv)
y = inv · Σ_faces (x_nb − x_i) (= ∇² in spacing h0 with inv = 1/h0²), on device.
void applyFv(const FvOp &op, View< const double > u, View< double > Lu)
Hu = (c0·I + cD·L) u (consistent conservative FV Laplacian, c0=0/cD=1 ⇒ pure L).
void jacobiSweep(BlockOctreeView< Dim, Bits > dev, View< double > x, View< const double > b, View< double > lx, double inv, double omega)
One weighted-Jacobi sweep of L u = b with L = ∇² (negative-definite, diagonal −2·Dim·inv),...
void removeMeanFv(const FvOp &op, View< double > u)
Project u to volume-weighted-mean-zero over the ACTIVE (fluid) cells of the operator — the constant-n...
void quadDelta(View< const Index > qStart, View< const Index > qSlot, View< const double > qCoef, View< const double > u, View< double > dq, Index n)
dq = (L_quad − L_std) u, the quadratic coarse-fine correction as its own SpMV over a precomputed CSR ...
void jacobiFv(const FvOp &op, View< double > u, View< const double > rhs, View< double > tmp, double omega)
One weighted-Jacobi sweep of H u = rhs (in place).
MORTON_HD double fvApplyRow(const Op &op, Index i, const U &u)
(H u)_i = c0·u_i + cD·( invVol_i·( Σ w·(u_nbr − u_i) − bcDiag_i·u_i ) ).
FvCsrOpT< View< const double >, View< const Index > > fvView(const FvOp &op)
View the assembled FV operator through the shared backend-agnostic FvCsrOpT, so the device kernels an...
MORTON_HD double fvPointSolve(const Op &op, Index i, const U &u, double rhs_i, double uOld)
The point solve of H u = rhs for one row (raw value, before damping), matching the host point solve a...
void residualFv(const FvOp &op, View< const double > u, View< const double > rhs, View< double > res)
res = rhs − H u.
Kokkos::View< T *, MemSpace > View
1D device array.
std::int64_t Index
Signed index type for grids and particles (supersedes block_decomposer's long int IndxT).
View< double > invVol
1/V_i, size n
View< double > faceW
w_f = openness·A_f/d_f per face, size nFaces
View< Index > faceStart
CSR row offsets, size n+1.
View< double > bcDiag
Dirichlet boundary diagonal per cell (0 if periodic), size n.
View< Index > faceNbr
neighbour leaf per face, size nFaces