Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
36b6f7a
Preliminary implementation: uncorrelated stochastic variables
AngPass Sep 15, 2025
d6d6e39
Merge branch 'su2code:develop' into develop
AngPass Sep 16, 2025
cfa0cd8
Add solution of Langevin equations
AngPass Sep 23, 2025
fd800d3
Merge branch 'develop' into develop
AngPass Sep 23, 2025
34f676f
Fix sanitizer warnings and regression failures
AngPass Sep 24, 2025
66293fd
Minor fixes
AngPass Sep 24, 2025
4a11c8b
Merge branch 'develop' into develop
AngPass Sep 25, 2025
3481df3
Ensure consistency with DES
AngPass Sep 26, 2025
26bcfda
Merge branch 'develop' into develop
AngPass Sep 28, 2025
85b8aac
Boundary conditions for Langevin equations
AngPass Sep 29, 2025
6293042
Use symmetry-preserving scheme for Langevin equations
AngPass Sep 30, 2025
b03f630
Merge branch 'develop' into develop
AngPass Oct 13, 2025
1e8e4e1
Add option for simulating DIHT
AngPass Oct 13, 2025
67c133c
Fix options for DIHT
AngPass Oct 16, 2025
25a32f7
Merge branch 'develop' into develop
AngPass Oct 24, 2025
9657bfb
Consistent estimation of turb. kinetic energy (for SA)
AngPass Oct 24, 2025
e1181d3
Merge branch 'develop' into develop
AngPass Oct 29, 2025
968d8f9
Add Laplacian smoothing (Langevin equations)
AngPass Oct 30, 2025
2f8245e
Fix redundancy in CTurbSAVariable.hpp
AngPass Oct 30, 2025
bdbfa05
Add stochastic source to turbulence model equation
AngPass Oct 30, 2025
7457d95
Merge branch 'develop' into develop
AngPass Nov 5, 2025
3272a1b
SOR algorithm for Laplacian smoothing
AngPass Nov 11, 2025
ddb99bf
Merge branch 'su2code:develop' into develop
AngPass Nov 18, 2025
15dbff3
Correct scaling of stochastic source terms in Langevin eqs.
AngPass Nov 20, 2025
4dd0f90
Merge branch 'su2code:develop' into develop
AngPass Nov 25, 2025
d93ed49
Merge branch 'su2code:develop' into develop
AngPass Nov 26, 2025
420e44a
Add LD2 scheme for the incompressible solver
AngPass Nov 26, 2025
02dbb54
Merge branch 'develop' of https://github.com/AngPass/SU2 into develop
AngPass Nov 26, 2025
2f654c6
Merge branch 'develop' into develop
AngPass Nov 26, 2025
65e531e
Merge branch 'develop' into develop
AngPass Nov 28, 2025
5c3e35c
Fix LD2 for periodic boundaries
AngPass Nov 28, 2025
71dca9c
Merge branch 'develop' into develop
AngPass Dec 3, 2025
6389023
Include stochastic source term in turb. equation
AngPass Dec 3, 2025
d382a2d
Minor fixes
Dec 3, 2025
d1a1ae8
Add time-averaged skin friction coefficient
Dec 9, 2025
babfb58
Minor fix
AngPass Dec 9, 2025
562f311
Minor fix
AngPass Dec 9, 2025
14323bb
Merge branch 'develop' into develop
AngPass Dec 10, 2025
92a016b
Merge branch 'develop' into develop
AngPass Dec 15, 2025
90ede00
Add fields to VOLUME_OUTPUT
Dec 15, 2025
a5b3aa0
Fix LD2 option in config file
Dec 16, 2025
ebb6806
Merge branch 'develop' into develop
AngPass Dec 19, 2025
3e44cd6
Merge branch 'develop' into develop
AngPass Dec 29, 2025
3530ea8
Merge branch 'develop' into develop
AngPass Jan 2, 2026
0df34ac
Enhance numerical robustness
Jan 2, 2026
343ed9b
Merge branch 'develop' into develop
AngPass Jan 6, 2026
f539511
Merge branch 'develop' into develop
AngPass Jan 6, 2026
443838f
Enhance numerical efficiency
Jan 6, 2026
86ba8d8
Merge branch 'develop' into develop
AngPass Jan 8, 2026
fb3f8ec
Fix bug in viscous flux computation
Jan 8, 2026
241fbcb
Merge branch 'develop' into develop
AngPass Jan 16, 2026
c20511e
Merge branch 'develop' into develop
AngPass Jan 27, 2026
77de85b
First major revision
Jan 27, 2026
1b77a2b
Merge branch 'develop' into develop
AngPass Jan 29, 2026
84c42d2
Minor fixes
Jan 30, 2026
e9cb3d8
Merge branch 'develop' into develop
AngPass Feb 11, 2026
dc5189d
Add new features
Feb 13, 2026
6598226
Merge branch 'develop' into develop
AngPass Feb 20, 2026
6515a53
Merge branch 'develop' into develop
AngPass Feb 20, 2026
0a0f348
Merge branch 'develop' into develop
AngPass Mar 2, 2026
cb91b8e
Redefine scaling of stochastic source term
Mar 2, 2026
190a1cc
Update config template
Mar 2, 2026
e6b9937
Delete TestCases/backscatter/DIHT directory
AngPass Mar 4, 2026
daac35f
Include stochastic variables in restart file
Mar 10, 2026
af37287
Merge branch 'develop' into develop
AngPass Mar 10, 2026
692e87a
Merge branch 'develop' into develop
AngPass Mar 16, 2026
3e49b9b
Change proposed test case
Mar 16, 2026
3d4bcb4
Merge branch 'develop' into develop
AngPass Mar 27, 2026
fcbca34
Update Common/include/toolboxes/random_toolbox.hpp
AngPass Mar 27, 2026
d3e8e31
Update Common/include/toolboxes/random_toolbox.hpp
AngPass Mar 27, 2026
6500ddd
Update SU2_CFD/src/solvers/CTurbSASolver.cpp
AngPass Mar 27, 2026
5459137
Update SU2_CFD/src/solvers/CTurbSASolver.cpp
AngPass Mar 27, 2026
f633f7b
Update SU2_CFD/include/numerics/turbulent/turb_sources.hpp
AngPass Mar 27, 2026
5203d3f
Update SU2_CFD/src/numerics/flow/convection/centered.cpp
AngPass Mar 27, 2026
f4b2fa1
Update SU2_CFD/src/solvers/CTurbSASolver.cpp
AngPass Mar 27, 2026
77b4e57
Merge branch 'develop' into develop
AngPass Mar 29, 2026
617453d
Second major revision
Mar 29, 2026
ca6cfb6
Minor fixes
Mar 29, 2026
efeb505
Merge branch 'develop' into develop
AngPass Mar 30, 2026
5bc9b35
Minor fixes
Mar 30, 2026
bbf40fb
Merge branch 'develop' into develop
AngPass Apr 7, 2026
c702cc9
Third major revision
Apr 7, 2026
6dc1738
Update SU2_CFD/include/variables/CTurbSAVariable.hpp
AngPass Apr 7, 2026
592bdf4
Update SU2_CFD/include/numerics/CNumerics.hpp
AngPass Apr 7, 2026
fdbec42
Update SU2_CFD/src/solvers/CTurbSASolver.cpp
AngPass Apr 7, 2026
3c2e445
Update SU2_CFD/src/solvers/CTurbSASolver.cpp
AngPass Apr 7, 2026
17bfb65
Update SU2_CFD/src/solvers/CTurbSASolver.cpp
AngPass Apr 7, 2026
a27c3ff
Add residuals of stoch. variables to vol. outputs
Apr 7, 2026
f7bd1c7
Update Common/include/toolboxes/random_toolbox.hpp
AngPass Apr 9, 2026
88726b0
Merge branch 'develop' into develop
AngPass Apr 9, 2026
ebcc1b8
Fix compilation errors
Apr 9, 2026
4d6ee96
Fix compilation errors - bis
Apr 9, 2026
f6c1f08
Fix compilation errors - tris
Apr 9, 2026
86a1d42
Fix compilation errors - tetra
Apr 9, 2026
9a3a043
Apply suggestions from code review
pcarruscag Apr 10, 2026
44fd568
Update SU2_CFD/include/variables/CTurbSAVariable.hpp
AngPass Apr 10, 2026
52f3ec1
Update SU2_CFD/include/variables/CTurbSAVariable.hpp
AngPass Apr 10, 2026
052d613
Update SU2_CFD/include/variables/CTurbSAVariable.hpp
AngPass Apr 10, 2026
29004cb
Update SU2_CFD/include/variables/CTurbVariable.hpp
AngPass Apr 10, 2026
92f9056
Update SU2_CFD/src/variables/CTurbSAVariable.cpp
AngPass Apr 10, 2026
36f154b
Update SU2_CFD/src/solvers/CTurbSASolver.cpp
AngPass Apr 10, 2026
ffdeca1
Fix code formatting
Apr 10, 2026
ca99d8d
Fix compilation errors - V
Apr 10, 2026
6a2f950
Fix errors in regression tests (hopefully)
Apr 10, 2026
2541151
Restore nPrimVarGrad in InitiatePeriodicComms
Apr 10, 2026
9c4b84a
Restore DDES test case (committed by mistake)
Apr 10, 2026
f2a7402
Merge branch 'develop' into develop
AngPass Apr 11, 2026
8b78410
Simplify backscatter test
Apr 11, 2026
5946be5
Merge branch 'develop' into develop
AngPass Apr 16, 2026
8842ec4
Merge branch 'develop' into develop
pcarruscag Apr 19, 2026
da6c862
Merge branch 'develop' into develop
AngPass Apr 22, 2026
9d133a5
Fix compilation issues
Apr 22, 2026
c82262c
Fix parallel regression
Apr 22, 2026
d181880
Fix regressions
Apr 22, 2026
f44bb9c
Merge branch 'develop' into develop
AngPass Apr 22, 2026
21e0417
Fix regressions #2
Apr 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,7 @@ class CConfig {
su2double Const_DES; /*!< \brief Detached Eddy Simulation Constant. */
WINDOW_FUNCTION Kind_WindowFct; /*!< \brief Type of window (weight) function for objective functional. */
unsigned short Kind_HybridRANSLES; /*!< \brief Kind of Hybrid RANS/LES. */
bool StochasticBackscatter; /*!< \brief Option to include Stochastic Backscatter Model. */
unsigned short Kind_RoeLowDiss; /*!< \brief Kind of Roe scheme with low dissipation for unsteady flows. */

unsigned short nSpanWiseSections; /*!< \brief number of span-wise sections */
Expand Down Expand Up @@ -9524,6 +9525,12 @@ class CConfig {
*/
unsigned short GetKind_HybridRANSLES(void) const { return Kind_HybridRANSLES; }

/*!
* \brief Get if the Stochastic Backscatter Model must be activated.
* \return TRUE if the Stochastic Backscatter Model is activated.
*/
bool GetStochastic_Backscatter(void) const { return StochasticBackscatter; }

/*!
* \brief Get the Kind of Roe Low Dissipation Scheme for Unsteady flows.
* \return Value of Low dissipation approach.
Expand Down
85 changes: 85 additions & 0 deletions Common/include/toolboxes/random_toolbox.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*!
* \file random_toolbox.hpp
* \brief Collection of utility functions for random number generation.
* \version 8.3.0 "Harrier"
Comment thread
AngPass marked this conversation as resolved.
Outdated
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2025, SU2 Contributors (cf. AUTHORS.md)
*
* SU2 is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* SU2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with SU2. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include <random>
#include <functional>

namespace RandomToolbox {
/// \addtogroup RandomToolbox
/// @{

/*!
* \brief Combine two 64-bit integers into a single hash value.
* \param[in] v1 Current hash value.
* \param[in] v2 Value to mix in.
* \return Combined hash value.
*/
inline uint64_t HashCombine(uint64_t v1, uint64_t v2) {
const uint64_t prime = 1099511628211ULL;
v1 ^= v2;
v1 *= prime;
return v1;
}

/*!
* \brief Convert a double to a 64-bit integer suitable for hashing.
* \param[in] x Double to integer.
* \return Hash value of the double.
*/
inline uint64_t ToUInt64(double x) {
return std::hash<double>{}(x);
}

/*!
* \brief Build a deterministic seed from physical time.
* \param[in] time Physical time.
* \return 64-bit seed value.
*/
inline uint64_t GetSeed(double x) {
uint64_t h = 1469598103934665603ULL; // Offset
h = HashCombine(h, ToUInt64(x));
return h;
}

/*!
* \brief Generate a standard normally-distributed random number.
* \param[in] seed Seed for the random number generator.
* \param[in] mean Mean of the normal distribution (default 0).
* \param[in] stddev Standard deviation of the normal distribution (default 1).
* \return Normally-distributed random number.
*/
inline double GetRandomNormal(uint64_t seed,
double mean = 0.0,
double stddev = 1.0) {
std::mt19937 gen(static_cast<unsigned int>(seed));
std::normal_distribution<double> rnd(mean, stddev);
return rnd(gen);
}

/// @}
} // namespace RandomToolbox
10 changes: 10 additions & 0 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2914,6 +2914,9 @@ void CConfig::SetConfig_Options() {
/* DESCRIPTION: Specify Hybrid RANS/LES model */
addEnumOption("HYBRID_RANSLES", Kind_HybridRANSLES, HybridRANSLES_Map, NO_HYBRIDRANSLES);

/* DESCRIPTION: Specify if the Stochastic Backscatter Model must be activated */
addBoolOption("STOCHASTIC_BACKSCATTER", StochasticBackscatter, false);

/* DESCRIPTION: Roe with low dissipation for unsteady flows */
addEnumOption("ROE_LOW_DISSIPATION", Kind_RoeLowDiss, RoeLowDiss_Map, NO_ROELOWDISS);

Expand Down Expand Up @@ -6447,6 +6450,13 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
case SA_ZDES: cout << "Delayed Detached Eddy Simulation (DDES) with Vorticity-based SGS" << endl; break;
case SA_EDDES: cout << "Delayed Detached Eddy Simulation (DDES) with Shear-layer Adapted SGS" << endl; break;
}
cout << "Stochastic Backscatter: ";
if (StochasticBackscatter)
cout << "ON" << endl;
else
cout << "OFF" << endl;
if (StochasticBackscatter && Kind_HybridRANSLES == NO_HYBRIDRANSLES)
SU2_MPI::Error("Stochastic Backscatter can only be activated with Hybrid RANS/LES.", CURRENT_FUNCTION);
break;
case MAIN_SOLVER::NEMO_EULER:
if (Kind_Regime == ENUM_REGIME::COMPRESSIBLE) cout << "Compressible two-temperature thermochemical non-equilibrium Euler equations." << endl;
Expand Down
97 changes: 97 additions & 0 deletions SU2_CFD/include/numerics/CNumerics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <iostream>
#include <limits>
#include <cstdlib>
#include <random>
Comment thread
AngPass marked this conversation as resolved.
Outdated

#include "../../../Common/include/CConfig.hpp"
#include "../../../Common/include/linear_algebra/blas_structure.hpp"
Expand Down Expand Up @@ -179,6 +180,15 @@
roughness_j = 0.0; /*!< \brief Roughness of the wall nearest to point j. */

su2double MeanPerturbedRSM[3][3]; /*!< \brief Perturbed Reynolds stress tensor */
su2double stochReynStress[3][3]; /*!< \brief Stochastic contribution to Reynolds stress tensor for Backscatter Model. */
su2double
lesSensor_i, /*!< \brief LES sensor at point i. */
lesSensor_j; /*!< \brief LES sensor at point j. */
su2double lastTime; /*!< \brief Physical time of unsteady simulation. */
su2double stochSource[3]; /*!< \brief Source term for Langevin equations in Stochastic Backscatter Model. */
const su2double
*stochVar_i, /*!< \brief Stochastic variables at point i for Stochastic Backscatter Model. */
*stochVar_j; /*!< \brief Stochastic variables at point j for Stochastic Backscatter Model. */
SST_ParsedOptions sstParsedOptions; /*!< \brief additional options for the SST turbulence model */
unsigned short Eig_Val_Comp; /*!< \brief Component towards which perturbation is perfromed */
su2double uq_delta_b; /*!< \brief Magnitude of perturbation */
Expand Down Expand Up @@ -633,6 +643,50 @@
}
}
}

/*!
* \brief Compute a random contribution to the Reynolds stress tensor (Stochastic Backscatter Model).
* \details See: Kok, Johan C. "A stochastic backscatter model for grey-area mitigation in detached
* eddy simulations." Flow, Turbulence and Combustion 99.1 (2017): 119-150.
* \param[in] nDim - Dimension of the flow problem, 2 or 3.
* \param[in] density - Density.
* \param[in] eddyVis - Eddy viscosity.
* \param[in] velGrad - Velocity gradient matrix.
* \param[out] stochReynStress - Stochastic tensor (to be added to the Reynolds stress tensor).
*/
template<class Mat1, class Mat2, class Scalar>
NEVERINLINE static void ComputeStochReynStress(size_t nDim, Scalar density, Scalar eddyVis,
const Mat1& velGrad, const su2double *rndVec,
Mat2& stochReynStress) {

/* --- Estimate turbulent kinetic energy --- */

Scalar turbKE = 0.0, strainMag = 0.0;
for (size_t iDim = 0; iDim < nDim; iDim++) {
for (size_t jDim = 0; jDim < nDim; jDim++) {
strainMag += pow(0.5 * (velGrad[iDim][jDim] + velGrad[jDim][iDim]), 2);
}
}
strainMag = sqrt(2.0 * strainMag);
turbKE = eddyVis * strainMag;
turbKE = max(turbKE, 1E-10);

/* --- Calculate stochastic tensor --- */

stochReynStress[1][0] = - density * turbKE * rndVec[2];
stochReynStress[2][0] = density * turbKE * rndVec[1];
stochReynStress[2][1] = - density * turbKE * rndVec[0];
for (size_t iDim = 0; iDim < nDim; iDim++) {
for (size_t jDim = 0; jDim <= iDim; jDim++) {
if (iDim==jDim) {
stochReynStress[iDim][jDim] = 0.0;
} else {
stochReynStress[jDim][iDim] = - stochReynStress[iDim][jDim];
}
}
}

}

/*!
* \brief Project average gradient onto normal (with or w/o correction) for viscous fluxes of scalar quantities.
Expand Down Expand Up @@ -817,6 +871,16 @@
turb_ke_j = val_turb_ke_j;
}

/*!
* \brief Set the stochastic variables from Langevin equations (Stochastic Backscatter Model).
* \param[in] val_stochvar_i - Value of the stochastic variable at point i.
* \param[in] val_stochvar_j - Value of the stochastic variable at point j.
*/
inline void SetStochVar(su2double *val_stochvar_i, su2double *val_stochvar_j) {
stochVar_i = val_stochvar_i;
Comment thread Fixed
stochVar_j = val_stochvar_j;
Comment thread Fixed
}

/*!
* \brief Set the value of the distance from the nearest wall.
* \param[in] val_dist_i - Value of of the distance from point i to the nearest wall.
Expand All @@ -827,6 +891,39 @@
dist_j = val_dist_j;
}

/*!
* \brief Set the value of the LES sensor.
* \param[in] val_les_i - Value of the LES sensor at point point i.
* \param[in] val_les_j - Value of the LES sensor at point point j.
*/
void SetLESSensor(su2double val_les_i, su2double val_les_j) {
lesSensor_i = val_les_i;
lesSensor_j = val_les_j;
}

/*!
* \brief Set the value of physical time.
* \param[in] val_last_time - Value of physical time.
*/
void SetLastTime(su2double val_last_time) {
lastTime = val_last_time;
}

/*!
* \brief Get the value of physical time.
* \param[out] lastTime - Value of physical time.
*/
inline su2double GetLastTime() const { return lastTime; }

/*!
* \brief Set the stochastic source term for the Langevin equations (Backscatter Model).
* \param[in] val_stoch_source - Value of stochastic source term.
* \param[in] iDim - Index of Langevin equation.
*/
void SetStochSource(su2double val_stoch_source, unsigned short iDim) {
stochSource[iDim] = val_stoch_source;
}

/*!
* \brief Set the value of the roughness from the nearest wall.
* \param[in] val_dist_i - Value of of the roughness of the nearest wall from point i
Expand Down
5 changes: 4 additions & 1 deletion SU2_CFD/include/numerics/flow/flow_diffusion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class CAvgGrad_Base : public CNumerics {
Mean_Cp, /*!< \brief Mean value of the specific heat capacity at constant pressure. */
Mean_turb_ke, /*!< \brief Mean value of the turbulent kinetic energy. */
Mean_TauWall, /*!< \brief Mean wall shear stress (wall functions). */
*Mean_StochVar, /*!< \brief Mean stochastic variables (Stochastic Backscatter Model). */
TauWall_i, TauWall_j, /*!< \brief Wall shear stress at point i and j (wall functions). */
dist_ij_2, /*!< \brief Length of the edge and face, squared */
Edge_Vector[MAXNDIM] = {0.0}, /*!< \brief Vector from point i to point j. */
Expand Down Expand Up @@ -200,12 +201,14 @@ class CAvgGrad_Base : public CNumerics {
* \param[in] val_turb_ke - Turbulent kinetic energy
* \param[in] val_laminar_viscosity - Laminar viscosity.
* \param[in] val_eddy_viscosity - Eddy viscosity.
* \param[in] config - Definition of the particular problem.
*/
void SetStressTensor(const su2double *val_primvar,
const su2double* const *val_gradprimvar,
su2double val_turb_ke,
su2double val_laminar_viscosity,
su2double val_eddy_viscosity);
su2double val_eddy_viscosity,
const CConfig* config);

/*!
* \brief Get a component of the viscous stress tensor.
Expand Down
17 changes: 14 additions & 3 deletions SU2_CFD/include/numerics/turbulent/turb_convection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,20 @@ class CUpwSca_TurbSA final : public CUpwScalar<FlowIndices> {
* \param[in] config - Definition of the particular problem.
*/
void FinishResidualCalc(const CConfig* config) override {
Flux[0] = a0*ScalarVar_i[0] + a1*ScalarVar_j[0];
Jacobian_i[0][0] = a0;
Jacobian_j[0][0] = a1;
bool backscatter = config->GetStochastic_Backscatter();
if (!backscatter) {
Flux[0] = a0*ScalarVar_i[0] + a1*ScalarVar_j[0];
Jacobian_i[0][0] = a0;
Jacobian_j[0][0] = a1;
} else {
for (unsigned short iVar = 0; iVar < 4; iVar++) {
Flux[iVar] = a0*ScalarVar_i[iVar] + a1*ScalarVar_j[iVar];
for (unsigned short jVar = 0; jVar < 4; jVar++) {
Jacobian_i[iVar][jVar] = (iVar == jVar) ? a0 : 0.0;
Jacobian_j[iVar][jVar] = (iVar == jVar) ? a1 : 0.0;
}
}
}
}

public:
Expand Down
Loading
Loading