DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
EulerEvaluatorSettings.hpp
Go to the documentation of this file.
1/** @file EulerEvaluatorSettings.hpp
2 * @brief Complete solver configuration for the Euler/Navier-Stokes evaluator.
3 *
4 * Contains the EulerEvaluatorSettings template struct which aggregates all
5 * runtime parameters for the compressible flow solver:
6 * - Jacobian options (scalar vs. Roe, wall treatment).
7 * - Reconstruction and limiting parameters.
8 * - Riemann solver selection and tuning.
9 * - Wall-distance computation settings.
10 * - RANS turbulence model selection (SA, k-omega) and DES length scales.
11 * - Viscous flux and source term options.
12 * - Rotating reference frame (FrameConstRotation).
13 * - CL (lift-coefficient) driver configuration.
14 * - Region-based initial conditions (box, plane, exprtk).
15 * - Ideal gas thermodynamic properties.
16 *
17 * All settings use DNDS_DECLARE_CONFIG for automatic JSON schema generation
18 * and serialization/deserialization.
19 */
20#pragma once
21#include "DNDS/JsonUtil.hpp"
22#include "DNDS/ConfigParam.hpp"
23
24#include "Euler.hpp"
25#include "Gas.hpp"
26#include "CLDriver.hpp"
27#include <unordered_set>
28
29namespace DNDS::Euler
30{
31 /**
32 * @brief Master configuration struct for the compressible Euler/Navier-Stokes evaluator.
33 *
34 * Organizes all solver-tunable parameters into a single struct that supports
35 * JSON round-trip serialization via DNDS_DECLARE_CONFIG. After deserialization,
36 * the finalize() hook validates cross-field constraints (e.g. mutually exclusive
37 * Jacobian modes) and computes derived reference quantities.
38 *
39 * @tparam model The EulerModel tag (e.g. NS_SA_3D) that determines variable
40 * count, spatial dimension, and available turbulence model traits.
41 */
42 template <EulerModel model>
44 {
45 using Traits = EulerModelTraits<model>; ///< Compile-time model traits.
46 static const int nVarsFixed = getnVarsFixed(model); ///< Compile-time variable count.
47 static const int dim = getDim_Fixed(model); ///< Physical dimension (2 or 3).
48 static const int gDim = getGeomDim_Fixed(model); ///< Geometric dimension (may differ for axi-symmetric).
49 static const auto I4 = dim + 1; ///< Index of the energy equation in the state vector.
50
51 /// @name Jacobian Options
52 /// @{
53 bool useScalarJacobian = false; ///< Use scalar (diagonal) Jacobian approximation instead of block.
54 bool useRoeJacobian = false; ///< Use Roe-linearization-based Jacobian.
55 bool noRsOnWall = false; ///< Disable the Riemann solver on wall boundary faces.
56 bool noGRPOnWall = false; ///< Disable the Generalized Riemann Problem (GRP) on wall faces.
57 bool ignoreSourceTerm = false; ///< Completely ignore source terms (must be false when RANS or body forces are active).
58 /// @}
59
60 /// @name Reconstruction
61 /// @{
62 int direct2ndRecMethod = 1; ///< Direct 2nd-order reconstruction method selector.
63 int specialBuiltinInitializer = 0; ///< Index of a built-in special initializer (0 = none).
64 real uRecAlphaCompressPower = 1; ///< Alpha compression power for the reconstruction limiter.
65 real uRecBetaCompressPower = 1; ///< Beta compression power for the reconstruction limiter.
66 bool forceVolURecBeta = true; ///< Force volume-based beta in the reconstruction.
67 bool ppEpsIsRelaxed = false; ///< Use relaxed positivity-preserving epsilon.
68 /// @}
69
70 real RANSBottomLimit = 0.01; ///< Lower clamp for RANS turbulence variables.
71
72 /// @name Riemann Solver Configuration
73 /// @{
74 Gas::RiemannSolverType rsType = Gas::Roe; ///< Primary Riemann solver type.
75 Gas::RiemannSolverType rsTypeAux = Gas::UnknownRS; ///< Auxiliary Riemann solver type (UnknownRS = same as primary).
76 Gas::RiemannSolverType rsTypeWall = Gas::UnknownRS; ///< Wall-face Riemann solver type (UnknownRS = same as primary).
77 real rsFixScale = 1; ///< Entropy-fix scaling factor for the Riemann solver.
78 real rsIncFScale = 1; ///< Incremental flux scaling factor.
79 int rsMeanValueEig = 0; ///< Mean-value eigenvalue computation mode.
80 int rsRotateScheme = 0; ///< Riemann solver rotation scheme selector.
81 /// @}
82
83 /// @name Wall-Distance Computation
84 /// @{
85 real minWallDist = 1e-12; ///< Minimum wall distance clamp (avoids singularities).
86 int wallDistExection = 0; ///< Execution mode: 0 = parallel, 1 = serial.
87 real wallDistRefineMax = 1; ///< Maximum wall-distance refinement factor.
88 int wallDistScheme = 0; ///< Wall-distance computation scheme selector.
89 int wallDistCellLoadSize = 1024 * 32; ///< Cell batch size for wall-distance computation.
90 int wallDistIter = 1000; ///< Maximum iterations for the wall-distance solver.
91 int wallDistLinSolver = 0; ///< Linear solver: 0 = Jacobi, 1 = GMRES.
92 real wallDistResTol = 1e-4; ///< Residual tolerance for wall-distance convergence.
93 int wallDistIterStart = 100; ///< Starting iteration count for the wall-distance solver.
94 int wallDistPoissonP = 2; ///< Poisson equation power in the wall-distance PDE.
95 real wallDistDTauScale = 100.; ///< Pseudo-time step scaling for wall-distance solver.
96 int wallDistNJacobiSweep = 10; ///< Number of Jacobi sweeps per wall-distance iteration.
97 /// @}
98
99 /// @name RANS / DES Configuration
100 /// @{
101 real SADESScale = veryLargeReal; ///< SA-DES length scale (veryLargeReal effectively disables DES).
102 int SADESMode = 1; ///< SA-DES mode selector (1 = DDES, etc.).
103 RANSModel ransModel = RANSModel::RANS_None; ///< RANS turbulence model (RANS_None, RANS_SA, RANS_KOWilcox, etc.).
104 int ransUseQCR = 0; ///< Enable QCR (Quadratic Constitutive Relation) correction.
105 int ransSARotCorrection = 1; ///< SA rotation/curvature correction mode.
106 int ransEigScheme = 0; ///< Eigenvalue computation scheme for RANS.
107 int ransForce2nd = 0; ///< Force 2nd-order accuracy for RANS variables.
108 int ransSource2nd = 0; ///< Enable 2nd-order RANS source term discretization.
109 /// @}
110
111 /// @name Viscous Flux and Source Options
112 /// @{
113 int source2nd = 0; ///< Enable 2nd-order source term discretization.
114 int usePrimGradInVisFlux = 0; ///< Use primitive-variable gradients in viscous flux.
115 int useSourceGradFixGG = 0; ///< Apply Green-Gauss gradient fix for source terms.
116 int nCentralSmoothStep = 0; ///< Number of central-difference smoothing steps.
117 real centralSmoothEps = 0.5; ///< Epsilon for central smoothing.
118 Eigen::Vector<real, 3> constMassForce = Eigen::Vector<real, 3>{0, 0, 0}; ///< Constant body force vector [fx, fy, fz].
119 /// @}
120 /**
121 * @brief Constant-rotation reference frame settings.
122 *
123 * When enabled, the solver transforms the governing equations into
124 * a non-inertial frame rotating at a constant angular velocity about
125 * the specified axis through the specified center.
126 */
128 {
129 bool enabled = false; ///< Enable the rotating frame.
130 Geom::tPoint axis = Geom::tPoint{0, 0, 1}; ///< Rotation axis (unit vector; normalized in finalize()).
131 Geom::tPoint center = Geom::tPoint{0, 0, 0}; ///< Center of rotation [x, y, z].
132 real rpm = 0; ///< Rotational speed in revolutions per minute.
133
134 /// @brief Compute angular velocity magnitude (rad/s) from RPM.
135 /// @return Omega = rpm * 2π / 60.
137 {
138 return rpm * (2 * pi / 60.);
139 }
140
141 /// @brief Return the angular velocity vector (axis * Omega).
142 /// @return 3-D omega vector aligned with the rotation axis.
144 {
145 return axis * Omega();
146 }
147
148 /**
149 * @brief Project a position vector onto the plane perpendicular to the axis.
150 * @param r Position vector in the absolute frame.
151 * @return Radial component of @p r (axis-normal projection).
152 */
154 {
155 return r - r.dot(axis) * axis;
156 }
157
158 /**
159 * @brief Build the local cylindrical (r, θ, z) coordinate frame at position @p r.
160 *
161 * Column 0 = radial unit vector, column 1 = tangential (axis × r̂),
162 * column 2 = axial (same as the rotation axis).
163 *
164 * @param r Position vector in the absolute frame.
165 * @return 3×3 matrix whose columns are the (r, θ, z) basis vectors.
166 */
168 {
169 Geom::tPoint rn = rVec(r).normalized();
170 Geom::tGPoint ret;
171 ret(EigenAll, 0) = rn;
172 ret(EigenAll, 2) = axis;
173 ret(EigenAll, 1) = axis.cross(rn);
174 return ret;
175 }
177 {
178 DNDS_FIELD(enabled, "Enable constant-rotation reference frame");
179 DNDS_FIELD(axis, "Rotation axis (unit vector)");
180 DNDS_FIELD(center, "Rotation center coordinates");
181 DNDS_FIELD(rpm, "Rotational speed in RPM");
182 }
183 } frameConstRotation; ///< Rotating reference frame configuration.
184 CLDriverSettings cLDriverSettings; ///< Lift-coefficient (CL) driver settings.
185 std::vector<std::string> cLDriverBCNames; ///< Boundary zone names for CL driver force integration.
186 Eigen::Vector<real, -1> farFieldStaticValue = Eigen::Vector<real, 5>{1, 0, 0, 0, 2.5}; ///< Far-field reference state vector (size = nVars).
187 /**
188 * @brief Axis-aligned box region for initial condition specification.
189 *
190 * Cells whose centroids lie within [x0,x1]×[y0,y1]×[z0,z1] are
191 * initialized to the state vector @c v.
192 */
194 {
195 real x0{0}, x1{0}, y0{0}, y1{0}, z0{0}, z1{0}; ///< Box bounds [min, max] per axis.
196 Eigen::Vector<real, -1> v; ///< Initial state vector (size = nVars).
197
199 {
200 DNDS_FIELD(x0, "Box x-min");
201 DNDS_FIELD(x1, "Box x-max");
202 DNDS_FIELD(y0, "Box y-min");
203 DNDS_FIELD(y1, "Box y-max");
204 DNDS_FIELD(z0, "Box z-min");
205 DNDS_FIELD(z1, "Box z-max");
206 DNDS_FIELD(v, "Initial value vector (size = nVars)");
207 }
208 };
209 std::vector<BoxInitializer> boxInitializers; ///< List of box-region initial condition specifiers.
210
211 /**
212 * @brief Half-space region for initial condition specification.
213 *
214 * Cells satisfying `a*x + b*y + c*z >= h` are initialized to the
215 * state vector @c v. The normal direction is (a, b, c).
216 */
218 {
219 real a{0}, b{0}, c{0}, h{0}; ///< Plane equation coefficients: a*x + b*y + c*z = h.
220 Eigen::Vector<real, -1> v; ///< Initial state vector (size = nVars).
221
223 {
224 DNDS_FIELD(a, "Plane normal x-component");
225 DNDS_FIELD(b, "Plane normal y-component");
226 DNDS_FIELD(c, "Plane normal z-component");
227 DNDS_FIELD(h, "Plane offset");
228 DNDS_FIELD(v, "Initial value vector (size = nVars)");
229 }
230 };
231 std::vector<PlaneInitializer> planeInitializers; ///< List of plane-region initial condition specifiers.
232
233 /**
234 * @brief Expression-based initial condition using the ExprTk library.
235 *
236 * Evaluates user-supplied mathematical expressions (one per line in @c exprs)
237 * to compute the initial state at each cell centroid. Lines are concatenated
238 * with newlines to form a single ExprTk program string.
239 */
241 {
242 std::vector<std::string> exprs; ///< ExprTk expression lines (concatenated with newlines).
243
245 {
246 DNDS_FIELD(exprs, "Expression lines (concatenated with newlines)");
247 }
248
249 /**
250 * @brief Concatenate all expression lines into a single ExprTk program string.
251 * @return The full expression string with newline separators.
252 */
253 std::string GetExpr() const
254 {
255 std::string ret;
256 for (auto &line : exprs)
257 ret += line + "\n";
258 return ret;
259 }
260 };
261 std::vector<ExprtkInitializer> exprtkInitializers; ///< List of ExprTk-based initial condition specifiers.
262
263 /**
264 * @brief Ideal gas thermodynamic property set.
265 *
266 * Stores gamma, gas constant, viscosity parameters, and Prandtl number.
267 * The heat capacity CpGas is a derived quantity recomputed automatically
268 * after deserialization via the post_read hook calling recomputeDerived().
269 */
271 {
272 real gamma = 1.4; ///< Ratio of specific heats (Cp/Cv).
273 real Rgas = 1; ///< Specific gas constant (J/(kg·K) in dimensional runs).
274 real muGas = 1; ///< Dynamic viscosity (or reference viscosity for Sutherland).
275 real prGas = 0.72; ///< Prandtl number.
276 real CpGas = Rgas * gamma / (gamma - 1); ///< Heat capacity at constant pressure (derived, not serialized).
277 real TRef = 273.15; ///< Reference temperature (K) for Sutherland's law.
278 real CSutherland = 110.4; ///< Sutherland constant (K).
279 int muModel = 1; ///< Viscosity model: 0 = constant, 1 = Sutherland, 2 = constant_nu.
280
282 {
283 DNDS_FIELD(gamma, "Ratio of specific heats",
285 DNDS_FIELD(Rgas, "Specific gas constant",
287 DNDS_FIELD(muGas, "Dynamic viscosity",
289 DNDS_FIELD(prGas, "Prandtl number",
291 DNDS_FIELD(TRef, "Reference temperature (K)");
292 DNDS_FIELD(CSutherland, "Sutherland constant (K)");
293 DNDS_FIELD(muModel, "Viscosity model: 0=constant, 1=sutherland, 2=constant_nu");
294 // CpGas is derived: recomputed after deserialization
295 config.post_read([](T &s) { s.recomputeDerived(); });
296 }
297
298 /// @brief Recompute derived quantities (CpGas) from gamma and Rgas after deserialization.
300 {
301 CpGas = Rgas * gamma / (gamma - 1);
302 }
303 } idealGasProperty; ///< Ideal gas thermodynamic property configuration.
304
305 /***************************************************************************************************/
306 // end of setting entries
307 /***************************************************************************************************/
308
309 int _nVars = 0; ///< Runtime nVars, not serialized. Set by ctor, preserved across from_json.
310 Eigen::Vector<real, -1> refU; ///< Reference conservative state (derived from farFieldStaticValue).
311 Eigen::Vector<real, -1> refUPrim; ///< Reference primitive state (derived from farFieldStaticValue).
312
314 {
315 DNDS_FIELD(useScalarJacobian, "Use scalar Jacobian approximation");
316 DNDS_FIELD(useRoeJacobian, "Use Roe-based Jacobian");
317 DNDS_FIELD(noRsOnWall, "Disable Riemann solver on wall boundaries");
318 DNDS_FIELD(noGRPOnWall, "Disable GRP on wall boundaries");
319 DNDS_FIELD(ignoreSourceTerm, "Ignore source terms");
320 DNDS_FIELD(direct2ndRecMethod, "Direct 2nd-order reconstruction method");
321 DNDS_FIELD(specialBuiltinInitializer, "Special built-in initializer code");
322 DNDS_FIELD(uRecAlphaCompressPower, "uRec alpha compression power");
323 DNDS_FIELD(uRecBetaCompressPower, "uRec beta compression power");
324 DNDS_FIELD(forceVolURecBeta, "Force volume uRec beta");
325 DNDS_FIELD(ppEpsIsRelaxed, "Positivity-preserving epsilon is relaxed");
326 DNDS_FIELD(RANSBottomLimit, "RANS variable bottom limit",
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");
334 DNDS_FIELD(rsFixScale, "Riemann solver entropy fix scale");
335 DNDS_FIELD(rsIncFScale, "Riemann solver increment flux scale");
336 DNDS_FIELD(rsMeanValueEig, "Riemann solver mean-value eigenvalue mode");
337 DNDS_FIELD(rsRotateScheme, "Riemann solver rotation scheme");
338 DNDS_FIELD(minWallDist, "Minimum wall distance clamp",
340 DNDS_FIELD(wallDistExection, "Wall distance execution mode: 0=parallel, 1=serial");
341 DNDS_FIELD(wallDistRefineMax, "Wall distance max refinement");
342 DNDS_FIELD(wallDistScheme, "Wall distance computation scheme");
343 DNDS_FIELD(wallDistCellLoadSize, "Wall distance cell load batch size",
345 DNDS_FIELD(wallDistIter, "Wall distance solver iterations",
347 DNDS_FIELD(wallDistLinSolver, "Wall distance linear solver: 0=jacobi, 1=gmres");
348 DNDS_FIELD(wallDistResTol, "Wall distance residual tolerance",
350 DNDS_FIELD(wallDistIterStart, "Wall distance solver start iteration",
352 DNDS_FIELD(wallDistPoissonP, "Wall distance Poisson equation power");
353 DNDS_FIELD(wallDistDTauScale, "Wall distance pseudo-time scale",
355 DNDS_FIELD(wallDistNJacobiSweep, "Wall distance Jacobi sweep count",
357 DNDS_FIELD(SADESScale, "SA-DES length scale");
358 DNDS_FIELD(SADESMode, "SA-DES mode");
359 DNDS_FIELD(ransModel, "RANS turbulence model");
360 DNDS_FIELD(ransUseQCR, "Use QCR correction for RANS");
361 DNDS_FIELD(ransSARotCorrection, "SA rotation correction");
362 DNDS_FIELD(ransEigScheme, "RANS eigenvalue scheme");
363 DNDS_FIELD(ransForce2nd, "Force 2nd-order RANS");
364 DNDS_FIELD(ransSource2nd, "RANS source 2nd-order");
365 DNDS_FIELD(source2nd, "Source term 2nd-order");
366 DNDS_FIELD(usePrimGradInVisFlux, "Use primitive gradient in viscous flux");
367 DNDS_FIELD(useSourceGradFixGG, "Use source gradient fix for Green-Gauss");
368 DNDS_FIELD(nCentralSmoothStep, "Central smoothing steps",
370 DNDS_FIELD(centralSmoothEps, "Central smoothing epsilon");
371 DNDS_FIELD(constMassForce, "Constant mass force vector (3D)");
372 config.field_section(&T::frameConstRotation, "frameConstRotation",
373 "Constant-rotation reference frame settings");
374 config.field_section(&T::cLDriverSettings, "cLDriverSettings",
375 "CL driver settings");
376 DNDS_FIELD(cLDriverBCNames, "Boundary names for CL driver force integration");
377 DNDS_FIELD(farFieldStaticValue, "Far-field static value vector (size = nVars)");
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");
389
390 // Cross-field checks
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; });
395
396 // Post-read hook: finalize derived quantities using stored _nVars
397 config.post_read([](T &s) { s.finalize(); });
398 }
399
400 /// @brief Default constructor (used for schema emission; _nVars remains 0).
402
403 /**
404 * @brief Construct with a known variable count and set model-appropriate defaults.
405 *
406 * If the model includes SA or 2-equation RANS traits, the default ransModel
407 * is set accordingly. The farFieldStaticValue is sized to @p nVars and
408 * initialized to a default freestream state.
409 *
410 * @param nVars Number of conservative variables for this model.
411 */
412 EulerEvaluatorSettings(int nVars) : _nVars(nVars)
413 {
414 if constexpr (Traits::hasSA)
415 {
417 }
418 if constexpr (Traits::has2EQ)
419 {
421 }
422 farFieldStaticValue.setOnes(nVars);
423 DNDS_assert(nVars > I4);
424 farFieldStaticValue(0) = 1;
425 farFieldStaticValue(Eigen::seq(Eigen::fix<0>, Eigen::fix<I4>)).setZero();
426 farFieldStaticValue(I4) = 2.5;
427 }
428
429 /**
430 * @brief Post-deserialization finalization: cross-field validation and derived quantities.
431 *
432 * Checks dimensional consistency of farFieldStaticValue, boxInitializers, and
433 * planeInitializers against _nVars. Normalizes the rotation axis if the rotating
434 * frame is enabled. Computes refU and refUPrim from the far-field state and ideal
435 * gas properties for use as reference scales in the solver.
436 *
437 * Uses the stored _nVars set by the constructor. Called automatically by the
438 * post_read hook after from_json, or explicitly after copy-construction.
439 * If _nVars <= 0 (e.g. default-constructed for schema emission), this is a no-op.
440 */
441 void finalize()
442 {
443 int nVars = _nVars;
444 if (nVars <= 0)
445 return; // skip finalize if nVars not set (e.g. schema emission default-ctor)
446 DNDS_assert(constMassForce.size() == 3);
447 DNDS_assert(farFieldStaticValue.size() == nVars);
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! ");
453 frameConstRotation.axis.normalize();
454 for (auto &box : boxInitializers)
455 DNDS_assert_info(box.v.size() == nVars, "box initial value dimension incorrect");
456 for (auto &plane : planeInitializers)
457 DNDS_assert_info(plane.v.size() == nVars, "plane initial value dimension incorrect");
458
459 // Compute reference values
462 refUPrim = refU;
463 Gas::IdealGasThermalConservative2Primitive<dim>(refU, refUPrim, idealGasProperty.gamma);
464 DNDS_assert(refUPrim(I4) > 0 && refUPrim(0) > 0);
465 real a = std::sqrt(idealGasProperty.gamma * refUPrim(I4) / (refUPrim(0) + verySmallReal));
466 refU(Seq123).setConstant(refU(Seq123).norm() + a);
467 refUPrim(Seq123).setConstant(refUPrim(Seq123).norm());
468 }
469 };
470}
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.
Definition Errors.hpp:113
#define DNDS_assert(expr)
Debug-only assertion (compiled out when DNDS_NDEBUG is defined). Prints the expression + file/line + ...
Definition Errors.hpp:108
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.
Definition Euler.hpp:56
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.
Definition Gas.hpp:62
RANSModel
Enumerates the available RANS turbulence closure models.
Definition Euler.hpp:898
@ RANS_Unknown
Sentinel / uninitialized value.
Definition Euler.hpp:899
@ RANS_SA
Spalart-Allmaras one-equation model.
Definition Euler.hpp:901
@ RANS_None
No turbulence model (laminar or DNS).
Definition Euler.hpp:900
@ RANS_KOWilcox
Wilcox k-omega two-equation model.
Definition Euler.hpp:902
Eigen::Vector3d tPoint
Definition Geometric.hpp:9
Eigen::Matrix3d tGPoint
Definition Geometric.hpp:11
DNDS_CONSTANT const real verySmallReal
Catch-all lower bound ("effectively zero").
Definition Defines.hpp:194
DNDS_CONSTANT const real pi
π in double precision (matches DNDS_E_PI macro).
Definition Defines.hpp:199
double real
Canonical floating-point scalar used throughout DNDSR (double precision).
Definition Defines.hpp:105
DNDS_CONSTANT const real veryLargeReal
Catch-all upper bound ("practically infinity") for physical scalars.
Definition Defines.hpp:190
JSON-configurable settings for the CL (lift coefficient) driver.
Definition CLDriver.hpp:31
Axis-aligned box region for initial condition specification.
Eigen::Vector< real, -1 > v
Initial state vector (size = nVars).
Expression-based initial condition using the ExprTk library.
std::vector< std::string > exprs
ExprTk expression lines (concatenated with newlines).
std::string GetExpr() const
Concatenate all expression lines into a single ExprTk program string.
real Omega()
Compute angular velocity magnitude (rad/s) from RPM.
real rpm
Rotational speed in revolutions per minute.
Geom::tPoint vOmega()
Return the angular velocity vector (axis * Omega).
Geom::tPoint axis
Rotation axis (unit vector; normalized in finalize()).
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.
int muModel
Viscosity model: 0 = constant, 1 = Sutherland, 2 = constant_nu.
real muGas
Dynamic viscosity (or reference viscosity for Sutherland).
real CpGas
Heat capacity at constant pressure (derived, not serialized).
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).
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.
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.
Definition Euler.hpp:1086
static constexpr bool hasSA
True for Spalart-Allmaras models (NS_SA, NS_SA_3D).
Definition Euler.hpp:1095
static constexpr bool has2EQ
True for 2-equation RANS models (NS_2EQ, NS_2EQ_3D).
Definition Euler.hpp:1097
tVec r(NCells)