|
NeoN
A framework for CFD software
|
Post-assembly functor that pins a set of cells to prescribed values. More...
#include <expression.hpp>
Public Member Functions | |
| FixedValueConstraints (View< const scalar > mask, View< const ValueType > values, localIdx nCells) | |
| void | operator() (la::LinearSystem< ValueType, ValueType, la::CSRMatrix< ValueType, IndexType > > &ls) const override |
Public Member Functions inherited from NeoN::dsl::PostAssemblyBase< VectorType, IndexType > | |
| virtual | ~PostAssemblyBase ()=default |
| virtual void | operator() (la::LinearSystem< VectorType, VectorType, la::CSRMatrix< VectorType, IndexType > > &) const |
| virtual void | applyScalarMatrix (la::LinearSystem< scalar, VectorType, la::CSRMatrix< scalar, IndexType >, la::COOMatrix< scalar, IndexType > > &) const |
| Apply to the segregated scalar-matrix / VectorType-rhs form (a scalar coefficient matrix with a VectorType right-hand side). Default no-op; functors that support the segregated form override this. A distinct name (rather than an operator() overload) avoids colliding with the same-type signature when VectorType == scalar. | |
Post-assembly functor that pins a set of cells to prescribed values.
This now performs OpenFOAM's FULL decouple (fvMatrix::setValuesFromList), not just a row wipe. For every constrained cell c: A[c, j] = 0 for all j != c (zero the off-diagonals of ROW c) A[j, c] = 0 for all j != c (zero the COLUMN c in every neighbour row j) rhs[j] -= A[j, c]*value[c] (relocate that coupling into the neighbour SOURCE) rhs[c] = A[c, c] * value[c] so the row reduces to A[c,c]*x_c = A[c,c]*value[c] => x_c = value[c] (independent of the relaxed/BC-augmented diagonal), and — crucially — the SpMV / residual no longer carries the huge in-matrix A[j,c]*value_c term (value_c is the viscous-sublayer wall omega, up to 1e12). Leaving that coefficient in the matrix (the previous row-only wipe) made A*x at neighbour cells a difference of ~1e18 magnitudes, which underflowed/NaN'd the L1 residual norm under FOAM_SIGFPE — OpenFOAM avoids it precisely by moving the term to the source. Mirrors upstream exactly.
Proc-boundary caveat: a pinned cell's coupling to an off-rank ghost lives in offDiagonalMatrix, not the local CSR, so it is not decoupled here (the local CSR column cut is the dominant term).
Pinning via both the row and column cut avoids large cancellation errors when pinned values are orders of magnitude larger than neighbouring unknowns. Off-rank coupling in offDiagonalMatrix is also zeroed for pinned rows.
Restricted to scalar ValueType: the segregated vector-solve path dispatches through applyScalarMatrix(), which this class does not implement.
mask[cell] != 0 marks a constrained cell; value[cell] holds its target. Both views are sized nCells and must outlive the functor.
Definition at line 174 of file expression.hpp.
|
inline |
Definition at line 184 of file expression.hpp.
|
inlineoverride |
Definition at line 188 of file expression.hpp.