20#ifndef PECLET_CORE_SOLVER_FACE_CSR_HPP
21#define PECLET_CORE_SOLVER_FACE_CSR_HPP
45template <
class D,
class I>
56template <
class Op,
class U>
58 double acc = op.diag(i) * u(i);
59 for (
Index k = op.start(i); k < op.start(i + 1); ++k)
60 acc += op.coef(k) * u(op.nbr(k));
62 acc += op.advDiag(i) * u(i);
63 for (
Index k = op.advStart(i); k < op.advStart(i + 1); ++k)
64 acc += op.advCoef(k) * u(op.advNbr(k));
72template <
class Op,
class U>
76 for (
Index k = op.start(i); k < op.start(i + 1); ++k)
77 off += op.coef(k) * u(op.nbr(k));
79 for (
Index k = op.advStart(i); k < op.advStart(i + 1); ++k)
80 off += op.advCoef(k) * u(op.advNbr(k));
89 const double nu = (d != 0.0) ? (b_i - off) / d : uOld;
90 return (1.0 - omega) * uOld + omega * nu;
103template <
class D,
class I>
113template <
class Op,
class U>
115 const double ui = u(i);
117 for (
Index k = op.start(i); k < op.start(i + 1); ++k)
118 acc += op.coef(k) * (u(op.nbr(k)) - ui);
119 return op.c0 * ui + op.cD * (op.invVol(i) * (acc - op.bcDiag(i) * ui));
124template <
class Op,
class U>
126 double sumOff = 0.0, sw = 0.0;
127 for (
Index k = op.start(i); k < op.start(i + 1); ++k) {
128 sumOff += op.coef(k) * u(op.nbr(k));
131 const double swbc = sw + op.bcDiag(i);
132 if (op.c0 == 0.0 && op.cD == 1.0)
133 return (swbc != 0.0) ? (sumOff - rhs_i / op.invVol(i)) / swbc : uOld;
134 const double Hii = op.c0 - op.cD * op.invVol(i) * swbc;
135 const double Hoff = op.cD * op.invVol(i) * sumOff;
136 return (Hii != 0.0) ? (rhs_i - Hoff) / Hii : uOld;
PECLET_HD void faceCsrOffDiag(const Op &op, Index i, const U &u, double &off, double &d)
Off-diagonal sum and the (advection-inclusive) diagonal for the point smoothers: out off = Σ coef·u[n...
PECLET_HD double faceCsrPointUpdate(double b_i, double off, double d, double uOld, double omega)
The damped point update used by both Jacobi and (multicolour) Gauss–Seidel: returns the new u_i given...
PECLET_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 ) ).
PECLET_HD double faceCsrApplyRow(const Op &op, Index i, const U &u)
(A u)_i — one assembled-operator row.
PECLET_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...
std::int64_t Index
Signed index type for grids and particles (supersedes block_decomposer's long int IndxT).
A backend-agnostic view of an assembled face-CSR operator.
A backend-agnostic view of an assembled FV (weight-CSR) operator.
PECLET_HD T operator()(Index i) const