Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Implementation of Simplified LM Transition model #1901

Open
wants to merge 22 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a7136d3
- Just copied the CTransLMSolver header and source to commit
rois1995 Jan 27, 2023
e9226db
- Start of implementation of Simplified LM transition model
rois1995 Jan 27, 2023
d03742a
- Modify number of variables if SLM option is used
rois1995 Jan 27, 2023
e17872d
- Updates on the transition model.
rois1995 Jan 31, 2023
4b9c615
- Added Cross flow effects for SLM
rois1995 Jan 31, 2023
04cd56d
- Fixed Intermittency_Sep computation for SLM.
rois1995 Feb 2, 2023
e29b4df
- Added computation for normals of grid points
rois1995 Feb 24, 2023
0319d62
Fixed normal extraction from structure
rois1995 Feb 24, 2023
b1edf61
Added computation of wall normals to the CPoint structure
rois1995 Feb 24, 2023
7eee4ab
Check For changes
rois1995 Apr 27, 2023
c461518
Removing changes for SA-R
rois1995 Apr 27, 2023
e68a9e4
Fixed vertex indexing for wall normal computation
rois1995 Apr 27, 2023
bcdd671
Removed a cout
rois1995 Apr 27, 2023
9bb2435
Fixed division by zero with Corr_Rec
rois1995 Apr 27, 2023
a9a6ce4
Removed cout
rois1995 Apr 27, 2023
86b068c
Fixed Max Velocity-Z output for Incompressible flow
rois1995 Apr 27, 2023
73c0a4b
Fixed output of Normals in volume
rois1995 Apr 27, 2023
8d5148e
- Added Simplified Langtry Menter model
rois1995 Jul 1, 2024
9db7301
- corrected bu in output
rois1995 Jul 1, 2024
1e7e7a3
Merge branch 'develop' into feature_Trans_SLM_v8
rois1995 Sep 12, 2024
ab2d71b
Merge remote-tracking branch 'origin/feature_Trans_SLM_v8' into featu…
rois1995 Sep 13, 2024
a6fe9bc
- finish update
rois1995 Sep 13, 2024
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
12 changes: 12 additions & 0 deletions Common/include/geometry/dual_grid/CPoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,18 @@ class CPoint {
}
inline void SetWall_Distance(unsigned long iPoint, su2double distance) { Wall_Distance(iPoint) = distance; }

/*!
* \brief Get the index of the closest wall element.
* \param[in] iPoint - Index of the point.
*/
inline unsigned long GetClosestWall_Elem(unsigned long iPoint) {return ClosestWall_Elem(iPoint);}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the param[out] for these please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll do it now.


/*!
* \brief Get the marker of the closest wall marker.
* \param[in] iPoint - Index of the point.
*/
inline unsigned long GetClosestWall_Marker(unsigned long iPoint) {return ClosestWall_Marker(iPoint);}

/*!
* \brief Get the value of the distance to the nearest wall.
* \param[in] iPoint - Index of the point.
Expand Down
53 changes: 49 additions & 4 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1173,26 +1173,36 @@ static const MapType<std::string, TURB_TRANS_MODEL> Trans_Model_Map = {
*/
enum class LM_OPTIONS {
NONE, /*!< \brief No option / default. */
LM2015, /*!< \brief Cross-flow corrections. */
CROSSFLOW, /*!< \brief Cross-flow corrections. */
SLM, /*!< \brief Simplified version. */
PRODLIM, /*!< \brief Add production term to Pk. */
MALAN, /*!< \brief Kind of transition correlation model (Malan). */
SULUKSNA, /*!< \brief Kind of transition correlation model (Suluksna). */
KRAUSE, /*!< \brief Kind of transition correlation model (Krause). */
KRAUSE_HYPER, /*!< \brief Kind of transition correlation model (Krause hypersonic). */
MEDIDA_BAEDER,/*!< \brief Kind of transition correlation model (Medida-Baeder). */
MEDIDA, /*!< \brief Kind of transition correlation model (Medida). */
MENTER_LANGTRY, /*!< \brief Kind of transition correlation model (Menter-Langtry). */
MENTER_SLM, /*!< \brief Kind of transition correlation model (Menter Simplified LM model). */
CODER_SLM, /*!< \brief Kind of transition correlation model (Coder Simplified LM model). */
MOD_EPPLER_SLM, /*!< \brief Kind of transition correlation model (Modified Eppler Simplified LM model). */
DEFAULT /*!< \brief Kind of transition correlation model (Menter-Langtry if SST, MALAN if SA). */
};

static const MapType<std::string, LM_OPTIONS> LM_Options_Map = {
MakePair("NONE", LM_OPTIONS::NONE)
MakePair("LM2015", LM_OPTIONS::LM2015)
MakePair("CROSSFLOW", LM_OPTIONS::CROSSFLOW)
MakePair("SLM", LM_OPTIONS::SLM)
MakePair("PRODLIM", LM_OPTIONS::PRODLIM)
MakePair("MALAN", LM_OPTIONS::MALAN)
MakePair("SULUKSNA", LM_OPTIONS::SULUKSNA)
MakePair("KRAUSE", LM_OPTIONS::KRAUSE)
MakePair("KRAUSE_HYPER", LM_OPTIONS::KRAUSE_HYPER)
MakePair("MEDIDA_BAEDER", LM_OPTIONS::MEDIDA_BAEDER)
MakePair("MENTER_LANGTRY", LM_OPTIONS::MENTER_LANGTRY)
MakePair("MENTER_SLM", LM_OPTIONS::MENTER_SLM)
MakePair("CODER_SLM", LM_OPTIONS::CODER_SLM)
MakePair("MOD_EPPLER_SLM", LM_OPTIONS::MOD_EPPLER_SLM)
MakePair("DEFAULT", LM_OPTIONS::DEFAULT)
};

Expand All @@ -1210,13 +1220,26 @@ enum class TURB_TRANS_CORRELATION {
DEFAULT /*!< \brief Kind of transition correlation model (Menter-Langtry if SST, MALAN if SA). */
};

/*!
* \brief Types of transition correlations for Simplified LM model
*/
enum class TURB_TRANS_CORRELATION_SLM {
MENTER_SLM, /*!< \brief Kind of transition correlation model (Menter Simplified LM model). */
CODER_SLM, /*!< \brief Kind of transition correlation model (Coder Simplified LM model). */
MOD_EPPLER_SLM, /*!< \brief Kind of transition correlation model (Modified Eppler Simplified LM model). */
DEFAULT /*!< \brief Kind of transition correlation model. */
};

/*!
* \brief Structure containing parsed LM options.
*/
struct LM_ParsedOptions {
LM_OPTIONS version = LM_OPTIONS::NONE; /*!< \brief LM base model. */
bool LM2015 = false; /*!< \brief Use cross-flow corrections. */
bool CrossFlow = false; /*!< \brief Use cross-flow corrections. */
bool SLM = false; /*!< \brief Use simplified version. */
bool ProdLim = false; /*!< \brief Add production term to Pk. */
TURB_TRANS_CORRELATION Correlation = TURB_TRANS_CORRELATION::DEFAULT;
TURB_TRANS_CORRELATION_SLM Correlation_SLM = TURB_TRANS_CORRELATION_SLM::DEFAULT;
};

/*!
Expand All @@ -1234,9 +1257,12 @@ inline LM_ParsedOptions ParseLMOptions(const LM_OPTIONS *LM_Options, unsigned sh
return std::find(LM_Options, lm_options_end, option) != lm_options_end;
};

LMParsedOptions.LM2015 = IsPresent(LM_OPTIONS::LM2015);
LMParsedOptions.CrossFlow = IsPresent(LM_OPTIONS::CROSSFLOW);
LMParsedOptions.SLM = IsPresent(LM_OPTIONS::SLM);
LMParsedOptions.ProdLim = IsPresent(LM_OPTIONS::PRODLIM);

int NFoundCorrelations = 0;
int NFoundCorrelations_SLM = 0;
if (IsPresent(LM_OPTIONS::MALAN)) {
LMParsedOptions.Correlation = TURB_TRANS_CORRELATION::MALAN;
NFoundCorrelations++;
Expand Down Expand Up @@ -1265,10 +1291,25 @@ inline LM_ParsedOptions ParseLMOptions(const LM_OPTIONS *LM_Options, unsigned sh
LMParsedOptions.Correlation = TURB_TRANS_CORRELATION::MENTER_LANGTRY;
NFoundCorrelations++;
}
if (IsPresent(LM_OPTIONS::MENTER_SLM)) {
LMParsedOptions.Correlation_SLM = TURB_TRANS_CORRELATION_SLM::MENTER_SLM;
NFoundCorrelations_SLM++;
}
if (IsPresent(LM_OPTIONS::CODER_SLM)) {
LMParsedOptions.Correlation_SLM = TURB_TRANS_CORRELATION_SLM::CODER_SLM;
NFoundCorrelations_SLM++;
}
if (IsPresent(LM_OPTIONS::MOD_EPPLER_SLM)) {
LMParsedOptions.Correlation_SLM = TURB_TRANS_CORRELATION_SLM::MOD_EPPLER_SLM;
NFoundCorrelations_SLM++;
}

if (NFoundCorrelations > 1) {
SU2_MPI::Error("Two correlations selected for LM_OPTIONS. Please choose only one.", CURRENT_FUNCTION);
}
if (NFoundCorrelations_SLM > 1) {
SU2_MPI::Error("Two correlations selected for Simplified model into LM_OPTIONS. Please choose only one.", CURRENT_FUNCTION);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SU2_MPI::Error("Two correlations selected for Simplified model into LM_OPTIONS. Please choose only one.", CURRENT_FUNCTION);
SU2_MPI::Error("Two correlations selected for simplified LM_OPTIONS. Please choose only one.", CURRENT_FUNCTION);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd stick with my change since the options are for the simplified model. They are not simplified options.

}

if (LMParsedOptions.Correlation == TURB_TRANS_CORRELATION::DEFAULT){
if (Kind_Turb_Model == TURB_MODEL::SST) {
Expand All @@ -1278,6 +1319,10 @@ inline LM_ParsedOptions ParseLMOptions(const LM_OPTIONS *LM_Options, unsigned sh
}
}

if (LMParsedOptions.Correlation_SLM == TURB_TRANS_CORRELATION_SLM::DEFAULT){
LMParsedOptions.Correlation_SLM = TURB_TRANS_CORRELATION_SLM::MENTER_SLM;
}

return LMParsedOptions;
}

Expand Down
37 changes: 30 additions & 7 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3471,9 +3471,9 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
if (Kind_Trans_Model == TURB_TRANS_MODEL::LM) {
lmParsedOptions = ParseLMOptions(LM_Options, nLM_Options, rank, Kind_Turb_Model);

/*--- Check if problem is 2D and LM2015 has been selected ---*/
if (lmParsedOptions.LM2015 && val_nDim == 2) {
SU2_MPI::Error("LM2015 is available only for 3D problems", CURRENT_FUNCTION);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is LM2015 gone? or is crossflow the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed the option to CROSSFLOW, since I will use it also for the Simplified model.

/*--- Check if problem is 2D and CrossFlow has been selected ---*/
if (lmParsedOptions.CrossFlow && val_nDim == 2) {
SU2_MPI::Error("Cross-flow corrections are available only for 3D problems", CURRENT_FUNCTION);
}
}

Expand Down Expand Up @@ -6113,11 +6113,27 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
switch (Kind_Trans_Model) {
case TURB_TRANS_MODEL::NONE: break;
case TURB_TRANS_MODEL::LM: {
cout << "Transition model: Langtry and Menter's 4 equation model";
if (lmParsedOptions.LM2015) {
cout << " w/ cross-flow corrections (2015)" << endl;
int NTurbEqs = 0;
switch (Kind_Turb_Model) {
case TURB_MODEL::SA: NTurbEqs = 1; break;
case TURB_MODEL::SST: NTurbEqs = 2; break;
case TURB_MODEL::NONE: SU2_MPI::Error("No turbulence model has been selected but LM transition model is active.", CURRENT_FUNCTION); break;
}
if (!lmParsedOptions.SLM) {
int NEquations = 2;
cout << "Transition model: Langtry and Menter's "<< NEquations+NTurbEqs <<" equation model";
} else {
cout << " (2009)" << endl;
int NEquations = 1;
cout << "Transition model: Simplified Langtry and Menter's "<< NEquations+NTurbEqs <<" equation model";
}
if (lmParsedOptions.CrossFlow) {
cout << " w/ cross-flow corrections" << endl;
} else {
if (!lmParsedOptions.SLM) {
cout << " (2009)" << endl;
} else {
cout << " (2015)" << endl;
}
}
break;
}
Expand All @@ -6141,6 +6157,13 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
}
break;
}
cout << "Correlation Functions for Simplified LM model: ";
switch (lmParsedOptions.Correlation_SLM) {
case TURB_TRANS_CORRELATION_SLM::CODER_SLM: cout << "Coder et al. (2012)" << endl; break;
case TURB_TRANS_CORRELATION_SLM::MOD_EPPLER_SLM: cout << "Modified Eppler (from Coder et al. 2012)" << endl; break;
case TURB_TRANS_CORRELATION_SLM::MENTER_SLM:
case TURB_TRANS_CORRELATION_SLM::DEFAULT: cout << "Menter et al. (2015)" << endl; break;
}
}
cout << "Hybrid RANS/LES: ";
switch (Kind_HybridRANSLES) {
Expand Down
19 changes: 19 additions & 0 deletions SU2_CFD/include/numerics/CNumerics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,25 @@ class CNumerics {
*/
su2double GetIntermittencyEff() const { return intermittency_eff_i; }

/*!
* \brief Get the value of the Transition Momentum Thickness Reynolds number from correlations.
* \param[in] Corr_Rec_i - Value of the Transition Momentum Thickness Reynolds number at point i.
*/
inline virtual su2double GetCorr_Rec() {return 0.0;}

/*!
* \brief Get the value of the Momentum Thickness Reynolds number.
* \param[in] Corr_Rec_i - Value of the Momentum Thickness Reynolds number at point i.
*/
inline virtual su2double GetRe_t() {return 0.0;}

/*!
* \brief Set the gradient of the auxiliary variables.
* \param[in] val_auxvar_grad_i - Gradient of the auxiliary variable at point i.
* \param[in] val_auxvar_grad_j - Gradient of the auxiliary variable at point j.
*/
inline virtual void SetAuxVar(su2double val_AuxVar) {}

/*!
* \brief Set the gradient of the auxiliary variables.
* \param[in] val_auxvar_grad_i - Gradient of the auxiliary variable at point i.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,10 @@
template <class FlowIndices>
using CUpwSca_TransLM = CUpwSca_TurbSST<FlowIndices>;

/*!
* \class CUpwSca_TransSLM
* \brief Re-use the SA convective fluxes for the scalar upwind discretization of Simplified LM transition model equations.
* \ingroup ConvDiscr
*/
template <class FlowIndices>
using CUpwSca_TransSLM = CUpwSca_TurbSA<FlowIndices>;
104 changes: 104 additions & 0 deletions SU2_CFD/include/numerics/turbulent/transition/trans_correlations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/

#pragma once
//#include <cmath>

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

/*!
* \class TransLMCorrelations
Expand Down Expand Up @@ -189,4 +190,107 @@ class TransLMCorrelations {

return F_length1;
}

/*!
* \brief Compute Re_theta_c from correlations for the Simplified LM model.
* \param[in] Tu - Turbulence intensity.
* \param[in] du_ds - Streamwise velocity gradient.
* \param[out] rethetac - Corrected value for Re_theta.
*/
su2double ReThetaC_Correlations_SLM(const su2double Tu_L, const su2double lambda_theta, const su2double wall_dist, const su2double VorticityMag, const su2double VelocityMag) const {

su2double rethetac = 0.0;

switch (options.Correlation_SLM) {
case TURB_TRANS_CORRELATION_SLM::MENTER_SLM: {

/*-- Thwaites parameter ---*/
// su2double lambda_theta_local = 7.57e-3 * du_ds * wall_dist * wall_dist * Density / Laminar_Viscosity + 0.0128;
su2double lambda_theta_local = lambda_theta;
lambda_theta_local = min(max(lambda_theta_local, -1.0), 1.0);

/*-- Function to sensitize the transition onset to the streamwise pressure gradient ---*/
su2double FPG = 0.0;
const su2double C_PG1 = 14.68;
const su2double C_PG1_lim = 1.5;
const su2double C_PG2 = -7.34;
const su2double C_PG2_lim = 3.0;
const su2double C_PG3 = 0.0;
if (lambda_theta_local >= 0.0) {
FPG = min(1+ C_PG1 * lambda_theta_local, C_PG1_lim);
} else {
const su2double FirstTerm = C_PG2 * lambda_theta_local;
const su2double SecondTerm = C_PG3 * min(lambda_theta_local + 0.0681, 0.0);
FPG = min(1 + FirstTerm + SecondTerm, C_PG2_lim);
}

FPG = max(FPG, 0.0);

const su2double C_TU1 = 100.0;
const su2double C_TU2 = 1000.0;
const su2double C_TU3 = 1.0;
rethetac = C_TU1 + C_TU2 * exp(-C_TU3 * Tu_L * FPG);

break;
} case TURB_TRANS_CORRELATION_SLM::CODER_SLM: {

/*-- Local pressure gradient parameter ---*/
const su2double H_c = max(min(wall_dist * VorticityMag / VelocityMag, 1.1542), 0.3823);

/*-- Thwaites parameter ---*/
su2double lambda_theta_local = 0.0;
const su2double H_c_delta = 0.587743 - H_c;
if ( H_c >= 0.587743 ) {
const su2double FirstTerm = 0.1919 * pow(H_c_delta, 3.0);
const su2double SecondTerm = 0.4182 * pow(H_c_delta, 2.0);
const su2double ThirdTerm = 0.2959 * H_c_delta;
lambda_theta_local = FirstTerm + SecondTerm + ThirdTerm;
} else {
const su2double FirstTerm = 4.7596 * pow(H_c_delta, 3.0);
const su2double SecondTerm = -0.3837 * pow(H_c_delta, 2.0);
const su2double ThirdTerm = 0.3575 * H_c_delta;
lambda_theta_local = FirstTerm + SecondTerm + ThirdTerm;
}

/*-- Function to sensitize the transition onset to the streamwise pressure gradient ---*/
su2double FPG = 0.0;
if (lambda_theta_local <= 0.0) {
const su2double FirstTerm = -12.986 * lambda_theta_local;
const su2double SecondTerm = -123.66 * pow(lambda_theta_local, 2.0);
const su2double ThirdTerm = -405.689 * pow(lambda_theta_local, 3.0);
FPG = 1 - (FirstTerm + SecondTerm + ThirdTerm) * exp(-pow(Tu_L/1.5,1.5));
} else {
FPG = 1 + 0.275 * (1 - exp(-35.0 * lambda_theta_local)) * exp(-Tu_L/0.5);
}

// This is not reported in the paper
//FPG = max(FPG, 0.0);

Comment on lines +264 to +266
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// This is not reported in the paper
//FPG = max(FPG, 0.0);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have left it there since I do not know if I have to keep it or not.

const su2double C_TU1 = 100.0;
const su2double C_TU2 = 1000.0;
const su2double C_TU3 = 1.0;
rethetac = C_TU1 + C_TU2 * exp(-C_TU3 * Tu_L * FPG);

break;
} case TURB_TRANS_CORRELATION_SLM::MOD_EPPLER_SLM: {

/*-- Local pressure gradient parameter ---*/
const su2double H_c = max(min(wall_dist * VorticityMag / VelocityMag, 1.1542), 0.3823);

/*-- H_32 Shape factor --*/
const su2double H_32 = 1.515095 + 0.2041 * pow((1.1542 - H_c), 2.0956);

rethetac = exp(127.94 * pow((H_32-1.515095), 2.0) + 6.774224);

break;
}
case TURB_TRANS_CORRELATION_SLM::DEFAULT:
SU2_MPI::Error("Transition correlation for Simplified LM model is set to DEFAULT but no default value has ben set in the code.",
CURRENT_FUNCTION);
break;
}

return rethetac;
}

};
Loading