27#include <unordered_set>
42 template <EulerModel model>
47 static const int dim = getDim_Fixed(model);
48 static const int gDim = getGeomDim_Fixed(model);
151 return rpm * (2 *
pi / 60.);
184 ret(EigenAll, 0) = rn;
185 ret(EigenAll, 2) =
axis;
186 ret(EigenAll, 1) =
axis.cross(rn);
222 DNDS_FIELD(
v,
"Initial value vector (size = nVars)");
246 DNDS_FIELD(
v,
"Initial value vector (size = nVars)");
277 for (
auto &line :
exprs)
317 config.post_read([](T &s) { s.recomputeDerived(); });
352 config.field_alias(&T::rsType,
"riemannSolverType",
353 "Riemann solver type");
354 config.field_alias(&T::rsTypeAux,
"riemannSolverTypeAux",
355 "Auxiliary Riemann solver type");
356 config.field_alias(&T::rsTypeWall,
"riemannSolverTypeWall",
357 "Wall Riemann solver type");
383 DNDS_FIELD(
SAVersion,
"SA variant: 0=current (cRot=2, corrected |S|, min(P,0) Jacobian), 1=legacy/pre-31578ce (cRot=1, Frobenius SS, P*0 Jacobian)");
397 config.field_section(&T::frameConstRotation,
"frameConstRotation",
398 "Constant-rotation reference frame settings");
399 config.field_section(&T::cLDriverSettings,
"cLDriverSettings",
400 "CL driver settings");
403 config.template field_array_of<BoxInitializer>(
404 &T::boxInitializers,
"boxInitializers",
405 "Box region initializers");
406 config.template field_array_of<PlaneInitializer>(
407 &T::planeInitializers,
"planeInitializers",
408 "Plane region initializers");
409 config.template field_array_of<ExprtkInitializer>(
410 &T::exprtkInitializers,
"exprtkInitializers",
411 "Exprtk expression initializers");
412 config.field_section(&T::idealGasProperty,
"idealGasProperty",
413 "Ideal gas thermodynamic properties");
416 config.check(
"useScalarJacobian and useRoeJacobian are mutually exclusive",
417 [](
const T &s) {
return !(s.useScalarJacobian && s.useRoeJacobian); });
418 config.check(
"ransModel must not be RANS_Unknown",
419 [](
const T &s) {
return s.ransModel !=
RANS_Unknown; });
422 config.post_read([](T &s) { s.finalize(); });
475 std::unordered_set<EulerModel>{NS_SA, NS_SA_3D, NS_2EQ, NS_2EQ_3D}.count(model))
477 "you have set source term, do not use ignoreSourceTerm! ");
481 DNDS_assert_info(box.v.size() == nVars,
"box initial value dimension incorrect");
483 DNDS_assert_info(plane.v.size() == nVars,
"plane initial value dimension incorrect");
492 refU(Seq123).setConstant(
refU(Seq123).norm() + a);
Iterative angle-of-attack driver for targeting a desired lift coefficient.
pybind11-style configuration registration with macro-based field declaration and namespace-scoped tag...
#define DNDS_FIELD(name_, desc_,...)
Register a field inside a DNDS_DECLARE_CONFIG body.
#define DNDS_assert_info(expr, info)
Debug-only assertion with an extra std::string info message.
#define DNDS_assert(expr)
Debug-only assertion (compiled out when DNDS_NDEBUG is defined). Prints the expression + file/line + ...
Core type definitions, enumerations, and distributed array wrappers for compressible Navier-Stokes / ...
#define DNDS_FV_EULEREVALUATOR_GET_FIXED_EIGEN_SEQS
Declares compile-time Eigen index sequences for sub-vector access into conservative state vectors.
Ideal-gas Riemann solvers, flux functions, and thermodynamic utilities for the compressible Euler / N...
JSON-to-Eigen conversion utilities and nlohmann_json helper macros.
RangeTag range(double min)
Create a minimum-only range constraint.
RiemannSolverType
Selects the approximate Riemann solver and its entropy-fix variant.
RANSModel
Enumerates the available RANS turbulence closure models.
@ RANS_Unknown
Sentinel / uninitialized value.
@ RANS_SA
Spalart-Allmaras one-equation model.
@ RANS_None
No turbulence model (laminar or DNS).
@ RANS_KOWilcox
Wilcox k-omega two-equation model.
DNDS_CONSTANT const real verySmallReal
Catch-all lower bound ("effectively zero").
DNDS_CONSTANT const real pi
π in double precision (matches DNDS_E_PI macro).
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.
JSON-configurable settings for the CL (lift coefficient) driver.
Axis-aligned box region for initial condition specification.
Eigen::Vector< real, -1 > v
Initial state vector (size = nVars).
DNDS_DECLARE_CONFIG(BoxInitializer)
real z1
Box bounds [min, max] per axis.
Expression-based initial condition using the ExprTk library.
std::vector< std::string > exprs
ExprTk expression lines (concatenated with newlines).
DNDS_DECLARE_CONFIG(ExprtkInitializer)
std::string GetExpr() const
Concatenate all expression lines into a single ExprTk program string.
Constant-rotation reference frame settings.
real Omega()
Compute angular velocity magnitude (rad/s) from RPM.
bool enabled
Enable the rotating frame.
real rpm
Rotational speed in revolutions per minute.
Geom::tPoint center
Center of rotation [x, y, z].
Geom::tPoint vOmega()
Return the angular velocity vector (axis * Omega).
Geom::tPoint axis
Rotation axis (unit vector; normalized in finalize()).
DNDS_DECLARE_CONFIG(FrameConstRotation)
Geom::tGPoint rtzFrame(const Geom::tPoint &r)
Build the local cylindrical (r, θ, z) coordinate frame at position r.
Geom::tPoint rVec(const Geom::tPoint &r)
Project a position vector onto the plane perpendicular to the axis.
Ideal gas thermodynamic property set.
int muModel
Viscosity model: 0 = constant, 1 = Sutherland, 2 = constant_nu.
real CSutherland
Sutherland constant (K).
real prGas
Prandtl number.
real muGas
Dynamic viscosity (or reference viscosity for Sutherland).
real CpGas
Heat capacity at constant pressure (derived, not serialized).
DNDS_DECLARE_CONFIG(IdealGasProperty)
real gamma
Ratio of specific heats (Cp/Cv).
real Rgas
Specific gas constant (J/(kg·K) in dimensional runs).
real TRef
Reference temperature (K) for Sutherland's law.
void recomputeDerived()
Recompute derived quantities (CpGas) from gamma and Rgas after deserialization.
Half-space region for initial condition specification.
Eigen::Vector< real, -1 > v
Initial state vector (size = nVars).
DNDS_DECLARE_CONFIG(PlaneInitializer)
real h
Plane equation coefficients: a*x + b*y + c*z = h.
Master configuration struct for the compressible Euler/Navier-Stokes evaluator.
int ransForce2nd
Force 2nd-order accuracy for RANS variables.
real wallDistResTol
Residual tolerance for wall-distance convergence.
bool ignoreSourceTerm
Completely ignore source terms (must be false when RANS or body forces are active).
real centralSmoothEps
Epsilon for central smoothing.
bool forceVolURecBeta
Force volume-based beta in the reconstruction.
real uRecAlphaCompressPower
Alpha compression power for the reconstruction limiter.
int ransSource2nd
Enable 2nd-order RANS source term discretization.
int wallDistExection
Execution mode: 0 = parallel, 1 = serial.
int wallDistNJacobiSweep
Number of Jacobi sweeps per wall-distance iteration.
int rsRotateScheme
Riemann solver rotation scheme selector.
int ransEigScheme
Eigenvalue computation scheme for RANS.
real rsIncFScale
Incremental flux scaling factor.
int rsMeanValueEig
Mean-value eigenvalue computation mode.
int ransSARotCorrection
SA rotation/curvature correction mode.
Gas::RiemannSolverType rsTypeAux
Auxiliary Riemann solver type (UnknownRS = same as primary).
static const int gDim
Geometric dimension (may differ for axi-symmetric).
int wallDistIterStart
Starting iteration count for the wall-distance solver.
std::vector< std::string > cLDriverBCNames
Boundary zone names for CL driver force integration.
real wallDistRefineMax
Maximum wall-distance refinement factor.
int _nVars
Runtime nVars, not serialized. Set by ctor, preserved across from_json.
void finalize()
Post-deserialization finalization: cross-field validation and derived quantities.
int wallDistPoissonP
Poisson equation power in the wall-distance PDE.
real SADESScale
SA-DES length scale (veryLargeReal effectively disables DES).
int SADESMode
SA-DES mode selector (1 = DDES, etc.).
real wallDistDTauScale
Pseudo-time step scaling for wall-distance solver.
int wallDistLinSolver
Linear solver: 0 = Jacobi, 1 = GMRES.
Gas::RiemannSolverType rsTypeWall
Wall-face Riemann solver type (UnknownRS = same as primary).
Eigen::Vector< real, -1 > refUPrim
Reference primitive state (derived from farFieldStaticValue).
static const auto I4
Index of the energy equation in the state vector.
Eigen::Vector< real, -1 > refU
Reference conservative state (derived from farFieldStaticValue).
std::vector< BoxInitializer > boxInitializers
List of box-region initial condition specifiers.
int direct2ndRecMethod
Direct 2nd-order reconstruction method selector.
Gas::RiemannSolverType rsType
Primary Riemann solver type.
int wallDistIter
Maximum iterations for the wall-distance solver.
DNDS_DECLARE_CONFIG(EulerEvaluatorSettings)
int source2nd
Enable 2nd-order source term discretization.
int usePrimGradInVisFlux
Use primitive-variable gradients in viscous flux.
real minWallDist
Minimum wall distance clamp (avoids singularities).
bool useRoeJacobian
Use Roe-linearization-based Jacobian.
int wallDistScheme
Wall-distance computation scheme selector.
real uRecBetaCompressPower
Beta compression power for the reconstruction limiter.
real RANSBottomLimit
Lower clamp for RANS turbulence variables.
int SAVersion
SA model variant selector.
int nCentralSmoothStep
Number of central-difference smoothing steps.
CLDriverSettings cLDriverSettings
Lift-coefficient (CL) driver settings.
struct DNDS::Euler::EulerEvaluatorSettings::FrameConstRotation frameConstRotation
Rotating reference frame configuration.
EulerEvaluatorSettings(int nVars)
Construct with a known variable count and set model-appropriate defaults.
Eigen::Vector< real, 3 > constMassForce
Constant body force vector [fx, fy, fz].
real rsFixScale
Entropy-fix scaling factor for the Riemann solver.
std::vector< PlaneInitializer > planeInitializers
List of plane-region initial condition specifiers.
int specialBuiltinInitializer
Index of a built-in special initializer (0 = none).
EulerEvaluatorSettings()=default
Default constructor (used for schema emission; _nVars remains 0).
bool ppEpsIsRelaxed
Use relaxed positivity-preserving epsilon.
int ransUseQCR
Enable QCR (Quadratic Constitutive Relation) correction.
bool noRsOnWall
Disable the Riemann solver on wall boundary faces.
int wallDistCellLoadSize
Cell batch size for wall-distance computation.
RANSModel ransModel
RANS turbulence model (RANS_None, RANS_SA, RANS_KOWilcox, etc.).
bool noGRPOnWall
Disable the Generalized Riemann Problem (GRP) on wall faces.
std::vector< ExprtkInitializer > exprtkInitializers
List of ExprTk-based initial condition specifiers.
Eigen::Vector< real, -1 > farFieldStaticValue
Far-field reference state vector (size = nVars).
bool useScalarJacobian
Use scalar (diagonal) Jacobian approximation instead of block.
static const int dim
Physical dimension (2 or 3).
int useSourceGradFixGG
Apply Green-Gauss gradient fix for source terms.
struct DNDS::Euler::EulerEvaluatorSettings::IdealGasProperty idealGasProperty
Ideal gas thermodynamic property configuration.
static const int nVarsFixed
Compile-time variable count.
Compile-time traits for EulerModel variants.
static constexpr bool hasSA
True for Spalart-Allmaras models (NS_SA, NS_SA_3D).
static constexpr bool has2EQ
True for 2-equation RANS models (NS_2EQ, NS_2EQ_3D).