Skip to content

Commit b87aef1

Browse files
authored
Apply suggestions from code review
1 parent 1596174 commit b87aef1

8 files changed

Lines changed: 24 additions & 105 deletions

File tree

Common/src/CConfig.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6049,8 +6049,8 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
60496049
break;
60506050
}
60516051
switch (Kind_Trans_Model) {
6052-
case TURB_TRANS_MODEL::NONE: break;
6053-
case TURB_TRANS_MODEL::LM: cout << "Transition model: Langtry and Menter's 4 equation model (2009)" << endl; break;
6052+
case TURB_TRANS_MODEL::NONE: break;
6053+
case TURB_TRANS_MODEL::LM: cout << "Transition model: Langtry and Menter's 4 equation model (2009)" << endl; break;
60546054
}
60556055
cout << "Hybrid RANS/LES: ";
60566056
switch (Kind_HybridRANSLES) {

SU2_CFD/include/numerics/turbulent/transition/trans_convection.hpp

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -28,63 +28,13 @@
2828

2929
#pragma once
3030

31-
#include "../../scalar/scalar_convection.hpp"
31+
#include "../turb_convection.hpp"
3232

3333
/*!
3434
* \class CUpwSca_TransLM
35-
* \brief Class for doing a scalar upwind solver for the LM transition model equations.
35+
* \brief Re-use the SST convective fluxes for the scalar upwind discretization of LM transition model equations.
3636
* \ingroup ConvDiscr
37-
* \author S. Kang.
3837
*/
3938
template <class FlowIndices>
40-
class CUpwSca_TransLM final : public CUpwScalar<FlowIndices> {
41-
private:
42-
using Base = CUpwScalar<FlowIndices>;
43-
using Base::nDim;
44-
using Base::V_i;
45-
using Base::V_j;
46-
using Base::a0;
47-
using Base::a1;
48-
using Base::Flux;
49-
using Base::Jacobian_i;
50-
using Base::Jacobian_j;
51-
using Base::ScalarVar_i;
52-
using Base::ScalarVar_j;
53-
using Base::implicit;
54-
using Base::idx;
39+
using CUpwSca_TransLM = CUpwSca_TurbSST<FlowIndices>;
5540

56-
/*!
57-
* \brief Adds any extra variables to AD
58-
*/
59-
void ExtraADPreaccIn() override {
60-
AD::SetPreaccIn(V_i[idx.Density()]);
61-
AD::SetPreaccIn(V_j[idx.Density()]);
62-
}
63-
64-
/*!
65-
* \brief LM specific steps in the ComputeResidual method
66-
* \param[in] config - Definition of the particular problem.
67-
*/
68-
void FinishResidualCalc(const CConfig* config) override {
69-
Flux[0] = a0*V_i[idx.Density()]*ScalarVar_i[0] + a1*V_j[idx.Density()]*ScalarVar_j[0];
70-
Flux[1] = a0*V_i[idx.Density()]*ScalarVar_i[1] + a1*V_j[idx.Density()]*ScalarVar_j[1];
71-
72-
if (implicit) {
73-
Jacobian_i[0][0] = a0; Jacobian_i[0][1] = 0.0;
74-
Jacobian_i[1][0] = 0.0; Jacobian_i[1][1] = a0;
75-
76-
Jacobian_j[0][0] = a1; Jacobian_j[0][1] = 0.0;
77-
Jacobian_j[1][0] = 0.0; Jacobian_j[1][1] = a1;
78-
}
79-
}
80-
81-
public:
82-
/*!
83-
* \brief Constructor of the class.
84-
* \param[in] val_nDim - Number of dimensions of the problem.
85-
* \param[in] val_nVar - Number of variables of the problem.
86-
* \param[in] config - Definition of the particular problem.
87-
*/
88-
CUpwSca_TransLM(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config)
89-
: CUpwScalar<FlowIndices>(val_nDim, val_nVar, config) {}
90-
};

SU2_CFD/include/numerics/turbulent/transition/trans_sources.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ class CSourcePieceWise_TransLM final : public CNumerics {
4040
private:
4141
const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */
4242

43-
su2double g_eff_i,
44-
g_eff_j,
45-
g_sep_i,
46-
g_sep_j;
4743
/*--- LM Closure constants ---*/
4844
const su2double c_e1 = 1.0;
4945
const su2double c_a1 = 2.0;
@@ -54,7 +50,6 @@ class CSourcePieceWise_TransLM final : public CNumerics {
5450
const su2double c_theta = 0.03;
5551
const su2double sigmat = 2.0;
5652

57-
su2double Vorticity;
5853
su2double Residual[2];
5954
su2double* Jacobian_i[2];
6055
su2double Jacobian_Buffer[4];// Static storage for the Jacobian (which needs to be pointer for return type).

SU2_CFD/include/numerics/turbulent/turb_sources.hpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -735,13 +735,10 @@ class CSourcePieceWise_TurbSST final : public CNumerics {
735735

736736
su2double eff_intermittency = 1.0;
737737

738-
if(TURB_TRANS_MODEL::LM == config->GetKind_Trans_Model()) {
738+
if (config->GetKind_Trans_Model() == TURB_TRANS_MODEL::LM) {
739739
AD::SetPreaccIn(intermittency_eff_i);
740740
eff_intermittency = intermittency_eff_i;
741741
}
742-
else {
743-
eff_intermittency = 1.0;
744-
}
745742

746743
if (dist_i > 1e-10) {
747744

@@ -818,9 +815,9 @@ class CSourcePieceWise_TurbSST final : public CNumerics {
818815
su2double dw = beta_blended * Density_i * ScalarVar_i[1] * ScalarVar_i[1];
819816

820817
/*--- LM model coupling with production and dissipation term for k transport equation---*/
821-
if (TURB_TRANS_MODEL::LM == config->GetKind_Trans_Model()) {
822-
pk = pk*eff_intermittency;
823-
dk = min(max(eff_intermittency,0.1),1.0) *dk;
818+
if (config->GetKind_Trans_Model() == TURB_TRANS_MODEL::LM) {
819+
pk = pk * eff_intermittency;
820+
dk = min(max(eff_intermittency, 0.1), 1.0) * dk;
824821
}
825822

826823
/*--- Add the production terms to the residuals. ---*/

SU2_CFD/include/variables/CTransLMVariable.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ class CTransLMVariable final : public CTurbVariable {
6363
/*!
6464
* \brief Set Separation intermittency.
6565
*/
66-
void SetIntermittencySep(unsigned long iPoint, su2double val_Intermittency_sep) override ;
66+
void SetIntermittencySep(unsigned long iPoint, su2double val_Intermittency_sep) override;
6767

6868
/*!
6969
* \brief Set Effective intermittency.
7070
*/
71-
void SetIntermittencyEff(unsigned long iPoint, su2double val_Intermittency_sep) override ;
71+
void SetIntermittencyEff(unsigned long iPoint, su2double val_Intermittency_sep) override;
7272

7373
/*!
7474
* \brief Calculate effective intermittency.

SU2_CFD/src/drivers/CDriver.cpp

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,16 +1345,8 @@ void CDriver::InstantiateTransitionNumerics(unsigned short nVar_Trans, int offse
13451345
const int conv_bound_term = CONV_BOUND_TERM + offset;
13461346
const int visc_bound_term = VISC_BOUND_TERM + offset;
13471347

1348-
bool LM = false;
1348+
const bool LM = config->GetKind_Trans_Model() == TURB_TRANS_MODEL::LM;
13491349

1350-
/*--- Assign transition model booleans ---*/
1351-
1352-
switch (config->GetKind_Trans_Model()) {
1353-
case TURB_TRANS_MODEL::NONE:
1354-
break;
1355-
case TURB_TRANS_MODEL::LM: LM = true; break;
1356-
}
1357-
13581350
/*--- Definition of the convective scheme for each equation and mesh level ---*/
13591351

13601352
switch (config->GetKind_ConvNumScheme_Turb()) {
@@ -1363,10 +1355,7 @@ void CDriver::InstantiateTransitionNumerics(unsigned short nVar_Trans, int offse
13631355
break;
13641356
case SPACE_UPWIND :
13651357
for (auto iMGlevel = 0u; iMGlevel <= config->GetnMGLevels(); iMGlevel++) {
1366-
if ( NONE) {
1367-
SU2_MPI::Error("Invalid convective scheme for the transition equations.", CURRENT_FUNCTION);
1368-
}
1369-
else if (LM) numerics[iMGlevel][TRANS_SOL][conv_term] = new CUpwSca_TransLM<Indices>(nDim, nVar_Trans, config);
1358+
if (LM) numerics[iMGlevel][TRANS_SOL][conv_term] = new CUpwSca_TransLM<Indices>(nDim, nVar_Trans, config);
13701359
}
13711360
break;
13721361
default:
@@ -1377,35 +1366,23 @@ void CDriver::InstantiateTransitionNumerics(unsigned short nVar_Trans, int offse
13771366
/*--- Definition of the viscous scheme for each equation and mesh level ---*/
13781367

13791368
for (auto iMGlevel = 0u; iMGlevel <= config->GetnMGLevels(); iMGlevel++) {
1380-
if (NONE) {
1381-
SU2_MPI::Error("Invalid viscous scheme for the transition equations.", CURRENT_FUNCTION);
1382-
}
1383-
else if (LM)
1384-
numerics[iMGlevel][TRANS_SOL][visc_term] = new CAvgGrad_TransLM<Indices>(nDim, nVar_Trans, true, config);
1369+
if (LM) numerics[iMGlevel][TRANS_SOL][visc_term] = new CAvgGrad_TransLM<Indices>(nDim, nVar_Trans, true, config);
13851370
}
13861371

13871372
/*--- Definition of the source term integration scheme for each equation and mesh level ---*/
13881373

13891374
for (auto iMGlevel = 0u; iMGlevel <= config->GetnMGLevels(); iMGlevel++) {
13901375
auto& trans_source_first_term = numerics[iMGlevel][TRANS_SOL][source_first_term];
13911376

1392-
if(NONE) {
1393-
SU2_MPI::Error("Invalid source for the transition equations.", CURRENT_FUNCTION);
1394-
}
1395-
else if (LM) {
1396-
trans_source_first_term = new CSourcePieceWise_TransLM<Indices>(nDim, nVar_Trans, config);
1397-
}
1377+
if (LM) trans_source_first_term = new CSourcePieceWise_TransLM<Indices>(nDim, nVar_Trans, config);
13981378

13991379
numerics[iMGlevel][TRANS_SOL][source_second_term] = new CSourceNothing(nDim, nVar_Trans, config);
14001380
}
14011381

14021382
/*--- Definition of the boundary condition method ---*/
14031383

14041384
for (auto iMGlevel = 0u; iMGlevel <= config->GetnMGLevels(); iMGlevel++) {
1405-
if (NONE) {
1406-
SU2_MPI::Error("Invalid boundary conditions for the transition equations.", CURRENT_FUNCTION);
1407-
}
1408-
else if (LM) {
1385+
if (LM) {
14091386
numerics[iMGlevel][TRANS_SOL][conv_bound_term] = new CUpwSca_TransLM<Indices>(nDim, nVar_Trans, config);
14101387
numerics[iMGlevel][TRANS_SOL][visc_bound_term] = new CAvgGrad_TransLM<Indices>(nDim, nVar_Trans, false, config);
14111388
}

SU2_CFD/src/output/CFlowOutput.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ void CFlowOutput::AddHistoryOutputFields_ScalarLinsol(const CConfig* config) {
967967
AddHistoryOutput("LINSOL_RESIDUAL_TURB", "LinSolResTurb", ScreenOutputFormat::FIXED, "LINSOL", "Residual of the linear solver for turbulence solver.");
968968
}
969969

970-
if (config->GetKind_Trans_Model() != TURB_TRANS_MODEL::NONE && config->GetKind_Trans_Model() != TURB_TRANS_MODEL::NONE) {
970+
if (config->GetKind_Trans_Model() != TURB_TRANS_MODEL::NONE) {
971971
AddHistoryOutput("LINSOL_ITER_TRANS", "LinSolIterTrans", ScreenOutputFormat::INTEGER, "LINSOL", "Number of iterations of the linear solver for transition solver.");
972972
AddHistoryOutput("LINSOL_RESIDUAL_TRANS", "LinSolResTrans", ScreenOutputFormat::FIXED, "LINSOL", "Residual of the linear solver for transition solver.");
973973
}

SU2_CFD/src/solvers/CEulerSolver.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,15 +1031,15 @@ void CEulerSolver::SetNondimensionalization(CConfig *config, unsigned short iMes
10311031
config->SetOmega_FreeStreamND(Omega_FreeStreamND);
10321032

10331033
if (config->GetTurbulenceIntensity_FreeStream() *100 <= 1.3) {
1034-
if(config->GetTurbulenceIntensity_FreeStream() *100 >=0.027) {
1035-
Re_ThetaT_FreeStream = (1173.51-589.428*config->GetTurbulenceIntensity_FreeStream() *100+0.2196/
1036-
(config->GetTurbulenceIntensity_FreeStream() *100*config->GetTurbulenceIntensity_FreeStream() *100));
1037-
}
1038-
else {
1039-
Re_ThetaT_FreeStream = (1173.51-589.428*config->GetTurbulenceIntensity_FreeStream() *100+0.2196/(0.27*0.27));
1034+
if(config->GetTurbulenceIntensity_FreeStream() *100 >=0.027) {
1035+
Re_ThetaT_FreeStream = (1173.51-589.428*config->GetTurbulenceIntensity_FreeStream() *100+0.2196/
1036+
(config->GetTurbulenceIntensity_FreeStream() *100*config->GetTurbulenceIntensity_FreeStream() *100));
1037+
}
1038+
else {
1039+
Re_ThetaT_FreeStream = (1173.51-589.428*config->GetTurbulenceIntensity_FreeStream() *100+0.2196/(0.27*0.27));
10401040
}
10411041
}
1042-
else if(config->GetTurbulenceIntensity_FreeStream() *100>1.3) {
1042+
else {
10431043
Re_ThetaT_FreeStream = 331.5*pow(config->GetTurbulenceIntensity_FreeStream() *100-0.5658,-0.671);
10441044
}
10451045
config->SetReThetaT_FreeStream(Re_ThetaT_FreeStream);

0 commit comments

Comments
 (0)