27#include <unordered_set>
42 template <EulerModel model>
47 static const int dim = getDim_Fixed(model);
48 static const int gDim = getGeomDim_Fixed(model);
138 return rpm * (2 *
pi / 60.);
171 ret(EigenAll, 0) = rn;
172 ret(EigenAll, 2) =
axis;
173 ret(EigenAll, 1) =
axis.cross(rn);
206 DNDS_FIELD(
v,
"Initial value vector (size = nVars)");
228 DNDS_FIELD(
v,
"Initial value vector (size = nVars)");
256 for (
auto &line :
exprs)
295 config.post_read([](T &s) { s.recomputeDerived(); });
328 config.field_alias(&T::rsType,
"riemannSolverType",
329 "Riemann solver type");
330 config.field_alias(&T::rsTypeAux,
"riemannSolverTypeAux",
331 "Auxiliary Riemann solver type");
332 config.field_alias(&T::rsTypeWall,
"riemannSolverTypeWall",
333 "Wall Riemann solver type");
372 config.field_section(&T::frameConstRotation,
"frameConstRotation",
373 "Constant-rotation reference frame settings");
374 config.field_section(&T::cLDriverSettings,
"cLDriverSettings",
375 "CL driver settings");
378 config.template field_array_of<BoxInitializer>(
379 &T::boxInitializers,
"boxInitializers",
380 "Box region initializers");
381 config.template field_array_of<PlaneInitializer>(
382 &T::planeInitializers,
"planeInitializers",
383 "Plane region initializers");
384 config.template field_array_of<ExprtkInitializer>(
385 &T::exprtkInitializers,
"exprtkInitializers",
386 "Exprtk expression initializers");
387 config.field_section(&T::idealGasProperty,
"idealGasProperty",
388 "Ideal gas thermodynamic properties");
391 config.check(
"useScalarJacobian and useRoeJacobian are mutually exclusive",
392 [](
const T &s) {
return !(s.useScalarJacobian && s.useRoeJacobian); });
393 config.check(
"ransModel must not be RANS_Unknown",
394 [](
const T &s) {
return s.ransModel !=
RANS_Unknown; });
397 config.post_read([](T &s) { s.finalize(); });
449 std::unordered_set<EulerModel>{NS_SA, NS_SA_3D, NS_2EQ, NS_2EQ_3D}.count(model))
451 "you have set source term, do not use ignoreSourceTerm! ");
455 DNDS_assert_info(box.v.size() == nVars,
"box initial value dimension incorrect");
457 DNDS_assert_info(plane.v.size() == nVars,
"plane initial value dimension incorrect");
466 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 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).