Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
29 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
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 @@ -1077,6 +1077,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 @@ -9466,6 +9467,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
8 changes: 8 additions & 0 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2911,6 +2911,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 @@ -6448,6 +6451,11 @@ 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;
break;
case MAIN_SOLVER::NEMO_EULER:
if (Kind_Regime == ENUM_REGIME::COMPRESSIBLE) cout << "Compressible two-temperature thermochemical non-equilibrium Euler equations." << endl;
Expand Down
58 changes: 58 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>

#include "../../../Common/include/CConfig.hpp"
#include "../../../Common/include/linear_algebra/blas_structure.hpp"
Expand Down Expand Up @@ -180,6 +181,7 @@ class CNumerics {
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. */
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 @@ -635,6 +637,62 @@ class CNumerics {
}
}

/*!
* \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, Mat2& stochReynStress) {

/* --- Initialize seed ---*/

static std::default_random_engine gen;
std::random_device rd;
gen.seed(rd());

/* --- Generate a vector of three independent normally-distributed samples ---*/

std::normal_distribution<Scalar> rnd(0.0,1.0);
Scalar rndVec [3] = {0.0};
for (size_t iDim = 0; iDim < nDim; iDim++)
rndVec[iDim] = rnd(gen);

/* --- 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.
* \param[in] nDim - Dimension of the flow problem, 2 or 3.
Expand Down
4 changes: 3 additions & 1 deletion SU2_CFD/include/numerics/flow/flow_diffusion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,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
39 changes: 35 additions & 4 deletions SU2_CFD/src/numerics/flow/flow_diffusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ void CAvgGrad_Base::SetStressTensor(const su2double *val_primvar,
const su2double* const *val_gradprimvar,
const su2double val_turb_ke,
const su2double val_laminar_viscosity,
const su2double val_eddy_viscosity) {
const su2double val_eddy_viscosity,
const CConfig* config) {

const su2double Density = val_primvar[nDim+2];

Expand All @@ -142,6 +143,15 @@ void CAvgGrad_Base::SetStressTensor(const su2double *val_primvar,
// turb_ke is not considered in the stress tensor, see #797
ComputeStressTensor(nDim, tau, val_gradprimvar+1, total_viscosity, Density, su2double(0.0));
}

/* --- If the Stochastic Backscatter Model is active, add random contribution to stress tensor ---*/

if (config->GetStochastic_Backscatter()) {
for (unsigned short iDim = 0 ; iDim < nDim; iDim++)
for (unsigned short jDim = 0 ; jDim < nDim; jDim++)
tau[iDim][jDim] += stochReynStress[iDim][jDim];
}

}

void CAvgGrad_Base::AddTauWall(const su2double *UnitNormal,
Expand Down Expand Up @@ -432,10 +442,17 @@ CNumerics::ResidualType<> CAvgGrad_Flow::ComputeResidual(const CConfig* config)
Mean_turb_ke, MeanPerturbedRSM);
}

/* --- If the Stochastic Backscatter Model is active, add random contribution to stress tensor ---*/

if (config->GetStochastic_Backscatter()) {
ComputeStochReynStress(nDim, Mean_PrimVar[nDim+2], Mean_Eddy_Viscosity, Mean_GradPrimVar+1,
stochReynStress);
}

/*--- Get projected flux tensor (viscous residual) ---*/

SetStressTensor(Mean_PrimVar, Mean_GradPrimVar, Mean_turb_ke,
Mean_Laminar_Viscosity, Mean_Eddy_Viscosity);
Mean_Laminar_Viscosity, Mean_Eddy_Viscosity,config);
if (config->GetSAParsedOptions().qcr2000) AddQCR(nDim, &Mean_GradPrimVar[1], tau);
if (Mean_TauWall > 0) AddTauWall(UnitNormal, Mean_TauWall);

Expand Down Expand Up @@ -617,9 +634,16 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi
Mean_turb_ke, MeanPerturbedRSM);
}

/* --- If the Stochastic Backscatter Model is active, add random contribution to stress tensor ---*/

if (config->GetStochastic_Backscatter()) {
ComputeStochReynStress(nDim, Mean_PrimVar[nDim+2], Mean_Eddy_Viscosity, Mean_GradPrimVar+1,
stochReynStress);
}

/*--- Get projected flux tensor (viscous residual) ---*/
SetStressTensor(Mean_PrimVar, Mean_GradPrimVar, Mean_turb_ke,
Mean_Laminar_Viscosity, Mean_Eddy_Viscosity);
Mean_Laminar_Viscosity, Mean_Eddy_Viscosity,config);
if (config->GetSAParsedOptions().qcr2000) AddQCR(nDim, &Mean_GradPrimVar[1], tau);
if (Mean_TauWall > 0) AddTauWall(UnitNormal, Mean_TauWall);

Expand Down Expand Up @@ -947,10 +971,17 @@ CNumerics::ResidualType<> CGeneralAvgGrad_Flow::ComputeResidual(const CConfig* c
Mean_turb_ke, MeanPerturbedRSM);
}

/* --- If the Stochastic Backscatter Model is active, add random contribution to stress tensor ---*/

if (config->GetStochastic_Backscatter()) {
ComputeStochReynStress(nDim, Mean_PrimVar[nDim+2], Mean_Eddy_Viscosity, Mean_GradPrimVar+1,
stochReynStress);
}

/*--- Get projected flux tensor (viscous residual) ---*/

SetStressTensor(Mean_PrimVar, Mean_GradPrimVar, Mean_turb_ke,
Mean_Laminar_Viscosity, Mean_Eddy_Viscosity);
Mean_Laminar_Viscosity, Mean_Eddy_Viscosity,config);
if (config->GetSAParsedOptions().qcr2000) AddQCR(nDim, &Mean_GradPrimVar[1], tau);
if (Mean_TauWall > 0) AddTauWall(UnitNormal, Mean_TauWall);

Expand Down
10 changes: 6 additions & 4 deletions TestCases/ddes/flatplate/ddes_flatplate.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
%
SOLVER= RANS
KIND_TURB_MODEL= SA
HYBRID_RANSLES= SA_EDDES
HYBRID_RANSLES= SA_DES
STOCHASTIC_BACKSCATTER= YES
MATH_PROBLEM= DIRECT
RESTART_SOL= NO
RESTART_ITER= 100

% ----------- COMPRESSIBLE AND INCOMPRESSIBLE FREE-STREAM DEFINITION ----------%
%
Expand All @@ -41,7 +43,7 @@ TIME_MARCHING= DUAL_TIME_STEPPING-2ND_ORDER
%
% U_inf = 69.4448 - dt*=0.02 - dt=0.000288
TIME_STEP= 0.000288
MAX_TIME= 20.0
MAX_TIME= 5
UNST_CFL_NUMBER= 0.0
INNER_ITER= 20

Expand All @@ -61,7 +63,7 @@ CFL_NUMBER= 10.0
CFL_ADAPT= NO
CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 )
RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 )
TIME_ITER= 10
TIME_ITER= 500

% ----------------------- SLOPE LIMITER DEFINITION ----------------------------%
%
Expand Down Expand Up @@ -103,5 +105,5 @@ VOLUME_ADJ_FILENAME= adjoint
GRAD_OBJFUNC_FILENAME= of_grad
SURFACE_FILENAME= surface_flow
SURFACE_ADJ_FILENAME= surface_adjoint
OUTPUT_WRT_FREQ= 1000
OUTPUT_WRT_FREQ= 1000000
SCREEN_OUTPUT= (TIME_ITER, INNER_ITER, RMS_DENSITY, RMS_NU_TILDE, LIFT, DRAG, TOTAL_HEATFLUX)
3 changes: 3 additions & 0 deletions config_template.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ HYBRID_RANSLES= SA_DDES
%
% DES Constant (0.65)
DES_CONST= 0.65
%
% Stochastic Backscatter Model (NO, YES)
STOCHASTIC_BACKSCATTER= NO

% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------%
%
Expand Down