56#define DNDS_FV_EULEREVALUATOR_GET_FIXED_EIGEN_SEQS \
57 static const auto Seq012 = Eigen::seq(Eigen::fix<0>, Eigen::fix<dim - 1>); \
58 static const auto Seq12 = Eigen::seq(Eigen::fix<1>, Eigen::fix<dim - 1>); \
59 static const auto Seq123 = Eigen::seq(Eigen::fix<1>, Eigen::fix<dim>); \
60 static const auto Seq23 = Eigen::seq(Eigen::fix<2>, Eigen::fix<dim>); \
61 static const auto Seq234 = Eigen::seq(Eigen::fix<2>, Eigen::fix<dim + 1>); \
62 static const auto Seq34 = Eigen::seq(Eigen::fix<3>, Eigen::fix<dim + 1>); \
63 static const auto Seq01234 = Eigen::seq(Eigen::fix<0>, Eigen::fix<dim + 1>); \
64 static const auto SeqG012 = Eigen::seq(Eigen::fix<0>, Eigen::fix<gDim - 1>); \
65 static const auto SeqI52Last = Eigen::seq(Eigen::fix<I4 + 1>, EigenLast); \
66 static const auto I4 = dim + 1;
91 template <
int nVarsFixed>
175#if defined(DNDS_DIST_MT_USE_OMP)
176# pragma omp parallel for schedule(static)
179 this->
operator[](i) *=
R[i];
191 template <
int nVarsFixed_T = nVarsFixed>
287 Eigen::Vector<real, nVarsFixed>
min()
293#if defined(DNDS_DIST_MT_USE_OMP)
294# pragma omp declare reduction(EigenVecMin : Eigen::Vector<real, nVarsFixed> : omp_out = omp_out.array().min(omp_in.array())) initializer(omp_priv = omp_orig)
295# pragma omp parallel for schedule(static) reduction(EigenVecMin : minLocal)
337 template <
class TMultL,
class TMultR>
343#if defined(DNDS_DIST_MT_USE_OMP)
344# pragma omp parallel for schedule(static) reduction(+ : sqrSum)
347 sqrSum += (this->
operator[](i).array() *
mL).matrix().dot((
R.operator[](i).array() *
mR).matrix());
370#if defined(DNDS_DIST_MT_USE_OMP)
371# pragma omp parallel for schedule(static)
374 this->
operator[](i).array() = this->
operator[](i).array().max(
R);
399 template <
int nVarsFixed>
429#if defined(DNDS_DIST_MT_USE_OMP)
430# pragma omp parallel for schedule(static)
433 this->
operator[](i) =
R;
476#if defined(DNDS_DIST_MT_USE_OMP)
477# pragma omp parallel for schedule(static)
480 this->
operator[](i) *=
R[i];
510#if defined(DNDS_DIST_MT_USE_OMP)
511# pragma omp parallel for schedule(static)
514 this->
operator[](i).array().rowwise() *=
R;
541#if defined(DNDS_DIST_MT_USE_OMP)
542# pragma omp parallel for schedule(static)
545 this->
operator[](i).array() +=
R.operator[](i).array().rowwise() *
r;
604 sqrSumAll.resizeLike(
sqrSum);
606#if defined(DNDS_DIST_MT_USE_OMP)
607# pragma omp declare reduction(EigenVecSum : Eigen::RowVector<real, nVarsFixed> : omp_out += omp_in) initializer(omp_priv = omp_orig)
608# pragma omp parallel for schedule(static) reduction(EigenVecSum : sqrSum)
611 sqrSum += (this->
operator[](i).array() *
R.operator[](i).array()).colwise().sum().matrix();
641 template <
int nVarsFixed,
int gDim>
670#if defined(DNDS_DIST_MT_USE_OMP)
671# pragma omp parallel for schedule(static)
674 this->
operator[](i) =
R;
715#if defined(DNDS_DIST_MT_USE_OMP)
716# pragma omp parallel for schedule(static)
719 this->
operator[](i) *=
R[i];
748#if defined(DNDS_DIST_MT_USE_OMP)
749# pragma omp parallel for schedule(static)
752 this->
operator[](i).array().rowwise() *=
R;
779 template <
int nVarsFixed>
933 constexpr static inline int getnVarsFixed(
const EulerModel model)
935 if (model ==
NS || model ==
NS_3D)
937 else if (model ==
NS_SA)
941 else if (model ==
NS_2D)
945 return Eigen::Dynamic;
964 constexpr static inline int getNVars(
EulerModel model)
966 int nVars = getnVarsFixed(model);
969 if (model ==
NS || model ==
NS_3D)
971 else if (model ==
NS_SA)
975 else if (model ==
NS_2D)
998 constexpr static inline int getDim_Fixed(
const EulerModel model)
1000 if (model ==
NS || model ==
NS_3D)
1002 else if (model ==
NS_SA)
1006 else if (model ==
NS_2D)
1012 return Eigen::Dynamic;
1031 constexpr static inline int getGeomDim_Fixed(
const EulerModel model)
1035 else if (model ==
NS_SA)
1037 else if (model ==
NS_2D)
1039 else if (model ==
NS_3D)
1043 else if (model ==
NS_2EQ)
1047 else if (model ==
NS_EX)
1051 return Eigen::Dynamic;
1084 template <EulerModel model>
1090 static constexpr int dim = getDim_Fixed(model);
1092 static constexpr int gDim = getGeomDim_Fixed(model);
1125 template <
int nVarsFixed,
int mul>
1126 constexpr static inline int nvarsFixedMultiply()
1128 return nVarsFixed != Eigen::Dynamic ? nVarsFixed * mul : Eigen::Dynamic;
Extended enum-to-JSON serialization macro that also exposes allowed string values for JSON Schema gen...
#define DNDS_DEFINE_ENUM_JSON(EnumType_,...)
Define JSON serialization for an enum AND expose its allowed string values.
Core type aliases, constants, and metaprogramming utilities for the DNDS framework.
Device memory abstraction layer with backend-specific storage and factory creation.
Eigen extensions: to_string, an fmt-safe wrapper, and fmt formatter specialisations for dense Eigen m...
Assertion / error-handling macros and supporting helper functions.
#define DNDS_assert(expr)
Debug-only assertion (compiled out when DNDS_NDEBUG is defined). Prints the expression + file/line + ...
Mutable device view of an ArrayDof father/son pair.
Primary solver state container: an ArrayEigenMatrix pair with MPI-collective vector-space operations.
real norm2()
Global L2 norm (MPI-collective). sqrt(sum_i sum_j x_ij^2).
t_element_mat componentWiseNorm1()
Per-component global L1 norm, returned as an n_m x n_n matrix (collective).
void operator-=(const t_self &R)
In-place element-wise subtract: this -= R.
real dot(const t_self &R)
Global inner product: sum_i sum_j x_ij * R_ij (collective).
void operator+=(const t_self &R)
In-place element-wise add: this += R.
void operator/=(const t_self &R)
Element-wise divide: this /= R.
void operator*=(real R)
Scalar multiply in place.
void setConstant(real R)
Set every entry of every (father+son) row to the scalar R.
void addTo(const t_self &R, real r)
AXPY: this += r * R. One of the hot-path solver primitives.
ArrayDofDeviceView< B, n_m, n_n > t_deviceView
Mutable device view alias.
Eigen::Matrix< real, RowSize_To_EigenSize(n_m), RowSize_To_EigenSize(n_n)> t_element_mat
Shape of one DOF row as an Eigen matrix.
void operator=(const t_self &R)
Value-copy assignment from another ArrayDof of identical layout.
ParArray<real> whose operator[] returns an Eigen::Map<Matrix<real, Ni, Nj>>.
MPI-parallel distributed array of per-cell Degrees-of-Freedom (conservative variable vectors).
void operator/=(const t_self &R)
Element-wise division: this[i] = this[i] ./ R[i].
void operator*=(const std::vector< real > &R)
Per-cell scalar multiplication from a vector of cell-wise weights.
void addTo(const t_self &R, real r)
Scaled addition: this[i] += r * R[i] for every cell (axpy-style).
void operator-=(const t_self &R)
Element-wise subtraction: this[i] -= R[i] for every cell.
typename t_base::t_element_mat t_element_mat
Per-element Eigen matrix/vector type.
real dot(const t_self &R)
Compute the global dot product <this, R> with MPI reduction.
void setConstant(real R)
Set all DOF entries to a uniform scalar value.
void operator+=(const Eigen::Vector< real, nVarsFixed > &R)
Add a constant vector to every cell: this[i] += R for all cells.
void setMaxWith(TR R)
Clamp all components from below: this[i] = max(this[i], R).
void operator*=(const Eigen::Vector< real, nVarsFixed > &R)
Component-wise multiplication by a constant vector.
void setConstant(const Eigen::Ref< const t_element_mat > &R)
Set all DOF entries to copies of a given vector.
void operator*=(real R)
Uniform scalar multiplication: this[i] *= R for every cell.
real norm2()
Compute the global L2 norm across all MPI ranks.
real dot(const t_self &R, TMultL &&mL, TMultR &&mR)
Compute a weighted global dot product with per-component multipliers.
void operator*=(const t_self &R)
Element-wise (Hadamard) multiplication: this[i] = this[i] .* R[i].
void operator+=(real R)
Add a scalar to every component of every cell.
Eigen::Vector< real, nVarsFixed > componentWiseNorm1()
Compute the per-component global L1 norm.
void operator=(const t_self &R)
Deep copy assignment from another ArrayDOFV.
void operator+=(const t_self &R)
Element-wise addition: this[i] += R[i] for every cell.
Eigen::Vector< real, nVarsFixed > min()
Compute the global component-wise minimum across all MPI ranks.
MPI-parallel distributed array of per-cell gradient matrices.
void operator+=(t_self &R)
Element-wise addition: this[i] += R[i] for every cell.
void setConstant(real R)
Set all gradient entries to a uniform scalar value.
void setConstant(const TR &R)
Set all cells' gradient matrices to copies of a given matrix.
void operator*=(ArrayDOFV< 1 > &R)
Component-wise multiplication by a scalar-per-cell ArrayDOFV<1>.
void operator*=(const Eigen::Array< real, 1, nVarsFixed > &R)
Column-wise scaling by a per-variable multiplier row-vector.
void operator*=(real R)
Uniform scalar multiplication: this[i] *= R for every cell.
void operator=(t_self &R)
Deep copy assignment from another ArrayGRADV.
void operator*=(std::vector< real > &R)
Per-cell scalar multiplication from a vector of cell-wise weights.
void operator-=(t_self &R)
Element-wise subtraction: this[i] -= R[i] for every cell.
MPI-parallel distributed array of per-cell reconstruction coefficient matrices.
real norm2()
Compute the global L2 norm of all reconstruction coefficients with MPI reduction.
void setConstant(const TR &R)
Set all cells' reconstruction matrices to copies of a given matrix.
real dot(const t_self &R)
Compute the global dot product <this, R> with MPI reduction.
void operator=(const t_self &R)
Deep copy assignment from another ArrayRECV.
void addTo(const t_self &R, real r)
Uniform scaled addition: this[i] += r * R[i] for every cell (axpy-style).
void operator*=(const std::vector< real > &R)
Per-cell scalar multiplication from a vector of cell-wise weights.
void operator*=(const Eigen::Array< real, 1, nVarsFixed > &R)
Column-wise scaling by a per-variable multiplier row-vector.
void operator-=(const t_self &R)
Element-wise subtraction: this[i] -= R[i] for every cell.
void setConstant(real R)
Set all reconstruction coefficients to a uniform scalar value.
void addTo(const t_self &R, const Eigen::Array< real, 1, nVarsFixed > &r)
Column-wise scaled addition: this[i] += R[i] .* r (per-variable scaling).
void operator*=(const ArrayDOFV< 1 > &R)
Component-wise multiplication by a scalar-per-cell ArrayDOFV<1>.
auto dotV(const t_self &R)
Compute a per-variable (column-wise) dot product with MPI reduction.
void operator+=(const t_self &R)
Element-wise addition: this[i] += R[i] for every cell.
void operator*=(real R)
Uniform scalar multiplication: this[i] *= R for every cell.
Placeholder container for implicit-solver Jacobian matrix storage.
ArrayDOFV< nVarsFixed > diag
Diagonal Jacobian values (one vector per cell).
ArrayEigenMatrix< nVarsFixed, nVarsFixed > diagBlockInv
Inverse of block-diagonal Jacobian.
ArrayEigenMatrix< nVarsFixed, nVarsFixed > diagBlock
Block-diagonal Jacobian (one nVars x nVars matrix per cell).
Type
Jacobian storage mode selector.
@ DiagonalBlock
One (nVars x nVars) dense block per cell.
@ Diagonal
One scalar per variable per cell (diagonal approximation).
@ Full
Sparse block structure following cell adjacency graph.
void SetDiagonal(ArrayDOFV< nVarsFixed > &uDof)
Initialize storage for diagonal (scalar-per-variable) Jacobian mode.
void SetDiagonalBlock(ArrayDOFV< nVarsFixed > &uDof)
Initialize storage for block-diagonal (dense block-per-cell) Jacobian mode.
ArrayRECV< nVarsFixed > offDiagBlock
Off-diagonal blocks for full Jacobian (sparse, adjacency-based).
void SetFull(ArrayDOFV< nVarsFixed > &uDof, Geom::tAdjPair &cell2cell)
Initialize storage for the full sparse block Jacobian following cell adjacency.
void InverseDiag()
Compute the inverse of the diagonal (or block-diagonal) Jacobian.
ArrayDOFV< nVarsFixed > diagInv
Inverse of diagonal Jacobian values.
RANSModel
Enumerates the available RANS turbulence closure models.
@ RANS_KOSST
Menter k-omega SST two-equation model.
@ RANS_Unknown
Sentinel / uninitialized value.
@ RANS_RKE
Realizable k-epsilon two-equation model.
@ RANS_SA
Spalart-Allmaras one-equation model.
@ RANS_None
No turbulence model (laminar or DNS).
@ RANS_KOWilcox
Wilcox k-omega two-equation model.
EulerModel
Enumerates the available compressible flow solver model configurations.
@ NS_2EQ_3D
NS + 2-equation RANS, 3D geometry (7 vars).
@ NS_SA_3D
NS + Spalart-Allmaras, 3D geometry (6 vars).
@ NS
Navier-Stokes, 2D geometry, 3D physics (5 vars).
@ NS_EX_3D
Extended NS, 3D geometry, dynamic nVars (Eigen::Dynamic).
@ NS_SA
NS + Spalart-Allmaras, 2D geometry (6 vars).
@ NS_2EQ
NS + 2-equation RANS, 2D geometry (7 vars).
@ NS_3D
Navier-Stokes, 3D geometry, 3D physics (5 vars).
@ NS_EX
Extended NS, 2D geometry, dynamic nVars (Eigen::Dynamic).
@ NS_2D
NS with 2D physics (2 velocity components, 4 vars). The only model with dim=2.
MPI_int Allreduce(const void *sendbuf, void *recvbuf, MPI_int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
Wrapper over MPI_Allreduce.
@ Unknown
Unset / sentinel.
int64_t index
Global row / DOF index type (signed 64-bit; handles multi-billion-cell meshes).
double real
Canonical floating-point scalar used throughout DNDSR (double precision).
DNDS_CONSTANT const real veryLargeReal
Catch-all upper bound ("practically infinity") for physical scalars.
const MPI_Datatype DNDS_MPI_REAL
MPI datatype matching real (= MPI_REAL8).
DNDS_DEVICE_CALLABLE index Size() const
Combined father + son row count.
Convenience bundle of a father, son, and attached ArrayTransformer.
decltype(father->operator[](index(0))) operator[](index i) const
Read-only row-pointer access in the combined address space.
ssp< TArray > father
Owned-side array (must be resized before ghost setup).
index Size() const
Combined row count (father->Size() + son->Size()).
auto RowSize() const
Uniform row width (delegates to father).
Compile-time traits for EulerModel variants.
static constexpr bool isGeom2D
True for 2D geometry models.
static constexpr int nRANSVars
Number of extra RANS transport variables (0, 1, or 2).
static constexpr bool isPlainNS
True for plain NS without turbulence or extensions.
static constexpr bool hasRANS
True for any RANS turbulence model (SA or 2-equation).
static constexpr int gDim
Geometry (mesh) spatial dimension.
static constexpr bool hasSA
True for Spalart-Allmaras models (NS_SA, NS_SA_3D).
static constexpr bool isGeom3D
True for 3D geometry models.
static constexpr bool has2EQ
True for 2-equation RANS models (NS_2EQ, NS_2EQ_3D).
static constexpr bool isExtended
True for extended/dynamic models (NS_EX, NS_EX_3D).
static constexpr int dim
Physics spatial dimension (2 for NS_2D, 3 for all others).
static constexpr int nVarsFixed
Number of fixed conservative variables (Eigen::Dynamic for NS_EX).