28#include "../../../../../Common/include/toolboxes/geometry_toolbox.hpp"
29#include "../../scalar/scalar_sources.hpp"
38template <
class FlowIndices>
41 const FlowIndices idx;
76 :
CNumerics(val_nDim, 2, config), idx(val_nDim, config->GetnSpecies()), options(config->GetLMParsedOptions()){
78 Jacobian_i[0] = Jacobian_Buffer;
79 Jacobian_i[1] = Jacobian_Buffer + 2;
116 const su2double Velocity_Mag =
sqrt(vel_u * vel_u + vel_v * vel_v + vel_w * vel_w);
126 Jacobian_i[0][0] = 0.0;
127 Jacobian_i[0][1] = 0.0;
128 Jacobian_i[1][0] = 0.0;
129 Jacobian_i[1][1] = 0.0;
147 F_length = Corr_F_length * (1. - f_sub) + 40.0 * f_sub;
157 const su2double F_onset1 = Re_v / (2.193 * Corr_Rec);
161 F_onset2 = min(max(F_onset1,
pow(F_onset1, 4.0)), 2.0);
162 F_onset3 = max(1.0 -
pow(R_t / 2.5, 3.0), 0.0);
165 F_onset2 = min(max(F_onset1,
pow(F_onset1, 4.0)), 4.0);
166 F_onset3 = max(2.0 -
pow(R_t / 2.5, 3.0), 0.0);
168 const su2double F_onset = max(F_onset2 - F_onset3, 0.0);
184 su2double du_ds = vel_u / Velocity_Mag * dU_dx + vel_v / Velocity_Mag * dU_dy;
185 if (
nDim == 3) du_ds += vel_w / Velocity_Mag * dU_dz;
190 time_scale = min(time_scale,
193 const su2double delta_bl = 7.5 * theta_bl;
199 f_wake =
exp(-
pow(re_omega / (1.0e+05), 2));
216 su2double Retheta_Error = 200.0, Retheta_old = 0.0;
220 for (
int iter = 0; iter < 100; iter++) {
223 lambda = min(max(-0.1, lambda), 0.1);
226 f_lambda = 1. - (-12.986 * lambda - 123.66 * lambda * lambda - 405.689 * lambda * lambda * lambda) *
229 f_lambda = 1. + 0.275 * (1. -
exp(-35. * lambda)) *
exp(-Tu / 0.5);
233 Corr_Ret = f_lambda * (1173.51 - 589.428 * Tu + 0.2196 / Tu / Tu);
235 Corr_Ret = 331.5 * f_lambda *
pow(Tu - 0.5658, -0.671);
237 Corr_Ret = max(Corr_Ret, Corr_Ret_lim);
239 Retheta_Error = fabs(Retheta_old - Corr_Ret) / Retheta_old;
241 if (Retheta_Error < 0.0000001) {
245 Retheta_old = Corr_Ret;
252 VelocityNormalized[0] = vel_u / Velocity_Mag;
253 VelocityNormalized[1] = vel_v / Velocity_Mag;
254 if (
nDim == 3) VelocityNormalized[2] = vel_w / Velocity_Mag;
257 for (
auto iDim = 0u; iDim <
nDim; iDim++) {
258 StreamwiseVort += VelocityNormalized[iDim] *
Vorticity_i[iDim];
260 StreamwiseVort =
abs(StreamwiseVort);
264 const su2double DeltaH_CF_Minus = max(-1.0 * (0.1066 - DeltaH_CF), 0.0);
265 const su2double DeltaH_CF_Plus = max(0.1066 - DeltaH_CF, 0.0);
266 const su2double fDeltaH_CF_Minus = 75.0 * tanh(DeltaH_CF_Minus / 0.0125);
267 const su2double fDeltaH_CF_Plus = 6200 * DeltaH_CF_Plus + 50000 * DeltaH_CF_Plus * DeltaH_CF_Plus;
273 const int nMax = 100;
276 for (iter = 0; iter < nMax && error > toll; iter++) {
278 thetat_SCF = max(1e-20, thetat_SCF);
280 ReThetat_SCF = -35.088 * log(hRoughness / thetat_SCF) + 319.51 + fDeltaH_CF_Plus - fDeltaH_CF_Minus;
282 error =
abs(ReThetat_SCF - rethetat_SCF_old) / rethetat_SCF_old;
284 rethetat_SCF_old = ReThetat_SCF;
302 DRethetat = -c_theta * (
Density_i / time_scale) * c_CF * min(ReThetat_SCF -
TransVar_i[1], 0.0) * f_theta_2;
305 Residual[0] += (Pg - Dg) *
Volume;
306 Residual[1] += (PRethetat - DRethetat) *
Volume;
311 c_a2 * VorticityMag * f_turb * (2.0 * c_e2 *
TransVar_i[0] - 1.0)) *
313 Jacobian_i[0][1] = 0.0;
314 Jacobian_i[1][0] = 0.0;
315 Jacobian_i[1][1] = -c_theta / time_scale * (1.0 - f_theta) *
Volume;
317 Jacobian_i[1][1] += (c_theta / time_scale) * c_CF * f_theta_2 *
Volume;
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
TURB_MODEL GetKind_Turb_Model(void) const
Get the kind of the turbulence model.
Definition CConfig.hpp:4693
su2double GetTurbulenceIntensity_FreeStream(void) const
Get the value of the non-dimensionalized freestream turbulence intensity.
Definition CConfig.hpp:2143
su2double GethRoughness(void) const
Get RMS roughness for Transtion model from config.
Definition CConfig.hpp:4711
Class for defining the numerical methods.
Definition CNumerics.hpp:48
su2double Eddy_Viscosity_i
Eddy viscosity at point i.
Definition CNumerics.hpp:77
unsigned short nVar
Number of dimensions and variables.
Definition CNumerics.hpp:52
CMatrixView< const su2double > ScalarVar_Grad_i
Gradient of scalar variables at point i.
Definition CNumerics.hpp:151
su2double StrainMag_i
Definition CNumerics.hpp:180
CMatrixView< const su2double > TransVar_Grad_i
Gradient of turbulent variables at point i.
Definition CNumerics.hpp:153
su2double Volume
Volume of the control volume around point i.
Definition CNumerics.hpp:173
su2double Density_i
Density at point i.
Definition CNumerics.hpp:89
const su2double * Vorticity_i
Definition CNumerics.hpp:179
const su2double * ScalarVar_i
Vector of scalar variables at point i.
Definition CNumerics.hpp:131
su2double Laminar_Viscosity_i
Laminar viscosity at point i.
Definition CNumerics.hpp:67
CMatrixView< const su2double > PrimVar_Grad_i
Gradient of primitive variables at point i.
Definition CNumerics.hpp:147
const su2double * V_i
Vector of primitive variables at point i.
Definition CNumerics.hpp:122
const su2double * TransVar_i
Vector of turbulent variables at point i.
Definition CNumerics.hpp:138
su2double dist_i
Distance of point i to the nearest wall.
Definition CNumerics.hpp:107
unsigned short nDim
Definition CNumerics.hpp:52
su2double LocalGridLength_i
Local grid length at point i.
Definition CNumerics.hpp:160
const su2double delta[3][3]
Identity matrix.
Definition CNumerics.hpp:62
Definition trans_sources.hpp:39
CSourcePieceWise_TransLM(unsigned short val_nDim, unsigned short val_nVar, const CConfig *config)
Constructor of the class.
Definition trans_sources.hpp:75
ResidualType ComputeResidual(const CConfig *config) override
Residual for source term integration.
Definition trans_sources.hpp:94
Class for LM model's correlation functions.
Definition trans_correlations.hpp:35
void SetOptions(const LM_ParsedOptions val_options)
Set LM options.
Definition trans_correlations.hpp:46
su2double FLength_Correlations(const su2double Tu, const su2double Re_theta_t) const
Compute FLength from correlations.
Definition trans_correlations.hpp:126
su2double ReThetaC_Correlations(const su2double Tu, const su2double Re_theta_t) const
Compute Re_theta_c from correlations.
Definition trans_correlations.hpp:56
passivedouble su2double
Definition code_config.hpp:181
FORCEINLINE ARRAY_T exp(const ARRAY_T &x)
Definition special_vectorization.hpp:156
FORCEINLINE ARRAY_T sqrt(const ARRAY_T &x)
Definition special_vectorization.hpp:116
FORCEINLINE ARRAY_T pow(const ARRAY_T &a, const ARRAY_T &b)
Definition special_vectorization.hpp:179
FORCEINLINE ARRAY_T abs(const ARRAY_T &x)
Definition special_vectorization.hpp:117
void StartPreacc()
Starts a new preaccumulation section and sets the input variables.
Definition ad_structure.hpp:215
void EndPreacc()
Ends a preaccumulation section and computes the local Jacobi matrix of a code section using the varia...
Definition ad_structure.hpp:243
void SetPreaccOut(Ts &&... data)
Sets the scalar outputs of a preaccumulation section.
Definition ad_structure.hpp:222
void SetPreaccIn(Ts &&... data)
Sets the scalar inputs of a preaccumulation section.
Definition ad_structure.hpp:186
TURB_FAMILY
Families of turbulence models.
Definition option_structure.hpp:1080
@ SA
Spalart-Allmaras variants.
TURB_FAMILY TurbModelFamily(TURB_MODEL model)
Associate turb models with their family.
Definition option_structure.hpp:1088
Return type used in some "ComputeResidual" overloads to give a const-view of the internally stored fl...
Definition CNumerics.hpp:218
Structure containing parsed LM options.
Definition option_structure.hpp:1417
bool LM2015
Use cross-flow corrections.
Definition option_structure.hpp:1419
Numerics class for the LM model's correlation functions.