14#ifndef PECLET_AMR_FV_OP_HPP
15#define PECLET_AMR_FV_OP_HPP
20#include "peclet/core/common/view.hpp"
25template <
int Dim,
unsigned Bits>
31 for (
int axis = 0; axis < Dim; ++axis)
32 for (
int dir = -1; dir <= 1; dir += 2) {
44template <
int Dim,
unsigned Bits>
48 const double diag = 2.0 * Dim *
inv;
53 for (
int axis = 0; axis < Dim; ++axis)
54 for (
int dir = -1; dir <= 1; dir += 2) {
62 "amr::device_jacobi_update", n,
114 Kokkos::parallel_for(
122 Kokkos::parallel_for(
123 "amr::fv_residual", op.
n,
136 Kokkos::parallel_for(
137 "amr::fv_jacobi_compute", op.
n,
139 Kokkos::parallel_for(
140 "amr::fv_jacobi_update", op.
n,
154 double sx = 0.0,
sv = 0.0;
161 Kokkos::parallel_reduce(
162 "amr::fv_rmean", op.
n,
168 an +=
u(
i) / invVol(
i);
169 ad += 1.0 / invVol(
i);
175 const double m =
sx /
sv;
176 Kokkos::parallel_for(
191 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.
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...
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 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 residualFv(const FvOp &op, View< const double > u, View< const double > rhs, View< double > res)
res = rhs − H u.
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).
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 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 ...
std::vector< std::array< double, Dim > > transferFieldGradients(const BlockOctree< Dim, Bits > &oldT, const std::vector< double > &oldF)
Per-old-leaf minmod prolongation gradients (per fine-coordinate unit) — transferField's stencil,...
Device mirror of a BlockOctree's leaf arrays + device-callable queries.
View< Index > faceStart
CSR row offsets, size n+1.
View< double > bcDiag
Dirichlet boundary diagonal per cell (0 if periodic), size n.
View< double > invVol
1/V_i, size n
View< Index > faceNbr
neighbour leaf per face, size nFaces
View< double > faceW
w_f = openness·A_f/d_f per face, size nFaces