Skip to content

Commit c677b0d

Browse files
AngPassAngelo PassarielloAngelo PassarielloAngelo Passariellopaan882
authored
Stochastic Backscatter Model for Grey Area Mitigation in Hybrid RANS-LES Simulations (#2572)
* Preliminary implementation: uncorrelated stochastic variables The Reynolds stress tensor definition is modified to include a random contribution, which is expressed as the curl of a normally-distributed stochastic vector potential. * Add solution of Langevin equations Add Langevin equations to Spalart-Allmaras solver (uncorrelated random source term) + add stochastic contribution to Reynolds stress tensor (using conservative variables from Langevin equations). * Fix sanitizer warnings and regression failures Fix sanitizer warnings and regression test failures - Address issues reported by clang sanitizers. - Adjust implementation to ensure regression tests pass. * Minor fixes - Enhance readability. - Ensure consistent declaration types. * Ensure consistency with DES - Extend implementation to 2D configurations. - Improve robustness. * Boundary conditions for Langevin equations Enforce boundary conditions in Langevin equations. * Use symmetry-preserving scheme for Langevin equations - Implement a skew-symmetric scheme for the discretization of the convective terms in the Langevin equations. - Fix the seed for the generation of the random source terms at the beginning of the simulation. * Add option for simulating DIHT - Add the flag for the simulation of the Decaying Isotropic Homogeneous Turbulence. - Generate the initial velocity field matching the experimental data by Comte-Bellot & Corrsin. - Include a preliminary test case. * Fix options for DIHT - Implement flag to enforce LES in the whole domain. - Add option to set the LES filter width to a user-specified value. - Add velocity divergence to volume outputs. - Remove internal generation of initial velocity field for simulating the Decaying Isotropic Homogeneous Turbulence (DIHT). * Consistent estimation of turb. kinetic energy (for SA) - Add consistent evaluation of the turbulent kinetic energy in the random source term appearing in the momentum equations. - Add backscatter intensity coefficient in the configuration file. - Add random initialization of the Langevin variables. * Add Laplacian smoothing (Langevin equations) - Add Laplacian smoothing of source terms in Langevin equations. Remark: pseudo-time integration is employed (residuals are printed on screen with fixed frequency, the maximum number of time iterations can be defined by the user). * Fix redundancy in CTurbSAVariable.hpp - Fix redundancy in virtual member definition. * Add stochastic source to turbulence model equation - Add stochastic source term to Spalart-Allmaras turbulence model equation (to ensure exchange of modeled and resolved kinetic energy). * SOR algorithm for Laplacian smoothing - Replace dual-time integration with Successive Over-Relaxation for Laplacian smoothing. - Initialize stochastic vector potential as equal to the stochastic source terms in Langevin equations. - Add random source term to main balance equations in LES zones exclusively. - Blend RANS and LES turbulence timescales using the LES sensor. * Correct scaling of stochastic source terms in Langevin eqs. - Scale source terms in Langevin equations using Bessel functions to preserve the variance. - Compute Bessel integral at the beginning of the simulation for optimization. - Add variance monitoring to screen output. * Add LD2 scheme for the incompressible solver - Add LD2 discretization for the inviscid terms in the main balance equations. Remarks: -- Valid only for the incompressible flow solver, with constant density fluid model. -- JST scheme must be selected in the config file. The novel option LD2_SCHEME must be set to YES. * Fix LD2 for periodic boundaries - Retrieve classic second-order central scheme at periodic boundaries. * Include stochastic source term in turb. equation Add option to include stochastic contribution to turbulence model equation. * Minor fixes - Use logarithmic approximation for Bessel function. - Compute relative variance of the stochastic field for verification. * Add time-averaged skin friction coefficient - Add option to print time-averaged skin friction coefficient in volume output. * Minor fix - Minor syntax fix in CConfig.cpp * Minor fix - Minor syntax fix in CConfig.cpp * Add fields to VOLUME_OUTPUT - Include time-averaged skin friction coefficient and instantaneous energy backscatter ratio into volume output fields. - Fix boundary conditions for the implicit smoothing of the stochastic source term in Langevin equations. - Fix computation of the source term in turbulence model equation. - Fix computation of the subgrid kinetic energy (divide eddy viscosity by flow density). - Diagonalize Jacobian in turbulence equations for numerical robustness. * Fix LD2 option in config file - Allow LD2 option only for JST scheme. * Enhance numerical robustness - Add option to include diagnostics of the stochastic source term smoothing. - Add relaxation factor for the random forcing term in the main balanca equations. - Add modeled and stochastic Reynolds stresses to volume output files. * Enhance numerical efficiency - Random generators removed from static variables. - Random generators re-initialized at every time step using deterministic seeds. * Fix bug in viscous flux computation - Account for zero DES length scale in ghost cells. - Fix threshold (=0.9) for the activation of the backscatter model. * First major revision - Add LD2 scheme to CONV_NUM_METHOD enum. - Change scaling of the backscatter term. - Increase the size of residual and Jacobian in turb_sources.hpp. - Remove dynamic allocation in CTurbSASolver.cpp. - Add helper function to compute relaxed backscatter intensity coefficient. - Include pressure extrapolation in LD2 scheme formulation. - Make code style homogeneous. * Minor fixes - Redefine default values for backscatter parameters. - Introduce RANS-LES blending factor for source terms in Langevin equations. - Fix bug in MPI communication of slope limiters between periodic faces. * Add new features - Add the option to apply the backscatter model only in a bounded box. - Add the option to enforce backscatter where shielding function exceeds user-defined value. - Correct bug in LD2 implementation. - Make style consistent and update configuration template. * Redefine scaling of stochastic source term - Modify the scaling of the stochastic forcing to include the modeled viscosity. - Fix the computation of the stochastic tensor. - Add the MPI communication of the DES lengthscale. * Update config template * Delete TestCases/backscatter/DIHT directory Remove outdated configuration file. * Include stochastic variables in restart file - Add the stochastic variables (from Langevin equations) to the restart file. - Optimize the definition of the points lying inside the box where the backscatter model is active. - Limit the turbulence time scale in RANS regions (Langevin equations). - Add test case: spatially-developing mixing layer. * Change proposed test case * Update Common/include/toolboxes/random_toolbox.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update Common/include/toolboxes/random_toolbox.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update SU2_CFD/src/solvers/CTurbSASolver.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update SU2_CFD/src/solvers/CTurbSASolver.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update SU2_CFD/include/numerics/turbulent/turb_sources.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update SU2_CFD/src/numerics/flow/convection/centered.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update SU2_CFD/src/solvers/CTurbSASolver.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Second major revision * Minor fixes * Minor fixes * Third major revision * Update SU2_CFD/include/variables/CTurbSAVariable.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update SU2_CFD/include/numerics/CNumerics.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update SU2_CFD/src/solvers/CTurbSASolver.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update SU2_CFD/src/solvers/CTurbSASolver.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update SU2_CFD/src/solvers/CTurbSASolver.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Add residuals of stoch. variables to vol. outputs * Update Common/include/toolboxes/random_toolbox.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Fix compilation errors * Fix compilation errors - bis * Fix compilation errors - tris * Fix compilation errors - tetra * Apply suggestions from code review Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update SU2_CFD/include/variables/CTurbSAVariable.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update SU2_CFD/include/variables/CTurbSAVariable.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update SU2_CFD/include/variables/CTurbSAVariable.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update SU2_CFD/include/variables/CTurbVariable.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update SU2_CFD/src/variables/CTurbSAVariable.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update SU2_CFD/src/solvers/CTurbSASolver.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Fix code formatting * Fix compilation errors - V * Fix errors in regression tests (hopefully) * Restore nPrimVarGrad in InitiatePeriodicComms * Restore DDES test case (committed by mistake) * Simplify backscatter test * Fix compilation issues * Fix parallel regression * Fix regressions * Fix regressions #2 --------- Co-authored-by: Angelo Passariello <apassari@login02.leonardo.local> Co-authored-by: Angelo Passariello <apassari@login05.leonardo.local> Co-authored-by: Angelo Passariello <apassari@login01.leonardo.local> Co-authored-by: paan882 <paan882@frontend.cluster.lan> Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com>
1 parent 68acbf8 commit c677b0d

46 files changed

Lines changed: 1771 additions & 95 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Common/include/CConfig.hpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,21 @@ class CConfig {
10961096
WINDOW_FUNCTION Kind_WindowFct; /*!< \brief Type of window (weight) function for objective functional. */
10971097
unsigned short Kind_HybridRANSLES; /*!< \brief Kind of Hybrid RANS/LES. */
10981098
unsigned short Kind_RoeLowDiss; /*!< \brief Kind of Roe scheme with low dissipation for unsteady flows. */
1099+
struct CStochBackScatParam {
1100+
bool StochasticBackscatter; /*!< \brief Option to include Stochastic Backscatter Model. */
1101+
su2double SBS_Cdelta; /*!< \brief Stochastic Backscatter Model lengthscale coefficient. */
1102+
unsigned short SBS_maxIterSmooth; /*!< \brief Maximum number of smoothing iterations for the SBS model. */
1103+
su2double SBS_Ctau; /*!< \brief Stochastic Backscatter Model timescale coefficient. */
1104+
su2double SBS_Cmag; /*!< \brief Stochastic Backscatter Model intensity coefficient. */
1105+
bool stochSourceNu; /*!< \brief Option for including stochastic source term in turbulence model equation (Stochastic Backscatter Model). */
1106+
bool stochSourceDiagnostics; /*!< \brief Option for writing diagnostics related to stochastic source terms in Langevin equations (Stochastic Backscatter Model). */
1107+
bool StochBackscatterInBox; /*!< \brief Option for activating the Stochastic Backscatter Model only in a bounded box. */
1108+
su2double StochBackscatterBoxBounds[6]; /*!< \brief Bounds of the box where the Stochastic Backscatter Model is active. */
1109+
su2double stochFdThreshold; /*!< \brief Shielding function lower threshold for application of Stochastic Backscatter Model. */
1110+
su2double stochSourceRelax; /*!< \brief Relaxation factor for stochastic source term generation (Stochastic Backscatter Model). */
1111+
} SBSParam;
1112+
bool enforceLES; /*!< \brief Option to enforce LES mode in hybrid RANS-LES simulations. */
1113+
su2double LES_FilterWidth; /*!< \brief LES filter width for hybrid RANS-LES simulations. */
10991114

11001115
unsigned short nSpanWiseSections; /*!< \brief number of span-wise sections */
11011116
unsigned short nSpanMaxAllZones; /*!< \brief number of maximum span-wise sections for all zones */
@@ -9598,12 +9613,30 @@ class CConfig {
95989613
*/
95999614
unsigned short GetKind_HybridRANSLES(void) const { return Kind_HybridRANSLES; }
96009615

9616+
/*!
9617+
* \brief Get if the LES mode must be enforced.
9618+
* \return TRUE if LES is enforced.
9619+
*/
9620+
bool GetEnforceLES(void) const { return enforceLES; }
9621+
9622+
/*!
9623+
* \brief Get the LES Filter Width.
9624+
* \return Value of LES Filter Width.
9625+
*/
9626+
su2double GetLES_FilterWidth(void) const { return LES_FilterWidth; }
9627+
96019628
/*!
96029629
* \brief Get the Kind of Roe Low Dissipation Scheme for Unsteady flows.
96039630
* \return Value of Low dissipation approach.
96049631
*/
96059632
unsigned short GetKind_RoeLowDiss(void) const { return Kind_RoeLowDiss; }
96069633

9634+
/*!
9635+
* \brief Get the Stochastic BackScatter (SBS) model parameters.
9636+
* \return SBS model parameters.
9637+
*/
9638+
const CStochBackScatParam& GetSBSParam(void) const { return SBSParam; }
9639+
96079640
/*!
96089641
* \brief Get the DES Constant.
96099642
* \return Value of DES constant.

Common/include/option_structure.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,14 +824,16 @@ enum class CENTERED {
824824
JST, /*!< \brief Jameson-Smith-Turkel centered numerical method. */
825825
LAX, /*!< \brief Lax-Friedrich centered numerical method. */
826826
JST_MAT, /*!< \brief JST with matrix dissipation. */
827-
JST_KE /*!< \brief Kinetic Energy preserving Jameson-Smith-Turkel centered numerical method. */
827+
JST_KE, /*!< \brief Kinetic Energy preserving Jameson-Smith-Turkel centered numerical method. */
828+
LD2 /*!< \brief Low-Dissipation Low-Dispersion (LD2) centered scheme. */
828829
};
829830
static const MapType<std::string, CENTERED> Centered_Map = {
830831
MakePair("NONE", CENTERED::NONE)
831832
MakePair("JST", CENTERED::JST)
832833
MakePair("JST_KE", CENTERED::JST_KE)
833834
MakePair("JST_MAT", CENTERED::JST_MAT)
834835
MakePair("LAX-FRIEDRICH", CENTERED::LAX)
836+
MakePair("LD2", CENTERED::LD2)
835837
};
836838

837839

@@ -2716,6 +2718,8 @@ enum class MPI_QUANTITIES {
27162718
MAX_LENGTH , /*!< \brief Maximum length communication. */
27172719
GRID_VELOCITY , /*!< \brief Grid velocity communication. */
27182720
SOLUTION_EDDY , /*!< \brief Turbulent solution plus eddy viscosity communication. */
2721+
STOCH_SOURCE_LANG , /*!< \brief Stochastic source term for Langevin equations communication. */
2722+
DES_LENGTHSCALE , /*!< \brief DES length scale communication. */
27192723
SOLUTION_MATRIX , /*!< \brief Matrix solution communication. */
27202724
SOLUTION_MATRIXTRANS , /*!< \brief Matrix transposed solution communication. */
27212725
NEIGHBORS , /*!< \brief Neighbor point count communication (for JST). */
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
/*!
2+
* \file random_toolbox.hpp
3+
* \brief Collection of utility functions for random number generation.
4+
* \version 8.4.0 "Harrier"
5+
*
6+
* SU2 Project Website: https://su2code.github.io
7+
*
8+
* The SU2 Project is maintained by the SU2 Foundation
9+
* (http://su2foundation.org)
10+
*
11+
* Copyright 2012-2025, SU2 Contributors (cf. AUTHORS.md)
12+
*
13+
* SU2 is free software; you can redistribute it and/or
14+
* modify it under the terms of the GNU Lesser General Public
15+
* License as published by the Free Software Foundation; either
16+
* version 2.1 of the License, or (at your option) any later version.
17+
*
18+
* SU2 is distributed in the hope that it will be useful,
19+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21+
* Lesser General Public License for more details.
22+
*
23+
* You should have received a copy of the GNU Lesser General Public
24+
* License along with SU2. If not, see <http://www.gnu.org/licenses/>.
25+
*/
26+
27+
#pragma once
28+
#include <cstdint>
29+
#include "../option_structure.hpp"
30+
31+
namespace RandomToolbox {
32+
/// \addtogroup RandomToolbox
33+
/// @{
34+
35+
/*!
36+
* \brief SplitMix64 hash function for 64-bit integers.
37+
* \param[in] x Input value to hash.
38+
* \return Hashed 64-bit output.
39+
*/
40+
static inline uint64_t splitmix64(uint64_t x) {
41+
x += 0x9e3779b97f4a7c15ULL; // golden ratio offset
42+
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9ULL; // first mixing step
43+
x = (x ^ (x >> 27)) * 0x94d049bb133111ebULL; // second mixing step
44+
return x ^ (x >> 31); // final avalanche
45+
}
46+
47+
/*!
48+
* \brief Generate a deterministic 64-bit hash from three integers.
49+
* \param[in] nodeIndex Global node index.
50+
* \param[in] iDim Dimension index.
51+
* \param[in] timeIter Current time iteration of the simulation.
52+
* \return 64-bit hash value.
53+
*/
54+
inline uint64_t GetHash(unsigned long nodeIndex, unsigned short iDim, unsigned long timeIter) {
55+
uint64_t x = nodeIndex;
56+
x ^= splitmix64(iDim);
57+
x ^= splitmix64(timeIter);
58+
return splitmix64(x);
59+
}
60+
61+
/*!
62+
* \brief Convert a 64-bit hash into a uniform double in (0,1].
63+
* Uses the top 53 bits of the hash to fill the mantissa of a double.
64+
* Ensures the result is never zero, suitable for Box-Muller transform.
65+
* \param[in] x 64-bit hash.
66+
* \return Uniform double in the interval (0,1].
67+
*/
68+
inline double HashToUniform(uint64_t x) {
69+
constexpr double inv53 = 1.0 / 9007199254740992.0; // 1/2^53
70+
uint64_t uInt = x >> 11; // top 53 bits
71+
return (uInt + 1) * inv53; // map to (0,1]
72+
}
73+
74+
/*!
75+
* \brief Generate a standard normal random number from a 64-bit hash.
76+
* Uses two deterministic uniforms derived from the hash and its bitwise NOT
77+
* as inputs to the Box-Muller transform.
78+
* \param[in] x 64-bit hash.
79+
* \return Standard normal random number (mean=0, stddev=1).
80+
*/
81+
inline double HashToNormal(uint64_t x) {
82+
double u = HashToUniform(x); // first uniform
83+
double v = HashToUniform(~x); // second uniform (bitwise NOT)
84+
double r = sqrt(-2.0 * log(u));
85+
double theta = 2.0 * PI_NUMBER * v;
86+
return r * cos(theta); // one normal sample
87+
}
88+
89+
/*!
90+
* \brief Generate a deterministic standard normal number for a cell, dimension, and timestep.
91+
*
92+
* Combines hashing and Box-Muller in one function.
93+
*
94+
* \param[in] nodeIndex Global node index.
95+
* \param[in] dim Dimension index.
96+
* \param[in] timeIter Simulation timestep (1-based).
97+
* \return Standard normal random number.
98+
*/
99+
inline double GetNormal(unsigned long nodeIndex, unsigned long dim, unsigned long timeIter) {
100+
uint64_t hash = GetHash(nodeIndex, dim, timeIter);
101+
return HashToNormal(hash);
102+
}
103+
104+
/*!
105+
* \brief Compute modified bessel function of first kind (order 0).
106+
* \param[in] x Argument of Bessel funtion.
107+
* \return Value of Bessel function.
108+
*/
109+
template <class T>
110+
inline T GetBesselZero(const T& x) {
111+
T abx = fabs(x);
112+
113+
if (abx < 3.75) {
114+
T t = abx / 3.75;
115+
T p =
116+
1.0 +
117+
t * t *
118+
(3.5156229 +
119+
t * t * (3.0899424 + t * t * (1.2067492 + t * t * (0.2659732 + t * t * (0.0360768 + t * t * 0.0045813)))));
120+
return log(p);
121+
} else {
122+
T t = 3.75 / abx;
123+
124+
T poly =
125+
0.39894228 +
126+
t * (0.01328592 +
127+
t * (0.00225319 +
128+
t * (-0.00157565 +
129+
t * (0.00916281 + t * (-0.02057706 + t * (0.02635537 + t * (-0.01647633 + t * 0.00392377)))))));
130+
131+
T arg = sqrt(abx) * poly;
132+
return abx - log(arg);
133+
}
134+
}
135+
136+
/*!
137+
* \brief Compute integral involving the product of three modified Bessel functions.
138+
* Useful for scaling the smoothed stochastic source terms in Langevin equations.
139+
* \param[in] beta_x Argument in x-direction.
140+
* \param[in] beta_y Argument in y-direction.
141+
* \param[in] beta_z Argument in z-direction.
142+
* \return Value of the integral.
143+
*/
144+
template <class T>
145+
inline T GetBesselIntegral(const T& beta_x, const T& beta_y, const T& beta_z) {
146+
const T A = 1 + 2 * (beta_x + beta_y + beta_z);
147+
const T Bx = 2 * beta_x;
148+
const T By = 2 * beta_y;
149+
const T Bz = 2 * beta_z;
150+
151+
const int N = 4000;
152+
const T t_max = 20.0;
153+
const T dt = t_max / N;
154+
155+
T sum = T(0.0);
156+
157+
for (int i = 1; i <= N; i++) {
158+
T t = i * dt;
159+
160+
T lin = log(t) - A * t + GetBesselZero(T(Bx * t)) + GetBesselZero(T(By * t)) + GetBesselZero(T(Bz * t));
161+
162+
T integrand = exp(lin);
163+
164+
T weight = (i == N) ? 0.5 : 1.0;
165+
sum += integrand * weight;
166+
}
167+
168+
return sum * dt;
169+
}
170+
171+
/// @}
172+
} // namespace RandomToolbox

Common/src/CConfig.cpp

Lines changed: 105 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2966,9 +2966,48 @@ void CConfig::SetConfig_Options() {
29662966
/* DESCRIPTION: DES Constant */
29672967
addDoubleOption("DES_CONST", Const_DES, 0.65);
29682968

2969+
/* DESCRIPTION: SBS lengthscale coefficient */
2970+
addDoubleOption("SBS_LENGTHSCALE_COEFF", SBSParam.SBS_Cdelta, 0.02);
2971+
2972+
/* DESCRIPTION: Maximum number of smoothing iterations for SBS model. */
2973+
addUnsignedShortOption("SBS_MAX_ITER_SMOOTH", SBSParam.SBS_maxIterSmooth, 100);
2974+
2975+
/* DESCRIPTION: SBS timescale coefficient */
2976+
addDoubleOption("SBS_TIMESCALE_COEFF", SBSParam.SBS_Ctau, 0.05);
2977+
2978+
/* DESCRIPTION: SBS intensity coefficient */
2979+
addDoubleOption("SBS_INTENSITY_COEFF", SBSParam.SBS_Cmag, 1.0);
2980+
29692981
/* DESCRIPTION: Specify Hybrid RANS/LES model */
29702982
addEnumOption("HYBRID_RANSLES", Kind_HybridRANSLES, HybridRANSLES_Map, NO_HYBRIDRANSLES);
29712983

2984+
/* DESCRIPTION: Specify if the Stochastic Backscatter Model must be activated */
2985+
addBoolOption("STOCHASTIC_BACKSCATTER", SBSParam.StochasticBackscatter, false);
2986+
2987+
/* DESCRIPTION: Specify if the LES mode must be enforced */
2988+
addBoolOption("ENFORCE_LES", enforceLES, false);
2989+
2990+
/* DESCRIPTION: Specify if the stochastic source term must be included in the turbulence model equation */
2991+
addBoolOption("SBS_SOURCE_NU_EQUATION", SBSParam.stochSourceNu, true);
2992+
2993+
/* DESCRIPTION: Enable diagnostics of the stochastic source term in Langevin equation. */
2994+
addBoolOption("SBS_SOURCE_DIAGNOSTICS", SBSParam.stochSourceDiagnostics, false);
2995+
2996+
/* DESCRIPTION: Relaxation factor for the stochastic source term (Stochastic Backscatter Model) */
2997+
addDoubleOption("SBS_RELAXATION_FACTOR", SBSParam.stochSourceRelax, 0.0);
2998+
2999+
/* DESCRIPTION: Apply Stochastic Backscatter Model only in a bounded box */
3000+
addBoolOption("SBS_IN_BOX", SBSParam.StochBackscatterInBox, false);
3001+
3002+
/* DESCRIPTION: Specify extents of box where Stochastic Backscatter Model is active */
3003+
addDoubleArrayOption("SBS_BOX_BOUNDS", 6, false, SBSParam.StochBackscatterBoxBounds);
3004+
3005+
/* DESCRIPTION: Shielding function lower threshold for application of Stochastic Backscatter Model */
3006+
addDoubleOption("SBS_FD_LOWER_THRESHOLD", SBSParam.stochFdThreshold, 0.9);
3007+
3008+
/* DESCRIPTION: Filter width for LES (if negative, it is computed based on the local cell size) */
3009+
addDoubleOption("LES_FILTER_WIDTH", LES_FilterWidth, -1.0);
3010+
29723011
/* DESCRIPTION: Roe with low dissipation for unsteady flows */
29733012
addEnumOption("ROE_LOW_DISSIPATION", Kind_RoeLowDiss, RoeLowDiss_Map, NO_ROELOWDISS);
29743013

@@ -6451,6 +6490,60 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
64516490
case SA_ZDES: cout << "Delayed Detached Eddy Simulation (DDES) with Vorticity-based SGS" << endl; break;
64526491
case SA_EDDES: cout << "Delayed Detached Eddy Simulation (DDES) with Shear-layer Adapted SGS" << endl; break;
64536492
}
6493+
if (Kind_HybridRANSLES != NO_HYBRIDRANSLES) {
6494+
if (LES_FilterWidth > 0.0) cout << "User-specified LES filter width: " << LES_FilterWidth << endl;
6495+
cout << "Stochastic Backscatter: ";
6496+
if (SBSParam.StochasticBackscatter) {
6497+
cout << "ON" << endl;
6498+
if (GetnDim(GetMesh_FileName(), Mesh_FileFormat) < 3)
6499+
SU2_MPI::Error("Stochastic Backscatter Model available for 3D flow simulations only.", CURRENT_FUNCTION);
6500+
cout << "Backscatter intensity coefficient: " << SBSParam.SBS_Cmag << endl;
6501+
if (SBSParam.SBS_Cmag < 0.0)
6502+
SU2_MPI::Error("Backscatter intensity coefficient must be non-negative.", CURRENT_FUNCTION);
6503+
if (SBSParam.SBS_Ctau > 0.0)
6504+
cout << "Backscatter timescale coefficient: " << SBSParam.SBS_Ctau << endl;
6505+
else
6506+
cout << "Langevin equations not integrated (temporally uncorrelated stochastic field)." << endl;
6507+
if (SBSParam.SBS_maxIterSmooth > 0) {
6508+
cout << "Maximum number of iterations for implicit smoothing: " << SBSParam.SBS_maxIterSmooth << endl;
6509+
cout << "Backscatter lengthscale coefficient: " << SBSParam.SBS_Cdelta << endl;
6510+
if (SBSParam.SBS_Cdelta < 0.0)
6511+
SU2_MPI::Error("Backscatter lengthscale coefficient must be non-negative.", CURRENT_FUNCTION);
6512+
} else {
6513+
cout << "No smoothing applied to stochastic source terms in Langevin equations." << endl;
6514+
}
6515+
if (SBSParam.stochSourceNu)
6516+
cout << "Stochastic source term included in turbulence model equation." << endl;
6517+
else
6518+
cout << "Stochastic source term NOT included in turbulence model equation." << endl;
6519+
if (SBSParam.stochSourceRelax > 0.0)
6520+
cout << "Relaxation factor for stochastic source term: " << SBSParam.stochSourceRelax << endl;
6521+
else
6522+
cout << "No relaxation factor for stochastic source term." << endl;
6523+
if (SBSParam.StochBackscatterInBox) {
6524+
cout << "Stochastic Backscatter Model activated only in a bounded box." << endl;
6525+
cout << "Box bounds: " << endl;
6526+
cout << " X: " << setw(10) << fixed << setprecision(4) << SBSParam.StochBackscatterBoxBounds[0] << " , "
6527+
<< setw(10) << fixed << setprecision(4) << SBSParam.StochBackscatterBoxBounds[1] << endl;
6528+
cout << " Y: " << setw(10) << fixed << setprecision(4) << SBSParam.StochBackscatterBoxBounds[2] << " , "
6529+
<< setw(10) << fixed << setprecision(4) << SBSParam.StochBackscatterBoxBounds[3] << endl;
6530+
cout << " Z: " << setw(10) << fixed << setprecision(4) << SBSParam.StochBackscatterBoxBounds[4] << " , "
6531+
<< setw(10) << fixed << setprecision(4) << SBSParam.StochBackscatterBoxBounds[5] << endl;
6532+
}
6533+
if (Kind_HybridRANSLES != SA_DES)
6534+
cout << "Stochastic source terms suppressed where the shielding function is lower than: " << setw(5) << setprecision(3) << SBSParam.stochFdThreshold << endl;
6535+
} else {
6536+
cout << "OFF" << endl;
6537+
}
6538+
}
6539+
if (Kind_HybridRANSLES == NO_HYBRIDRANSLES && SBSParam.StochasticBackscatter)
6540+
SU2_MPI::Error("Stochastic Backscatter can only be activated with Hybrid RANS/LES.", CURRENT_FUNCTION);
6541+
if (enforceLES) {
6542+
if (Kind_HybridRANSLES == NO_HYBRIDRANSLES)
6543+
SU2_MPI::Error("ENFORCE_LES can only be activated with Hybrid RANS/LES.", CURRENT_FUNCTION);
6544+
else
6545+
cout << "LES enforced in the whole computational domain." << endl;
6546+
}
64546547
break;
64556548
case MAIN_SOLVER::NEMO_EULER:
64566549
if (Kind_Regime == ENUM_REGIME::COMPRESSIBLE) cout << "Compressible two-temperature thermochemical non-equilibrium Euler equations." << endl;
@@ -7019,11 +7112,20 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
70197112
cout << "Lax viscous coefficients (1st): " << Kappa_1st_Flow << ".\n";
70207113
cout << "First order integration." << endl;
70217114
}
7115+
else if (Kind_Centered_Flow == CENTERED::LD2) {
7116+
cout << "Low-Dissipation Low-Dispersion (LD2) scheme for the flow inviscid terms." << endl;
7117+
if (!(Kind_Solver==MAIN_SOLVER::INC_EULER || Kind_Solver==MAIN_SOLVER::INC_NAVIER_STOKES || Kind_Solver==MAIN_SOLVER::INC_RANS))
7118+
SU2_MPI::Error("LD2 scheme not yet implemented for the compressible flow solver.", CURRENT_FUNCTION);
7119+
if (Kind_FluidModel != CONSTANT_DENSITY)
7120+
SU2_MPI::Error("LD2 scheme available for constant density flows only.", CURRENT_FUNCTION);
7121+
if (Energy_Equation)
7122+
cout << "WARNING: Current implementation of the LD2 scheme not compatible with the energy equation. JST employed in energy equation instead." << endl;
7123+
}
70227124
else {
7023-
cout << "Jameson-Schmidt-Turkel scheme (2nd order in space) for the flow inviscid terms.\n";
7024-
cout << "JST viscous coefficients (2nd & 4th): " << Kappa_2nd_Flow << ", " << Kappa_4th_Flow << ".\n";
7025-
cout << "The method includes a grid stretching correction (p = 0.3)."<< endl;
7125+
cout << "Jameson-Schmidt-Turkel scheme (2nd order in space) for the flow inviscid terms.\n";
70267126
}
7127+
cout << "JST viscous coefficients (2nd & 4th): " << Kappa_2nd_Flow << ", " << Kappa_4th_Flow << ".\n";
7128+
cout << "The method includes a grid stretching correction (p = 0.3)."<< endl;
70277129
}
70287130

70297131
if (Kind_ConvNumScheme_Flow == SPACE_UPWIND) {

0 commit comments

Comments
 (0)