Skip to content

Commit 5474f06

Browse files
authored
Fix OMP issues in SBS (#2795)
* address comments 1 * fix OMP issues
1 parent 578f131 commit 5474f06

7 files changed

Lines changed: 128 additions & 120 deletions

File tree

AUTHORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Amit Sachdeva
5252
Ana Lourenco
5353
Andrew Burkett
5454
Andrew Wendorff
55+
Angelo Passariello
5556
Aniket C. Aranake
5657
Antonio Rubino
5758
Arne Bachmann

SU2_CFD/include/numerics/CNumerics.hpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,8 @@ class CNumerics {
192192
su2double
193193
lesMode_i = 0.0, /*!< \brief LES sensor at point i for hybrid RANS-LES methods. */
194194
lesMode_j = 0.0; /*!< \brief LES sensor at point j for hybrid RANS-LES methods. */
195-
unsigned short
196-
sbsInBox_i = 0, /*!< \brief Sensor to assess if point i lies inside the box where the Stochastic Backscatter Model is active. */
197-
sbsInBox_j = 0; /*!< \brief Sensor to assess if point j lies inside the box where the Stochastic Backscatter Model is active. */
195+
int8_t
196+
sbsInBox_i = 0; /*!< \brief Sensor to assess if point i lies inside the box where the Stochastic Backscatter Model is active. */
198197
SST_ParsedOptions sstParsedOptions; /*!< \brief additional options for the SST turbulence model */
199198
unsigned short Eig_Val_Comp; /*!< \brief Component towards which perturbation is perfromed */
200199
su2double uq_delta_b; /*!< \brief Magnitude of perturbation */
@@ -651,7 +650,7 @@ class CNumerics {
651650
}
652651
}
653652
}
654-
653+
655654
/*!
656655
* \brief Compute a random contribution to the Reynolds stress tensor (Stochastic Backscatter Model).
657656
* \details See: Kok, Johan C. "A stochastic backscatter model for grey-area mitigation in detached
@@ -664,12 +663,12 @@ class CNumerics {
664663
* \param[out] stochReynStress - Stochastic tensor (to be added to the Reynolds stress tensor).
665664
*/
666665
template<class Vec, class Mat>
667-
inline void ComputeStochReynStress(su2double density, su2double tke, const Vec& rndVec,
666+
inline void ComputeStochReynStress(su2double density, su2double tke, const Vec& rndVec,
668667
su2double Cmag, Mat& stochReynStress) {
669668

670669
/* --- Calculate stochastic tensor --- */
671670

672-
su2double stochLim = 3.0;
671+
su2double stochLim = 3.0;
673672

674673
stochReynStress[0][0] = 0.0;
675674
stochReynStress[1][1] = 0.0;
@@ -918,11 +917,9 @@ class CNumerics {
918917
/*!
919918
* \brief Set the sensor to locate the box where the Stochastic Backscatter Model is active.
920919
* \param[in] val_sbsInBox_i - 1 if point i lies inside the box where the model is active.
921-
* \param[in] val_sbsInBox_j - 1 if point j lies inside the box where the model is active.
922920
*/
923-
inline void SetSbsInBoxSensor(unsigned short val_sbsInBox_i, unsigned short val_sbsInBox_j) {
921+
inline void SetSbsInBoxSensor(int8_t val_sbsInBox_i) {
924922
sbsInBox_i = val_sbsInBox_i;
925-
sbsInBox_j = val_sbsInBox_j;
926923
}
927924

928925
/*!

SU2_CFD/include/numerics_simd/CNumericsSIMD.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ CNumericsSIMD* createCenteredNumerics(const CConfig& config, int iMesh, const CV
7474
obj = new CLaxScheme<ViscousDecorator>(config, iMesh, turbVars);
7575
break;
7676
case CENTERED::JST:
77-
case CENTERED::LD2: // Just to silence compiler warnings (LD2 implemented in the incompressible solver only).
7877
obj = new CJSTScheme<ViscousDecorator>(config, iMesh, turbVars);
7978
break;
8079
case CENTERED::JST_KE:
@@ -83,6 +82,9 @@ CNumericsSIMD* createCenteredNumerics(const CConfig& config, int iMesh, const CV
8382
case CENTERED::JST_MAT:
8483
obj = new CJSTmatScheme<ViscousDecorator>(config, iMesh, turbVars);
8584
break;
85+
case CENTERED::LD2:
86+
/*--- LD2 implemented only in the incompressible solver. ---*/
87+
break;
8688
}
8789
return obj;
8890
}

SU2_CFD/include/variables/CVariable.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include <cmath>
3535
#include <iostream>
3636
#include <cstdlib>
37-
#include <random>
3837

3938
#include "../../../Common/include/CConfig.hpp"
4039
#include "../../../Common/include/containers/container_decorators.hpp"

SU2_CFD/src/numerics/flow/flow_diffusion.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ CNumerics::ResidualType<> CAvgGrad_Flow::ComputeResidual(const CConfig* config)
477477
/*--- Get projected flux tensor (viscous residual) ---*/
478478

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

@@ -655,7 +655,7 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi
655655
/*--- Get projected flux tensor (viscous residual) ---*/
656656

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

@@ -985,7 +985,7 @@ CNumerics::ResidualType<> CGeneralAvgGrad_Flow::ComputeResidual(const CConfig* c
985985
/*--- Get projected flux tensor (viscous residual) ---*/
986986

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

SU2_CFD/src/output/CFlowOutput.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4136,19 +4136,19 @@ void CFlowOutput::SetTimeAveragedFields(const CConfig *config) {
41364136
}
41374137

41384138
if (config->GetKind_Turb_Model() != TURB_MODEL::NONE) {
4139-
AddVolumeOutput("MODELED_REYNOLDS_STRESS_11", "ModeledReynoldsStress_11", "TIME_AVERAGE", "Modeled Reynolds stress xx-component");
4140-
AddVolumeOutput("MODELED_REYNOLDS_STRESS_22", "ModeledReynoldsStress_22", "TIME_AVERAGE", "Modeled Reynolds stress yy-component");
4141-
AddVolumeOutput("MODELED_REYNOLDS_STRESS_12", "ModeledReynoldsStress_12", "TIME_AVERAGE", "Modeled Reynolds stress xy-component");
4139+
AddVolumeOutput("MODELED_REYNOLDS_STRESS_XX", "ModeledReynoldsStress_XX", "TIME_AVERAGE", "Modeled Reynolds stress xx-component");
4140+
AddVolumeOutput("MODELED_REYNOLDS_STRESS_YY", "ModeledReynoldsStress_YY", "TIME_AVERAGE", "Modeled Reynolds stress yy-component");
4141+
AddVolumeOutput("MODELED_REYNOLDS_STRESS_XY", "ModeledReynoldsStress_XY", "TIME_AVERAGE", "Modeled Reynolds stress xy-component");
41424142
if (nDim == 3){
4143-
AddVolumeOutput("MODELED_REYNOLDS_STRESS_33", "ModeledReynoldsStress_33", "TIME_AVERAGE", "Modeled Reynolds stress zz-component");
4144-
AddVolumeOutput("MODELED_REYNOLDS_STRESS_13", "ModeledReynoldsStress_13", "TIME_AVERAGE", "Modeled Reynolds stress xz-component");
4145-
AddVolumeOutput("MODELED_REYNOLDS_STRESS_23", "ModeledReynoldsStress_23", "TIME_AVERAGE", "Modeled Reynolds stress yz-component");
4143+
AddVolumeOutput("MODELED_REYNOLDS_STRESS_ZZ", "ModeledReynoldsStress_ZZ", "TIME_AVERAGE", "Modeled Reynolds stress zz-component");
4144+
AddVolumeOutput("MODELED_REYNOLDS_STRESS_XZ", "ModeledReynoldsStress_XZ", "TIME_AVERAGE", "Modeled Reynolds stress xz-component");
4145+
AddVolumeOutput("MODELED_REYNOLDS_STRESS_YZ", "ModeledReynoldsStress_YZ", "TIME_AVERAGE", "Modeled Reynolds stress yz-component");
41464146
}
41474147

41484148
if (config->GetSBSParam().StochasticBackscatter) {
4149-
AddVolumeOutput("STOCHASTIC_REYNOLDS_STRESS_12", "StochasticReynoldsStress_12", "TIME_AVERAGE", "Stochastic Reynolds stress xy-component");
4150-
AddVolumeOutput("STOCHASTIC_REYNOLDS_STRESS_13", "StochasticReynoldsStress_13", "TIME_AVERAGE", "Stochastic Reynolds stress xz-component");
4151-
AddVolumeOutput("STOCHASTIC_REYNOLDS_STRESS_23", "StochasticReynoldsStress_23", "TIME_AVERAGE", "Stochastic Reynolds stress yz-component");
4149+
AddVolumeOutput("STOCHASTIC_REYNOLDS_STRESS_XY", "StochasticReynoldsStress_XY", "TIME_AVERAGE", "Stochastic Reynolds stress xy-component");
4150+
AddVolumeOutput("STOCHASTIC_REYNOLDS_STRESS_XZ", "StochasticReynoldsStress_XZ", "TIME_AVERAGE", "Stochastic Reynolds stress xz-component");
4151+
AddVolumeOutput("STOCHASTIC_REYNOLDS_STRESS_YZ", "StochasticReynoldsStress_YZ", "TIME_AVERAGE", "Stochastic Reynolds stress yz-component");
41524152
}
41534153
}
41544154
}
@@ -4201,16 +4201,16 @@ void CFlowOutput::LoadTimeAveragedData(unsigned long iPoint, const CVariable *No
42014201
const su2double tau_xx = nu_t * (2*vel_grad(0,0) - (2.0/3.0)*vel_div);
42024202
const su2double tau_yy = nu_t * (2*vel_grad(1,1) - (2.0/3.0)*vel_div);
42034203
const su2double tau_xy = nu_t * (vel_grad(0,1) + vel_grad(1,0));
4204-
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_11", iPoint, -tau_xx);
4205-
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_22", iPoint, -tau_yy);
4206-
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_12", iPoint, -tau_xy);
4204+
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_XX", iPoint, -tau_xx);
4205+
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_YY", iPoint, -tau_yy);
4206+
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_XY", iPoint, -tau_xy);
42074207
if (nDim == 3){
42084208
const su2double tau_zz = nu_t * (2*vel_grad(2,2) - (2.0/3.0)*vel_div);
42094209
const su2double tau_xz = nu_t * (vel_grad(0,2) + vel_grad(2,0));
42104210
const su2double tau_yz = nu_t * (vel_grad(1,2) + vel_grad(2,1));
4211-
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_33", iPoint, -tau_zz);
4212-
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_13", iPoint, -tau_xz);
4213-
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_23", iPoint, -tau_yz);
4211+
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_ZZ", iPoint, -tau_zz);
4212+
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_XZ", iPoint, -tau_xz);
4213+
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_YZ", iPoint, -tau_yz);
42144214
}
42154215

42164216
if (config->GetSBSParam().StochasticBackscatter) {
@@ -4226,9 +4226,9 @@ void CFlowOutput::LoadTimeAveragedData(unsigned long iPoint, const CVariable *No
42264226
const su2double R_xy = - mag * tke_estim * csi_z;
42274227
const su2double R_xz = + mag * tke_estim * csi_y;
42284228
const su2double R_yz = - mag * tke_estim * csi_x;
4229-
SetAvgVolumeOutputValue("STOCHASTIC_REYNOLDS_STRESS_12", iPoint, -R_xy);
4230-
SetAvgVolumeOutputValue("STOCHASTIC_REYNOLDS_STRESS_13", iPoint, -R_xz);
4231-
SetAvgVolumeOutputValue("STOCHASTIC_REYNOLDS_STRESS_23", iPoint, -R_yz);
4229+
SetAvgVolumeOutputValue("STOCHASTIC_REYNOLDS_STRESS_XY", iPoint, -R_xy);
4230+
SetAvgVolumeOutputValue("STOCHASTIC_REYNOLDS_STRESS_XY", iPoint, -R_xz);
4231+
SetAvgVolumeOutputValue("STOCHASTIC_REYNOLDS_STRESS_YZ", iPoint, -R_yz);
42324232
}
42334233
}
42344234
}

0 commit comments

Comments
 (0)