From a0e22abd210138835f57af89fecb47ba5084c07a Mon Sep 17 00:00:00 2001 From: Guillermo Suarez Date: Thu, 21 Oct 2021 09:55:19 +0200 Subject: [PATCH 01/34] First step towards Frankenstein turbulence modeling With new implementation of turbulence modeling, the current turb_sources.cpp and turb_sources.hpp are no longer useful. Because of that, I deleted almost everything related to SA in order to start from scratch. --- .../numerics/turbulent/turb_sources.hpp | 280 +++---- .../src/numerics/turbulent/turb_sources.cpp | 693 ------------------ 2 files changed, 121 insertions(+), 852 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index f7777d0e6df0..46bfd3894b2e 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -33,29 +33,36 @@ /*! * \class CSourcePieceWise_TurbSA * \brief Class for integrating the source terms of the Spalart-Allmaras turbulence model equation. + * \brief The variables that are subject to change in each variation/correction have their own class. Additional source terms are implemented as decorators. * \ingroup SourceDiscr * \author A. Bueno. */ +template class CSourceBase_TurbSA : public CNumerics { protected: - su2double cv1_3; - su2double k2; - su2double cb1; - su2double cw2; - su2double ct3; - su2double ct4; - su2double cw3_6; - su2double cb2_sigma; - su2double sigma; - su2double cb2; - su2double cw1; - su2double cr1; + /*--- List of constants and auxiliary functions ---*/ + su2double cv1_3, + k2, + cb1, + cw2, + ct3, + ct4, + cw3_6, + cb2_sigma, + sigma, + cb2, + cw1, + cr1; su2double Gamma_BC = 0.0; su2double intermittency; - su2double Production, Destruction, CrossProduction; + /*--- Source term components ---*/ + su2double Production, Destruction, CrossProduction, AddSourceTerm; + + /*--- Residual and Jacobian ---*/ su2double Residual, *Jacobian_i; + private: su2double Jacobian_Buffer; /// Static storage for the Jacobian (which needs to be pointer for return type). @@ -116,179 +123,134 @@ class CSourceBase_TurbSA : public CNumerics { * \brief ______________. */ inline su2double GetCrossProduction(void) const final { return CrossProduction; } -}; - -/*! - * \class CSourcePieceWise_TurbSA - * \brief Class for integrating the source terms of the Spalart-Allmaras turbulence model equation. - * \ingroup SourceDiscr - * \author A. Bueno. - */ -class CSourcePieceWise_TurbSA final : public CSourceBase_TurbSA { -private: - su2double nu, Ji, fv1, fv2, ft2, Omega, S, Shat, inv_Shat, dist_i_2, Ji_2, Ji_3, inv_k2_d2; - su2double r, g, g_6, glim, fw; - su2double norm2_Grad; - su2double dfv1, dfv2, dShat; - su2double dr, dg, dfw; - unsigned short iDim; - bool transition; - bool axisymmetric; - -public: - /*! - * \brief Constructor of the class. - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nVar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CSourcePieceWise_TurbSA(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config); + su2double ComputeXsi(const su2double nue, const su2double nul) { return nue/nul + cr1*(roughness_i/(dist_i+EPS)); //roughness_i = 0 for smooth walls and Ji remains the same, changes only if roughness is specified.nue/nul } /*! * \brief Residual for source term integration. * \param[in] config - Definition of the particular problem. * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. */ - ResidualType<> ComputeResidual(const CConfig* config) override; - + ResidualType<> ComputeResidual(const CConfig* config) final { + + }; }; +/*------------------------------------------------------------------------------ +| Define the Spalart-Allmaras variation/corrections. +| \author A. Bueno., E.Molina, F. Palacios +------------------------------------------------------------------------------*/ /*! - * \class CSourcePieceWise_TurbSA_COMP - * \brief Class for integrating the source terms of the Spalart-Allmaras CC modification turbulence model equation. - * \ingroup SourceDiscr - * \author E.Molina, A. Bueno. - * \version 7.2.0 "Blackbird" + * \brief SU2 baseline ft2 term value + * \param[in] ft2 - ft2 variable + * \param[in] d_ft2 - derivative of ft2 w.r.t. nue variable + * \return Zero */ -class CSourcePieceWise_TurbSA_COMP final : public CSourceBase_TurbSA { -private: - su2double nu, Ji, fv1, fv2, ft2, Omega, S, Shat, inv_Shat, dist_i_2, Ji_2, Ji_3, inv_k2_d2; - su2double r, g, g_6, glim, fw; - su2double norm2_Grad; - su2double dfv1, dfv2, dShat; - su2double dr, dg, dfw; - su2double aux_cc, CompCorrection, c5; - unsigned short iDim, jDim; +class ft2_bsl { static double get(su2double ft2, su2double d_ft2) { ft2 = 0.0; d_ft2 = 0.0; } }; -public: - /*! - * \brief Constructor of the class. - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nVar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CSourcePieceWise_TurbSA_COMP(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config); +/*! + * \brief non-zero ft2 term according to the literature. + * \param[in] ct3 - constant ct3 + * \param[in] ct4 - constant ct4 + * \param[in] nut - nu_tilde + * \param[in] nul - dynamic laminar viscosity + * \param[in] ft2 - ft2 variable + * \param[in] d_ft2 - derivative of ft2 w.r.t. nue variable + */ +class ft2_nonzero { + static void get(const su2double ct3, const su2double ct4, const su2double nue, const su2double nul, su2double ft2, su2double d_ft2) { + const su2double xsi = ComputeXsi(nue, nul), + xsi2 = xsi*xsi; + + const su2double dxsi = 1.0/nul; + + ft2 = ct3*exp(-ct4*xsi2); + d_ft2 = -2.0*ct4*xsi*ft2*dxsi; + } +}; - /*! - * \brief Residual for source term integration. - * \param[in] config - Definition of the particular problem. - * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. - */ - ResidualType<> ComputeResidual(const CConfig* config) override; +class ModVort_bsl { + static double get(const su2double S, const su2double nue, const su2double fv2, const su2double inv_k2_d2, const su2double d_fv2, su2double Shat, su2double d_Shat){ + Shat = S + nue*fv2*inv_k2_d2; + Shat = max(Shat, 1.0e-10); + + d_Shat = (Shat <= 1.0e-10) ? 0.0 : (fv2 + nue*d_fv2)*inv_k2_d2; + } }; -/*! - * \class CSourcePieceWise_TurbSA_E - * \brief Class for integrating the source terms of the Spalart-Allmaras Edwards modification turbulence model equation. - * \ingroup SourceDiscr - * \author E.Molina, A. Bueno. - * \version 7.2.0 "Blackbird" - */ -class CSourcePieceWise_TurbSA_E final : public CSourceBase_TurbSA { -private: - su2double nu, Ji, fv1, fv2, ft2, Omega, S, Shat, inv_Shat, dist_i_2, Ji_2, Ji_3, inv_k2_d2; - su2double r, g, g_6, glim, fw; - su2double norm2_Grad; - su2double dfv1, dfv2, dShat; - su2double dr, dg, dfw; - su2double Sbar; -public: - /*! - * \brief Constructor of the class. - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nVar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CSourcePieceWise_TurbSA_E(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config); +class ModVort_Edw { + static double get(const su2double nue, const su2double nul, const su2double fv1, const su2double inv_k2_d2, const su2double d_fv1, su2double Shat, su2double d_Shat){ - /*! - * \brief Residual for source term integration. - * \param[in] config - Definition of the particular problem. - * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. - */ - ResidualType<> ComputeResidual(const CConfig* config) override; -}; + /* + From NASA Turbulence model site. http://turbmodels.larc.nasa.gov/spalart.html + This form was developed primarily to improve the near-wall numerical behavior of the model (i.e., the goal was to improve the convergence behavior). The reference is: + Edwards, J. R. and Chandra, S. "Comparison of Eddy Viscosity-Transport Turbulence Models for Three-Dimensional, Shock-Separated Flowfields," AIAA Journal, Vol. 34, No. 4, 1996, pp. 756-763. + In this modificaton Omega is replaced by Strain Rate + */ -/*! - * \class CSourcePieceWise_TurbSA_E_COMP - * \brief Class for integrating the source terms of the Spalart-Allmaras Edwards modification with CC turbulence model equation. - * \ingroup SourceDiscr - * \author E.Molina, A. Bueno. - * \version 7.2.0 "Blackbird" - */ -class CSourcePieceWise_TurbSA_E_COMP : public CSourceBase_TurbSA { -private: - su2double nu, Ji, fv1, fv2, ft2, Omega, S, Shat, inv_Shat, dist_i_2, Ji_2, Ji_3, inv_k2_d2; - su2double r, g, g_6, glim, fw; - su2double norm2_Grad; - su2double dfv1, dfv2, dShat; - su2double dr, dg, dfw; - su2double Sbar; - su2double aux_cc, CompCorrection, c5; - unsigned short jDim; + const su2double xsi = ComputeXsi(nue, nul); -public: - /*! - * \brief Constructor of the class. - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nVar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CSourcePieceWise_TurbSA_E_COMP(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config); + /*--- Evaluate Omega, here Omega is the Strain Rate ---*/ - /*! - * \brief Residual for source term integration. - * \param[in] config - Definition of the particular problem. - * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. - */ - ResidualType<> ComputeResidual(const CConfig* config) override; -}; + su2double Sbar = 0.0; + for(iDim=0;iDim ComputeResidual(const CConfig* config) override; + const su2double S = Omega; + Shat = max(S*((1.0/max(xsi,1.0e-16))+fv1),1.0e-16); + Shat = max(Shat, 1.0e-10); + + d_Shat = (Shat <= 1.0e-10) ? 0.0 : -S*pow(xsi,-2.0)/nul + S*d_fv1; + } }; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /*! * \class CSourcePieceWise_TurbSST * \brief Class for integrating the source terms of the Menter SST turbulence model equations. diff --git a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp index 368e40367ec0..d68f463ed5e3 100644 --- a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp +++ b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp @@ -58,699 +58,6 @@ CSourceBase_TurbSA::CSourceBase_TurbSA(unsigned short val_nDim, } -CSourcePieceWise_TurbSA::CSourcePieceWise_TurbSA(unsigned short val_nDim, - unsigned short val_nVar, - const CConfig* config) : - CSourceBase_TurbSA(val_nDim, val_nVar, config) { - - transition = (config->GetKind_Trans_Model() == BC); -} - -CNumerics::ResidualType<> CSourcePieceWise_TurbSA::ComputeResidual(const CConfig* config) { - -// AD::StartPreacc(); -// AD::SetPreaccIn(V_i, nDim+6); -// AD::SetPreaccIn(Vorticity_i, nDim); -// AD::SetPreaccIn(StrainMag_i); -// AD::SetPreaccIn(ScalarVar_i[0]); -// AD::SetPreaccIn(ScalarVar_Grad_i[0], nDim); -// AD::SetPreaccIn(Volume); AD::SetPreaccIn(dist_i); - - // Set the boolean here depending on whether the point is closest to a rough wall or not. - roughwall = (roughness_i > 0.0); - - if (incompressible) { - Density_i = V_i[nDim+2]; - Laminar_Viscosity_i = V_i[nDim+4]; - } - else { - Density_i = V_i[nDim+2]; - Laminar_Viscosity_i = V_i[nDim+5]; - } - - Residual = 0.0; - Production = 0.0; - Destruction = 0.0; - CrossProduction = 0.0; - Jacobian_i[0] = 0.0; - - /*--- Evaluate Omega ---*/ - - Omega = sqrt(Vorticity_i[0]*Vorticity_i[0] + Vorticity_i[1]*Vorticity_i[1] + Vorticity_i[2]*Vorticity_i[2]); - - /*--- Rotational correction term ---*/ - - if (rotating_frame) { Omega += 2.0*min(0.0, StrainMag_i-Omega); } - - if (dist_i > 1e-10) { - - /*--- Production term ---*/ - - dist_i_2 = dist_i*dist_i; - nu = Laminar_Viscosity_i/Density_i; - - /*--- Modified values for roughness ---*/ - /*--- Ref: Aupoix, B. and Spalart, P. R., "Extensions of the Spalart-Allmaras Turbulence Model to Account for Wall Roughness," - * International Journal of Heat and Fluid Flow, Vol. 24, 2003, pp. 454-462. ---*/ - /* --- See https://turbmodels.larc.nasa.gov/spalart.html#sarough for detailed explanation. ---*/ - - Ji = ScalarVar_i[0]/nu + cr1*(roughness_i/(dist_i+EPS)); //roughness_i = 0 for smooth walls and Ji remains the same, changes only if roughness is specified. - Ji_2 = Ji*Ji; - Ji_3 = Ji_2*Ji; - fv1 = Ji_3/(Ji_3+cv1_3); - - /*--- Using a modified relation so as to not change the Shat that depends on fv2. ---*/ - fv2 = 1.0 - ScalarVar_i[0]/(nu+ScalarVar_i[0]*fv1); // From NASA turb modeling resource and 2003 paper - - ft2 = ct3*exp(-ct4*Ji_2); - S = Omega; - inv_k2_d2 = 1.0/(k2*dist_i_2); - - Shat = S + ScalarVar_i[0]*fv2*inv_k2_d2; - Shat = max(Shat, 1.0e-10); - inv_Shat = 1.0/Shat; - -// Original SA model -// Production = cb1*(1.0-ft2)*Shat*ScalarVar_i[0]*Volume; - - if (transition) { - - /*--- BC model constants (2020 revision). ---*/ - const su2double chi_1 = 0.002; - const su2double chi_2 = 50.0; - - /*--- turbulence intensity is u'/U so we multiply by 100 to get percentage ---*/ - su2double tu = 100.0 * config->GetTurbulenceIntensity_FreeStream(); - - su2double nu_t = (ScalarVar_i[0]*fv1); //S-A variable - - su2double re_v = ((Density_i*pow(dist_i,2.))/(Laminar_Viscosity_i))*Omega; - su2double re_theta = re_v/2.193; - su2double re_theta_t = (803.73 * pow((tu + 0.6067),-1.027)); //MENTER correlation - //re_theta_t = 163.0 + exp(6.91-tu); //ABU-GHANNAM & SHAW correlation - - su2double term1 = sqrt(max(re_theta-re_theta_t,0.)/(chi_1*re_theta_t)); - su2double term2 = sqrt(max((nu_t*chi_2)/nu,0.)); - su2double term_exponential = (term1 + term2); - - Gamma_BC = 1.0 - exp(-term_exponential); - - Production = Gamma_BC*cb1*Shat*ScalarVar_i[0]*Volume; - } - else { - Production = cb1*Shat*ScalarVar_i[0]*Volume; - } - - /*--- Destruction term ---*/ - - r = min(ScalarVar_i[0]*inv_Shat*inv_k2_d2,10.0); - g = r + cw2*(pow(r,6.0)-r); - g_6 = pow(g,6.0); - glim = pow((1.0+cw3_6)/(g_6+cw3_6),1.0/6.0); - fw = g*glim; - -// Original SA model -// Destruction = (cw1*fw-cb1*ft2/k2)*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; - - Destruction = cw1*fw*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; - - /*--- Diffusion term ---*/ - - norm2_Grad = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - norm2_Grad += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; - - CrossProduction = cb2_sigma*norm2_Grad*Volume; - - Residual = Production - Destruction + CrossProduction; - - /*--- Implicit part, production term ---*/ - - dfv1 = 3.0*Ji_2*cv1_3/(nu*pow(Ji_3+cv1_3,2.)); - dfv2 = -(1/nu-Ji_2*dfv1)/pow(1.+Ji*fv1,2.); - if ( Shat <= 1.0e-10 ) dShat = 0.0; - else dShat = (fv2+ScalarVar_i[0]*dfv2)*inv_k2_d2; - - if (transition) { - Jacobian_i[0] += Gamma_BC*cb1*(ScalarVar_i[0]*dShat+Shat)*Volume; - } - else { - Jacobian_i[0] += cb1*(ScalarVar_i[0]*dShat+Shat)*Volume; - } - - /*--- Implicit part, destruction term ---*/ - - dr = (Shat-ScalarVar_i[0]*dShat)*inv_Shat*inv_Shat*inv_k2_d2; - if (r == 10.0) dr = 0.0; - dg = dr*(1.+cw2*(6.0*pow(r,5.0)-1.0)); - dfw = dg*glim*(1.-g_6/(g_6+cw3_6)); - Jacobian_i[0] -= cw1*(dfw*ScalarVar_i[0] + 2.0*fw)*ScalarVar_i[0]/dist_i_2*Volume; - - } - -// AD::SetPreaccOut(Residual); -// AD::EndPreacc(); - - return ResidualType<>(&Residual, &Jacobian_i, nullptr); - -} - -CSourcePieceWise_TurbSA_COMP::CSourcePieceWise_TurbSA_COMP(unsigned short val_nDim, - unsigned short val_nVar, - const CConfig* config) : - CSourceBase_TurbSA(val_nDim, val_nVar, config), c5(3.5) { } - -CNumerics::ResidualType<> CSourcePieceWise_TurbSA_COMP::ComputeResidual(const CConfig* config) { - - // AD::StartPreacc(); - // AD::SetPreaccIn(V_i, nDim+6); - // AD::SetPreaccIn(Vorticity_i, nDim); - // AD::SetPreaccIn(StrainMag_i); - // AD::SetPreaccIn(ScalarVar_i[0]); - // AD::SetPreaccIn(ScalarVar_Grad_i[0], nDim); - // AD::SetPreaccIn(Volume); AD::SetPreaccIn(dist_i); - - if (incompressible) { - Density_i = V_i[nDim+2]; - Laminar_Viscosity_i = V_i[nDim+4]; - } - else { - Density_i = V_i[nDim+2]; - Laminar_Viscosity_i = V_i[nDim+5]; - } - - Residual = 0.0; - Production = 0.0; - Destruction = 0.0; - CrossProduction = 0.0; - Jacobian_i[0] = 0.0; - - /*--- Evaluate Omega ---*/ - - Omega = sqrt(Vorticity_i[0]*Vorticity_i[0] + Vorticity_i[1]*Vorticity_i[1] + Vorticity_i[2]*Vorticity_i[2]); - - /*--- Rotational correction term ---*/ - - if (rotating_frame) { Omega += 2.0*min(0.0, StrainMag_i-Omega); } - - if (dist_i > 1e-10) { - - /*--- Production term ---*/ - - dist_i_2 = dist_i*dist_i; - nu = Laminar_Viscosity_i/Density_i; - Ji = ScalarVar_i[0]/nu; - Ji_2 = Ji*Ji; - Ji_3 = Ji_2*Ji; - fv1 = Ji_3/(Ji_3+cv1_3); - fv2 = 1.0 - Ji/(1.0+Ji*fv1); - ft2 = ct3*exp(-ct4*Ji_2); - S = Omega; - inv_k2_d2 = 1.0/(k2*dist_i_2); - - Shat = S + ScalarVar_i[0]*fv2*inv_k2_d2; - Shat = max(Shat, 1.0e-10); - inv_Shat = 1.0/Shat; - - /*--- Production term ---*/; - - Production = cb1*Shat*ScalarVar_i[0]*Volume; - - /*--- Destruction term ---*/ - - r = min(ScalarVar_i[0]*inv_Shat*inv_k2_d2,10.0); - g = r + cw2*(pow(r,6.0)-r); - g_6 = pow(g,6.0); - glim = pow((1.0+cw3_6)/(g_6+cw3_6),1.0/6.0); - fw = g*glim; - - Destruction = cw1*fw*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; - - /*--- Diffusion term ---*/ - - norm2_Grad = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - norm2_Grad += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; - - CrossProduction = cb2_sigma*norm2_Grad*Volume; - - Residual = Production - Destruction + CrossProduction; - - /*--- Compressibility Correction term ---*/ - Pressure_i = V_i[nDim+1]; - SoundSpeed_i = sqrt(Pressure_i*Gamma/Density_i); - aux_cc=0; - for(iDim=0;iDim(&Residual, &Jacobian_i, nullptr); - -} - -CSourcePieceWise_TurbSA_E::CSourcePieceWise_TurbSA_E(unsigned short val_nDim, - unsigned short val_nVar, - const CConfig* config) : - CSourceBase_TurbSA(val_nDim, val_nVar, config) { } - -CNumerics::ResidualType<> CSourcePieceWise_TurbSA_E::ComputeResidual(const CConfig* config) { - - unsigned short iDim, jDim; - - // AD::StartPreacc(); - // AD::SetPreaccIn(V_i, nDim+6); - // AD::SetPreaccIn(Vorticity_i, nDim); - // AD::SetPreaccIn(StrainMag_i); - // AD::SetPreaccIn(ScalarVar_i[0]); - // AD::SetPreaccIn(ScalarVar_Grad_i[0], nDim); - // AD::SetPreaccIn(Volume); AD::SetPreaccIn(dist_i); - - if (incompressible) { - Density_i = V_i[nDim+2]; - Laminar_Viscosity_i = V_i[nDim+4]; - } - else { - Density_i = V_i[nDim+2]; - Laminar_Viscosity_i = V_i[nDim+5]; - } - - Residual = 0.0; - Production = 0.0; - Destruction = 0.0; - CrossProduction = 0.0; - Jacobian_i[0] = 0.0; - - /* - From NASA Turbulence model site. http://turbmodels.larc.nasa.gov/spalart.html - This form was developed primarily to improve the near-wall numerical behavior of the model (i.e., the goal was to improve the convergence behavior). The reference is: - Edwards, J. R. and Chandra, S. "Comparison of Eddy Viscosity-Transport Turbulence Models for Three-Dimensional, Shock-Separated Flowfields," AIAA Journal, Vol. 34, No. 4, 1996, pp. 756-763. - In this modificaton Omega is replaced by Strain Rate - */ - - /*--- Evaluate Omega, here Omega is the Strain Rate ---*/ - - Sbar = 0.0; - for(iDim=0;iDim 1e-10) { - - /*--- Production term ---*/ - - dist_i_2 = dist_i*dist_i; - nu = Laminar_Viscosity_i/Density_i; - Ji = ScalarVar_i[0]/nu; - Ji_2 = Ji*Ji; - Ji_3 = Ji_2*Ji; - fv1 = Ji_3/(Ji_3+cv1_3); - fv2 = 1.0 - Ji/(1.0+Ji*fv1); - ft2 = ct3*exp(-ct4*Ji_2); - S = Omega; - inv_k2_d2 = 1.0/(k2*dist_i_2); - - //Shat = S + ScalarVar_i[0]*fv2*inv_k2_d2; - Shat = max(S*((1.0/max(Ji,1.0e-16))+fv1),1.0e-16); - - Shat = max(Shat, 1.0e-10); - inv_Shat = 1.0/Shat; - - /*--- Production term ---*/; - - Production = cb1*Shat*ScalarVar_i[0]*Volume; - - /*--- Destruction term ---*/ - - r = min(ScalarVar_i[0]*inv_Shat*inv_k2_d2,10.0); - r=tanh(r)/tanh(1.0); - - g = r + cw2*(pow(r,6.0)-r); - g_6 = pow(g,6.0); - glim = pow((1.0+cw3_6)/(g_6+cw3_6),1.0/6.0); - fw = g*glim; - - Destruction = cw1*fw*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; - - /*--- Diffusion term ---*/ - - norm2_Grad = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - norm2_Grad += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; - - CrossProduction = cb2_sigma*norm2_Grad*Volume; - - Residual = Production - Destruction + CrossProduction; - - /*--- Implicit part, production term ---*/ - - dfv1 = 3.0*Ji_2*cv1_3/(nu*pow(Ji_3+cv1_3,2.)); - dfv2 = -(1/nu-Ji_2*dfv1)/pow(1.+Ji*fv1,2.); - - if ( Shat <= 1.0e-10 ) dShat = 0.0; - else dShat = -S*pow(Ji,-2.0)/nu + S*dfv1; - Jacobian_i[0] += cb1*(ScalarVar_i[0]*dShat+Shat)*Volume; - - /*--- Implicit part, destruction term ---*/ - - dr = (Shat-ScalarVar_i[0]*dShat)*inv_Shat*inv_Shat*inv_k2_d2; - dr=(1-pow(tanh(r),2.0))*(dr)/tanh(1.0); - dg = dr*(1.+cw2*(6.0*pow(r,5.0)-1.0)); - dfw = dg*glim*(1.-g_6/(g_6+cw3_6)); - Jacobian_i[0] -= cw1*(dfw*ScalarVar_i[0] + 2.0*fw)*ScalarVar_i[0]/dist_i_2*Volume; - - } - - // AD::SetPreaccOut(Residual); - // AD::EndPreacc(); - - return ResidualType<>(&Residual, &Jacobian_i, nullptr); - -} - -CSourcePieceWise_TurbSA_E_COMP::CSourcePieceWise_TurbSA_E_COMP(unsigned short val_nDim, - unsigned short val_nVar, - const CConfig* config) : - CSourceBase_TurbSA(val_nDim, val_nVar, config) { } - -CNumerics::ResidualType<> CSourcePieceWise_TurbSA_E_COMP::ComputeResidual(const CConfig* config) { - - unsigned short iDim; - - // AD::StartPreacc(); - // AD::SetPreaccIn(V_i, nDim+6); - // AD::SetPreaccIn(Vorticity_i, nDim); - // AD::SetPreaccIn(StrainMag_i); - // AD::SetPreaccIn(ScalarVar_i[0]); - // AD::SetPreaccIn(ScalarVar_Grad_i[0], nDim); - // AD::SetPreaccIn(Volume); AD::SetPreaccIn(dist_i); - - if (incompressible) { - Density_i = V_i[nDim+2]; - Laminar_Viscosity_i = V_i[nDim+4]; - } - else { - Density_i = V_i[nDim+2]; - Laminar_Viscosity_i = V_i[nDim+5]; - } - - Residual = 0.0; - Production = 0.0; - Destruction = 0.0; - CrossProduction = 0.0; - Jacobian_i[0] = 0.0; - - /* - From NASA Turbulence model site. http://turbmodels.larc.nasa.gov/spalart.html - This form was developed primarily to improve the near-wall numerical behavior of the model (i.e., the goal was to improve the convergence behavior). The reference is: - Edwards, J. R. and Chandra, S. "Comparison of Eddy Viscosity-Transport Turbulence Models for Three-Dimensional, Shock-Separated Flowfields," AIAA Journal, Vol. 34, No. 4, 1996, pp. 756-763. - In this modificaton Omega is replaced by Strain Rate - */ - - /*--- Evaluate Omega, here Omega is the Strain Rate ---*/ - - Sbar = 0.0; - for(iDim=0;iDim 1e-10) { - - /*--- Production term ---*/ - - dist_i_2 = dist_i*dist_i; - nu = Laminar_Viscosity_i/Density_i; - Ji = ScalarVar_i[0]/nu; - Ji_2 = Ji*Ji; - Ji_3 = Ji_2*Ji; - fv1 = Ji_3/(Ji_3+cv1_3); - fv2 = 1.0 - Ji/(1.0+Ji*fv1); - ft2 = ct3*exp(-ct4*Ji_2); - S = Omega; - inv_k2_d2 = 1.0/(k2*dist_i_2); - - Shat = max(S*((1.0/max(Ji,1.0e-16))+fv1),1.0e-16); - - Shat = max(Shat, 1.0e-10); - inv_Shat = 1.0/Shat; - - /*--- Production term ---*/; - - Production = cb1*Shat*ScalarVar_i[0]*Volume; - - /*--- Destruction term ---*/ - - r = min(ScalarVar_i[0]*inv_Shat*inv_k2_d2,10.0); - r=tanh(r)/tanh(1.0); - - g = r + cw2*(pow(r,6.0)-r); - g_6 = pow(g,6.0); - glim = pow((1.0+cw3_6)/(g_6+cw3_6),1.0/6.0); - fw = g*glim; - - Destruction = cw1*fw*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; - - /*--- Diffusion term ---*/ - - norm2_Grad = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - norm2_Grad += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; - - CrossProduction = cb2_sigma*norm2_Grad*Volume; - - Residual = Production - Destruction + CrossProduction; - - /*--- Compressibility Correction term ---*/ - Pressure_i = V_i[nDim+1]; - SoundSpeed_i = sqrt(Pressure_i*Gamma/Density_i); - aux_cc=0; - for(iDim=0;iDim(&Residual, &Jacobian_i, nullptr); - -} - -CSourcePieceWise_TurbSA_Neg::CSourcePieceWise_TurbSA_Neg(unsigned short val_nDim, - unsigned short val_nVar, - const CConfig* config) : - CSourceBase_TurbSA(val_nDim, val_nVar, config) { } - -CNumerics::ResidualType<> CSourcePieceWise_TurbSA_Neg::ComputeResidual(const CConfig* config) { - - unsigned short iDim; - -// AD::StartPreacc(); -// AD::SetPreaccIn(V_i, nDim+6); -// AD::SetPreaccIn(Vorticity_i, nDim); -// AD::SetPreaccIn(StrainMag_i); -// AD::SetPreaccIn(ScalarVar_i[0]); -// AD::SetPreaccIn(ScalarVar_Grad_i[0], nDim); -// AD::SetPreaccIn(Volume); AD::SetPreaccIn(dist_i); - - if (incompressible) { - Density_i = V_i[nDim+2]; - Laminar_Viscosity_i = V_i[nDim+4]; - } - else { - Density_i = V_i[nDim+2]; - Laminar_Viscosity_i = V_i[nDim+5]; - } - - Residual = 0.0; - Production = 0.0; - Destruction = 0.0; - CrossProduction = 0.0; - Jacobian_i[0] = 0.0; - - /*--- Evaluate Omega ---*/ - - Omega = sqrt(Vorticity_i[0]*Vorticity_i[0] + Vorticity_i[1]*Vorticity_i[1] + Vorticity_i[2]*Vorticity_i[2]); - - /*--- Rotational correction term ---*/ - - if (rotating_frame) { Omega += 2.0*min(0.0, StrainMag_i-Omega); } - - if (dist_i > 1e-10) { - - if (ScalarVar_i[0] > 0.0) { - - /*--- Production term ---*/ - - dist_i_2 = dist_i*dist_i; - nu = Laminar_Viscosity_i/Density_i; - Ji = ScalarVar_i[0]/nu; - Ji_2 = Ji*Ji; - Ji_3 = Ji_2*Ji; - fv1 = Ji_3/(Ji_3+cv1_3); - fv2 = 1.0 - Ji/(1.0+Ji*fv1); - ft2 = ct3*exp(-ct4*Ji_2); - S = Omega; - inv_k2_d2 = 1.0/(k2*dist_i_2); - - Shat = S + ScalarVar_i[0]*fv2*inv_k2_d2; - Shat = max(Shat, 1.0e-10); - inv_Shat = 1.0/Shat; - - /*--- Production term ---*/; - - // Original SA model - // Production = cb1*(1.0-ft2)*Shat*ScalarVar_i[0]*Volume; - - Production = cb1*Shat*ScalarVar_i[0]*Volume; - - /*--- Destruction term ---*/ - - r = min(ScalarVar_i[0]*inv_Shat*inv_k2_d2,10.0); - g = r + cw2*(pow(r,6.0)-r); - g_6 = pow(g,6.0); - glim = pow((1.0+cw3_6)/(g_6+cw3_6),1.0/6.0); - fw = g*glim; - - Destruction = cw1*fw*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; - - /*--- Diffusion term ---*/ - - norm2_Grad = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - norm2_Grad += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; - - CrossProduction = cb2_sigma*norm2_Grad*Volume; - - Residual = Production - Destruction + CrossProduction; - - /*--- Implicit part, production term ---*/ - - dfv1 = 3.0*Ji_2*cv1_3/(nu*pow(Ji_3+cv1_3,2.)); - dfv2 = -(1/nu-Ji_2*dfv1)/pow(1.+Ji*fv1,2.); - if ( Shat <= 1.0e-10 ) dShat = 0.0; - else dShat = (fv2+ScalarVar_i[0]*dfv2)*inv_k2_d2; - Jacobian_i[0] += cb1*(ScalarVar_i[0]*dShat+Shat)*Volume; - - /*--- Implicit part, destruction term ---*/ - - dr = (Shat-ScalarVar_i[0]*dShat)*inv_Shat*inv_Shat*inv_k2_d2; - if (r == 10.0) dr = 0.0; - dg = dr*(1.+cw2*(6.0*pow(r,5.0)-1.0)); - dfw = dg*glim*(1.-g_6/(g_6+cw3_6)); - Jacobian_i[0] -= cw1*(dfw*ScalarVar_i[0] + 2.0*fw)*ScalarVar_i[0]/dist_i_2*Volume; - - } - - else { - - /*--- Production term ---*/ - - dist_i_2 = dist_i*dist_i; - - /*--- Production term ---*/; - - Production = cb1*(1.0-ct3)*Omega*ScalarVar_i[0]*Volume; - - /*--- Destruction term ---*/ - - Destruction = cw1*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; - - /*--- Diffusion term ---*/ - - norm2_Grad = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - norm2_Grad += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; - - CrossProduction = cb2_sigma*norm2_Grad*Volume; - - Residual = Production + Destruction + CrossProduction; - - /*--- Implicit part, production term ---*/ - - Jacobian_i[0] += cb1*(1.0-ct3)*Omega*Volume; - - /*--- Implicit part, destruction term ---*/ - - Jacobian_i[0] += 2.0*cw1*ScalarVar_i[0]/dist_i_2*Volume; - - } - - } - -// AD::SetPreaccOut(Residual); -// AD::EndPreacc(); - - return ResidualType<>(&Residual, &Jacobian_i, nullptr); - -} - CSourcePieceWise_TurbSST::CSourcePieceWise_TurbSST(unsigned short val_nDim, unsigned short val_nVar, const su2double *constants, From 779e20146cfbe2ed59a1e3b9ede473708765e456 Mon Sep 17 00:00:00 2001 From: Guillermo Suarez Date: Wed, 27 Oct 2021 11:41:33 +0200 Subject: [PATCH 02/34] Test cases for SA variation/corrections Create a test cases directory for turbulence modeling. The selected geometry if the RAE2822 airfoil. Created the config files for the SA turb. mod. variations: - baseline - negative - Edwards - Compressibility - Edwards and Compressibility - ft2 - QCR --- TestCases/parallel_regression.py | 88 +++++ TestCases/serial_regression.py | 88 +++++ .../sa/rae2822/turb_SA_BSL_RAE2822.cfg | 1 + .../sa/rae2822/turb_SA_COMP_RAE2822.cfg | 347 +++++++++++++++++ .../sa/rae2822/turb_SA_EDW_COMP_RAE2822.cfg | 347 +++++++++++++++++ .../sa/rae2822/turb_SA_EDW_RAE2822.cfg | 347 +++++++++++++++++ .../sa/rae2822/turb_SA_FT2_RAE2822.cfg | 347 +++++++++++++++++ .../sa/rae2822/turb_SA_NEG_RAE2822.cfg | 347 +++++++++++++++++ .../sa/rae2822/turb_SA_QCR_RAE2822.cfg | 350 ++++++++++++++++++ 9 files changed, 2262 insertions(+) create mode 120000 TestCases/turbulence_models/sa/rae2822/turb_SA_BSL_RAE2822.cfg create mode 100644 TestCases/turbulence_models/sa/rae2822/turb_SA_COMP_RAE2822.cfg create mode 100644 TestCases/turbulence_models/sa/rae2822/turb_SA_EDW_COMP_RAE2822.cfg create mode 100644 TestCases/turbulence_models/sa/rae2822/turb_SA_EDW_RAE2822.cfg create mode 100644 TestCases/turbulence_models/sa/rae2822/turb_SA_FT2_RAE2822.cfg create mode 100644 TestCases/turbulence_models/sa/rae2822/turb_SA_NEG_RAE2822.cfg create mode 100644 TestCases/turbulence_models/sa/rae2822/turb_SA_QCR_RAE2822.cfg diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 9cbc00da54b5..bb3dd6ad1fef 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -620,6 +620,94 @@ def main(): fem_ns_unsteady_cylinder_ader.tol = 0.00001 test_list.append(fem_ns_unsteady_cylinder_ader) + ########################### + ### Turbulence modeling ### + ########################### + + # SA Baseline (Identical to RANS SA RAE2822) + turbmod_sa_bsl_rae2822 = TestCase('turbmod_sa_bsl_rae2822') + turbmod_sa_bsl_rae2822.cfg_dir = "turbulence_models/sa/rae2822" + turbmod_sa_bsl_rae2822.cfg_file = "turb_SA_BSL_RAE2822.cfg" + turbmod_sa_bsl_rae2822.test_iter = rae2822_sa.test_iter + turbmod_sa_bsl_rae2822.test_vals = rae2822_sa.test_vals + turbmod_sa_bsl_rae2822.su2_exec = "parallel_computation.py -f" + turbmod_sa_bsl_rae2822.timeout = rae2822_sa.timeout + turbmod_sa_bsl_rae2822.new_output = True + turbmod_sa_bsl_rae2822.tol = rae2822_sa.tol + test_list.append(turbmod_sa_bsl_rae2822) + + # SA Negative + turbmod_sa_neg_rae2822 = TestCase('turbmod_sa_neg_rae2822') + turbmod_sa_neg_rae2822.cfg_dir = "turbulence_models/sa/rae2822" + turbmod_sa_neg_rae2822.cfg_file = "turb_SA_NEG_RAE2822.cfg" + turbmod_sa_neg_rae2822.test_iter = 20 + turbmod_sa_neg_rae2822.test_vals = [-2.020123, -5.269330, 0.807147, 0.060499] + turbmod_sa_neg_rae2822.su2_exec = "parallel_computation.py -f" + turbmod_sa_neg_rae2822.timeout = 1600 + turbmod_sa_neg_rae2822.new_output = True + turbmod_sa_neg_rae2822.tol = 0.00001 + test_list.append(turbmod_sa_neg_rae2822) + + # SA Compressibility Correction + turbmod_sa_comp_rae2822 = TestCase('turbmod_sa_comp_rae2822') + turbmod_sa_comp_rae2822.cfg_dir = "turbulence_models/sa/rae2822" + turbmod_sa_comp_rae2822.cfg_file = "turb_SA_COMP_RAE2822.cfg" + turbmod_sa_comp_rae2822.test_iter = 20 + turbmod_sa_comp_rae2822.test_vals = [-2.020123, -5.269330, 0.807147, 0.060499] + turbmod_sa_comp_rae2822.su2_exec = "parallel_computation.py -f" + turbmod_sa_comp_rae2822.timeout = 1600 + turbmod_sa_comp_rae2822.new_output = True + turbmod_sa_comp_rae2822.tol = 0.00001 + test_list.append(turbmod_sa_comp_rae2822) + + # SA Edwards + turbmod_sa_edw_rae2822 = TestCase('turbmod_sa_edw_rae2822') + turbmod_sa_edw_rae2822.cfg_dir = "turbulence_models/sa/rae2822" + turbmod_sa_edw_rae2822.cfg_file = "turb_SA_EDW_RAE2822.cfg" + turbmod_sa_edw_rae2822.test_iter = 20 + turbmod_sa_edw_rae2822.test_vals = [-2.020123, -5.269330, 0.807147, 0.060499] + turbmod_sa_edw_rae2822.su2_exec = "parallel_computation.py -f" + turbmod_sa_edw_rae2822.timeout = 1600 + turbmod_sa_edw_rae2822.new_output = True + turbmod_sa_edw_rae2822.tol = 0.00001 + test_list.append(turbmod_sa_edw_rae2822) + + # SA Compressibility and Edwards + turbmod_sa_comp_edw_rae2822 = TestCase('turbmod_sa_comp_edw_rae2822') + turbmod_sa_comp_edw_rae2822.cfg_dir = "turbulence_models/sa/rae2822" + turbmod_sa_comp_edw_rae2822.cfg_file = "turb_SA_COMP_EDW_RAE2822.cfg" + turbmod_sa_comp_edw_rae2822.test_iter = 20 + turbmod_sa_comp_edw_rae2822.test_vals = [-2.020123, -5.269330, 0.807147, 0.060499] + turbmod_sa_comp_edw_rae2822.su2_exec = "parallel_computation.py -f" + turbmod_sa_comp_edw_rae2822.timeout = 1600 + turbmod_sa_comp_edw_rae2822.new_output = True + turbmod_sa_comp_edw_rae2822.tol = 0.00001 + test_list.append(turbmod_sa_comp_edw_rae2822) + + # SA ft2 + turbmod_sa_ft2_rae2822 = TestCase('turbmod_sa_ft2_rae2822') + turbmod_sa_ft2_rae2822.cfg_dir = "turbulence_models/sa/rae2822" + turbmod_sa_ft2_rae2822.cfg_file = "turb_SA_FT2_RAE2822.cfg" + turbmod_sa_ft2_rae2822.test_iter = 20 + turbmod_sa_ft2_rae2822.test_vals = [-2.020123, -5.269330, 0.807147, 0.060499] + turbmod_sa_ft2_rae2822.su2_exec = "parallel_computation.py -f" + turbmod_sa_ft2_rae2822.timeout = 1600 + turbmod_sa_ft2_rae2822.new_output = True + turbmod_sa_ft2_rae2822.tol = 0.00001 + test_list.append(turbmod_sa_ft2_rae2822) + + # SA QCR + turbmod_sa_qcr_rae2822 = TestCase('turbmod_sa_qcr_rae2822') + turbmod_sa_qcr_rae2822.cfg_dir = "turbulence_models/sa/rae2822" + turbmod_sa_qcr_rae2822.cfg_file = "turb_SA_QCR_RAE2822.cfg" + turbmod_sa_qcr_rae2822.test_iter = 20 + turbmod_sa_qcr_rae2822.test_vals = [-2.020123, -5.269330, 0.807147, 0.060499] + turbmod_sa_qcr_rae2822.su2_exec = "parallel_computation.py -f" + turbmod_sa_qcr_rae2822.timeout = 1600 + turbmod_sa_qcr_rae2822.new_output = True + turbmod_sa_qcr_rae2822.tol = 0.00001 + test_list.append(turbmod_sa_qcr_rae2822) + ############################ ### Transition ### ############################ diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index cc68e417ca4d..348601fd077a 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -659,6 +659,94 @@ def main(): fem_ns_unsteady_cylinder_ader.tol = 0.00001 test_list.append(fem_ns_unsteady_cylinder_ader) + ########################### + ### Turbulence modeling ### + ########################### + + # SA Baseline (Identical to RANS SA RAE2822) + turbmod_sa_bsl_rae2822 = TestCase('turbmod_sa_bsl_rae2822') + turbmod_sa_bsl_rae2822.cfg_dir = "turbulence_models/sa/rae2822" + turbmod_sa_bsl_rae2822.cfg_file = "turb_SA_BSL_RAE2822.cfg" + turbmod_sa_bsl_rae2822.test_iter = rae2822_sa.test_iter + turbmod_sa_bsl_rae2822.test_vals = rae2822_sa.test_vals + turbmod_sa_bsl_rae2822.su2_exec = "SU2_CFD" + turbmod_sa_bsl_rae2822.timeout = rae2822_sa.timeout + turbmod_sa_bsl_rae2822.new_output = True + turbmod_sa_bsl_rae2822.tol = rae2822_sa.tol + test_list.append(turbmod_sa_bsl_rae2822) + + # SA Negative + turbmod_sa_neg_rae2822 = TestCase('turbmod_sa_neg_rae2822') + turbmod_sa_neg_rae2822.cfg_dir = "turbulence_models/sa/rae2822" + turbmod_sa_neg_rae2822.cfg_file = "turb_SA_NEG_RAE2822.cfg" + turbmod_sa_neg_rae2822.test_iter = 20 + turbmod_sa_neg_rae2822.test_vals = [-2.020123, -5.269330, 0.807147, 0.060499] + turbmod_sa_neg_rae2822.su2_exec = "SU2_CFD" + turbmod_sa_neg_rae2822.timeout = 1600 + turbmod_sa_neg_rae2822.new_output = True + turbmod_sa_neg_rae2822.tol = 0.00001 + test_list.append(turbmod_sa_neg_rae2822) + + # SA Compressibility Correction + turbmod_sa_comp_rae2822 = TestCase('turbmod_sa_comp_rae2822') + turbmod_sa_comp_rae2822.cfg_dir = "turbulence_models/sa/rae2822" + turbmod_sa_comp_rae2822.cfg_file = "turb_SA_COMP_RAE2822.cfg" + turbmod_sa_comp_rae2822.test_iter = 20 + turbmod_sa_comp_rae2822.test_vals = [-2.020123, -5.269330, 0.807147, 0.060499] + turbmod_sa_comp_rae2822.su2_exec = "SU2_CFD" + turbmod_sa_comp_rae2822.timeout = 1600 + turbmod_sa_comp_rae2822.new_output = True + turbmod_sa_comp_rae2822.tol = 0.00001 + test_list.append(turbmod_sa_comp_rae2822) + + # SA Edwards + turbmod_sa_edw_rae2822 = TestCase('turbmod_sa_edw_rae2822') + turbmod_sa_edw_rae2822.cfg_dir = "turbulence_models/sa/rae2822" + turbmod_sa_edw_rae2822.cfg_file = "turb_SA_EDW_RAE2822.cfg" + turbmod_sa_edw_rae2822.test_iter = 20 + turbmod_sa_edw_rae2822.test_vals = [-2.020123, -5.269330, 0.807147, 0.060499] + turbmod_sa_edw_rae2822.su2_exec = "SU2_CFD" + turbmod_sa_edw_rae2822.timeout = 1600 + turbmod_sa_edw_rae2822.new_output = True + turbmod_sa_edw_rae2822.tol = 0.00001 + test_list.append(turbmod_sa_edw_rae2822) + + # SA Compressibility and Edwards + turbmod_sa_comp_edw_rae2822 = TestCase('turbmod_sa_comp_edw_rae2822') + turbmod_sa_comp_edw_rae2822.cfg_dir = "turbulence_models/sa/rae2822" + turbmod_sa_comp_edw_rae2822.cfg_file = "turb_SA_COMP_EDW_RAE2822.cfg" + turbmod_sa_comp_edw_rae2822.test_iter = 20 + turbmod_sa_comp_edw_rae2822.test_vals = [-2.020123, -5.269330, 0.807147, 0.060499] + turbmod_sa_comp_edw_rae2822.su2_exec = "SU2_CFD" + turbmod_sa_comp_edw_rae2822.timeout = 1600 + turbmod_sa_comp_edw_rae2822.new_output = True + turbmod_sa_comp_edw_rae2822.tol = 0.00001 + test_list.append(turbmod_sa_comp_edw_rae2822) + + # SA ft2 + turbmod_sa_ft2_rae2822 = TestCase('turbmod_sa_ft2_rae2822') + turbmod_sa_ft2_rae2822.cfg_dir = "turbulence_models/sa/rae2822" + turbmod_sa_ft2_rae2822.cfg_file = "turb_SA_FT2_RAE2822.cfg" + turbmod_sa_ft2_rae2822.test_iter = 20 + turbmod_sa_ft2_rae2822.test_vals = [-2.020123, -5.269330, 0.807147, 0.060499] + turbmod_sa_ft2_rae2822.su2_exec = "SU2_CFD" + turbmod_sa_ft2_rae2822.timeout = 1600 + turbmod_sa_ft2_rae2822.new_output = True + turbmod_sa_ft2_rae2822.tol = 0.00001 + test_list.append(turbmod_sa_ft2_rae2822) + + # SA QCR + turbmod_sa_qcr_rae2822 = TestCase('turbmod_sa_qcr_rae2822') + turbmod_sa_qcr_rae2822.cfg_dir = "turbulence_models/sa/rae2822" + turbmod_sa_qcr_rae2822.cfg_file = "turb_SA_QCR_RAE2822.cfg" + turbmod_sa_qcr_rae2822.test_iter = 20 + turbmod_sa_qcr_rae2822.test_vals = [-2.020123, -5.269330, 0.807147, 0.060499] + turbmod_sa_qcr_rae2822.su2_exec = "SU2_CFD" + turbmod_sa_qcr_rae2822.timeout = 1600 + turbmod_sa_qcr_rae2822.new_output = True + turbmod_sa_qcr_rae2822.tol = 0.00001 + test_list.append(turbmod_sa_qcr_rae2822) + ######################### ### Transition ### ######################### diff --git a/TestCases/turbulence_models/sa/rae2822/turb_SA_BSL_RAE2822.cfg b/TestCases/turbulence_models/sa/rae2822/turb_SA_BSL_RAE2822.cfg new file mode 120000 index 000000000000..e7f22ff4e9ec --- /dev/null +++ b/TestCases/turbulence_models/sa/rae2822/turb_SA_BSL_RAE2822.cfg @@ -0,0 +1 @@ +../../../rans/rae2822/turb_SA_RAE2822.cfg \ No newline at end of file diff --git a/TestCases/turbulence_models/sa/rae2822/turb_SA_COMP_RAE2822.cfg b/TestCases/turbulence_models/sa/rae2822/turb_SA_COMP_RAE2822.cfg new file mode 100644 index 000000000000..1d4d2814c488 --- /dev/null +++ b/TestCases/turbulence_models/sa/rae2822/turb_SA_COMP_RAE2822.cfg @@ -0,0 +1,347 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Transonic simulation RAE2822 (RANS) % +% Author: Francisco Palacios % +% Institution: Stanford University % +% Date: 5/15/2013 % +% File Version 7.2.0 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +% Physical governing equations (EULER, NAVIER_STOKES, +% WAVE_EQUATION, HEAT_EQUATION, FEM_ELASTICITY, +% POISSON_EQUATION) +SOLVER= RANS +% +% Specify turbulent model (NONE, SA, SA_NEG, SST) +KIND_TURB_MODEL= SA_COMP +% +% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT) +MATH_PROBLEM= DIRECT +% +% Restart solution (NO, YES) +RESTART_SOL= NO +% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% +% +% Mach number (non-dimensional, based on the free-stream values) +MACH_NUMBER= 0.729 +% +% Angle of attack (degrees, only for compressible flows) +AOA= 2.31 +% +% Free-stream temperature (288.15 K by default) +FREESTREAM_TEMPERATURE= 288.15 +% +% Reynolds number (non-dimensional, based on the free-stream values) +REYNOLDS_NUMBER= 6.5E6 +% +% Reynolds length (1 m by default) +REYNOLDS_LENGTH= 1.0 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% +% Reference origin for moment computation +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +% +% Reference length for pitching, rolling, and yawing non-dimensional moment +REF_LENGTH= 1.0 +% +% Reference area for force coefficients (0 implies automatic calculation) +REF_AREA= 1.0 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +% Navier-Stokes wall boundary marker(s) (NONE = no marker) +MARKER_HEATFLUX= ( AIRFOIL, 0.0 ) +% +% Farfield boundary marker(s) (NONE = no marker) +MARKER_FAR= ( FARFIELD ) +% +% Marker(s) of the surface to be plotted or designed +MARKER_PLOTTING= ( AIRFOIL ) +% +% Marker(s) of the surface where the functional (Cd, Cl, etc.) will be evaluated +MARKER_MONITORING= ( AIRFOIL ) + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) +NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES +% +% Courant-Friedrichs-Lewy condition of the finest grid +CFL_NUMBER= 2.5 +% +% Adaptive CFL number (NO, YES) +CFL_ADAPT= NO +% +% Parameters of the adaptive CFL number (factor down, factor up, CFL min value, +% CFL max value ) +CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) +% +% Number of total iterations +ITER= 99999 +% +% Linear solver for the implicit formulation (BCGSTAB, FGMRES) +LINEAR_SOLVER= BCGSTAB +% +% Min error of the linear solver for the implicit formulation +LINEAR_SOLVER_ERROR= 1E-6 +% +% Max number of iterations of the linear solver for the implicit formulation +LINEAR_SOLVER_ITER= 20 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% +% +% Multi-Grid Levels (0 = no multi-grid) +MGLEVEL= 3 +% +% Multi-grid cycle (V_CYCLE, W_CYCLE, FULLMG_CYCLE) +MGCYCLE= W_CYCLE +% +% Multi-grid pre-smoothing level +MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) +% +% Multi-grid post-smoothing level +MG_POST_SMOOTH= ( 0, 0, 0, 0 ) +% +% Jacobi implicit smoothing of the correction +MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) +% +% Damping factor for the residual restriction +MG_DAMP_RESTRICTION= 0.95 +% +% Damping factor for the correction prolongation +MG_DAMP_PROLONGATION= 0.95 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, HLLC, +% TURKEL_PREC, MSW) +CONV_NUM_METHOD_FLOW= JST +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_FLOW= YES +% +% Slope limiter (VENKATAKRISHNAN, MINMOD) +SLOPE_LIMITER_FLOW= VENKATAKRISHNAN +% +% Coefficient for the limiter (smooth regions) +VENKAT_LIMITER_COEFF= 0.03 +% +% 2nd and 4th order artificial dissipation coefficients +JST_SENSOR_COEFF= ( 0.5, 0.02 ) +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +% Convective numerical method (SCALAR_UPWIND) +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_TURB= NO +% +% Time discretization (EULER_IMPLICIT) +TIME_DISCRE_TURB= EULER_IMPLICIT + +% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------% +% Adjoint problem boundary condition (DRAG, LIFT, SIDEFORCE, MOMENT_X, +% MOMENT_Y, MOMENT_Z, EFFICIENCY, +% EQUIVALENT_AREA, NEARFIELD_PRESSURE, +% FORCE_X, FORCE_Y, FORCE_Z, THRUST, +% TORQUE, FREE_SURFACE, TOTAL_HEAT, +% MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, +% INVERSE_DESIGN_HEATFLUX) +OBJECTIVE_FUNCTION= DRAG +% +% Convective numerical method (JST, LAX-FRIEDRICH, ROE) +CONV_NUM_METHOD_ADJFLOW= JST +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the adjoint flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_ADJFLOW= YES +% +% Slope limiter (NONE, VENKATAKRISHNAN, BARTH_JESPERSEN, VAN_ALBADA_EDGE, +% SHARP_EDGES, WALL_DISTANCE) +SLOPE_LIMITER_ADJFLOW= NONE +% +% Coefficient for the sharp edges limiter +ADJ_SHARP_LIMITER_COEFF= 3.0 +% +% 2nd, and 4th order artificial dissipation coefficients +ADJ_JST_SENSOR_COEFF= ( 0.0, 0.01 ) +% +% Reduction factor of the CFL coefficient in the adjoint problem +CFL_REDUCTION_ADJFLOW= 0.75 +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT) +TIME_DISCRE_ADJFLOW= EULER_IMPLICIT +% +% Adjoint frozen viscosity (NO, YES) +FROZEN_VISC_CONT= YES + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +% Min value of the residual (log10 of the residual) +CONV_RESIDUAL_MINVAL= -8 +% +% Start convergence criteria at iteration number +CONV_STARTITER= 10 +% +% Number of elements to apply the criteria +CONV_CAUCHY_ELEMS= 100 +% +% Epsilon to control the series convergence +CONV_CAUCHY_EPS= 1E-6 +% + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +% Mesh input file +MESH_FILENAME= mesh_RAE2822_turb.su2 +% +% Mesh input file format (SU2, CGNS, NETCDF_ASCII) +MESH_FORMAT= SU2 +% +% Mesh output file +MESH_OUT_FILENAME= mesh_out.su2 +% +% Restart flow input file +SOLUTION_FILENAME= solution_flow.dat +% +% Restart adjoint input file +SOLUTION_ADJ_FILENAME= solution_adj.dat +% +% Output file format (PARAVIEW, TECPLOT, STL) +TABULAR_FORMAT= CSV +% +% Output file convergence history (w/o extension) +CONV_FILENAME= history +% +% Output file restart flow +RESTART_FILENAME= restart_flow.dat +% +% Output file restart adjoint +RESTART_ADJ_FILENAME= restart_adj.dat +% +% Output file flow (w/o extension) variables +VOLUME_FILENAME= flow +% +% Output file adjoint (w/o extension) variables +VOLUME_ADJ_FILENAME= adjoint +% +% Output objective function gradient (using continuous adjoint) +GRAD_OBJFUNC_FILENAME= of_grad.dat +% +% Output file surface flow coefficient (w/o extension) +SURFACE_FILENAME= surface_flow +% +% Output file surface adjoint coefficient (w/o extension) +SURFACE_ADJ_FILENAME= surface_adjoint +% +% Writing solution file frequency +OUTPUT_WRT_FREQ= 250 +% +% +% Screen output fields +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_NU_TILDE, LIFT, DRAG) + +% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% +% +% Kind of deformation (FFD_SETTING, HICKS_HENNE, PARABOLIC, NACA_4DIGITS, +% DISPLACEMENT, ROTATION, FFD_CONTROL_POINT, +% FFD_DIHEDRAL_ANGLE, FFD_TWIST_ANGLE, +% FFD_ROTATION, FFD_CAMBER, FFD_THICKNESS, FFD_VOLUME +% SURFACE_FILE) +DV_KIND= FFD_SETTING +% +% Marker of the surface to which we are going apply the shape deformation +DV_MARKER= ( AIRFOIL ) +% +% Parameters of the shape deformation +% - HICKS_HENNE ( Lower Surface (0)/Upper Surface (1)/Only one Surface (2), x_Loc ) +% - NACA_4DIGITS ( 1st digit, 2nd digit, 3rd and 4th digit ) +% - PARABOLIC ( Center, Thickness ) +% - DISPLACEMENT ( x_Disp, y_Disp, z_Disp ) +% - ROTATION ( x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - OBSTACLE ( Center, Bump size ) +% - FFD_CONTROL_POINT ( FFD_BoxTag ID, i_Ind, j_Ind, k_Ind, x_Disp, y_Disp, z_Disp ) +% - FFD_DIHEDRAL_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - FFD_TWIST_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - FFD_ROTATION ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - FFD_CAMBER ( FFD_BoxTag ID, i_Ind, j_Ind ) +% - FFD_THICKNESS ( FFD_BoxTag ID, i_Ind, j_Ind ) +% - FFD_VOLUME ( FFD_BoxTag ID, i_Ind, j_Ind ) +DV_PARAM= ( 1, 0.5 ) +% +% New value of the shape deformation +DV_VALUE= 0.01 +% +% Hold the grid fixed in a region (NO, YES) +HOLD_GRID_FIXED= NO +% +% Coordinates of the box where the grid will be deformed (Xmin, Ymin, Zmin, +% Xmax, Ymax, Zmax) +HOLD_GRID_FIXED_COORD= ( -0.5, -0.49, 0.0, 2.5, 0.49, 0.0 ) + +% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------% +% +% Available flow based objective functions or constraint functions +% DRAG, LIFT, SIDEFORCE, EFFICIENCY, BUFFET, +% FORCE_X, FORCE_Y, FORCE_Z, +% MOMENT_X, MOMENT_Y, MOMENT_Z, +% THRUST, TORQUE, FIGURE_OF_MERIT, +% EQUIVALENT_AREA, NEARFIELD_PRESSURE, +% TOTAL_HEATFLUX, MAXIMUM_HEATFLUX, +% INVERSE_DESIGN_PRESSURE, INVERSE_DESIGN_HEATFLUX, +% SURFACE_TOTAL_PRESSURE, SURFACE_MASSFLOW +% SURFACE_STATIC_PRESSURE, SURFACE_MACH +% +% Available geometrical based objective functions or constraint functions +% AIRFOIL_AREA, AIRFOIL_THICKNESS, AIRFOIL_CHORD, AIRFOIL_TOC, AIRFOIL_AOA, +% WING_VOLUME, WING_MIN_THICKNESS, WING_MAX_THICKNESS, WING_MAX_CHORD, WING_MIN_TOC, WING_MAX_TWIST, WING_MAX_CURVATURE, WING_MAX_DIHEDRAL +% STATION#_WIDTH, STATION#_AREA, STATION#_THICKNESS, STATION#_CHORD, STATION#_TOC, +% STATION#_TWIST (where # is the index of the station defined in GEO_LOCATION_STATIONS) +% +% Available design variables +% 2D Design variables +% FFD_CONTROL_POINT_2D ( 19, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, x_Mov, y_Mov ) +% FFD_CAMBER_2D ( 20, Scale | Mark. List | FFD_BoxTag, i_Ind ) +% FFD_THICKNESS_2D ( 21, Scale | Mark. List | FFD_BoxTag, i_Ind ) +% FFD_TWIST_2D ( 22, Scale | Mark. List | FFD_BoxTag, x_Orig, y_Orig ) +% HICKS_HENNE ( 30, Scale | Mark. List | Lower(0)/Upper(1) side, x_Loc ) +% ANGLE_OF_ATTACK ( 101, Scale | Mark. List | 1.0 ) +% +% 3D Design variables +% FFD_CONTROL_POINT ( 11, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, k_Ind, x_Mov, y_Mov, z_Mov ) +% FFD_NACELLE ( 12, Scale | Mark. List | FFD_BoxTag, rho_Ind, theta_Ind, phi_Ind, rho_Mov, phi_Mov ) +% FFD_GULL ( 13, Scale | Mark. List | FFD_BoxTag, j_Ind ) +% FFD_CAMBER ( 14, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) +% FFD_TWIST ( 15, Scale | Mark. List | FFD_BoxTag, j_Ind, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% FFD_THICKNESS ( 16, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) +% FFD_ROTATION ( 18, Scale | Mark. List | FFD_BoxTag, x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) +% FFD_ANGLE_OF_ATTACK ( 24, Scale | Mark. List | FFD_BoxTag, 1.0 ) +% +% Global design variables +% TRANSLATION ( 1, Scale | Mark. List | x_Disp, y_Disp, z_Disp ) +% ROTATION ( 2, Scale | Mark. List | x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) + +% Optimization objective function with optional scaling factor +% ex= Objective * Scale +OPT_OBJECTIVE= DRAG * 0.001 + +% Optimization constraint functions with scaling factors, separated by semicolons +% ex= (Objective = Value ) * Scale, use '>','<','=' +OPT_CONSTRAINT= NONE + +% List of design variables (Design variables are separated by semicolons) +DEFINITION_DV= ( 30, 1.0 | AIRFOIL | 0, 0.05 ); ( 30, 1.0 | AIRFOIL | 0, 0.10 ); ( 30, 1.0 | AIRFOIL | 0, 0.15 ); ( 30, 1.0 | AIRFOIL | 0, 0.20 ); ( 30, 1.0 | AIRFOIL | 0, 0.25 ); ( 30, 1.0 | AIRFOIL | 0, 0.30 ); ( 30, 1.0 | AIRFOIL | 0, 0.35 ); ( 30, 1.0 | AIRFOIL | 0, 0.40 ); ( 30, 1.0 | AIRFOIL | 0, 0.45 ); ( 30, 1.0 | AIRFOIL | 0, 0.50 ); ( 30, 1.0 | AIRFOIL | 0, 0.55 ); ( 30, 1.0 | AIRFOIL | 0, 0.60 ); ( 30, 1.0 | AIRFOIL | 0, 0.65 ); ( 30, 1.0 | AIRFOIL | 0, 0.70 ); ( 30, 1.0 | AIRFOIL | 0, 0.75 ); ( 30, 1.0 | AIRFOIL | 0, 0.80 ); ( 30, 1.0 | AIRFOIL | 0, 0.85 ); ( 30, 1.0 | AIRFOIL | 0, 0.90 ); ( 30, 1.0 | AIRFOIL | 0, 0.95 ); ( 30, 1.0 | AIRFOIL | 1, 0.05 ); ( 30, 1.0 | AIRFOIL | 1, 0.10 ); ( 30, 1.0 | AIRFOIL | 1, 0.15 ); ( 30, 1.0 | AIRFOIL | 1, 0.20 ); ( 30, 1.0 | AIRFOIL | 1, 0.25 ); ( 30, 1.0 | AIRFOIL | 1, 0.30 ); ( 30, 1.0 | AIRFOIL | 1, 0.35 ); ( 30, 1.0 | AIRFOIL | 1, 0.40 ); ( 30, 1.0 | AIRFOIL | 1, 0.45 ); ( 30, 1.0 | AIRFOIL | 1, 0.50 ); ( 30, 1.0 | AIRFOIL | 1, 0.55 ); ( 30, 1.0 | AIRFOIL | 1, 0.60 ); ( 30, 1.0 | AIRFOIL | 1, 0.65 ); ( 30, 1.0 | AIRFOIL | 1, 0.70 ); ( 30, 1.0 | AIRFOIL | 1, 0.75 ); ( 30, 1.0 | AIRFOIL | 1, 0.80 ); ( 30, 1.0 | AIRFOIL | 1, 0.85 ); ( 30, 1.0 | AIRFOIL | 1, 0.90 ); ( 30, 1.0 | AIRFOIL | 1, 0.95 ) + diff --git a/TestCases/turbulence_models/sa/rae2822/turb_SA_EDW_COMP_RAE2822.cfg b/TestCases/turbulence_models/sa/rae2822/turb_SA_EDW_COMP_RAE2822.cfg new file mode 100644 index 000000000000..973b8aa40eff --- /dev/null +++ b/TestCases/turbulence_models/sa/rae2822/turb_SA_EDW_COMP_RAE2822.cfg @@ -0,0 +1,347 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Transonic simulation RAE2822 (RANS) % +% Author: Francisco Palacios % +% Institution: Stanford University % +% Date: 5/15/2013 % +% File Version 7.2.0 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +% Physical governing equations (EULER, NAVIER_STOKES, +% WAVE_EQUATION, HEAT_EQUATION, FEM_ELASTICITY, +% POISSON_EQUATION) +SOLVER= RANS +% +% Specify turbulent model (NONE, SA, SA_NEG, SST) +KIND_TURB_MODEL= SA_E_COMP +% +% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT) +MATH_PROBLEM= DIRECT +% +% Restart solution (NO, YES) +RESTART_SOL= NO +% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% +% +% Mach number (non-dimensional, based on the free-stream values) +MACH_NUMBER= 0.729 +% +% Angle of attack (degrees, only for compressible flows) +AOA= 2.31 +% +% Free-stream temperature (288.15 K by default) +FREESTREAM_TEMPERATURE= 288.15 +% +% Reynolds number (non-dimensional, based on the free-stream values) +REYNOLDS_NUMBER= 6.5E6 +% +% Reynolds length (1 m by default) +REYNOLDS_LENGTH= 1.0 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% +% Reference origin for moment computation +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +% +% Reference length for pitching, rolling, and yawing non-dimensional moment +REF_LENGTH= 1.0 +% +% Reference area for force coefficients (0 implies automatic calculation) +REF_AREA= 1.0 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +% Navier-Stokes wall boundary marker(s) (NONE = no marker) +MARKER_HEATFLUX= ( AIRFOIL, 0.0 ) +% +% Farfield boundary marker(s) (NONE = no marker) +MARKER_FAR= ( FARFIELD ) +% +% Marker(s) of the surface to be plotted or designed +MARKER_PLOTTING= ( AIRFOIL ) +% +% Marker(s) of the surface where the functional (Cd, Cl, etc.) will be evaluated +MARKER_MONITORING= ( AIRFOIL ) + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) +NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES +% +% Courant-Friedrichs-Lewy condition of the finest grid +CFL_NUMBER= 2.5 +% +% Adaptive CFL number (NO, YES) +CFL_ADAPT= NO +% +% Parameters of the adaptive CFL number (factor down, factor up, CFL min value, +% CFL max value ) +CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) +% +% Number of total iterations +ITER= 99999 +% +% Linear solver for the implicit formulation (BCGSTAB, FGMRES) +LINEAR_SOLVER= BCGSTAB +% +% Min error of the linear solver for the implicit formulation +LINEAR_SOLVER_ERROR= 1E-6 +% +% Max number of iterations of the linear solver for the implicit formulation +LINEAR_SOLVER_ITER= 20 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% +% +% Multi-Grid Levels (0 = no multi-grid) +MGLEVEL= 3 +% +% Multi-grid cycle (V_CYCLE, W_CYCLE, FULLMG_CYCLE) +MGCYCLE= W_CYCLE +% +% Multi-grid pre-smoothing level +MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) +% +% Multi-grid post-smoothing level +MG_POST_SMOOTH= ( 0, 0, 0, 0 ) +% +% Jacobi implicit smoothing of the correction +MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) +% +% Damping factor for the residual restriction +MG_DAMP_RESTRICTION= 0.95 +% +% Damping factor for the correction prolongation +MG_DAMP_PROLONGATION= 0.95 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, HLLC, +% TURKEL_PREC, MSW) +CONV_NUM_METHOD_FLOW= JST +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_FLOW= YES +% +% Slope limiter (VENKATAKRISHNAN, MINMOD) +SLOPE_LIMITER_FLOW= VENKATAKRISHNAN +% +% Coefficient for the limiter (smooth regions) +VENKAT_LIMITER_COEFF= 0.03 +% +% 2nd and 4th order artificial dissipation coefficients +JST_SENSOR_COEFF= ( 0.5, 0.02 ) +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +% Convective numerical method (SCALAR_UPWIND) +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_TURB= NO +% +% Time discretization (EULER_IMPLICIT) +TIME_DISCRE_TURB= EULER_IMPLICIT + +% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------% +% Adjoint problem boundary condition (DRAG, LIFT, SIDEFORCE, MOMENT_X, +% MOMENT_Y, MOMENT_Z, EFFICIENCY, +% EQUIVALENT_AREA, NEARFIELD_PRESSURE, +% FORCE_X, FORCE_Y, FORCE_Z, THRUST, +% TORQUE, FREE_SURFACE, TOTAL_HEAT, +% MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, +% INVERSE_DESIGN_HEATFLUX) +OBJECTIVE_FUNCTION= DRAG +% +% Convective numerical method (JST, LAX-FRIEDRICH, ROE) +CONV_NUM_METHOD_ADJFLOW= JST +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the adjoint flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_ADJFLOW= YES +% +% Slope limiter (NONE, VENKATAKRISHNAN, BARTH_JESPERSEN, VAN_ALBADA_EDGE, +% SHARP_EDGES, WALL_DISTANCE) +SLOPE_LIMITER_ADJFLOW= NONE +% +% Coefficient for the sharp edges limiter +ADJ_SHARP_LIMITER_COEFF= 3.0 +% +% 2nd, and 4th order artificial dissipation coefficients +ADJ_JST_SENSOR_COEFF= ( 0.0, 0.01 ) +% +% Reduction factor of the CFL coefficient in the adjoint problem +CFL_REDUCTION_ADJFLOW= 0.75 +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT) +TIME_DISCRE_ADJFLOW= EULER_IMPLICIT +% +% Adjoint frozen viscosity (NO, YES) +FROZEN_VISC_CONT= YES + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +% Min value of the residual (log10 of the residual) +CONV_RESIDUAL_MINVAL= -8 +% +% Start convergence criteria at iteration number +CONV_STARTITER= 10 +% +% Number of elements to apply the criteria +CONV_CAUCHY_ELEMS= 100 +% +% Epsilon to control the series convergence +CONV_CAUCHY_EPS= 1E-6 +% + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +% Mesh input file +MESH_FILENAME= mesh_RAE2822_turb.su2 +% +% Mesh input file format (SU2, CGNS, NETCDF_ASCII) +MESH_FORMAT= SU2 +% +% Mesh output file +MESH_OUT_FILENAME= mesh_out.su2 +% +% Restart flow input file +SOLUTION_FILENAME= solution_flow.dat +% +% Restart adjoint input file +SOLUTION_ADJ_FILENAME= solution_adj.dat +% +% Output file format (PARAVIEW, TECPLOT, STL) +TABULAR_FORMAT= CSV +% +% Output file convergence history (w/o extension) +CONV_FILENAME= history +% +% Output file restart flow +RESTART_FILENAME= restart_flow.dat +% +% Output file restart adjoint +RESTART_ADJ_FILENAME= restart_adj.dat +% +% Output file flow (w/o extension) variables +VOLUME_FILENAME= flow +% +% Output file adjoint (w/o extension) variables +VOLUME_ADJ_FILENAME= adjoint +% +% Output objective function gradient (using continuous adjoint) +GRAD_OBJFUNC_FILENAME= of_grad.dat +% +% Output file surface flow coefficient (w/o extension) +SURFACE_FILENAME= surface_flow +% +% Output file surface adjoint coefficient (w/o extension) +SURFACE_ADJ_FILENAME= surface_adjoint +% +% Writing solution file frequency +OUTPUT_WRT_FREQ= 250 +% +% +% Screen output fields +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_NU_TILDE, LIFT, DRAG) + +% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% +% +% Kind of deformation (FFD_SETTING, HICKS_HENNE, PARABOLIC, NACA_4DIGITS, +% DISPLACEMENT, ROTATION, FFD_CONTROL_POINT, +% FFD_DIHEDRAL_ANGLE, FFD_TWIST_ANGLE, +% FFD_ROTATION, FFD_CAMBER, FFD_THICKNESS, FFD_VOLUME +% SURFACE_FILE) +DV_KIND= FFD_SETTING +% +% Marker of the surface to which we are going apply the shape deformation +DV_MARKER= ( AIRFOIL ) +% +% Parameters of the shape deformation +% - HICKS_HENNE ( Lower Surface (0)/Upper Surface (1)/Only one Surface (2), x_Loc ) +% - NACA_4DIGITS ( 1st digit, 2nd digit, 3rd and 4th digit ) +% - PARABOLIC ( Center, Thickness ) +% - DISPLACEMENT ( x_Disp, y_Disp, z_Disp ) +% - ROTATION ( x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - OBSTACLE ( Center, Bump size ) +% - FFD_CONTROL_POINT ( FFD_BoxTag ID, i_Ind, j_Ind, k_Ind, x_Disp, y_Disp, z_Disp ) +% - FFD_DIHEDRAL_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - FFD_TWIST_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - FFD_ROTATION ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - FFD_CAMBER ( FFD_BoxTag ID, i_Ind, j_Ind ) +% - FFD_THICKNESS ( FFD_BoxTag ID, i_Ind, j_Ind ) +% - FFD_VOLUME ( FFD_BoxTag ID, i_Ind, j_Ind ) +DV_PARAM= ( 1, 0.5 ) +% +% New value of the shape deformation +DV_VALUE= 0.01 +% +% Hold the grid fixed in a region (NO, YES) +HOLD_GRID_FIXED= NO +% +% Coordinates of the box where the grid will be deformed (Xmin, Ymin, Zmin, +% Xmax, Ymax, Zmax) +HOLD_GRID_FIXED_COORD= ( -0.5, -0.49, 0.0, 2.5, 0.49, 0.0 ) + +% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------% +% +% Available flow based objective functions or constraint functions +% DRAG, LIFT, SIDEFORCE, EFFICIENCY, BUFFET, +% FORCE_X, FORCE_Y, FORCE_Z, +% MOMENT_X, MOMENT_Y, MOMENT_Z, +% THRUST, TORQUE, FIGURE_OF_MERIT, +% EQUIVALENT_AREA, NEARFIELD_PRESSURE, +% TOTAL_HEATFLUX, MAXIMUM_HEATFLUX, +% INVERSE_DESIGN_PRESSURE, INVERSE_DESIGN_HEATFLUX, +% SURFACE_TOTAL_PRESSURE, SURFACE_MASSFLOW +% SURFACE_STATIC_PRESSURE, SURFACE_MACH +% +% Available geometrical based objective functions or constraint functions +% AIRFOIL_AREA, AIRFOIL_THICKNESS, AIRFOIL_CHORD, AIRFOIL_TOC, AIRFOIL_AOA, +% WING_VOLUME, WING_MIN_THICKNESS, WING_MAX_THICKNESS, WING_MAX_CHORD, WING_MIN_TOC, WING_MAX_TWIST, WING_MAX_CURVATURE, WING_MAX_DIHEDRAL +% STATION#_WIDTH, STATION#_AREA, STATION#_THICKNESS, STATION#_CHORD, STATION#_TOC, +% STATION#_TWIST (where # is the index of the station defined in GEO_LOCATION_STATIONS) +% +% Available design variables +% 2D Design variables +% FFD_CONTROL_POINT_2D ( 19, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, x_Mov, y_Mov ) +% FFD_CAMBER_2D ( 20, Scale | Mark. List | FFD_BoxTag, i_Ind ) +% FFD_THICKNESS_2D ( 21, Scale | Mark. List | FFD_BoxTag, i_Ind ) +% FFD_TWIST_2D ( 22, Scale | Mark. List | FFD_BoxTag, x_Orig, y_Orig ) +% HICKS_HENNE ( 30, Scale | Mark. List | Lower(0)/Upper(1) side, x_Loc ) +% ANGLE_OF_ATTACK ( 101, Scale | Mark. List | 1.0 ) +% +% 3D Design variables +% FFD_CONTROL_POINT ( 11, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, k_Ind, x_Mov, y_Mov, z_Mov ) +% FFD_NACELLE ( 12, Scale | Mark. List | FFD_BoxTag, rho_Ind, theta_Ind, phi_Ind, rho_Mov, phi_Mov ) +% FFD_GULL ( 13, Scale | Mark. List | FFD_BoxTag, j_Ind ) +% FFD_CAMBER ( 14, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) +% FFD_TWIST ( 15, Scale | Mark. List | FFD_BoxTag, j_Ind, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% FFD_THICKNESS ( 16, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) +% FFD_ROTATION ( 18, Scale | Mark. List | FFD_BoxTag, x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) +% FFD_ANGLE_OF_ATTACK ( 24, Scale | Mark. List | FFD_BoxTag, 1.0 ) +% +% Global design variables +% TRANSLATION ( 1, Scale | Mark. List | x_Disp, y_Disp, z_Disp ) +% ROTATION ( 2, Scale | Mark. List | x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) + +% Optimization objective function with optional scaling factor +% ex= Objective * Scale +OPT_OBJECTIVE= DRAG * 0.001 + +% Optimization constraint functions with scaling factors, separated by semicolons +% ex= (Objective = Value ) * Scale, use '>','<','=' +OPT_CONSTRAINT= NONE + +% List of design variables (Design variables are separated by semicolons) +DEFINITION_DV= ( 30, 1.0 | AIRFOIL | 0, 0.05 ); ( 30, 1.0 | AIRFOIL | 0, 0.10 ); ( 30, 1.0 | AIRFOIL | 0, 0.15 ); ( 30, 1.0 | AIRFOIL | 0, 0.20 ); ( 30, 1.0 | AIRFOIL | 0, 0.25 ); ( 30, 1.0 | AIRFOIL | 0, 0.30 ); ( 30, 1.0 | AIRFOIL | 0, 0.35 ); ( 30, 1.0 | AIRFOIL | 0, 0.40 ); ( 30, 1.0 | AIRFOIL | 0, 0.45 ); ( 30, 1.0 | AIRFOIL | 0, 0.50 ); ( 30, 1.0 | AIRFOIL | 0, 0.55 ); ( 30, 1.0 | AIRFOIL | 0, 0.60 ); ( 30, 1.0 | AIRFOIL | 0, 0.65 ); ( 30, 1.0 | AIRFOIL | 0, 0.70 ); ( 30, 1.0 | AIRFOIL | 0, 0.75 ); ( 30, 1.0 | AIRFOIL | 0, 0.80 ); ( 30, 1.0 | AIRFOIL | 0, 0.85 ); ( 30, 1.0 | AIRFOIL | 0, 0.90 ); ( 30, 1.0 | AIRFOIL | 0, 0.95 ); ( 30, 1.0 | AIRFOIL | 1, 0.05 ); ( 30, 1.0 | AIRFOIL | 1, 0.10 ); ( 30, 1.0 | AIRFOIL | 1, 0.15 ); ( 30, 1.0 | AIRFOIL | 1, 0.20 ); ( 30, 1.0 | AIRFOIL | 1, 0.25 ); ( 30, 1.0 | AIRFOIL | 1, 0.30 ); ( 30, 1.0 | AIRFOIL | 1, 0.35 ); ( 30, 1.0 | AIRFOIL | 1, 0.40 ); ( 30, 1.0 | AIRFOIL | 1, 0.45 ); ( 30, 1.0 | AIRFOIL | 1, 0.50 ); ( 30, 1.0 | AIRFOIL | 1, 0.55 ); ( 30, 1.0 | AIRFOIL | 1, 0.60 ); ( 30, 1.0 | AIRFOIL | 1, 0.65 ); ( 30, 1.0 | AIRFOIL | 1, 0.70 ); ( 30, 1.0 | AIRFOIL | 1, 0.75 ); ( 30, 1.0 | AIRFOIL | 1, 0.80 ); ( 30, 1.0 | AIRFOIL | 1, 0.85 ); ( 30, 1.0 | AIRFOIL | 1, 0.90 ); ( 30, 1.0 | AIRFOIL | 1, 0.95 ) + diff --git a/TestCases/turbulence_models/sa/rae2822/turb_SA_EDW_RAE2822.cfg b/TestCases/turbulence_models/sa/rae2822/turb_SA_EDW_RAE2822.cfg new file mode 100644 index 000000000000..4ecfdf035fc4 --- /dev/null +++ b/TestCases/turbulence_models/sa/rae2822/turb_SA_EDW_RAE2822.cfg @@ -0,0 +1,347 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Transonic simulation RAE2822 (RANS) % +% Author: Francisco Palacios % +% Institution: Stanford University % +% Date: 5/15/2013 % +% File Version 7.2.0 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +% Physical governing equations (EULER, NAVIER_STOKES, +% WAVE_EQUATION, HEAT_EQUATION, FEM_ELASTICITY, +% POISSON_EQUATION) +SOLVER= RANS +% +% Specify turbulent model (NONE, SA, SA_NEG, SST) +KIND_TURB_MODEL= SA_E +% +% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT) +MATH_PROBLEM= DIRECT +% +% Restart solution (NO, YES) +RESTART_SOL= NO +% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% +% +% Mach number (non-dimensional, based on the free-stream values) +MACH_NUMBER= 0.729 +% +% Angle of attack (degrees, only for compressible flows) +AOA= 2.31 +% +% Free-stream temperature (288.15 K by default) +FREESTREAM_TEMPERATURE= 288.15 +% +% Reynolds number (non-dimensional, based on the free-stream values) +REYNOLDS_NUMBER= 6.5E6 +% +% Reynolds length (1 m by default) +REYNOLDS_LENGTH= 1.0 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% +% Reference origin for moment computation +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +% +% Reference length for pitching, rolling, and yawing non-dimensional moment +REF_LENGTH= 1.0 +% +% Reference area for force coefficients (0 implies automatic calculation) +REF_AREA= 1.0 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +% Navier-Stokes wall boundary marker(s) (NONE = no marker) +MARKER_HEATFLUX= ( AIRFOIL, 0.0 ) +% +% Farfield boundary marker(s) (NONE = no marker) +MARKER_FAR= ( FARFIELD ) +% +% Marker(s) of the surface to be plotted or designed +MARKER_PLOTTING= ( AIRFOIL ) +% +% Marker(s) of the surface where the functional (Cd, Cl, etc.) will be evaluated +MARKER_MONITORING= ( AIRFOIL ) + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) +NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES +% +% Courant-Friedrichs-Lewy condition of the finest grid +CFL_NUMBER= 2.5 +% +% Adaptive CFL number (NO, YES) +CFL_ADAPT= NO +% +% Parameters of the adaptive CFL number (factor down, factor up, CFL min value, +% CFL max value ) +CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) +% +% Number of total iterations +ITER= 99999 +% +% Linear solver for the implicit formulation (BCGSTAB, FGMRES) +LINEAR_SOLVER= BCGSTAB +% +% Min error of the linear solver for the implicit formulation +LINEAR_SOLVER_ERROR= 1E-6 +% +% Max number of iterations of the linear solver for the implicit formulation +LINEAR_SOLVER_ITER= 20 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% +% +% Multi-Grid Levels (0 = no multi-grid) +MGLEVEL= 3 +% +% Multi-grid cycle (V_CYCLE, W_CYCLE, FULLMG_CYCLE) +MGCYCLE= W_CYCLE +% +% Multi-grid pre-smoothing level +MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) +% +% Multi-grid post-smoothing level +MG_POST_SMOOTH= ( 0, 0, 0, 0 ) +% +% Jacobi implicit smoothing of the correction +MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) +% +% Damping factor for the residual restriction +MG_DAMP_RESTRICTION= 0.95 +% +% Damping factor for the correction prolongation +MG_DAMP_PROLONGATION= 0.95 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, HLLC, +% TURKEL_PREC, MSW) +CONV_NUM_METHOD_FLOW= JST +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_FLOW= YES +% +% Slope limiter (VENKATAKRISHNAN, MINMOD) +SLOPE_LIMITER_FLOW= VENKATAKRISHNAN +% +% Coefficient for the limiter (smooth regions) +VENKAT_LIMITER_COEFF= 0.03 +% +% 2nd and 4th order artificial dissipation coefficients +JST_SENSOR_COEFF= ( 0.5, 0.02 ) +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +% Convective numerical method (SCALAR_UPWIND) +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_TURB= NO +% +% Time discretization (EULER_IMPLICIT) +TIME_DISCRE_TURB= EULER_IMPLICIT + +% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------% +% Adjoint problem boundary condition (DRAG, LIFT, SIDEFORCE, MOMENT_X, +% MOMENT_Y, MOMENT_Z, EFFICIENCY, +% EQUIVALENT_AREA, NEARFIELD_PRESSURE, +% FORCE_X, FORCE_Y, FORCE_Z, THRUST, +% TORQUE, FREE_SURFACE, TOTAL_HEAT, +% MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, +% INVERSE_DESIGN_HEATFLUX) +OBJECTIVE_FUNCTION= DRAG +% +% Convective numerical method (JST, LAX-FRIEDRICH, ROE) +CONV_NUM_METHOD_ADJFLOW= JST +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the adjoint flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_ADJFLOW= YES +% +% Slope limiter (NONE, VENKATAKRISHNAN, BARTH_JESPERSEN, VAN_ALBADA_EDGE, +% SHARP_EDGES, WALL_DISTANCE) +SLOPE_LIMITER_ADJFLOW= NONE +% +% Coefficient for the sharp edges limiter +ADJ_SHARP_LIMITER_COEFF= 3.0 +% +% 2nd, and 4th order artificial dissipation coefficients +ADJ_JST_SENSOR_COEFF= ( 0.0, 0.01 ) +% +% Reduction factor of the CFL coefficient in the adjoint problem +CFL_REDUCTION_ADJFLOW= 0.75 +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT) +TIME_DISCRE_ADJFLOW= EULER_IMPLICIT +% +% Adjoint frozen viscosity (NO, YES) +FROZEN_VISC_CONT= YES + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +% Min value of the residual (log10 of the residual) +CONV_RESIDUAL_MINVAL= -8 +% +% Start convergence criteria at iteration number +CONV_STARTITER= 10 +% +% Number of elements to apply the criteria +CONV_CAUCHY_ELEMS= 100 +% +% Epsilon to control the series convergence +CONV_CAUCHY_EPS= 1E-6 +% + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +% Mesh input file +MESH_FILENAME= mesh_RAE2822_turb.su2 +% +% Mesh input file format (SU2, CGNS, NETCDF_ASCII) +MESH_FORMAT= SU2 +% +% Mesh output file +MESH_OUT_FILENAME= mesh_out.su2 +% +% Restart flow input file +SOLUTION_FILENAME= solution_flow.dat +% +% Restart adjoint input file +SOLUTION_ADJ_FILENAME= solution_adj.dat +% +% Output file format (PARAVIEW, TECPLOT, STL) +TABULAR_FORMAT= CSV +% +% Output file convergence history (w/o extension) +CONV_FILENAME= history +% +% Output file restart flow +RESTART_FILENAME= restart_flow.dat +% +% Output file restart adjoint +RESTART_ADJ_FILENAME= restart_adj.dat +% +% Output file flow (w/o extension) variables +VOLUME_FILENAME= flow +% +% Output file adjoint (w/o extension) variables +VOLUME_ADJ_FILENAME= adjoint +% +% Output objective function gradient (using continuous adjoint) +GRAD_OBJFUNC_FILENAME= of_grad.dat +% +% Output file surface flow coefficient (w/o extension) +SURFACE_FILENAME= surface_flow +% +% Output file surface adjoint coefficient (w/o extension) +SURFACE_ADJ_FILENAME= surface_adjoint +% +% Writing solution file frequency +OUTPUT_WRT_FREQ= 250 +% +% +% Screen output fields +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_NU_TILDE, LIFT, DRAG) + +% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% +% +% Kind of deformation (FFD_SETTING, HICKS_HENNE, PARABOLIC, NACA_4DIGITS, +% DISPLACEMENT, ROTATION, FFD_CONTROL_POINT, +% FFD_DIHEDRAL_ANGLE, FFD_TWIST_ANGLE, +% FFD_ROTATION, FFD_CAMBER, FFD_THICKNESS, FFD_VOLUME +% SURFACE_FILE) +DV_KIND= FFD_SETTING +% +% Marker of the surface to which we are going apply the shape deformation +DV_MARKER= ( AIRFOIL ) +% +% Parameters of the shape deformation +% - HICKS_HENNE ( Lower Surface (0)/Upper Surface (1)/Only one Surface (2), x_Loc ) +% - NACA_4DIGITS ( 1st digit, 2nd digit, 3rd and 4th digit ) +% - PARABOLIC ( Center, Thickness ) +% - DISPLACEMENT ( x_Disp, y_Disp, z_Disp ) +% - ROTATION ( x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - OBSTACLE ( Center, Bump size ) +% - FFD_CONTROL_POINT ( FFD_BoxTag ID, i_Ind, j_Ind, k_Ind, x_Disp, y_Disp, z_Disp ) +% - FFD_DIHEDRAL_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - FFD_TWIST_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - FFD_ROTATION ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - FFD_CAMBER ( FFD_BoxTag ID, i_Ind, j_Ind ) +% - FFD_THICKNESS ( FFD_BoxTag ID, i_Ind, j_Ind ) +% - FFD_VOLUME ( FFD_BoxTag ID, i_Ind, j_Ind ) +DV_PARAM= ( 1, 0.5 ) +% +% New value of the shape deformation +DV_VALUE= 0.01 +% +% Hold the grid fixed in a region (NO, YES) +HOLD_GRID_FIXED= NO +% +% Coordinates of the box where the grid will be deformed (Xmin, Ymin, Zmin, +% Xmax, Ymax, Zmax) +HOLD_GRID_FIXED_COORD= ( -0.5, -0.49, 0.0, 2.5, 0.49, 0.0 ) + +% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------% +% +% Available flow based objective functions or constraint functions +% DRAG, LIFT, SIDEFORCE, EFFICIENCY, BUFFET, +% FORCE_X, FORCE_Y, FORCE_Z, +% MOMENT_X, MOMENT_Y, MOMENT_Z, +% THRUST, TORQUE, FIGURE_OF_MERIT, +% EQUIVALENT_AREA, NEARFIELD_PRESSURE, +% TOTAL_HEATFLUX, MAXIMUM_HEATFLUX, +% INVERSE_DESIGN_PRESSURE, INVERSE_DESIGN_HEATFLUX, +% SURFACE_TOTAL_PRESSURE, SURFACE_MASSFLOW +% SURFACE_STATIC_PRESSURE, SURFACE_MACH +% +% Available geometrical based objective functions or constraint functions +% AIRFOIL_AREA, AIRFOIL_THICKNESS, AIRFOIL_CHORD, AIRFOIL_TOC, AIRFOIL_AOA, +% WING_VOLUME, WING_MIN_THICKNESS, WING_MAX_THICKNESS, WING_MAX_CHORD, WING_MIN_TOC, WING_MAX_TWIST, WING_MAX_CURVATURE, WING_MAX_DIHEDRAL +% STATION#_WIDTH, STATION#_AREA, STATION#_THICKNESS, STATION#_CHORD, STATION#_TOC, +% STATION#_TWIST (where # is the index of the station defined in GEO_LOCATION_STATIONS) +% +% Available design variables +% 2D Design variables +% FFD_CONTROL_POINT_2D ( 19, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, x_Mov, y_Mov ) +% FFD_CAMBER_2D ( 20, Scale | Mark. List | FFD_BoxTag, i_Ind ) +% FFD_THICKNESS_2D ( 21, Scale | Mark. List | FFD_BoxTag, i_Ind ) +% FFD_TWIST_2D ( 22, Scale | Mark. List | FFD_BoxTag, x_Orig, y_Orig ) +% HICKS_HENNE ( 30, Scale | Mark. List | Lower(0)/Upper(1) side, x_Loc ) +% ANGLE_OF_ATTACK ( 101, Scale | Mark. List | 1.0 ) +% +% 3D Design variables +% FFD_CONTROL_POINT ( 11, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, k_Ind, x_Mov, y_Mov, z_Mov ) +% FFD_NACELLE ( 12, Scale | Mark. List | FFD_BoxTag, rho_Ind, theta_Ind, phi_Ind, rho_Mov, phi_Mov ) +% FFD_GULL ( 13, Scale | Mark. List | FFD_BoxTag, j_Ind ) +% FFD_CAMBER ( 14, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) +% FFD_TWIST ( 15, Scale | Mark. List | FFD_BoxTag, j_Ind, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% FFD_THICKNESS ( 16, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) +% FFD_ROTATION ( 18, Scale | Mark. List | FFD_BoxTag, x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) +% FFD_ANGLE_OF_ATTACK ( 24, Scale | Mark. List | FFD_BoxTag, 1.0 ) +% +% Global design variables +% TRANSLATION ( 1, Scale | Mark. List | x_Disp, y_Disp, z_Disp ) +% ROTATION ( 2, Scale | Mark. List | x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) + +% Optimization objective function with optional scaling factor +% ex= Objective * Scale +OPT_OBJECTIVE= DRAG * 0.001 + +% Optimization constraint functions with scaling factors, separated by semicolons +% ex= (Objective = Value ) * Scale, use '>','<','=' +OPT_CONSTRAINT= NONE + +% List of design variables (Design variables are separated by semicolons) +DEFINITION_DV= ( 30, 1.0 | AIRFOIL | 0, 0.05 ); ( 30, 1.0 | AIRFOIL | 0, 0.10 ); ( 30, 1.0 | AIRFOIL | 0, 0.15 ); ( 30, 1.0 | AIRFOIL | 0, 0.20 ); ( 30, 1.0 | AIRFOIL | 0, 0.25 ); ( 30, 1.0 | AIRFOIL | 0, 0.30 ); ( 30, 1.0 | AIRFOIL | 0, 0.35 ); ( 30, 1.0 | AIRFOIL | 0, 0.40 ); ( 30, 1.0 | AIRFOIL | 0, 0.45 ); ( 30, 1.0 | AIRFOIL | 0, 0.50 ); ( 30, 1.0 | AIRFOIL | 0, 0.55 ); ( 30, 1.0 | AIRFOIL | 0, 0.60 ); ( 30, 1.0 | AIRFOIL | 0, 0.65 ); ( 30, 1.0 | AIRFOIL | 0, 0.70 ); ( 30, 1.0 | AIRFOIL | 0, 0.75 ); ( 30, 1.0 | AIRFOIL | 0, 0.80 ); ( 30, 1.0 | AIRFOIL | 0, 0.85 ); ( 30, 1.0 | AIRFOIL | 0, 0.90 ); ( 30, 1.0 | AIRFOIL | 0, 0.95 ); ( 30, 1.0 | AIRFOIL | 1, 0.05 ); ( 30, 1.0 | AIRFOIL | 1, 0.10 ); ( 30, 1.0 | AIRFOIL | 1, 0.15 ); ( 30, 1.0 | AIRFOIL | 1, 0.20 ); ( 30, 1.0 | AIRFOIL | 1, 0.25 ); ( 30, 1.0 | AIRFOIL | 1, 0.30 ); ( 30, 1.0 | AIRFOIL | 1, 0.35 ); ( 30, 1.0 | AIRFOIL | 1, 0.40 ); ( 30, 1.0 | AIRFOIL | 1, 0.45 ); ( 30, 1.0 | AIRFOIL | 1, 0.50 ); ( 30, 1.0 | AIRFOIL | 1, 0.55 ); ( 30, 1.0 | AIRFOIL | 1, 0.60 ); ( 30, 1.0 | AIRFOIL | 1, 0.65 ); ( 30, 1.0 | AIRFOIL | 1, 0.70 ); ( 30, 1.0 | AIRFOIL | 1, 0.75 ); ( 30, 1.0 | AIRFOIL | 1, 0.80 ); ( 30, 1.0 | AIRFOIL | 1, 0.85 ); ( 30, 1.0 | AIRFOIL | 1, 0.90 ); ( 30, 1.0 | AIRFOIL | 1, 0.95 ) + diff --git a/TestCases/turbulence_models/sa/rae2822/turb_SA_FT2_RAE2822.cfg b/TestCases/turbulence_models/sa/rae2822/turb_SA_FT2_RAE2822.cfg new file mode 100644 index 000000000000..9c931077a97e --- /dev/null +++ b/TestCases/turbulence_models/sa/rae2822/turb_SA_FT2_RAE2822.cfg @@ -0,0 +1,347 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Transonic simulation RAE2822 (RANS) % +% Author: Francisco Palacios % +% Institution: Stanford University % +% Date: 5/15/2013 % +% File Version 7.2.0 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +% Physical governing equations (EULER, NAVIER_STOKES, +% WAVE_EQUATION, HEAT_EQUATION, FEM_ELASTICITY, +% POISSON_EQUATION) +SOLVER= RANS +% +% Specify turbulent model (NONE, SA, SA_NEG, SST) +KIND_TURB_MODEL= SA +% +% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT) +MATH_PROBLEM= DIRECT +% +% Restart solution (NO, YES) +RESTART_SOL= NO +% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% +% +% Mach number (non-dimensional, based on the free-stream values) +MACH_NUMBER= 0.729 +% +% Angle of attack (degrees, only for compressible flows) +AOA= 2.31 +% +% Free-stream temperature (288.15 K by default) +FREESTREAM_TEMPERATURE= 288.15 +% +% Reynolds number (non-dimensional, based on the free-stream values) +REYNOLDS_NUMBER= 6.5E6 +% +% Reynolds length (1 m by default) +REYNOLDS_LENGTH= 1.0 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% +% Reference origin for moment computation +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +% +% Reference length for pitching, rolling, and yawing non-dimensional moment +REF_LENGTH= 1.0 +% +% Reference area for force coefficients (0 implies automatic calculation) +REF_AREA= 1.0 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +% Navier-Stokes wall boundary marker(s) (NONE = no marker) +MARKER_HEATFLUX= ( AIRFOIL, 0.0 ) +% +% Farfield boundary marker(s) (NONE = no marker) +MARKER_FAR= ( FARFIELD ) +% +% Marker(s) of the surface to be plotted or designed +MARKER_PLOTTING= ( AIRFOIL ) +% +% Marker(s) of the surface where the functional (Cd, Cl, etc.) will be evaluated +MARKER_MONITORING= ( AIRFOIL ) + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) +NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES +% +% Courant-Friedrichs-Lewy condition of the finest grid +CFL_NUMBER= 2.5 +% +% Adaptive CFL number (NO, YES) +CFL_ADAPT= NO +% +% Parameters of the adaptive CFL number (factor down, factor up, CFL min value, +% CFL max value ) +CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) +% +% Number of total iterations +ITER= 99999 +% +% Linear solver for the implicit formulation (BCGSTAB, FGMRES) +LINEAR_SOLVER= BCGSTAB +% +% Min error of the linear solver for the implicit formulation +LINEAR_SOLVER_ERROR= 1E-6 +% +% Max number of iterations of the linear solver for the implicit formulation +LINEAR_SOLVER_ITER= 20 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% +% +% Multi-Grid Levels (0 = no multi-grid) +MGLEVEL= 3 +% +% Multi-grid cycle (V_CYCLE, W_CYCLE, FULLMG_CYCLE) +MGCYCLE= W_CYCLE +% +% Multi-grid pre-smoothing level +MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) +% +% Multi-grid post-smoothing level +MG_POST_SMOOTH= ( 0, 0, 0, 0 ) +% +% Jacobi implicit smoothing of the correction +MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) +% +% Damping factor for the residual restriction +MG_DAMP_RESTRICTION= 0.95 +% +% Damping factor for the correction prolongation +MG_DAMP_PROLONGATION= 0.95 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, HLLC, +% TURKEL_PREC, MSW) +CONV_NUM_METHOD_FLOW= JST +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_FLOW= YES +% +% Slope limiter (VENKATAKRISHNAN, MINMOD) +SLOPE_LIMITER_FLOW= VENKATAKRISHNAN +% +% Coefficient for the limiter (smooth regions) +VENKAT_LIMITER_COEFF= 0.03 +% +% 2nd and 4th order artificial dissipation coefficients +JST_SENSOR_COEFF= ( 0.5, 0.02 ) +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +% Convective numerical method (SCALAR_UPWIND) +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_TURB= NO +% +% Time discretization (EULER_IMPLICIT) +TIME_DISCRE_TURB= EULER_IMPLICIT + +% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------% +% Adjoint problem boundary condition (DRAG, LIFT, SIDEFORCE, MOMENT_X, +% MOMENT_Y, MOMENT_Z, EFFICIENCY, +% EQUIVALENT_AREA, NEARFIELD_PRESSURE, +% FORCE_X, FORCE_Y, FORCE_Z, THRUST, +% TORQUE, FREE_SURFACE, TOTAL_HEAT, +% MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, +% INVERSE_DESIGN_HEATFLUX) +OBJECTIVE_FUNCTION= DRAG +% +% Convective numerical method (JST, LAX-FRIEDRICH, ROE) +CONV_NUM_METHOD_ADJFLOW= JST +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the adjoint flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_ADJFLOW= YES +% +% Slope limiter (NONE, VENKATAKRISHNAN, BARTH_JESPERSEN, VAN_ALBADA_EDGE, +% SHARP_EDGES, WALL_DISTANCE) +SLOPE_LIMITER_ADJFLOW= NONE +% +% Coefficient for the sharp edges limiter +ADJ_SHARP_LIMITER_COEFF= 3.0 +% +% 2nd, and 4th order artificial dissipation coefficients +ADJ_JST_SENSOR_COEFF= ( 0.0, 0.01 ) +% +% Reduction factor of the CFL coefficient in the adjoint problem +CFL_REDUCTION_ADJFLOW= 0.75 +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT) +TIME_DISCRE_ADJFLOW= EULER_IMPLICIT +% +% Adjoint frozen viscosity (NO, YES) +FROZEN_VISC_CONT= YES + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +% Min value of the residual (log10 of the residual) +CONV_RESIDUAL_MINVAL= -8 +% +% Start convergence criteria at iteration number +CONV_STARTITER= 10 +% +% Number of elements to apply the criteria +CONV_CAUCHY_ELEMS= 100 +% +% Epsilon to control the series convergence +CONV_CAUCHY_EPS= 1E-6 +% + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +% Mesh input file +MESH_FILENAME= mesh_RAE2822_turb.su2 +% +% Mesh input file format (SU2, CGNS, NETCDF_ASCII) +MESH_FORMAT= SU2 +% +% Mesh output file +MESH_OUT_FILENAME= mesh_out.su2 +% +% Restart flow input file +SOLUTION_FILENAME= solution_flow.dat +% +% Restart adjoint input file +SOLUTION_ADJ_FILENAME= solution_adj.dat +% +% Output file format (PARAVIEW, TECPLOT, STL) +TABULAR_FORMAT= CSV +% +% Output file convergence history (w/o extension) +CONV_FILENAME= history +% +% Output file restart flow +RESTART_FILENAME= restart_flow.dat +% +% Output file restart adjoint +RESTART_ADJ_FILENAME= restart_adj.dat +% +% Output file flow (w/o extension) variables +VOLUME_FILENAME= flow +% +% Output file adjoint (w/o extension) variables +VOLUME_ADJ_FILENAME= adjoint +% +% Output objective function gradient (using continuous adjoint) +GRAD_OBJFUNC_FILENAME= of_grad.dat +% +% Output file surface flow coefficient (w/o extension) +SURFACE_FILENAME= surface_flow +% +% Output file surface adjoint coefficient (w/o extension) +SURFACE_ADJ_FILENAME= surface_adjoint +% +% Writing solution file frequency +OUTPUT_WRT_FREQ= 250 +% +% +% Screen output fields +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_NU_TILDE, LIFT, DRAG) + +% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% +% +% Kind of deformation (FFD_SETTING, HICKS_HENNE, PARABOLIC, NACA_4DIGITS, +% DISPLACEMENT, ROTATION, FFD_CONTROL_POINT, +% FFD_DIHEDRAL_ANGLE, FFD_TWIST_ANGLE, +% FFD_ROTATION, FFD_CAMBER, FFD_THICKNESS, FFD_VOLUME +% SURFACE_FILE) +DV_KIND= FFD_SETTING +% +% Marker of the surface to which we are going apply the shape deformation +DV_MARKER= ( AIRFOIL ) +% +% Parameters of the shape deformation +% - HICKS_HENNE ( Lower Surface (0)/Upper Surface (1)/Only one Surface (2), x_Loc ) +% - NACA_4DIGITS ( 1st digit, 2nd digit, 3rd and 4th digit ) +% - PARABOLIC ( Center, Thickness ) +% - DISPLACEMENT ( x_Disp, y_Disp, z_Disp ) +% - ROTATION ( x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - OBSTACLE ( Center, Bump size ) +% - FFD_CONTROL_POINT ( FFD_BoxTag ID, i_Ind, j_Ind, k_Ind, x_Disp, y_Disp, z_Disp ) +% - FFD_DIHEDRAL_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - FFD_TWIST_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - FFD_ROTATION ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - FFD_CAMBER ( FFD_BoxTag ID, i_Ind, j_Ind ) +% - FFD_THICKNESS ( FFD_BoxTag ID, i_Ind, j_Ind ) +% - FFD_VOLUME ( FFD_BoxTag ID, i_Ind, j_Ind ) +DV_PARAM= ( 1, 0.5 ) +% +% New value of the shape deformation +DV_VALUE= 0.01 +% +% Hold the grid fixed in a region (NO, YES) +HOLD_GRID_FIXED= NO +% +% Coordinates of the box where the grid will be deformed (Xmin, Ymin, Zmin, +% Xmax, Ymax, Zmax) +HOLD_GRID_FIXED_COORD= ( -0.5, -0.49, 0.0, 2.5, 0.49, 0.0 ) + +% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------% +% +% Available flow based objective functions or constraint functions +% DRAG, LIFT, SIDEFORCE, EFFICIENCY, BUFFET, +% FORCE_X, FORCE_Y, FORCE_Z, +% MOMENT_X, MOMENT_Y, MOMENT_Z, +% THRUST, TORQUE, FIGURE_OF_MERIT, +% EQUIVALENT_AREA, NEARFIELD_PRESSURE, +% TOTAL_HEATFLUX, MAXIMUM_HEATFLUX, +% INVERSE_DESIGN_PRESSURE, INVERSE_DESIGN_HEATFLUX, +% SURFACE_TOTAL_PRESSURE, SURFACE_MASSFLOW +% SURFACE_STATIC_PRESSURE, SURFACE_MACH +% +% Available geometrical based objective functions or constraint functions +% AIRFOIL_AREA, AIRFOIL_THICKNESS, AIRFOIL_CHORD, AIRFOIL_TOC, AIRFOIL_AOA, +% WING_VOLUME, WING_MIN_THICKNESS, WING_MAX_THICKNESS, WING_MAX_CHORD, WING_MIN_TOC, WING_MAX_TWIST, WING_MAX_CURVATURE, WING_MAX_DIHEDRAL +% STATION#_WIDTH, STATION#_AREA, STATION#_THICKNESS, STATION#_CHORD, STATION#_TOC, +% STATION#_TWIST (where # is the index of the station defined in GEO_LOCATION_STATIONS) +% +% Available design variables +% 2D Design variables +% FFD_CONTROL_POINT_2D ( 19, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, x_Mov, y_Mov ) +% FFD_CAMBER_2D ( 20, Scale | Mark. List | FFD_BoxTag, i_Ind ) +% FFD_THICKNESS_2D ( 21, Scale | Mark. List | FFD_BoxTag, i_Ind ) +% FFD_TWIST_2D ( 22, Scale | Mark. List | FFD_BoxTag, x_Orig, y_Orig ) +% HICKS_HENNE ( 30, Scale | Mark. List | Lower(0)/Upper(1) side, x_Loc ) +% ANGLE_OF_ATTACK ( 101, Scale | Mark. List | 1.0 ) +% +% 3D Design variables +% FFD_CONTROL_POINT ( 11, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, k_Ind, x_Mov, y_Mov, z_Mov ) +% FFD_NACELLE ( 12, Scale | Mark. List | FFD_BoxTag, rho_Ind, theta_Ind, phi_Ind, rho_Mov, phi_Mov ) +% FFD_GULL ( 13, Scale | Mark. List | FFD_BoxTag, j_Ind ) +% FFD_CAMBER ( 14, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) +% FFD_TWIST ( 15, Scale | Mark. List | FFD_BoxTag, j_Ind, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% FFD_THICKNESS ( 16, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) +% FFD_ROTATION ( 18, Scale | Mark. List | FFD_BoxTag, x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) +% FFD_ANGLE_OF_ATTACK ( 24, Scale | Mark. List | FFD_BoxTag, 1.0 ) +% +% Global design variables +% TRANSLATION ( 1, Scale | Mark. List | x_Disp, y_Disp, z_Disp ) +% ROTATION ( 2, Scale | Mark. List | x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) + +% Optimization objective function with optional scaling factor +% ex= Objective * Scale +OPT_OBJECTIVE= DRAG * 0.001 + +% Optimization constraint functions with scaling factors, separated by semicolons +% ex= (Objective = Value ) * Scale, use '>','<','=' +OPT_CONSTRAINT= NONE + +% List of design variables (Design variables are separated by semicolons) +DEFINITION_DV= ( 30, 1.0 | AIRFOIL | 0, 0.05 ); ( 30, 1.0 | AIRFOIL | 0, 0.10 ); ( 30, 1.0 | AIRFOIL | 0, 0.15 ); ( 30, 1.0 | AIRFOIL | 0, 0.20 ); ( 30, 1.0 | AIRFOIL | 0, 0.25 ); ( 30, 1.0 | AIRFOIL | 0, 0.30 ); ( 30, 1.0 | AIRFOIL | 0, 0.35 ); ( 30, 1.0 | AIRFOIL | 0, 0.40 ); ( 30, 1.0 | AIRFOIL | 0, 0.45 ); ( 30, 1.0 | AIRFOIL | 0, 0.50 ); ( 30, 1.0 | AIRFOIL | 0, 0.55 ); ( 30, 1.0 | AIRFOIL | 0, 0.60 ); ( 30, 1.0 | AIRFOIL | 0, 0.65 ); ( 30, 1.0 | AIRFOIL | 0, 0.70 ); ( 30, 1.0 | AIRFOIL | 0, 0.75 ); ( 30, 1.0 | AIRFOIL | 0, 0.80 ); ( 30, 1.0 | AIRFOIL | 0, 0.85 ); ( 30, 1.0 | AIRFOIL | 0, 0.90 ); ( 30, 1.0 | AIRFOIL | 0, 0.95 ); ( 30, 1.0 | AIRFOIL | 1, 0.05 ); ( 30, 1.0 | AIRFOIL | 1, 0.10 ); ( 30, 1.0 | AIRFOIL | 1, 0.15 ); ( 30, 1.0 | AIRFOIL | 1, 0.20 ); ( 30, 1.0 | AIRFOIL | 1, 0.25 ); ( 30, 1.0 | AIRFOIL | 1, 0.30 ); ( 30, 1.0 | AIRFOIL | 1, 0.35 ); ( 30, 1.0 | AIRFOIL | 1, 0.40 ); ( 30, 1.0 | AIRFOIL | 1, 0.45 ); ( 30, 1.0 | AIRFOIL | 1, 0.50 ); ( 30, 1.0 | AIRFOIL | 1, 0.55 ); ( 30, 1.0 | AIRFOIL | 1, 0.60 ); ( 30, 1.0 | AIRFOIL | 1, 0.65 ); ( 30, 1.0 | AIRFOIL | 1, 0.70 ); ( 30, 1.0 | AIRFOIL | 1, 0.75 ); ( 30, 1.0 | AIRFOIL | 1, 0.80 ); ( 30, 1.0 | AIRFOIL | 1, 0.85 ); ( 30, 1.0 | AIRFOIL | 1, 0.90 ); ( 30, 1.0 | AIRFOIL | 1, 0.95 ) + diff --git a/TestCases/turbulence_models/sa/rae2822/turb_SA_NEG_RAE2822.cfg b/TestCases/turbulence_models/sa/rae2822/turb_SA_NEG_RAE2822.cfg new file mode 100644 index 000000000000..c0be1c6101c6 --- /dev/null +++ b/TestCases/turbulence_models/sa/rae2822/turb_SA_NEG_RAE2822.cfg @@ -0,0 +1,347 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Transonic simulation RAE2822 (RANS) % +% Author: Francisco Palacios % +% Institution: Stanford University % +% Date: 5/15/2013 % +% File Version 7.2.0 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +% Physical governing equations (EULER, NAVIER_STOKES, +% WAVE_EQUATION, HEAT_EQUATION, FEM_ELASTICITY, +% POISSON_EQUATION) +SOLVER= RANS +% +% Specify turbulent model (NONE, SA, SA_NEG, SST) +KIND_TURB_MODEL= SA_NEG +% +% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT) +MATH_PROBLEM= DIRECT +% +% Restart solution (NO, YES) +RESTART_SOL= NO +% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% +% +% Mach number (non-dimensional, based on the free-stream values) +MACH_NUMBER= 0.729 +% +% Angle of attack (degrees, only for compressible flows) +AOA= 2.31 +% +% Free-stream temperature (288.15 K by default) +FREESTREAM_TEMPERATURE= 288.15 +% +% Reynolds number (non-dimensional, based on the free-stream values) +REYNOLDS_NUMBER= 6.5E6 +% +% Reynolds length (1 m by default) +REYNOLDS_LENGTH= 1.0 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% +% Reference origin for moment computation +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +% +% Reference length for pitching, rolling, and yawing non-dimensional moment +REF_LENGTH= 1.0 +% +% Reference area for force coefficients (0 implies automatic calculation) +REF_AREA= 1.0 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +% Navier-Stokes wall boundary marker(s) (NONE = no marker) +MARKER_HEATFLUX= ( AIRFOIL, 0.0 ) +% +% Farfield boundary marker(s) (NONE = no marker) +MARKER_FAR= ( FARFIELD ) +% +% Marker(s) of the surface to be plotted or designed +MARKER_PLOTTING= ( AIRFOIL ) +% +% Marker(s) of the surface where the functional (Cd, Cl, etc.) will be evaluated +MARKER_MONITORING= ( AIRFOIL ) + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) +NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES +% +% Courant-Friedrichs-Lewy condition of the finest grid +CFL_NUMBER= 2.5 +% +% Adaptive CFL number (NO, YES) +CFL_ADAPT= NO +% +% Parameters of the adaptive CFL number (factor down, factor up, CFL min value, +% CFL max value ) +CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) +% +% Number of total iterations +ITER= 99999 +% +% Linear solver for the implicit formulation (BCGSTAB, FGMRES) +LINEAR_SOLVER= BCGSTAB +% +% Min error of the linear solver for the implicit formulation +LINEAR_SOLVER_ERROR= 1E-6 +% +% Max number of iterations of the linear solver for the implicit formulation +LINEAR_SOLVER_ITER= 20 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% +% +% Multi-Grid Levels (0 = no multi-grid) +MGLEVEL= 3 +% +% Multi-grid cycle (V_CYCLE, W_CYCLE, FULLMG_CYCLE) +MGCYCLE= W_CYCLE +% +% Multi-grid pre-smoothing level +MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) +% +% Multi-grid post-smoothing level +MG_POST_SMOOTH= ( 0, 0, 0, 0 ) +% +% Jacobi implicit smoothing of the correction +MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) +% +% Damping factor for the residual restriction +MG_DAMP_RESTRICTION= 0.95 +% +% Damping factor for the correction prolongation +MG_DAMP_PROLONGATION= 0.95 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, HLLC, +% TURKEL_PREC, MSW) +CONV_NUM_METHOD_FLOW= JST +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_FLOW= YES +% +% Slope limiter (VENKATAKRISHNAN, MINMOD) +SLOPE_LIMITER_FLOW= VENKATAKRISHNAN +% +% Coefficient for the limiter (smooth regions) +VENKAT_LIMITER_COEFF= 0.03 +% +% 2nd and 4th order artificial dissipation coefficients +JST_SENSOR_COEFF= ( 0.5, 0.02 ) +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +% Convective numerical method (SCALAR_UPWIND) +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_TURB= NO +% +% Time discretization (EULER_IMPLICIT) +TIME_DISCRE_TURB= EULER_IMPLICIT + +% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------% +% Adjoint problem boundary condition (DRAG, LIFT, SIDEFORCE, MOMENT_X, +% MOMENT_Y, MOMENT_Z, EFFICIENCY, +% EQUIVALENT_AREA, NEARFIELD_PRESSURE, +% FORCE_X, FORCE_Y, FORCE_Z, THRUST, +% TORQUE, FREE_SURFACE, TOTAL_HEAT, +% MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, +% INVERSE_DESIGN_HEATFLUX) +OBJECTIVE_FUNCTION= DRAG +% +% Convective numerical method (JST, LAX-FRIEDRICH, ROE) +CONV_NUM_METHOD_ADJFLOW= JST +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the adjoint flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_ADJFLOW= YES +% +% Slope limiter (NONE, VENKATAKRISHNAN, BARTH_JESPERSEN, VAN_ALBADA_EDGE, +% SHARP_EDGES, WALL_DISTANCE) +SLOPE_LIMITER_ADJFLOW= NONE +% +% Coefficient for the sharp edges limiter +ADJ_SHARP_LIMITER_COEFF= 3.0 +% +% 2nd, and 4th order artificial dissipation coefficients +ADJ_JST_SENSOR_COEFF= ( 0.0, 0.01 ) +% +% Reduction factor of the CFL coefficient in the adjoint problem +CFL_REDUCTION_ADJFLOW= 0.75 +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT) +TIME_DISCRE_ADJFLOW= EULER_IMPLICIT +% +% Adjoint frozen viscosity (NO, YES) +FROZEN_VISC_CONT= YES + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +% Min value of the residual (log10 of the residual) +CONV_RESIDUAL_MINVAL= -8 +% +% Start convergence criteria at iteration number +CONV_STARTITER= 10 +% +% Number of elements to apply the criteria +CONV_CAUCHY_ELEMS= 100 +% +% Epsilon to control the series convergence +CONV_CAUCHY_EPS= 1E-6 +% + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +% Mesh input file +MESH_FILENAME= mesh_RAE2822_turb.su2 +% +% Mesh input file format (SU2, CGNS, NETCDF_ASCII) +MESH_FORMAT= SU2 +% +% Mesh output file +MESH_OUT_FILENAME= mesh_out.su2 +% +% Restart flow input file +SOLUTION_FILENAME= solution_flow.dat +% +% Restart adjoint input file +SOLUTION_ADJ_FILENAME= solution_adj.dat +% +% Output file format (PARAVIEW, TECPLOT, STL) +TABULAR_FORMAT= CSV +% +% Output file convergence history (w/o extension) +CONV_FILENAME= history +% +% Output file restart flow +RESTART_FILENAME= restart_flow.dat +% +% Output file restart adjoint +RESTART_ADJ_FILENAME= restart_adj.dat +% +% Output file flow (w/o extension) variables +VOLUME_FILENAME= flow +% +% Output file adjoint (w/o extension) variables +VOLUME_ADJ_FILENAME= adjoint +% +% Output objective function gradient (using continuous adjoint) +GRAD_OBJFUNC_FILENAME= of_grad.dat +% +% Output file surface flow coefficient (w/o extension) +SURFACE_FILENAME= surface_flow +% +% Output file surface adjoint coefficient (w/o extension) +SURFACE_ADJ_FILENAME= surface_adjoint +% +% Writing solution file frequency +OUTPUT_WRT_FREQ= 250 +% +% +% Screen output fields +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_NU_TILDE, LIFT, DRAG) + +% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% +% +% Kind of deformation (FFD_SETTING, HICKS_HENNE, PARABOLIC, NACA_4DIGITS, +% DISPLACEMENT, ROTATION, FFD_CONTROL_POINT, +% FFD_DIHEDRAL_ANGLE, FFD_TWIST_ANGLE, +% FFD_ROTATION, FFD_CAMBER, FFD_THICKNESS, FFD_VOLUME +% SURFACE_FILE) +DV_KIND= FFD_SETTING +% +% Marker of the surface to which we are going apply the shape deformation +DV_MARKER= ( AIRFOIL ) +% +% Parameters of the shape deformation +% - HICKS_HENNE ( Lower Surface (0)/Upper Surface (1)/Only one Surface (2), x_Loc ) +% - NACA_4DIGITS ( 1st digit, 2nd digit, 3rd and 4th digit ) +% - PARABOLIC ( Center, Thickness ) +% - DISPLACEMENT ( x_Disp, y_Disp, z_Disp ) +% - ROTATION ( x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - OBSTACLE ( Center, Bump size ) +% - FFD_CONTROL_POINT ( FFD_BoxTag ID, i_Ind, j_Ind, k_Ind, x_Disp, y_Disp, z_Disp ) +% - FFD_DIHEDRAL_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - FFD_TWIST_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - FFD_ROTATION ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - FFD_CAMBER ( FFD_BoxTag ID, i_Ind, j_Ind ) +% - FFD_THICKNESS ( FFD_BoxTag ID, i_Ind, j_Ind ) +% - FFD_VOLUME ( FFD_BoxTag ID, i_Ind, j_Ind ) +DV_PARAM= ( 1, 0.5 ) +% +% New value of the shape deformation +DV_VALUE= 0.01 +% +% Hold the grid fixed in a region (NO, YES) +HOLD_GRID_FIXED= NO +% +% Coordinates of the box where the grid will be deformed (Xmin, Ymin, Zmin, +% Xmax, Ymax, Zmax) +HOLD_GRID_FIXED_COORD= ( -0.5, -0.49, 0.0, 2.5, 0.49, 0.0 ) + +% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------% +% +% Available flow based objective functions or constraint functions +% DRAG, LIFT, SIDEFORCE, EFFICIENCY, BUFFET, +% FORCE_X, FORCE_Y, FORCE_Z, +% MOMENT_X, MOMENT_Y, MOMENT_Z, +% THRUST, TORQUE, FIGURE_OF_MERIT, +% EQUIVALENT_AREA, NEARFIELD_PRESSURE, +% TOTAL_HEATFLUX, MAXIMUM_HEATFLUX, +% INVERSE_DESIGN_PRESSURE, INVERSE_DESIGN_HEATFLUX, +% SURFACE_TOTAL_PRESSURE, SURFACE_MASSFLOW +% SURFACE_STATIC_PRESSURE, SURFACE_MACH +% +% Available geometrical based objective functions or constraint functions +% AIRFOIL_AREA, AIRFOIL_THICKNESS, AIRFOIL_CHORD, AIRFOIL_TOC, AIRFOIL_AOA, +% WING_VOLUME, WING_MIN_THICKNESS, WING_MAX_THICKNESS, WING_MAX_CHORD, WING_MIN_TOC, WING_MAX_TWIST, WING_MAX_CURVATURE, WING_MAX_DIHEDRAL +% STATION#_WIDTH, STATION#_AREA, STATION#_THICKNESS, STATION#_CHORD, STATION#_TOC, +% STATION#_TWIST (where # is the index of the station defined in GEO_LOCATION_STATIONS) +% +% Available design variables +% 2D Design variables +% FFD_CONTROL_POINT_2D ( 19, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, x_Mov, y_Mov ) +% FFD_CAMBER_2D ( 20, Scale | Mark. List | FFD_BoxTag, i_Ind ) +% FFD_THICKNESS_2D ( 21, Scale | Mark. List | FFD_BoxTag, i_Ind ) +% FFD_TWIST_2D ( 22, Scale | Mark. List | FFD_BoxTag, x_Orig, y_Orig ) +% HICKS_HENNE ( 30, Scale | Mark. List | Lower(0)/Upper(1) side, x_Loc ) +% ANGLE_OF_ATTACK ( 101, Scale | Mark. List | 1.0 ) +% +% 3D Design variables +% FFD_CONTROL_POINT ( 11, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, k_Ind, x_Mov, y_Mov, z_Mov ) +% FFD_NACELLE ( 12, Scale | Mark. List | FFD_BoxTag, rho_Ind, theta_Ind, phi_Ind, rho_Mov, phi_Mov ) +% FFD_GULL ( 13, Scale | Mark. List | FFD_BoxTag, j_Ind ) +% FFD_CAMBER ( 14, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) +% FFD_TWIST ( 15, Scale | Mark. List | FFD_BoxTag, j_Ind, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% FFD_THICKNESS ( 16, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) +% FFD_ROTATION ( 18, Scale | Mark. List | FFD_BoxTag, x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) +% FFD_ANGLE_OF_ATTACK ( 24, Scale | Mark. List | FFD_BoxTag, 1.0 ) +% +% Global design variables +% TRANSLATION ( 1, Scale | Mark. List | x_Disp, y_Disp, z_Disp ) +% ROTATION ( 2, Scale | Mark. List | x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) + +% Optimization objective function with optional scaling factor +% ex= Objective * Scale +OPT_OBJECTIVE= DRAG * 0.001 + +% Optimization constraint functions with scaling factors, separated by semicolons +% ex= (Objective = Value ) * Scale, use '>','<','=' +OPT_CONSTRAINT= NONE + +% List of design variables (Design variables are separated by semicolons) +DEFINITION_DV= ( 30, 1.0 | AIRFOIL | 0, 0.05 ); ( 30, 1.0 | AIRFOIL | 0, 0.10 ); ( 30, 1.0 | AIRFOIL | 0, 0.15 ); ( 30, 1.0 | AIRFOIL | 0, 0.20 ); ( 30, 1.0 | AIRFOIL | 0, 0.25 ); ( 30, 1.0 | AIRFOIL | 0, 0.30 ); ( 30, 1.0 | AIRFOIL | 0, 0.35 ); ( 30, 1.0 | AIRFOIL | 0, 0.40 ); ( 30, 1.0 | AIRFOIL | 0, 0.45 ); ( 30, 1.0 | AIRFOIL | 0, 0.50 ); ( 30, 1.0 | AIRFOIL | 0, 0.55 ); ( 30, 1.0 | AIRFOIL | 0, 0.60 ); ( 30, 1.0 | AIRFOIL | 0, 0.65 ); ( 30, 1.0 | AIRFOIL | 0, 0.70 ); ( 30, 1.0 | AIRFOIL | 0, 0.75 ); ( 30, 1.0 | AIRFOIL | 0, 0.80 ); ( 30, 1.0 | AIRFOIL | 0, 0.85 ); ( 30, 1.0 | AIRFOIL | 0, 0.90 ); ( 30, 1.0 | AIRFOIL | 0, 0.95 ); ( 30, 1.0 | AIRFOIL | 1, 0.05 ); ( 30, 1.0 | AIRFOIL | 1, 0.10 ); ( 30, 1.0 | AIRFOIL | 1, 0.15 ); ( 30, 1.0 | AIRFOIL | 1, 0.20 ); ( 30, 1.0 | AIRFOIL | 1, 0.25 ); ( 30, 1.0 | AIRFOIL | 1, 0.30 ); ( 30, 1.0 | AIRFOIL | 1, 0.35 ); ( 30, 1.0 | AIRFOIL | 1, 0.40 ); ( 30, 1.0 | AIRFOIL | 1, 0.45 ); ( 30, 1.0 | AIRFOIL | 1, 0.50 ); ( 30, 1.0 | AIRFOIL | 1, 0.55 ); ( 30, 1.0 | AIRFOIL | 1, 0.60 ); ( 30, 1.0 | AIRFOIL | 1, 0.65 ); ( 30, 1.0 | AIRFOIL | 1, 0.70 ); ( 30, 1.0 | AIRFOIL | 1, 0.75 ); ( 30, 1.0 | AIRFOIL | 1, 0.80 ); ( 30, 1.0 | AIRFOIL | 1, 0.85 ); ( 30, 1.0 | AIRFOIL | 1, 0.90 ); ( 30, 1.0 | AIRFOIL | 1, 0.95 ) + diff --git a/TestCases/turbulence_models/sa/rae2822/turb_SA_QCR_RAE2822.cfg b/TestCases/turbulence_models/sa/rae2822/turb_SA_QCR_RAE2822.cfg new file mode 100644 index 000000000000..40e0dd6e7d82 --- /dev/null +++ b/TestCases/turbulence_models/sa/rae2822/turb_SA_QCR_RAE2822.cfg @@ -0,0 +1,350 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Transonic simulation RAE2822 (RANS) % +% Author: Francisco Palacios % +% Institution: Stanford University % +% Date: 5/15/2013 % +% File Version 7.2.0 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +% Physical governing equations (EULER, NAVIER_STOKES, +% WAVE_EQUATION, HEAT_EQUATION, FEM_ELASTICITY, +% POISSON_EQUATION) +SOLVER= RANS +% +% Specify turbulent model (NONE, SA, SA_NEG, SST) +KIND_TURB_MODEL= SA +% +% Activate SA Quadratic Constitutive Relation, 2000 version +SA_QCR= YES +% +% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT) +MATH_PROBLEM= DIRECT +% +% Restart solution (NO, YES) +RESTART_SOL= NO +% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% +% +% Mach number (non-dimensional, based on the free-stream values) +MACH_NUMBER= 0.729 +% +% Angle of attack (degrees, only for compressible flows) +AOA= 2.31 +% +% Free-stream temperature (288.15 K by default) +FREESTREAM_TEMPERATURE= 288.15 +% +% Reynolds number (non-dimensional, based on the free-stream values) +REYNOLDS_NUMBER= 6.5E6 +% +% Reynolds length (1 m by default) +REYNOLDS_LENGTH= 1.0 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% +% Reference origin for moment computation +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +% +% Reference length for pitching, rolling, and yawing non-dimensional moment +REF_LENGTH= 1.0 +% +% Reference area for force coefficients (0 implies automatic calculation) +REF_AREA= 1.0 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +% Navier-Stokes wall boundary marker(s) (NONE = no marker) +MARKER_HEATFLUX= ( AIRFOIL, 0.0 ) +% +% Farfield boundary marker(s) (NONE = no marker) +MARKER_FAR= ( FARFIELD ) +% +% Marker(s) of the surface to be plotted or designed +MARKER_PLOTTING= ( AIRFOIL ) +% +% Marker(s) of the surface where the functional (Cd, Cl, etc.) will be evaluated +MARKER_MONITORING= ( AIRFOIL ) + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) +NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES +% +% Courant-Friedrichs-Lewy condition of the finest grid +CFL_NUMBER= 2.5 +% +% Adaptive CFL number (NO, YES) +CFL_ADAPT= NO +% +% Parameters of the adaptive CFL number (factor down, factor up, CFL min value, +% CFL max value ) +CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) +% +% Number of total iterations +ITER= 99999 +% +% Linear solver for the implicit formulation (BCGSTAB, FGMRES) +LINEAR_SOLVER= BCGSTAB +% +% Min error of the linear solver for the implicit formulation +LINEAR_SOLVER_ERROR= 1E-6 +% +% Max number of iterations of the linear solver for the implicit formulation +LINEAR_SOLVER_ITER= 20 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% +% +% Multi-Grid Levels (0 = no multi-grid) +MGLEVEL= 3 +% +% Multi-grid cycle (V_CYCLE, W_CYCLE, FULLMG_CYCLE) +MGCYCLE= W_CYCLE +% +% Multi-grid pre-smoothing level +MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) +% +% Multi-grid post-smoothing level +MG_POST_SMOOTH= ( 0, 0, 0, 0 ) +% +% Jacobi implicit smoothing of the correction +MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) +% +% Damping factor for the residual restriction +MG_DAMP_RESTRICTION= 0.95 +% +% Damping factor for the correction prolongation +MG_DAMP_PROLONGATION= 0.95 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, HLLC, +% TURKEL_PREC, MSW) +CONV_NUM_METHOD_FLOW= JST +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_FLOW= YES +% +% Slope limiter (VENKATAKRISHNAN, MINMOD) +SLOPE_LIMITER_FLOW= VENKATAKRISHNAN +% +% Coefficient for the limiter (smooth regions) +VENKAT_LIMITER_COEFF= 0.03 +% +% 2nd and 4th order artificial dissipation coefficients +JST_SENSOR_COEFF= ( 0.5, 0.02 ) +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +% Convective numerical method (SCALAR_UPWIND) +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_TURB= NO +% +% Time discretization (EULER_IMPLICIT) +TIME_DISCRE_TURB= EULER_IMPLICIT + +% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------% +% Adjoint problem boundary condition (DRAG, LIFT, SIDEFORCE, MOMENT_X, +% MOMENT_Y, MOMENT_Z, EFFICIENCY, +% EQUIVALENT_AREA, NEARFIELD_PRESSURE, +% FORCE_X, FORCE_Y, FORCE_Z, THRUST, +% TORQUE, FREE_SURFACE, TOTAL_HEAT, +% MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, +% INVERSE_DESIGN_HEATFLUX) +OBJECTIVE_FUNCTION= DRAG +% +% Convective numerical method (JST, LAX-FRIEDRICH, ROE) +CONV_NUM_METHOD_ADJFLOW= JST +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the adjoint flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_ADJFLOW= YES +% +% Slope limiter (NONE, VENKATAKRISHNAN, BARTH_JESPERSEN, VAN_ALBADA_EDGE, +% SHARP_EDGES, WALL_DISTANCE) +SLOPE_LIMITER_ADJFLOW= NONE +% +% Coefficient for the sharp edges limiter +ADJ_SHARP_LIMITER_COEFF= 3.0 +% +% 2nd, and 4th order artificial dissipation coefficients +ADJ_JST_SENSOR_COEFF= ( 0.0, 0.01 ) +% +% Reduction factor of the CFL coefficient in the adjoint problem +CFL_REDUCTION_ADJFLOW= 0.75 +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT) +TIME_DISCRE_ADJFLOW= EULER_IMPLICIT +% +% Adjoint frozen viscosity (NO, YES) +FROZEN_VISC_CONT= YES + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +% Min value of the residual (log10 of the residual) +CONV_RESIDUAL_MINVAL= -8 +% +% Start convergence criteria at iteration number +CONV_STARTITER= 10 +% +% Number of elements to apply the criteria +CONV_CAUCHY_ELEMS= 100 +% +% Epsilon to control the series convergence +CONV_CAUCHY_EPS= 1E-6 +% + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +% Mesh input file +MESH_FILENAME= mesh_RAE2822_turb.su2 +% +% Mesh input file format (SU2, CGNS, NETCDF_ASCII) +MESH_FORMAT= SU2 +% +% Mesh output file +MESH_OUT_FILENAME= mesh_out.su2 +% +% Restart flow input file +SOLUTION_FILENAME= solution_flow.dat +% +% Restart adjoint input file +SOLUTION_ADJ_FILENAME= solution_adj.dat +% +% Output file format (PARAVIEW, TECPLOT, STL) +TABULAR_FORMAT= CSV +% +% Output file convergence history (w/o extension) +CONV_FILENAME= history +% +% Output file restart flow +RESTART_FILENAME= restart_flow.dat +% +% Output file restart adjoint +RESTART_ADJ_FILENAME= restart_adj.dat +% +% Output file flow (w/o extension) variables +VOLUME_FILENAME= flow +% +% Output file adjoint (w/o extension) variables +VOLUME_ADJ_FILENAME= adjoint +% +% Output objective function gradient (using continuous adjoint) +GRAD_OBJFUNC_FILENAME= of_grad.dat +% +% Output file surface flow coefficient (w/o extension) +SURFACE_FILENAME= surface_flow +% +% Output file surface adjoint coefficient (w/o extension) +SURFACE_ADJ_FILENAME= surface_adjoint +% +% Writing solution file frequency +OUTPUT_WRT_FREQ= 250 +% +% +% Screen output fields +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_NU_TILDE, LIFT, DRAG) + +% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% +% +% Kind of deformation (FFD_SETTING, HICKS_HENNE, PARABOLIC, NACA_4DIGITS, +% DISPLACEMENT, ROTATION, FFD_CONTROL_POINT, +% FFD_DIHEDRAL_ANGLE, FFD_TWIST_ANGLE, +% FFD_ROTATION, FFD_CAMBER, FFD_THICKNESS, FFD_VOLUME +% SURFACE_FILE) +DV_KIND= FFD_SETTING +% +% Marker of the surface to which we are going apply the shape deformation +DV_MARKER= ( AIRFOIL ) +% +% Parameters of the shape deformation +% - HICKS_HENNE ( Lower Surface (0)/Upper Surface (1)/Only one Surface (2), x_Loc ) +% - NACA_4DIGITS ( 1st digit, 2nd digit, 3rd and 4th digit ) +% - PARABOLIC ( Center, Thickness ) +% - DISPLACEMENT ( x_Disp, y_Disp, z_Disp ) +% - ROTATION ( x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - OBSTACLE ( Center, Bump size ) +% - FFD_CONTROL_POINT ( FFD_BoxTag ID, i_Ind, j_Ind, k_Ind, x_Disp, y_Disp, z_Disp ) +% - FFD_DIHEDRAL_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - FFD_TWIST_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - FFD_ROTATION ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% - FFD_CAMBER ( FFD_BoxTag ID, i_Ind, j_Ind ) +% - FFD_THICKNESS ( FFD_BoxTag ID, i_Ind, j_Ind ) +% - FFD_VOLUME ( FFD_BoxTag ID, i_Ind, j_Ind ) +DV_PARAM= ( 1, 0.5 ) +% +% New value of the shape deformation +DV_VALUE= 0.01 +% +% Hold the grid fixed in a region (NO, YES) +HOLD_GRID_FIXED= NO +% +% Coordinates of the box where the grid will be deformed (Xmin, Ymin, Zmin, +% Xmax, Ymax, Zmax) +HOLD_GRID_FIXED_COORD= ( -0.5, -0.49, 0.0, 2.5, 0.49, 0.0 ) + +% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------% +% +% Available flow based objective functions or constraint functions +% DRAG, LIFT, SIDEFORCE, EFFICIENCY, BUFFET, +% FORCE_X, FORCE_Y, FORCE_Z, +% MOMENT_X, MOMENT_Y, MOMENT_Z, +% THRUST, TORQUE, FIGURE_OF_MERIT, +% EQUIVALENT_AREA, NEARFIELD_PRESSURE, +% TOTAL_HEATFLUX, MAXIMUM_HEATFLUX, +% INVERSE_DESIGN_PRESSURE, INVERSE_DESIGN_HEATFLUX, +% SURFACE_TOTAL_PRESSURE, SURFACE_MASSFLOW +% SURFACE_STATIC_PRESSURE, SURFACE_MACH +% +% Available geometrical based objective functions or constraint functions +% AIRFOIL_AREA, AIRFOIL_THICKNESS, AIRFOIL_CHORD, AIRFOIL_TOC, AIRFOIL_AOA, +% WING_VOLUME, WING_MIN_THICKNESS, WING_MAX_THICKNESS, WING_MAX_CHORD, WING_MIN_TOC, WING_MAX_TWIST, WING_MAX_CURVATURE, WING_MAX_DIHEDRAL +% STATION#_WIDTH, STATION#_AREA, STATION#_THICKNESS, STATION#_CHORD, STATION#_TOC, +% STATION#_TWIST (where # is the index of the station defined in GEO_LOCATION_STATIONS) +% +% Available design variables +% 2D Design variables +% FFD_CONTROL_POINT_2D ( 19, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, x_Mov, y_Mov ) +% FFD_CAMBER_2D ( 20, Scale | Mark. List | FFD_BoxTag, i_Ind ) +% FFD_THICKNESS_2D ( 21, Scale | Mark. List | FFD_BoxTag, i_Ind ) +% FFD_TWIST_2D ( 22, Scale | Mark. List | FFD_BoxTag, x_Orig, y_Orig ) +% HICKS_HENNE ( 30, Scale | Mark. List | Lower(0)/Upper(1) side, x_Loc ) +% ANGLE_OF_ATTACK ( 101, Scale | Mark. List | 1.0 ) +% +% 3D Design variables +% FFD_CONTROL_POINT ( 11, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, k_Ind, x_Mov, y_Mov, z_Mov ) +% FFD_NACELLE ( 12, Scale | Mark. List | FFD_BoxTag, rho_Ind, theta_Ind, phi_Ind, rho_Mov, phi_Mov ) +% FFD_GULL ( 13, Scale | Mark. List | FFD_BoxTag, j_Ind ) +% FFD_CAMBER ( 14, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) +% FFD_TWIST ( 15, Scale | Mark. List | FFD_BoxTag, j_Ind, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) +% FFD_THICKNESS ( 16, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) +% FFD_ROTATION ( 18, Scale | Mark. List | FFD_BoxTag, x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) +% FFD_ANGLE_OF_ATTACK ( 24, Scale | Mark. List | FFD_BoxTag, 1.0 ) +% +% Global design variables +% TRANSLATION ( 1, Scale | Mark. List | x_Disp, y_Disp, z_Disp ) +% ROTATION ( 2, Scale | Mark. List | x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) + +% Optimization objective function with optional scaling factor +% ex= Objective * Scale +OPT_OBJECTIVE= DRAG * 0.001 + +% Optimization constraint functions with scaling factors, separated by semicolons +% ex= (Objective = Value ) * Scale, use '>','<','=' +OPT_CONSTRAINT= NONE + +% List of design variables (Design variables are separated by semicolons) +DEFINITION_DV= ( 30, 1.0 | AIRFOIL | 0, 0.05 ); ( 30, 1.0 | AIRFOIL | 0, 0.10 ); ( 30, 1.0 | AIRFOIL | 0, 0.15 ); ( 30, 1.0 | AIRFOIL | 0, 0.20 ); ( 30, 1.0 | AIRFOIL | 0, 0.25 ); ( 30, 1.0 | AIRFOIL | 0, 0.30 ); ( 30, 1.0 | AIRFOIL | 0, 0.35 ); ( 30, 1.0 | AIRFOIL | 0, 0.40 ); ( 30, 1.0 | AIRFOIL | 0, 0.45 ); ( 30, 1.0 | AIRFOIL | 0, 0.50 ); ( 30, 1.0 | AIRFOIL | 0, 0.55 ); ( 30, 1.0 | AIRFOIL | 0, 0.60 ); ( 30, 1.0 | AIRFOIL | 0, 0.65 ); ( 30, 1.0 | AIRFOIL | 0, 0.70 ); ( 30, 1.0 | AIRFOIL | 0, 0.75 ); ( 30, 1.0 | AIRFOIL | 0, 0.80 ); ( 30, 1.0 | AIRFOIL | 0, 0.85 ); ( 30, 1.0 | AIRFOIL | 0, 0.90 ); ( 30, 1.0 | AIRFOIL | 0, 0.95 ); ( 30, 1.0 | AIRFOIL | 1, 0.05 ); ( 30, 1.0 | AIRFOIL | 1, 0.10 ); ( 30, 1.0 | AIRFOIL | 1, 0.15 ); ( 30, 1.0 | AIRFOIL | 1, 0.20 ); ( 30, 1.0 | AIRFOIL | 1, 0.25 ); ( 30, 1.0 | AIRFOIL | 1, 0.30 ); ( 30, 1.0 | AIRFOIL | 1, 0.35 ); ( 30, 1.0 | AIRFOIL | 1, 0.40 ); ( 30, 1.0 | AIRFOIL | 1, 0.45 ); ( 30, 1.0 | AIRFOIL | 1, 0.50 ); ( 30, 1.0 | AIRFOIL | 1, 0.55 ); ( 30, 1.0 | AIRFOIL | 1, 0.60 ); ( 30, 1.0 | AIRFOIL | 1, 0.65 ); ( 30, 1.0 | AIRFOIL | 1, 0.70 ); ( 30, 1.0 | AIRFOIL | 1, 0.75 ); ( 30, 1.0 | AIRFOIL | 1, 0.80 ); ( 30, 1.0 | AIRFOIL | 1, 0.85 ); ( 30, 1.0 | AIRFOIL | 1, 0.90 ); ( 30, 1.0 | AIRFOIL | 1, 0.95 ) + From 4e8c00995912d784517bcd32ca3932395c041dc5 Mon Sep 17 00:00:00 2001 From: Guillermo Suarez Date: Wed, 27 Oct 2021 13:20:05 +0200 Subject: [PATCH 03/34] Rename SA Edwards compressibility config file --- ...{turb_SA_EDW_COMP_RAE2822.cfg => turb_SA_COMP_EDW_RAE2822.cfg} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename TestCases/turbulence_models/sa/rae2822/{turb_SA_EDW_COMP_RAE2822.cfg => turb_SA_COMP_EDW_RAE2822.cfg} (100%) diff --git a/TestCases/turbulence_models/sa/rae2822/turb_SA_EDW_COMP_RAE2822.cfg b/TestCases/turbulence_models/sa/rae2822/turb_SA_COMP_EDW_RAE2822.cfg similarity index 100% rename from TestCases/turbulence_models/sa/rae2822/turb_SA_EDW_COMP_RAE2822.cfg rename to TestCases/turbulence_models/sa/rae2822/turb_SA_COMP_EDW_RAE2822.cfg From b80b95da4dad070402b8e848d3217ac76f4502ce Mon Sep 17 00:00:00 2001 From: Guillermo Suarez Date: Fri, 29 Oct 2021 10:29:45 +0200 Subject: [PATCH 04/34] Update test cases config files --- .../sa/rae2822/turb_SA_BSL_RAE2822.cfg | 203 +++++++++++++++++- .../sa/rae2822/turb_SA_COMP_EDW_RAE2822.cfg | 147 +------------ .../sa/rae2822/turb_SA_COMP_RAE2822.cfg | 147 +------------ .../sa/rae2822/turb_SA_EDW_RAE2822.cfg | 147 +------------ .../sa/rae2822/turb_SA_FT2_RAE2822.cfg | 147 +------------ .../sa/rae2822/turb_SA_QCR_RAE2822.cfg | 147 +------------ 6 files changed, 207 insertions(+), 731 deletions(-) mode change 120000 => 100644 TestCases/turbulence_models/sa/rae2822/turb_SA_BSL_RAE2822.cfg diff --git a/TestCases/turbulence_models/sa/rae2822/turb_SA_BSL_RAE2822.cfg b/TestCases/turbulence_models/sa/rae2822/turb_SA_BSL_RAE2822.cfg deleted file mode 120000 index e7f22ff4e9ec..000000000000 --- a/TestCases/turbulence_models/sa/rae2822/turb_SA_BSL_RAE2822.cfg +++ /dev/null @@ -1 +0,0 @@ -../../../rans/rae2822/turb_SA_RAE2822.cfg \ No newline at end of file diff --git a/TestCases/turbulence_models/sa/rae2822/turb_SA_BSL_RAE2822.cfg b/TestCases/turbulence_models/sa/rae2822/turb_SA_BSL_RAE2822.cfg new file mode 100644 index 000000000000..1d2efcc747b7 --- /dev/null +++ b/TestCases/turbulence_models/sa/rae2822/turb_SA_BSL_RAE2822.cfg @@ -0,0 +1,202 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Transonic simulation RAE2822 (RANS) % +% Author: Francisco Palacios % +% Institution: Stanford University % +% Date: 5/15/2013 % +% File Version 7.2.0 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +% Physical governing equations (EULER, NAVIER_STOKES, +% WAVE_EQUATION, HEAT_EQUATION, FEM_ELASTICITY, +% POISSON_EQUATION) +SOLVER= RANS +% +% Specify turbulent model (NONE, SA, SA_NEG, SST) +KIND_TURB_MODEL= SA +% +% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT) +MATH_PROBLEM= DIRECT +% +% Restart solution (NO, YES) +RESTART_SOL= NO +% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% +% +% Mach number (non-dimensional, based on the free-stream values) +MACH_NUMBER= 0.729 +% +% Angle of attack (degrees, only for compressible flows) +AOA= 2.31 +% +% Free-stream temperature (288.15 K by default) +FREESTREAM_TEMPERATURE= 288.15 +% +% Reynolds number (non-dimensional, based on the free-stream values) +REYNOLDS_NUMBER= 6.5E6 +% +% Reynolds length (1 m by default) +REYNOLDS_LENGTH= 1.0 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% +% Reference origin for moment computation +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +% +% Reference length for pitching, rolling, and yawing non-dimensional moment +REF_LENGTH= 1.0 +% +% Reference area for force coefficients (0 implies automatic calculation) +REF_AREA= 1.0 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +% Navier-Stokes wall boundary marker(s) (NONE = no marker) +MARKER_HEATFLUX= ( AIRFOIL, 0.0 ) +% +% Farfield boundary marker(s) (NONE = no marker) +MARKER_FAR= ( FARFIELD ) +% +% Marker(s) of the surface to be plotted or designed +MARKER_PLOTTING= ( AIRFOIL ) +% +% Marker(s) of the surface where the functional (Cd, Cl, etc.) will be evaluated +MARKER_MONITORING= ( AIRFOIL ) + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) +NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES +% +% Courant-Friedrichs-Lewy condition of the finest grid +CFL_NUMBER= 2.5 +% +% Adaptive CFL number (NO, YES) +CFL_ADAPT= NO +% +% Parameters of the adaptive CFL number (factor down, factor up, CFL min value, +% CFL max value ) +CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) +% +% Number of total iterations +ITER= 99999 +% +% Linear solver for the implicit formulation (BCGSTAB, FGMRES) +LINEAR_SOLVER= BCGSTAB +% +% Min error of the linear solver for the implicit formulation +LINEAR_SOLVER_ERROR= 1E-6 +% +% Max number of iterations of the linear solver for the implicit formulation +LINEAR_SOLVER_ITER= 20 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% +% +% Multi-Grid Levels (0 = no multi-grid) +MGLEVEL= 3 +% +% Multi-grid cycle (V_CYCLE, W_CYCLE, FULLMG_CYCLE) +MGCYCLE= W_CYCLE +% +% Multi-grid pre-smoothing level +MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) +% +% Multi-grid post-smoothing level +MG_POST_SMOOTH= ( 0, 0, 0, 0 ) +% +% Jacobi implicit smoothing of the correction +MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) +% +% Damping factor for the residual restriction +MG_DAMP_RESTRICTION= 0.95 +% +% Damping factor for the correction prolongation +MG_DAMP_PROLONGATION= 0.95 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, HLLC, +% TURKEL_PREC, MSW) +CONV_NUM_METHOD_FLOW= JST +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_FLOW= YES +% +% Slope limiter (VENKATAKRISHNAN, MINMOD) +SLOPE_LIMITER_FLOW= VENKATAKRISHNAN +% +% Coefficient for the limiter (smooth regions) +VENKAT_LIMITER_COEFF= 0.03 +% +% 2nd and 4th order artificial dissipation coefficients +JST_SENSOR_COEFF= ( 0.5, 0.02 ) +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +% Convective numerical method (SCALAR_UPWIND) +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_TURB= NO +% +% Time discretization (EULER_IMPLICIT) +TIME_DISCRE_TURB= EULER_IMPLICIT + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +% Min value of the residual (log10 of the residual) +CONV_RESIDUAL_MINVAL= -8 +% +% Start convergence criteria at iteration number +CONV_STARTITER= 10 +% +% Number of elements to apply the criteria +CONV_CAUCHY_ELEMS= 100 +% +% Epsilon to control the series convergence +CONV_CAUCHY_EPS= 1E-6 + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +% Mesh input file +MESH_FILENAME= mesh_RAE2822_turb.su2 +% +% Mesh input file format (SU2, CGNS, NETCDF_ASCII) +MESH_FORMAT= SU2 +% +% Mesh output file +MESH_OUT_FILENAME= mesh_out.su2 +% +% Restart flow input file +SOLUTION_FILENAME= solution_flow.dat +% +% Output file format (PARAVIEW, TECPLOT, STL) +TABULAR_FORMAT= CSV +% +% Output file convergence history (w/o extension) +CONV_FILENAME= history +% +% Output file restart flow +RESTART_FILENAME= restart_flow.dat +% +% Output file flow (w/o extension) variables +VOLUME_FILENAME= flow +% +% Output file surface flow coefficient (w/o extension) +SURFACE_FILENAME= surface_flow +% +% Writing solution file frequency +OUTPUT_WRT_FREQ= 250 +% +% Screen output fields +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_MOMENTUM-X, RMS_MOMENTUM-Y, RMS_NU_TILDE, LIFT, DRAG) diff --git a/TestCases/turbulence_models/sa/rae2822/turb_SA_COMP_EDW_RAE2822.cfg b/TestCases/turbulence_models/sa/rae2822/turb_SA_COMP_EDW_RAE2822.cfg index 973b8aa40eff..42cd2f9eec33 100644 --- a/TestCases/turbulence_models/sa/rae2822/turb_SA_COMP_EDW_RAE2822.cfg +++ b/TestCases/turbulence_models/sa/rae2822/turb_SA_COMP_EDW_RAE2822.cfg @@ -152,42 +152,6 @@ MUSCL_TURB= NO % Time discretization (EULER_IMPLICIT) TIME_DISCRE_TURB= EULER_IMPLICIT -% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------% -% Adjoint problem boundary condition (DRAG, LIFT, SIDEFORCE, MOMENT_X, -% MOMENT_Y, MOMENT_Z, EFFICIENCY, -% EQUIVALENT_AREA, NEARFIELD_PRESSURE, -% FORCE_X, FORCE_Y, FORCE_Z, THRUST, -% TORQUE, FREE_SURFACE, TOTAL_HEAT, -% MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, -% INVERSE_DESIGN_HEATFLUX) -OBJECTIVE_FUNCTION= DRAG -% -% Convective numerical method (JST, LAX-FRIEDRICH, ROE) -CONV_NUM_METHOD_ADJFLOW= JST -% -% Monotonic Upwind Scheme for Conservation Laws (TVD) in the adjoint flow equations. -% Required for 2nd order upwind schemes (NO, YES) -MUSCL_ADJFLOW= YES -% -% Slope limiter (NONE, VENKATAKRISHNAN, BARTH_JESPERSEN, VAN_ALBADA_EDGE, -% SHARP_EDGES, WALL_DISTANCE) -SLOPE_LIMITER_ADJFLOW= NONE -% -% Coefficient for the sharp edges limiter -ADJ_SHARP_LIMITER_COEFF= 3.0 -% -% 2nd, and 4th order artificial dissipation coefficients -ADJ_JST_SENSOR_COEFF= ( 0.0, 0.01 ) -% -% Reduction factor of the CFL coefficient in the adjoint problem -CFL_REDUCTION_ADJFLOW= 0.75 -% -% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT) -TIME_DISCRE_ADJFLOW= EULER_IMPLICIT -% -% Adjoint frozen viscosity (NO, YES) -FROZEN_VISC_CONT= YES - % --------------------------- CONVERGENCE PARAMETERS --------------------------% % % Min value of the residual (log10 of the residual) @@ -201,7 +165,6 @@ CONV_CAUCHY_ELEMS= 100 % % Epsilon to control the series convergence CONV_CAUCHY_EPS= 1E-6 -% % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % @@ -217,9 +180,6 @@ MESH_OUT_FILENAME= mesh_out.su2 % Restart flow input file SOLUTION_FILENAME= solution_flow.dat % -% Restart adjoint input file -SOLUTION_ADJ_FILENAME= solution_adj.dat -% % Output file format (PARAVIEW, TECPLOT, STL) TABULAR_FORMAT= CSV % @@ -229,119 +189,14 @@ CONV_FILENAME= history % Output file restart flow RESTART_FILENAME= restart_flow.dat % -% Output file restart adjoint -RESTART_ADJ_FILENAME= restart_adj.dat -% % Output file flow (w/o extension) variables VOLUME_FILENAME= flow % -% Output file adjoint (w/o extension) variables -VOLUME_ADJ_FILENAME= adjoint -% -% Output objective function gradient (using continuous adjoint) -GRAD_OBJFUNC_FILENAME= of_grad.dat -% % Output file surface flow coefficient (w/o extension) SURFACE_FILENAME= surface_flow % -% Output file surface adjoint coefficient (w/o extension) -SURFACE_ADJ_FILENAME= surface_adjoint -% % Writing solution file frequency OUTPUT_WRT_FREQ= 250 % -% % Screen output fields -SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_NU_TILDE, LIFT, DRAG) - -% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% -% -% Kind of deformation (FFD_SETTING, HICKS_HENNE, PARABOLIC, NACA_4DIGITS, -% DISPLACEMENT, ROTATION, FFD_CONTROL_POINT, -% FFD_DIHEDRAL_ANGLE, FFD_TWIST_ANGLE, -% FFD_ROTATION, FFD_CAMBER, FFD_THICKNESS, FFD_VOLUME -% SURFACE_FILE) -DV_KIND= FFD_SETTING -% -% Marker of the surface to which we are going apply the shape deformation -DV_MARKER= ( AIRFOIL ) -% -% Parameters of the shape deformation -% - HICKS_HENNE ( Lower Surface (0)/Upper Surface (1)/Only one Surface (2), x_Loc ) -% - NACA_4DIGITS ( 1st digit, 2nd digit, 3rd and 4th digit ) -% - PARABOLIC ( Center, Thickness ) -% - DISPLACEMENT ( x_Disp, y_Disp, z_Disp ) -% - ROTATION ( x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - OBSTACLE ( Center, Bump size ) -% - FFD_CONTROL_POINT ( FFD_BoxTag ID, i_Ind, j_Ind, k_Ind, x_Disp, y_Disp, z_Disp ) -% - FFD_DIHEDRAL_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - FFD_TWIST_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - FFD_ROTATION ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - FFD_CAMBER ( FFD_BoxTag ID, i_Ind, j_Ind ) -% - FFD_THICKNESS ( FFD_BoxTag ID, i_Ind, j_Ind ) -% - FFD_VOLUME ( FFD_BoxTag ID, i_Ind, j_Ind ) -DV_PARAM= ( 1, 0.5 ) -% -% New value of the shape deformation -DV_VALUE= 0.01 -% -% Hold the grid fixed in a region (NO, YES) -HOLD_GRID_FIXED= NO -% -% Coordinates of the box where the grid will be deformed (Xmin, Ymin, Zmin, -% Xmax, Ymax, Zmax) -HOLD_GRID_FIXED_COORD= ( -0.5, -0.49, 0.0, 2.5, 0.49, 0.0 ) - -% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------% -% -% Available flow based objective functions or constraint functions -% DRAG, LIFT, SIDEFORCE, EFFICIENCY, BUFFET, -% FORCE_X, FORCE_Y, FORCE_Z, -% MOMENT_X, MOMENT_Y, MOMENT_Z, -% THRUST, TORQUE, FIGURE_OF_MERIT, -% EQUIVALENT_AREA, NEARFIELD_PRESSURE, -% TOTAL_HEATFLUX, MAXIMUM_HEATFLUX, -% INVERSE_DESIGN_PRESSURE, INVERSE_DESIGN_HEATFLUX, -% SURFACE_TOTAL_PRESSURE, SURFACE_MASSFLOW -% SURFACE_STATIC_PRESSURE, SURFACE_MACH -% -% Available geometrical based objective functions or constraint functions -% AIRFOIL_AREA, AIRFOIL_THICKNESS, AIRFOIL_CHORD, AIRFOIL_TOC, AIRFOIL_AOA, -% WING_VOLUME, WING_MIN_THICKNESS, WING_MAX_THICKNESS, WING_MAX_CHORD, WING_MIN_TOC, WING_MAX_TWIST, WING_MAX_CURVATURE, WING_MAX_DIHEDRAL -% STATION#_WIDTH, STATION#_AREA, STATION#_THICKNESS, STATION#_CHORD, STATION#_TOC, -% STATION#_TWIST (where # is the index of the station defined in GEO_LOCATION_STATIONS) -% -% Available design variables -% 2D Design variables -% FFD_CONTROL_POINT_2D ( 19, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, x_Mov, y_Mov ) -% FFD_CAMBER_2D ( 20, Scale | Mark. List | FFD_BoxTag, i_Ind ) -% FFD_THICKNESS_2D ( 21, Scale | Mark. List | FFD_BoxTag, i_Ind ) -% FFD_TWIST_2D ( 22, Scale | Mark. List | FFD_BoxTag, x_Orig, y_Orig ) -% HICKS_HENNE ( 30, Scale | Mark. List | Lower(0)/Upper(1) side, x_Loc ) -% ANGLE_OF_ATTACK ( 101, Scale | Mark. List | 1.0 ) -% -% 3D Design variables -% FFD_CONTROL_POINT ( 11, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, k_Ind, x_Mov, y_Mov, z_Mov ) -% FFD_NACELLE ( 12, Scale | Mark. List | FFD_BoxTag, rho_Ind, theta_Ind, phi_Ind, rho_Mov, phi_Mov ) -% FFD_GULL ( 13, Scale | Mark. List | FFD_BoxTag, j_Ind ) -% FFD_CAMBER ( 14, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) -% FFD_TWIST ( 15, Scale | Mark. List | FFD_BoxTag, j_Ind, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% FFD_THICKNESS ( 16, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) -% FFD_ROTATION ( 18, Scale | Mark. List | FFD_BoxTag, x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) -% FFD_ANGLE_OF_ATTACK ( 24, Scale | Mark. List | FFD_BoxTag, 1.0 ) -% -% Global design variables -% TRANSLATION ( 1, Scale | Mark. List | x_Disp, y_Disp, z_Disp ) -% ROTATION ( 2, Scale | Mark. List | x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) - -% Optimization objective function with optional scaling factor -% ex= Objective * Scale -OPT_OBJECTIVE= DRAG * 0.001 - -% Optimization constraint functions with scaling factors, separated by semicolons -% ex= (Objective = Value ) * Scale, use '>','<','=' -OPT_CONSTRAINT= NONE - -% List of design variables (Design variables are separated by semicolons) -DEFINITION_DV= ( 30, 1.0 | AIRFOIL | 0, 0.05 ); ( 30, 1.0 | AIRFOIL | 0, 0.10 ); ( 30, 1.0 | AIRFOIL | 0, 0.15 ); ( 30, 1.0 | AIRFOIL | 0, 0.20 ); ( 30, 1.0 | AIRFOIL | 0, 0.25 ); ( 30, 1.0 | AIRFOIL | 0, 0.30 ); ( 30, 1.0 | AIRFOIL | 0, 0.35 ); ( 30, 1.0 | AIRFOIL | 0, 0.40 ); ( 30, 1.0 | AIRFOIL | 0, 0.45 ); ( 30, 1.0 | AIRFOIL | 0, 0.50 ); ( 30, 1.0 | AIRFOIL | 0, 0.55 ); ( 30, 1.0 | AIRFOIL | 0, 0.60 ); ( 30, 1.0 | AIRFOIL | 0, 0.65 ); ( 30, 1.0 | AIRFOIL | 0, 0.70 ); ( 30, 1.0 | AIRFOIL | 0, 0.75 ); ( 30, 1.0 | AIRFOIL | 0, 0.80 ); ( 30, 1.0 | AIRFOIL | 0, 0.85 ); ( 30, 1.0 | AIRFOIL | 0, 0.90 ); ( 30, 1.0 | AIRFOIL | 0, 0.95 ); ( 30, 1.0 | AIRFOIL | 1, 0.05 ); ( 30, 1.0 | AIRFOIL | 1, 0.10 ); ( 30, 1.0 | AIRFOIL | 1, 0.15 ); ( 30, 1.0 | AIRFOIL | 1, 0.20 ); ( 30, 1.0 | AIRFOIL | 1, 0.25 ); ( 30, 1.0 | AIRFOIL | 1, 0.30 ); ( 30, 1.0 | AIRFOIL | 1, 0.35 ); ( 30, 1.0 | AIRFOIL | 1, 0.40 ); ( 30, 1.0 | AIRFOIL | 1, 0.45 ); ( 30, 1.0 | AIRFOIL | 1, 0.50 ); ( 30, 1.0 | AIRFOIL | 1, 0.55 ); ( 30, 1.0 | AIRFOIL | 1, 0.60 ); ( 30, 1.0 | AIRFOIL | 1, 0.65 ); ( 30, 1.0 | AIRFOIL | 1, 0.70 ); ( 30, 1.0 | AIRFOIL | 1, 0.75 ); ( 30, 1.0 | AIRFOIL | 1, 0.80 ); ( 30, 1.0 | AIRFOIL | 1, 0.85 ); ( 30, 1.0 | AIRFOIL | 1, 0.90 ); ( 30, 1.0 | AIRFOIL | 1, 0.95 ) - +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_MOMENTUM-X, RMS_MOMENTUM-Y, RMS_NU_TILDE, LIFT, DRAG) diff --git a/TestCases/turbulence_models/sa/rae2822/turb_SA_COMP_RAE2822.cfg b/TestCases/turbulence_models/sa/rae2822/turb_SA_COMP_RAE2822.cfg index 1d4d2814c488..b0b3626e82a3 100644 --- a/TestCases/turbulence_models/sa/rae2822/turb_SA_COMP_RAE2822.cfg +++ b/TestCases/turbulence_models/sa/rae2822/turb_SA_COMP_RAE2822.cfg @@ -152,42 +152,6 @@ MUSCL_TURB= NO % Time discretization (EULER_IMPLICIT) TIME_DISCRE_TURB= EULER_IMPLICIT -% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------% -% Adjoint problem boundary condition (DRAG, LIFT, SIDEFORCE, MOMENT_X, -% MOMENT_Y, MOMENT_Z, EFFICIENCY, -% EQUIVALENT_AREA, NEARFIELD_PRESSURE, -% FORCE_X, FORCE_Y, FORCE_Z, THRUST, -% TORQUE, FREE_SURFACE, TOTAL_HEAT, -% MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, -% INVERSE_DESIGN_HEATFLUX) -OBJECTIVE_FUNCTION= DRAG -% -% Convective numerical method (JST, LAX-FRIEDRICH, ROE) -CONV_NUM_METHOD_ADJFLOW= JST -% -% Monotonic Upwind Scheme for Conservation Laws (TVD) in the adjoint flow equations. -% Required for 2nd order upwind schemes (NO, YES) -MUSCL_ADJFLOW= YES -% -% Slope limiter (NONE, VENKATAKRISHNAN, BARTH_JESPERSEN, VAN_ALBADA_EDGE, -% SHARP_EDGES, WALL_DISTANCE) -SLOPE_LIMITER_ADJFLOW= NONE -% -% Coefficient for the sharp edges limiter -ADJ_SHARP_LIMITER_COEFF= 3.0 -% -% 2nd, and 4th order artificial dissipation coefficients -ADJ_JST_SENSOR_COEFF= ( 0.0, 0.01 ) -% -% Reduction factor of the CFL coefficient in the adjoint problem -CFL_REDUCTION_ADJFLOW= 0.75 -% -% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT) -TIME_DISCRE_ADJFLOW= EULER_IMPLICIT -% -% Adjoint frozen viscosity (NO, YES) -FROZEN_VISC_CONT= YES - % --------------------------- CONVERGENCE PARAMETERS --------------------------% % % Min value of the residual (log10 of the residual) @@ -201,7 +165,6 @@ CONV_CAUCHY_ELEMS= 100 % % Epsilon to control the series convergence CONV_CAUCHY_EPS= 1E-6 -% % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % @@ -217,9 +180,6 @@ MESH_OUT_FILENAME= mesh_out.su2 % Restart flow input file SOLUTION_FILENAME= solution_flow.dat % -% Restart adjoint input file -SOLUTION_ADJ_FILENAME= solution_adj.dat -% % Output file format (PARAVIEW, TECPLOT, STL) TABULAR_FORMAT= CSV % @@ -229,119 +189,14 @@ CONV_FILENAME= history % Output file restart flow RESTART_FILENAME= restart_flow.dat % -% Output file restart adjoint -RESTART_ADJ_FILENAME= restart_adj.dat -% % Output file flow (w/o extension) variables VOLUME_FILENAME= flow % -% Output file adjoint (w/o extension) variables -VOLUME_ADJ_FILENAME= adjoint -% -% Output objective function gradient (using continuous adjoint) -GRAD_OBJFUNC_FILENAME= of_grad.dat -% % Output file surface flow coefficient (w/o extension) SURFACE_FILENAME= surface_flow % -% Output file surface adjoint coefficient (w/o extension) -SURFACE_ADJ_FILENAME= surface_adjoint -% % Writing solution file frequency OUTPUT_WRT_FREQ= 250 % -% % Screen output fields -SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_NU_TILDE, LIFT, DRAG) - -% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% -% -% Kind of deformation (FFD_SETTING, HICKS_HENNE, PARABOLIC, NACA_4DIGITS, -% DISPLACEMENT, ROTATION, FFD_CONTROL_POINT, -% FFD_DIHEDRAL_ANGLE, FFD_TWIST_ANGLE, -% FFD_ROTATION, FFD_CAMBER, FFD_THICKNESS, FFD_VOLUME -% SURFACE_FILE) -DV_KIND= FFD_SETTING -% -% Marker of the surface to which we are going apply the shape deformation -DV_MARKER= ( AIRFOIL ) -% -% Parameters of the shape deformation -% - HICKS_HENNE ( Lower Surface (0)/Upper Surface (1)/Only one Surface (2), x_Loc ) -% - NACA_4DIGITS ( 1st digit, 2nd digit, 3rd and 4th digit ) -% - PARABOLIC ( Center, Thickness ) -% - DISPLACEMENT ( x_Disp, y_Disp, z_Disp ) -% - ROTATION ( x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - OBSTACLE ( Center, Bump size ) -% - FFD_CONTROL_POINT ( FFD_BoxTag ID, i_Ind, j_Ind, k_Ind, x_Disp, y_Disp, z_Disp ) -% - FFD_DIHEDRAL_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - FFD_TWIST_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - FFD_ROTATION ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - FFD_CAMBER ( FFD_BoxTag ID, i_Ind, j_Ind ) -% - FFD_THICKNESS ( FFD_BoxTag ID, i_Ind, j_Ind ) -% - FFD_VOLUME ( FFD_BoxTag ID, i_Ind, j_Ind ) -DV_PARAM= ( 1, 0.5 ) -% -% New value of the shape deformation -DV_VALUE= 0.01 -% -% Hold the grid fixed in a region (NO, YES) -HOLD_GRID_FIXED= NO -% -% Coordinates of the box where the grid will be deformed (Xmin, Ymin, Zmin, -% Xmax, Ymax, Zmax) -HOLD_GRID_FIXED_COORD= ( -0.5, -0.49, 0.0, 2.5, 0.49, 0.0 ) - -% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------% -% -% Available flow based objective functions or constraint functions -% DRAG, LIFT, SIDEFORCE, EFFICIENCY, BUFFET, -% FORCE_X, FORCE_Y, FORCE_Z, -% MOMENT_X, MOMENT_Y, MOMENT_Z, -% THRUST, TORQUE, FIGURE_OF_MERIT, -% EQUIVALENT_AREA, NEARFIELD_PRESSURE, -% TOTAL_HEATFLUX, MAXIMUM_HEATFLUX, -% INVERSE_DESIGN_PRESSURE, INVERSE_DESIGN_HEATFLUX, -% SURFACE_TOTAL_PRESSURE, SURFACE_MASSFLOW -% SURFACE_STATIC_PRESSURE, SURFACE_MACH -% -% Available geometrical based objective functions or constraint functions -% AIRFOIL_AREA, AIRFOIL_THICKNESS, AIRFOIL_CHORD, AIRFOIL_TOC, AIRFOIL_AOA, -% WING_VOLUME, WING_MIN_THICKNESS, WING_MAX_THICKNESS, WING_MAX_CHORD, WING_MIN_TOC, WING_MAX_TWIST, WING_MAX_CURVATURE, WING_MAX_DIHEDRAL -% STATION#_WIDTH, STATION#_AREA, STATION#_THICKNESS, STATION#_CHORD, STATION#_TOC, -% STATION#_TWIST (where # is the index of the station defined in GEO_LOCATION_STATIONS) -% -% Available design variables -% 2D Design variables -% FFD_CONTROL_POINT_2D ( 19, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, x_Mov, y_Mov ) -% FFD_CAMBER_2D ( 20, Scale | Mark. List | FFD_BoxTag, i_Ind ) -% FFD_THICKNESS_2D ( 21, Scale | Mark. List | FFD_BoxTag, i_Ind ) -% FFD_TWIST_2D ( 22, Scale | Mark. List | FFD_BoxTag, x_Orig, y_Orig ) -% HICKS_HENNE ( 30, Scale | Mark. List | Lower(0)/Upper(1) side, x_Loc ) -% ANGLE_OF_ATTACK ( 101, Scale | Mark. List | 1.0 ) -% -% 3D Design variables -% FFD_CONTROL_POINT ( 11, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, k_Ind, x_Mov, y_Mov, z_Mov ) -% FFD_NACELLE ( 12, Scale | Mark. List | FFD_BoxTag, rho_Ind, theta_Ind, phi_Ind, rho_Mov, phi_Mov ) -% FFD_GULL ( 13, Scale | Mark. List | FFD_BoxTag, j_Ind ) -% FFD_CAMBER ( 14, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) -% FFD_TWIST ( 15, Scale | Mark. List | FFD_BoxTag, j_Ind, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% FFD_THICKNESS ( 16, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) -% FFD_ROTATION ( 18, Scale | Mark. List | FFD_BoxTag, x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) -% FFD_ANGLE_OF_ATTACK ( 24, Scale | Mark. List | FFD_BoxTag, 1.0 ) -% -% Global design variables -% TRANSLATION ( 1, Scale | Mark. List | x_Disp, y_Disp, z_Disp ) -% ROTATION ( 2, Scale | Mark. List | x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) - -% Optimization objective function with optional scaling factor -% ex= Objective * Scale -OPT_OBJECTIVE= DRAG * 0.001 - -% Optimization constraint functions with scaling factors, separated by semicolons -% ex= (Objective = Value ) * Scale, use '>','<','=' -OPT_CONSTRAINT= NONE - -% List of design variables (Design variables are separated by semicolons) -DEFINITION_DV= ( 30, 1.0 | AIRFOIL | 0, 0.05 ); ( 30, 1.0 | AIRFOIL | 0, 0.10 ); ( 30, 1.0 | AIRFOIL | 0, 0.15 ); ( 30, 1.0 | AIRFOIL | 0, 0.20 ); ( 30, 1.0 | AIRFOIL | 0, 0.25 ); ( 30, 1.0 | AIRFOIL | 0, 0.30 ); ( 30, 1.0 | AIRFOIL | 0, 0.35 ); ( 30, 1.0 | AIRFOIL | 0, 0.40 ); ( 30, 1.0 | AIRFOIL | 0, 0.45 ); ( 30, 1.0 | AIRFOIL | 0, 0.50 ); ( 30, 1.0 | AIRFOIL | 0, 0.55 ); ( 30, 1.0 | AIRFOIL | 0, 0.60 ); ( 30, 1.0 | AIRFOIL | 0, 0.65 ); ( 30, 1.0 | AIRFOIL | 0, 0.70 ); ( 30, 1.0 | AIRFOIL | 0, 0.75 ); ( 30, 1.0 | AIRFOIL | 0, 0.80 ); ( 30, 1.0 | AIRFOIL | 0, 0.85 ); ( 30, 1.0 | AIRFOIL | 0, 0.90 ); ( 30, 1.0 | AIRFOIL | 0, 0.95 ); ( 30, 1.0 | AIRFOIL | 1, 0.05 ); ( 30, 1.0 | AIRFOIL | 1, 0.10 ); ( 30, 1.0 | AIRFOIL | 1, 0.15 ); ( 30, 1.0 | AIRFOIL | 1, 0.20 ); ( 30, 1.0 | AIRFOIL | 1, 0.25 ); ( 30, 1.0 | AIRFOIL | 1, 0.30 ); ( 30, 1.0 | AIRFOIL | 1, 0.35 ); ( 30, 1.0 | AIRFOIL | 1, 0.40 ); ( 30, 1.0 | AIRFOIL | 1, 0.45 ); ( 30, 1.0 | AIRFOIL | 1, 0.50 ); ( 30, 1.0 | AIRFOIL | 1, 0.55 ); ( 30, 1.0 | AIRFOIL | 1, 0.60 ); ( 30, 1.0 | AIRFOIL | 1, 0.65 ); ( 30, 1.0 | AIRFOIL | 1, 0.70 ); ( 30, 1.0 | AIRFOIL | 1, 0.75 ); ( 30, 1.0 | AIRFOIL | 1, 0.80 ); ( 30, 1.0 | AIRFOIL | 1, 0.85 ); ( 30, 1.0 | AIRFOIL | 1, 0.90 ); ( 30, 1.0 | AIRFOIL | 1, 0.95 ) - +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_MOMENTUM-X, RMS_MOMENTUM-Y, RMS_NU_TILDE, LIFT, DRAG) diff --git a/TestCases/turbulence_models/sa/rae2822/turb_SA_EDW_RAE2822.cfg b/TestCases/turbulence_models/sa/rae2822/turb_SA_EDW_RAE2822.cfg index 4ecfdf035fc4..1f53a2d8bbc3 100644 --- a/TestCases/turbulence_models/sa/rae2822/turb_SA_EDW_RAE2822.cfg +++ b/TestCases/turbulence_models/sa/rae2822/turb_SA_EDW_RAE2822.cfg @@ -152,42 +152,6 @@ MUSCL_TURB= NO % Time discretization (EULER_IMPLICIT) TIME_DISCRE_TURB= EULER_IMPLICIT -% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------% -% Adjoint problem boundary condition (DRAG, LIFT, SIDEFORCE, MOMENT_X, -% MOMENT_Y, MOMENT_Z, EFFICIENCY, -% EQUIVALENT_AREA, NEARFIELD_PRESSURE, -% FORCE_X, FORCE_Y, FORCE_Z, THRUST, -% TORQUE, FREE_SURFACE, TOTAL_HEAT, -% MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, -% INVERSE_DESIGN_HEATFLUX) -OBJECTIVE_FUNCTION= DRAG -% -% Convective numerical method (JST, LAX-FRIEDRICH, ROE) -CONV_NUM_METHOD_ADJFLOW= JST -% -% Monotonic Upwind Scheme for Conservation Laws (TVD) in the adjoint flow equations. -% Required for 2nd order upwind schemes (NO, YES) -MUSCL_ADJFLOW= YES -% -% Slope limiter (NONE, VENKATAKRISHNAN, BARTH_JESPERSEN, VAN_ALBADA_EDGE, -% SHARP_EDGES, WALL_DISTANCE) -SLOPE_LIMITER_ADJFLOW= NONE -% -% Coefficient for the sharp edges limiter -ADJ_SHARP_LIMITER_COEFF= 3.0 -% -% 2nd, and 4th order artificial dissipation coefficients -ADJ_JST_SENSOR_COEFF= ( 0.0, 0.01 ) -% -% Reduction factor of the CFL coefficient in the adjoint problem -CFL_REDUCTION_ADJFLOW= 0.75 -% -% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT) -TIME_DISCRE_ADJFLOW= EULER_IMPLICIT -% -% Adjoint frozen viscosity (NO, YES) -FROZEN_VISC_CONT= YES - % --------------------------- CONVERGENCE PARAMETERS --------------------------% % % Min value of the residual (log10 of the residual) @@ -201,7 +165,6 @@ CONV_CAUCHY_ELEMS= 100 % % Epsilon to control the series convergence CONV_CAUCHY_EPS= 1E-6 -% % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % @@ -217,9 +180,6 @@ MESH_OUT_FILENAME= mesh_out.su2 % Restart flow input file SOLUTION_FILENAME= solution_flow.dat % -% Restart adjoint input file -SOLUTION_ADJ_FILENAME= solution_adj.dat -% % Output file format (PARAVIEW, TECPLOT, STL) TABULAR_FORMAT= CSV % @@ -229,119 +189,14 @@ CONV_FILENAME= history % Output file restart flow RESTART_FILENAME= restart_flow.dat % -% Output file restart adjoint -RESTART_ADJ_FILENAME= restart_adj.dat -% % Output file flow (w/o extension) variables VOLUME_FILENAME= flow % -% Output file adjoint (w/o extension) variables -VOLUME_ADJ_FILENAME= adjoint -% -% Output objective function gradient (using continuous adjoint) -GRAD_OBJFUNC_FILENAME= of_grad.dat -% % Output file surface flow coefficient (w/o extension) SURFACE_FILENAME= surface_flow % -% Output file surface adjoint coefficient (w/o extension) -SURFACE_ADJ_FILENAME= surface_adjoint -% % Writing solution file frequency OUTPUT_WRT_FREQ= 250 % -% % Screen output fields -SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_NU_TILDE, LIFT, DRAG) - -% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% -% -% Kind of deformation (FFD_SETTING, HICKS_HENNE, PARABOLIC, NACA_4DIGITS, -% DISPLACEMENT, ROTATION, FFD_CONTROL_POINT, -% FFD_DIHEDRAL_ANGLE, FFD_TWIST_ANGLE, -% FFD_ROTATION, FFD_CAMBER, FFD_THICKNESS, FFD_VOLUME -% SURFACE_FILE) -DV_KIND= FFD_SETTING -% -% Marker of the surface to which we are going apply the shape deformation -DV_MARKER= ( AIRFOIL ) -% -% Parameters of the shape deformation -% - HICKS_HENNE ( Lower Surface (0)/Upper Surface (1)/Only one Surface (2), x_Loc ) -% - NACA_4DIGITS ( 1st digit, 2nd digit, 3rd and 4th digit ) -% - PARABOLIC ( Center, Thickness ) -% - DISPLACEMENT ( x_Disp, y_Disp, z_Disp ) -% - ROTATION ( x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - OBSTACLE ( Center, Bump size ) -% - FFD_CONTROL_POINT ( FFD_BoxTag ID, i_Ind, j_Ind, k_Ind, x_Disp, y_Disp, z_Disp ) -% - FFD_DIHEDRAL_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - FFD_TWIST_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - FFD_ROTATION ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - FFD_CAMBER ( FFD_BoxTag ID, i_Ind, j_Ind ) -% - FFD_THICKNESS ( FFD_BoxTag ID, i_Ind, j_Ind ) -% - FFD_VOLUME ( FFD_BoxTag ID, i_Ind, j_Ind ) -DV_PARAM= ( 1, 0.5 ) -% -% New value of the shape deformation -DV_VALUE= 0.01 -% -% Hold the grid fixed in a region (NO, YES) -HOLD_GRID_FIXED= NO -% -% Coordinates of the box where the grid will be deformed (Xmin, Ymin, Zmin, -% Xmax, Ymax, Zmax) -HOLD_GRID_FIXED_COORD= ( -0.5, -0.49, 0.0, 2.5, 0.49, 0.0 ) - -% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------% -% -% Available flow based objective functions or constraint functions -% DRAG, LIFT, SIDEFORCE, EFFICIENCY, BUFFET, -% FORCE_X, FORCE_Y, FORCE_Z, -% MOMENT_X, MOMENT_Y, MOMENT_Z, -% THRUST, TORQUE, FIGURE_OF_MERIT, -% EQUIVALENT_AREA, NEARFIELD_PRESSURE, -% TOTAL_HEATFLUX, MAXIMUM_HEATFLUX, -% INVERSE_DESIGN_PRESSURE, INVERSE_DESIGN_HEATFLUX, -% SURFACE_TOTAL_PRESSURE, SURFACE_MASSFLOW -% SURFACE_STATIC_PRESSURE, SURFACE_MACH -% -% Available geometrical based objective functions or constraint functions -% AIRFOIL_AREA, AIRFOIL_THICKNESS, AIRFOIL_CHORD, AIRFOIL_TOC, AIRFOIL_AOA, -% WING_VOLUME, WING_MIN_THICKNESS, WING_MAX_THICKNESS, WING_MAX_CHORD, WING_MIN_TOC, WING_MAX_TWIST, WING_MAX_CURVATURE, WING_MAX_DIHEDRAL -% STATION#_WIDTH, STATION#_AREA, STATION#_THICKNESS, STATION#_CHORD, STATION#_TOC, -% STATION#_TWIST (where # is the index of the station defined in GEO_LOCATION_STATIONS) -% -% Available design variables -% 2D Design variables -% FFD_CONTROL_POINT_2D ( 19, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, x_Mov, y_Mov ) -% FFD_CAMBER_2D ( 20, Scale | Mark. List | FFD_BoxTag, i_Ind ) -% FFD_THICKNESS_2D ( 21, Scale | Mark. List | FFD_BoxTag, i_Ind ) -% FFD_TWIST_2D ( 22, Scale | Mark. List | FFD_BoxTag, x_Orig, y_Orig ) -% HICKS_HENNE ( 30, Scale | Mark. List | Lower(0)/Upper(1) side, x_Loc ) -% ANGLE_OF_ATTACK ( 101, Scale | Mark. List | 1.0 ) -% -% 3D Design variables -% FFD_CONTROL_POINT ( 11, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, k_Ind, x_Mov, y_Mov, z_Mov ) -% FFD_NACELLE ( 12, Scale | Mark. List | FFD_BoxTag, rho_Ind, theta_Ind, phi_Ind, rho_Mov, phi_Mov ) -% FFD_GULL ( 13, Scale | Mark. List | FFD_BoxTag, j_Ind ) -% FFD_CAMBER ( 14, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) -% FFD_TWIST ( 15, Scale | Mark. List | FFD_BoxTag, j_Ind, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% FFD_THICKNESS ( 16, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) -% FFD_ROTATION ( 18, Scale | Mark. List | FFD_BoxTag, x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) -% FFD_ANGLE_OF_ATTACK ( 24, Scale | Mark. List | FFD_BoxTag, 1.0 ) -% -% Global design variables -% TRANSLATION ( 1, Scale | Mark. List | x_Disp, y_Disp, z_Disp ) -% ROTATION ( 2, Scale | Mark. List | x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) - -% Optimization objective function with optional scaling factor -% ex= Objective * Scale -OPT_OBJECTIVE= DRAG * 0.001 - -% Optimization constraint functions with scaling factors, separated by semicolons -% ex= (Objective = Value ) * Scale, use '>','<','=' -OPT_CONSTRAINT= NONE - -% List of design variables (Design variables are separated by semicolons) -DEFINITION_DV= ( 30, 1.0 | AIRFOIL | 0, 0.05 ); ( 30, 1.0 | AIRFOIL | 0, 0.10 ); ( 30, 1.0 | AIRFOIL | 0, 0.15 ); ( 30, 1.0 | AIRFOIL | 0, 0.20 ); ( 30, 1.0 | AIRFOIL | 0, 0.25 ); ( 30, 1.0 | AIRFOIL | 0, 0.30 ); ( 30, 1.0 | AIRFOIL | 0, 0.35 ); ( 30, 1.0 | AIRFOIL | 0, 0.40 ); ( 30, 1.0 | AIRFOIL | 0, 0.45 ); ( 30, 1.0 | AIRFOIL | 0, 0.50 ); ( 30, 1.0 | AIRFOIL | 0, 0.55 ); ( 30, 1.0 | AIRFOIL | 0, 0.60 ); ( 30, 1.0 | AIRFOIL | 0, 0.65 ); ( 30, 1.0 | AIRFOIL | 0, 0.70 ); ( 30, 1.0 | AIRFOIL | 0, 0.75 ); ( 30, 1.0 | AIRFOIL | 0, 0.80 ); ( 30, 1.0 | AIRFOIL | 0, 0.85 ); ( 30, 1.0 | AIRFOIL | 0, 0.90 ); ( 30, 1.0 | AIRFOIL | 0, 0.95 ); ( 30, 1.0 | AIRFOIL | 1, 0.05 ); ( 30, 1.0 | AIRFOIL | 1, 0.10 ); ( 30, 1.0 | AIRFOIL | 1, 0.15 ); ( 30, 1.0 | AIRFOIL | 1, 0.20 ); ( 30, 1.0 | AIRFOIL | 1, 0.25 ); ( 30, 1.0 | AIRFOIL | 1, 0.30 ); ( 30, 1.0 | AIRFOIL | 1, 0.35 ); ( 30, 1.0 | AIRFOIL | 1, 0.40 ); ( 30, 1.0 | AIRFOIL | 1, 0.45 ); ( 30, 1.0 | AIRFOIL | 1, 0.50 ); ( 30, 1.0 | AIRFOIL | 1, 0.55 ); ( 30, 1.0 | AIRFOIL | 1, 0.60 ); ( 30, 1.0 | AIRFOIL | 1, 0.65 ); ( 30, 1.0 | AIRFOIL | 1, 0.70 ); ( 30, 1.0 | AIRFOIL | 1, 0.75 ); ( 30, 1.0 | AIRFOIL | 1, 0.80 ); ( 30, 1.0 | AIRFOIL | 1, 0.85 ); ( 30, 1.0 | AIRFOIL | 1, 0.90 ); ( 30, 1.0 | AIRFOIL | 1, 0.95 ) - +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_MOMENTUM-X, RMS_MOMENTUM-Y, RMS_NU_TILDE, LIFT, DRAG) diff --git a/TestCases/turbulence_models/sa/rae2822/turb_SA_FT2_RAE2822.cfg b/TestCases/turbulence_models/sa/rae2822/turb_SA_FT2_RAE2822.cfg index 9c931077a97e..1d2efcc747b7 100644 --- a/TestCases/turbulence_models/sa/rae2822/turb_SA_FT2_RAE2822.cfg +++ b/TestCases/turbulence_models/sa/rae2822/turb_SA_FT2_RAE2822.cfg @@ -152,42 +152,6 @@ MUSCL_TURB= NO % Time discretization (EULER_IMPLICIT) TIME_DISCRE_TURB= EULER_IMPLICIT -% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------% -% Adjoint problem boundary condition (DRAG, LIFT, SIDEFORCE, MOMENT_X, -% MOMENT_Y, MOMENT_Z, EFFICIENCY, -% EQUIVALENT_AREA, NEARFIELD_PRESSURE, -% FORCE_X, FORCE_Y, FORCE_Z, THRUST, -% TORQUE, FREE_SURFACE, TOTAL_HEAT, -% MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, -% INVERSE_DESIGN_HEATFLUX) -OBJECTIVE_FUNCTION= DRAG -% -% Convective numerical method (JST, LAX-FRIEDRICH, ROE) -CONV_NUM_METHOD_ADJFLOW= JST -% -% Monotonic Upwind Scheme for Conservation Laws (TVD) in the adjoint flow equations. -% Required for 2nd order upwind schemes (NO, YES) -MUSCL_ADJFLOW= YES -% -% Slope limiter (NONE, VENKATAKRISHNAN, BARTH_JESPERSEN, VAN_ALBADA_EDGE, -% SHARP_EDGES, WALL_DISTANCE) -SLOPE_LIMITER_ADJFLOW= NONE -% -% Coefficient for the sharp edges limiter -ADJ_SHARP_LIMITER_COEFF= 3.0 -% -% 2nd, and 4th order artificial dissipation coefficients -ADJ_JST_SENSOR_COEFF= ( 0.0, 0.01 ) -% -% Reduction factor of the CFL coefficient in the adjoint problem -CFL_REDUCTION_ADJFLOW= 0.75 -% -% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT) -TIME_DISCRE_ADJFLOW= EULER_IMPLICIT -% -% Adjoint frozen viscosity (NO, YES) -FROZEN_VISC_CONT= YES - % --------------------------- CONVERGENCE PARAMETERS --------------------------% % % Min value of the residual (log10 of the residual) @@ -201,7 +165,6 @@ CONV_CAUCHY_ELEMS= 100 % % Epsilon to control the series convergence CONV_CAUCHY_EPS= 1E-6 -% % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % @@ -217,9 +180,6 @@ MESH_OUT_FILENAME= mesh_out.su2 % Restart flow input file SOLUTION_FILENAME= solution_flow.dat % -% Restart adjoint input file -SOLUTION_ADJ_FILENAME= solution_adj.dat -% % Output file format (PARAVIEW, TECPLOT, STL) TABULAR_FORMAT= CSV % @@ -229,119 +189,14 @@ CONV_FILENAME= history % Output file restart flow RESTART_FILENAME= restart_flow.dat % -% Output file restart adjoint -RESTART_ADJ_FILENAME= restart_adj.dat -% % Output file flow (w/o extension) variables VOLUME_FILENAME= flow % -% Output file adjoint (w/o extension) variables -VOLUME_ADJ_FILENAME= adjoint -% -% Output objective function gradient (using continuous adjoint) -GRAD_OBJFUNC_FILENAME= of_grad.dat -% % Output file surface flow coefficient (w/o extension) SURFACE_FILENAME= surface_flow % -% Output file surface adjoint coefficient (w/o extension) -SURFACE_ADJ_FILENAME= surface_adjoint -% % Writing solution file frequency OUTPUT_WRT_FREQ= 250 % -% % Screen output fields -SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_NU_TILDE, LIFT, DRAG) - -% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% -% -% Kind of deformation (FFD_SETTING, HICKS_HENNE, PARABOLIC, NACA_4DIGITS, -% DISPLACEMENT, ROTATION, FFD_CONTROL_POINT, -% FFD_DIHEDRAL_ANGLE, FFD_TWIST_ANGLE, -% FFD_ROTATION, FFD_CAMBER, FFD_THICKNESS, FFD_VOLUME -% SURFACE_FILE) -DV_KIND= FFD_SETTING -% -% Marker of the surface to which we are going apply the shape deformation -DV_MARKER= ( AIRFOIL ) -% -% Parameters of the shape deformation -% - HICKS_HENNE ( Lower Surface (0)/Upper Surface (1)/Only one Surface (2), x_Loc ) -% - NACA_4DIGITS ( 1st digit, 2nd digit, 3rd and 4th digit ) -% - PARABOLIC ( Center, Thickness ) -% - DISPLACEMENT ( x_Disp, y_Disp, z_Disp ) -% - ROTATION ( x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - OBSTACLE ( Center, Bump size ) -% - FFD_CONTROL_POINT ( FFD_BoxTag ID, i_Ind, j_Ind, k_Ind, x_Disp, y_Disp, z_Disp ) -% - FFD_DIHEDRAL_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - FFD_TWIST_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - FFD_ROTATION ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - FFD_CAMBER ( FFD_BoxTag ID, i_Ind, j_Ind ) -% - FFD_THICKNESS ( FFD_BoxTag ID, i_Ind, j_Ind ) -% - FFD_VOLUME ( FFD_BoxTag ID, i_Ind, j_Ind ) -DV_PARAM= ( 1, 0.5 ) -% -% New value of the shape deformation -DV_VALUE= 0.01 -% -% Hold the grid fixed in a region (NO, YES) -HOLD_GRID_FIXED= NO -% -% Coordinates of the box where the grid will be deformed (Xmin, Ymin, Zmin, -% Xmax, Ymax, Zmax) -HOLD_GRID_FIXED_COORD= ( -0.5, -0.49, 0.0, 2.5, 0.49, 0.0 ) - -% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------% -% -% Available flow based objective functions or constraint functions -% DRAG, LIFT, SIDEFORCE, EFFICIENCY, BUFFET, -% FORCE_X, FORCE_Y, FORCE_Z, -% MOMENT_X, MOMENT_Y, MOMENT_Z, -% THRUST, TORQUE, FIGURE_OF_MERIT, -% EQUIVALENT_AREA, NEARFIELD_PRESSURE, -% TOTAL_HEATFLUX, MAXIMUM_HEATFLUX, -% INVERSE_DESIGN_PRESSURE, INVERSE_DESIGN_HEATFLUX, -% SURFACE_TOTAL_PRESSURE, SURFACE_MASSFLOW -% SURFACE_STATIC_PRESSURE, SURFACE_MACH -% -% Available geometrical based objective functions or constraint functions -% AIRFOIL_AREA, AIRFOIL_THICKNESS, AIRFOIL_CHORD, AIRFOIL_TOC, AIRFOIL_AOA, -% WING_VOLUME, WING_MIN_THICKNESS, WING_MAX_THICKNESS, WING_MAX_CHORD, WING_MIN_TOC, WING_MAX_TWIST, WING_MAX_CURVATURE, WING_MAX_DIHEDRAL -% STATION#_WIDTH, STATION#_AREA, STATION#_THICKNESS, STATION#_CHORD, STATION#_TOC, -% STATION#_TWIST (where # is the index of the station defined in GEO_LOCATION_STATIONS) -% -% Available design variables -% 2D Design variables -% FFD_CONTROL_POINT_2D ( 19, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, x_Mov, y_Mov ) -% FFD_CAMBER_2D ( 20, Scale | Mark. List | FFD_BoxTag, i_Ind ) -% FFD_THICKNESS_2D ( 21, Scale | Mark. List | FFD_BoxTag, i_Ind ) -% FFD_TWIST_2D ( 22, Scale | Mark. List | FFD_BoxTag, x_Orig, y_Orig ) -% HICKS_HENNE ( 30, Scale | Mark. List | Lower(0)/Upper(1) side, x_Loc ) -% ANGLE_OF_ATTACK ( 101, Scale | Mark. List | 1.0 ) -% -% 3D Design variables -% FFD_CONTROL_POINT ( 11, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, k_Ind, x_Mov, y_Mov, z_Mov ) -% FFD_NACELLE ( 12, Scale | Mark. List | FFD_BoxTag, rho_Ind, theta_Ind, phi_Ind, rho_Mov, phi_Mov ) -% FFD_GULL ( 13, Scale | Mark. List | FFD_BoxTag, j_Ind ) -% FFD_CAMBER ( 14, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) -% FFD_TWIST ( 15, Scale | Mark. List | FFD_BoxTag, j_Ind, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% FFD_THICKNESS ( 16, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) -% FFD_ROTATION ( 18, Scale | Mark. List | FFD_BoxTag, x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) -% FFD_ANGLE_OF_ATTACK ( 24, Scale | Mark. List | FFD_BoxTag, 1.0 ) -% -% Global design variables -% TRANSLATION ( 1, Scale | Mark. List | x_Disp, y_Disp, z_Disp ) -% ROTATION ( 2, Scale | Mark. List | x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) - -% Optimization objective function with optional scaling factor -% ex= Objective * Scale -OPT_OBJECTIVE= DRAG * 0.001 - -% Optimization constraint functions with scaling factors, separated by semicolons -% ex= (Objective = Value ) * Scale, use '>','<','=' -OPT_CONSTRAINT= NONE - -% List of design variables (Design variables are separated by semicolons) -DEFINITION_DV= ( 30, 1.0 | AIRFOIL | 0, 0.05 ); ( 30, 1.0 | AIRFOIL | 0, 0.10 ); ( 30, 1.0 | AIRFOIL | 0, 0.15 ); ( 30, 1.0 | AIRFOIL | 0, 0.20 ); ( 30, 1.0 | AIRFOIL | 0, 0.25 ); ( 30, 1.0 | AIRFOIL | 0, 0.30 ); ( 30, 1.0 | AIRFOIL | 0, 0.35 ); ( 30, 1.0 | AIRFOIL | 0, 0.40 ); ( 30, 1.0 | AIRFOIL | 0, 0.45 ); ( 30, 1.0 | AIRFOIL | 0, 0.50 ); ( 30, 1.0 | AIRFOIL | 0, 0.55 ); ( 30, 1.0 | AIRFOIL | 0, 0.60 ); ( 30, 1.0 | AIRFOIL | 0, 0.65 ); ( 30, 1.0 | AIRFOIL | 0, 0.70 ); ( 30, 1.0 | AIRFOIL | 0, 0.75 ); ( 30, 1.0 | AIRFOIL | 0, 0.80 ); ( 30, 1.0 | AIRFOIL | 0, 0.85 ); ( 30, 1.0 | AIRFOIL | 0, 0.90 ); ( 30, 1.0 | AIRFOIL | 0, 0.95 ); ( 30, 1.0 | AIRFOIL | 1, 0.05 ); ( 30, 1.0 | AIRFOIL | 1, 0.10 ); ( 30, 1.0 | AIRFOIL | 1, 0.15 ); ( 30, 1.0 | AIRFOIL | 1, 0.20 ); ( 30, 1.0 | AIRFOIL | 1, 0.25 ); ( 30, 1.0 | AIRFOIL | 1, 0.30 ); ( 30, 1.0 | AIRFOIL | 1, 0.35 ); ( 30, 1.0 | AIRFOIL | 1, 0.40 ); ( 30, 1.0 | AIRFOIL | 1, 0.45 ); ( 30, 1.0 | AIRFOIL | 1, 0.50 ); ( 30, 1.0 | AIRFOIL | 1, 0.55 ); ( 30, 1.0 | AIRFOIL | 1, 0.60 ); ( 30, 1.0 | AIRFOIL | 1, 0.65 ); ( 30, 1.0 | AIRFOIL | 1, 0.70 ); ( 30, 1.0 | AIRFOIL | 1, 0.75 ); ( 30, 1.0 | AIRFOIL | 1, 0.80 ); ( 30, 1.0 | AIRFOIL | 1, 0.85 ); ( 30, 1.0 | AIRFOIL | 1, 0.90 ); ( 30, 1.0 | AIRFOIL | 1, 0.95 ) - +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_MOMENTUM-X, RMS_MOMENTUM-Y, RMS_NU_TILDE, LIFT, DRAG) diff --git a/TestCases/turbulence_models/sa/rae2822/turb_SA_QCR_RAE2822.cfg b/TestCases/turbulence_models/sa/rae2822/turb_SA_QCR_RAE2822.cfg index 40e0dd6e7d82..08a934789240 100644 --- a/TestCases/turbulence_models/sa/rae2822/turb_SA_QCR_RAE2822.cfg +++ b/TestCases/turbulence_models/sa/rae2822/turb_SA_QCR_RAE2822.cfg @@ -155,42 +155,6 @@ MUSCL_TURB= NO % Time discretization (EULER_IMPLICIT) TIME_DISCRE_TURB= EULER_IMPLICIT -% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------% -% Adjoint problem boundary condition (DRAG, LIFT, SIDEFORCE, MOMENT_X, -% MOMENT_Y, MOMENT_Z, EFFICIENCY, -% EQUIVALENT_AREA, NEARFIELD_PRESSURE, -% FORCE_X, FORCE_Y, FORCE_Z, THRUST, -% TORQUE, FREE_SURFACE, TOTAL_HEAT, -% MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, -% INVERSE_DESIGN_HEATFLUX) -OBJECTIVE_FUNCTION= DRAG -% -% Convective numerical method (JST, LAX-FRIEDRICH, ROE) -CONV_NUM_METHOD_ADJFLOW= JST -% -% Monotonic Upwind Scheme for Conservation Laws (TVD) in the adjoint flow equations. -% Required for 2nd order upwind schemes (NO, YES) -MUSCL_ADJFLOW= YES -% -% Slope limiter (NONE, VENKATAKRISHNAN, BARTH_JESPERSEN, VAN_ALBADA_EDGE, -% SHARP_EDGES, WALL_DISTANCE) -SLOPE_LIMITER_ADJFLOW= NONE -% -% Coefficient for the sharp edges limiter -ADJ_SHARP_LIMITER_COEFF= 3.0 -% -% 2nd, and 4th order artificial dissipation coefficients -ADJ_JST_SENSOR_COEFF= ( 0.0, 0.01 ) -% -% Reduction factor of the CFL coefficient in the adjoint problem -CFL_REDUCTION_ADJFLOW= 0.75 -% -% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT) -TIME_DISCRE_ADJFLOW= EULER_IMPLICIT -% -% Adjoint frozen viscosity (NO, YES) -FROZEN_VISC_CONT= YES - % --------------------------- CONVERGENCE PARAMETERS --------------------------% % % Min value of the residual (log10 of the residual) @@ -204,7 +168,6 @@ CONV_CAUCHY_ELEMS= 100 % % Epsilon to control the series convergence CONV_CAUCHY_EPS= 1E-6 -% % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % @@ -220,9 +183,6 @@ MESH_OUT_FILENAME= mesh_out.su2 % Restart flow input file SOLUTION_FILENAME= solution_flow.dat % -% Restart adjoint input file -SOLUTION_ADJ_FILENAME= solution_adj.dat -% % Output file format (PARAVIEW, TECPLOT, STL) TABULAR_FORMAT= CSV % @@ -232,119 +192,14 @@ CONV_FILENAME= history % Output file restart flow RESTART_FILENAME= restart_flow.dat % -% Output file restart adjoint -RESTART_ADJ_FILENAME= restart_adj.dat -% % Output file flow (w/o extension) variables VOLUME_FILENAME= flow % -% Output file adjoint (w/o extension) variables -VOLUME_ADJ_FILENAME= adjoint -% -% Output objective function gradient (using continuous adjoint) -GRAD_OBJFUNC_FILENAME= of_grad.dat -% % Output file surface flow coefficient (w/o extension) SURFACE_FILENAME= surface_flow % -% Output file surface adjoint coefficient (w/o extension) -SURFACE_ADJ_FILENAME= surface_adjoint -% % Writing solution file frequency OUTPUT_WRT_FREQ= 250 % -% % Screen output fields -SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_NU_TILDE, LIFT, DRAG) - -% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% -% -% Kind of deformation (FFD_SETTING, HICKS_HENNE, PARABOLIC, NACA_4DIGITS, -% DISPLACEMENT, ROTATION, FFD_CONTROL_POINT, -% FFD_DIHEDRAL_ANGLE, FFD_TWIST_ANGLE, -% FFD_ROTATION, FFD_CAMBER, FFD_THICKNESS, FFD_VOLUME -% SURFACE_FILE) -DV_KIND= FFD_SETTING -% -% Marker of the surface to which we are going apply the shape deformation -DV_MARKER= ( AIRFOIL ) -% -% Parameters of the shape deformation -% - HICKS_HENNE ( Lower Surface (0)/Upper Surface (1)/Only one Surface (2), x_Loc ) -% - NACA_4DIGITS ( 1st digit, 2nd digit, 3rd and 4th digit ) -% - PARABOLIC ( Center, Thickness ) -% - DISPLACEMENT ( x_Disp, y_Disp, z_Disp ) -% - ROTATION ( x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - OBSTACLE ( Center, Bump size ) -% - FFD_CONTROL_POINT ( FFD_BoxTag ID, i_Ind, j_Ind, k_Ind, x_Disp, y_Disp, z_Disp ) -% - FFD_DIHEDRAL_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - FFD_TWIST_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - FFD_ROTATION ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - FFD_CAMBER ( FFD_BoxTag ID, i_Ind, j_Ind ) -% - FFD_THICKNESS ( FFD_BoxTag ID, i_Ind, j_Ind ) -% - FFD_VOLUME ( FFD_BoxTag ID, i_Ind, j_Ind ) -DV_PARAM= ( 1, 0.5 ) -% -% New value of the shape deformation -DV_VALUE= 0.01 -% -% Hold the grid fixed in a region (NO, YES) -HOLD_GRID_FIXED= NO -% -% Coordinates of the box where the grid will be deformed (Xmin, Ymin, Zmin, -% Xmax, Ymax, Zmax) -HOLD_GRID_FIXED_COORD= ( -0.5, -0.49, 0.0, 2.5, 0.49, 0.0 ) - -% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------% -% -% Available flow based objective functions or constraint functions -% DRAG, LIFT, SIDEFORCE, EFFICIENCY, BUFFET, -% FORCE_X, FORCE_Y, FORCE_Z, -% MOMENT_X, MOMENT_Y, MOMENT_Z, -% THRUST, TORQUE, FIGURE_OF_MERIT, -% EQUIVALENT_AREA, NEARFIELD_PRESSURE, -% TOTAL_HEATFLUX, MAXIMUM_HEATFLUX, -% INVERSE_DESIGN_PRESSURE, INVERSE_DESIGN_HEATFLUX, -% SURFACE_TOTAL_PRESSURE, SURFACE_MASSFLOW -% SURFACE_STATIC_PRESSURE, SURFACE_MACH -% -% Available geometrical based objective functions or constraint functions -% AIRFOIL_AREA, AIRFOIL_THICKNESS, AIRFOIL_CHORD, AIRFOIL_TOC, AIRFOIL_AOA, -% WING_VOLUME, WING_MIN_THICKNESS, WING_MAX_THICKNESS, WING_MAX_CHORD, WING_MIN_TOC, WING_MAX_TWIST, WING_MAX_CURVATURE, WING_MAX_DIHEDRAL -% STATION#_WIDTH, STATION#_AREA, STATION#_THICKNESS, STATION#_CHORD, STATION#_TOC, -% STATION#_TWIST (where # is the index of the station defined in GEO_LOCATION_STATIONS) -% -% Available design variables -% 2D Design variables -% FFD_CONTROL_POINT_2D ( 19, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, x_Mov, y_Mov ) -% FFD_CAMBER_2D ( 20, Scale | Mark. List | FFD_BoxTag, i_Ind ) -% FFD_THICKNESS_2D ( 21, Scale | Mark. List | FFD_BoxTag, i_Ind ) -% FFD_TWIST_2D ( 22, Scale | Mark. List | FFD_BoxTag, x_Orig, y_Orig ) -% HICKS_HENNE ( 30, Scale | Mark. List | Lower(0)/Upper(1) side, x_Loc ) -% ANGLE_OF_ATTACK ( 101, Scale | Mark. List | 1.0 ) -% -% 3D Design variables -% FFD_CONTROL_POINT ( 11, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, k_Ind, x_Mov, y_Mov, z_Mov ) -% FFD_NACELLE ( 12, Scale | Mark. List | FFD_BoxTag, rho_Ind, theta_Ind, phi_Ind, rho_Mov, phi_Mov ) -% FFD_GULL ( 13, Scale | Mark. List | FFD_BoxTag, j_Ind ) -% FFD_CAMBER ( 14, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) -% FFD_TWIST ( 15, Scale | Mark. List | FFD_BoxTag, j_Ind, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% FFD_THICKNESS ( 16, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) -% FFD_ROTATION ( 18, Scale | Mark. List | FFD_BoxTag, x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) -% FFD_ANGLE_OF_ATTACK ( 24, Scale | Mark. List | FFD_BoxTag, 1.0 ) -% -% Global design variables -% TRANSLATION ( 1, Scale | Mark. List | x_Disp, y_Disp, z_Disp ) -% ROTATION ( 2, Scale | Mark. List | x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) - -% Optimization objective function with optional scaling factor -% ex= Objective * Scale -OPT_OBJECTIVE= DRAG * 0.001 - -% Optimization constraint functions with scaling factors, separated by semicolons -% ex= (Objective = Value ) * Scale, use '>','<','=' -OPT_CONSTRAINT= NONE - -% List of design variables (Design variables are separated by semicolons) -DEFINITION_DV= ( 30, 1.0 | AIRFOIL | 0, 0.05 ); ( 30, 1.0 | AIRFOIL | 0, 0.10 ); ( 30, 1.0 | AIRFOIL | 0, 0.15 ); ( 30, 1.0 | AIRFOIL | 0, 0.20 ); ( 30, 1.0 | AIRFOIL | 0, 0.25 ); ( 30, 1.0 | AIRFOIL | 0, 0.30 ); ( 30, 1.0 | AIRFOIL | 0, 0.35 ); ( 30, 1.0 | AIRFOIL | 0, 0.40 ); ( 30, 1.0 | AIRFOIL | 0, 0.45 ); ( 30, 1.0 | AIRFOIL | 0, 0.50 ); ( 30, 1.0 | AIRFOIL | 0, 0.55 ); ( 30, 1.0 | AIRFOIL | 0, 0.60 ); ( 30, 1.0 | AIRFOIL | 0, 0.65 ); ( 30, 1.0 | AIRFOIL | 0, 0.70 ); ( 30, 1.0 | AIRFOIL | 0, 0.75 ); ( 30, 1.0 | AIRFOIL | 0, 0.80 ); ( 30, 1.0 | AIRFOIL | 0, 0.85 ); ( 30, 1.0 | AIRFOIL | 0, 0.90 ); ( 30, 1.0 | AIRFOIL | 0, 0.95 ); ( 30, 1.0 | AIRFOIL | 1, 0.05 ); ( 30, 1.0 | AIRFOIL | 1, 0.10 ); ( 30, 1.0 | AIRFOIL | 1, 0.15 ); ( 30, 1.0 | AIRFOIL | 1, 0.20 ); ( 30, 1.0 | AIRFOIL | 1, 0.25 ); ( 30, 1.0 | AIRFOIL | 1, 0.30 ); ( 30, 1.0 | AIRFOIL | 1, 0.35 ); ( 30, 1.0 | AIRFOIL | 1, 0.40 ); ( 30, 1.0 | AIRFOIL | 1, 0.45 ); ( 30, 1.0 | AIRFOIL | 1, 0.50 ); ( 30, 1.0 | AIRFOIL | 1, 0.55 ); ( 30, 1.0 | AIRFOIL | 1, 0.60 ); ( 30, 1.0 | AIRFOIL | 1, 0.65 ); ( 30, 1.0 | AIRFOIL | 1, 0.70 ); ( 30, 1.0 | AIRFOIL | 1, 0.75 ); ( 30, 1.0 | AIRFOIL | 1, 0.80 ); ( 30, 1.0 | AIRFOIL | 1, 0.85 ); ( 30, 1.0 | AIRFOIL | 1, 0.90 ); ( 30, 1.0 | AIRFOIL | 1, 0.95 ) - +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_MOMENTUM-X, RMS_MOMENTUM-Y, RMS_NU_TILDE, LIFT, DRAG) From f175162b981f8f5f16bcbe5c700d9dcb0c29b191 Mon Sep 17 00:00:00 2001 From: Guillermo Suarez Date: Fri, 29 Oct 2021 10:37:39 +0200 Subject: [PATCH 05/34] Update test case SA neg --- .../sa/rae2822/turb_SA_NEG_RAE2822.cfg | 147 +----------------- 1 file changed, 1 insertion(+), 146 deletions(-) diff --git a/TestCases/turbulence_models/sa/rae2822/turb_SA_NEG_RAE2822.cfg b/TestCases/turbulence_models/sa/rae2822/turb_SA_NEG_RAE2822.cfg index c0be1c6101c6..c43880c94101 100644 --- a/TestCases/turbulence_models/sa/rae2822/turb_SA_NEG_RAE2822.cfg +++ b/TestCases/turbulence_models/sa/rae2822/turb_SA_NEG_RAE2822.cfg @@ -152,42 +152,6 @@ MUSCL_TURB= NO % Time discretization (EULER_IMPLICIT) TIME_DISCRE_TURB= EULER_IMPLICIT -% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------% -% Adjoint problem boundary condition (DRAG, LIFT, SIDEFORCE, MOMENT_X, -% MOMENT_Y, MOMENT_Z, EFFICIENCY, -% EQUIVALENT_AREA, NEARFIELD_PRESSURE, -% FORCE_X, FORCE_Y, FORCE_Z, THRUST, -% TORQUE, FREE_SURFACE, TOTAL_HEAT, -% MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, -% INVERSE_DESIGN_HEATFLUX) -OBJECTIVE_FUNCTION= DRAG -% -% Convective numerical method (JST, LAX-FRIEDRICH, ROE) -CONV_NUM_METHOD_ADJFLOW= JST -% -% Monotonic Upwind Scheme for Conservation Laws (TVD) in the adjoint flow equations. -% Required for 2nd order upwind schemes (NO, YES) -MUSCL_ADJFLOW= YES -% -% Slope limiter (NONE, VENKATAKRISHNAN, BARTH_JESPERSEN, VAN_ALBADA_EDGE, -% SHARP_EDGES, WALL_DISTANCE) -SLOPE_LIMITER_ADJFLOW= NONE -% -% Coefficient for the sharp edges limiter -ADJ_SHARP_LIMITER_COEFF= 3.0 -% -% 2nd, and 4th order artificial dissipation coefficients -ADJ_JST_SENSOR_COEFF= ( 0.0, 0.01 ) -% -% Reduction factor of the CFL coefficient in the adjoint problem -CFL_REDUCTION_ADJFLOW= 0.75 -% -% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT) -TIME_DISCRE_ADJFLOW= EULER_IMPLICIT -% -% Adjoint frozen viscosity (NO, YES) -FROZEN_VISC_CONT= YES - % --------------------------- CONVERGENCE PARAMETERS --------------------------% % % Min value of the residual (log10 of the residual) @@ -201,7 +165,6 @@ CONV_CAUCHY_ELEMS= 100 % % Epsilon to control the series convergence CONV_CAUCHY_EPS= 1E-6 -% % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % @@ -217,9 +180,6 @@ MESH_OUT_FILENAME= mesh_out.su2 % Restart flow input file SOLUTION_FILENAME= solution_flow.dat % -% Restart adjoint input file -SOLUTION_ADJ_FILENAME= solution_adj.dat -% % Output file format (PARAVIEW, TECPLOT, STL) TABULAR_FORMAT= CSV % @@ -229,119 +189,14 @@ CONV_FILENAME= history % Output file restart flow RESTART_FILENAME= restart_flow.dat % -% Output file restart adjoint -RESTART_ADJ_FILENAME= restart_adj.dat -% % Output file flow (w/o extension) variables VOLUME_FILENAME= flow % -% Output file adjoint (w/o extension) variables -VOLUME_ADJ_FILENAME= adjoint -% -% Output objective function gradient (using continuous adjoint) -GRAD_OBJFUNC_FILENAME= of_grad.dat -% % Output file surface flow coefficient (w/o extension) SURFACE_FILENAME= surface_flow % -% Output file surface adjoint coefficient (w/o extension) -SURFACE_ADJ_FILENAME= surface_adjoint -% % Writing solution file frequency OUTPUT_WRT_FREQ= 250 % -% % Screen output fields -SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_NU_TILDE, LIFT, DRAG) - -% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% -% -% Kind of deformation (FFD_SETTING, HICKS_HENNE, PARABOLIC, NACA_4DIGITS, -% DISPLACEMENT, ROTATION, FFD_CONTROL_POINT, -% FFD_DIHEDRAL_ANGLE, FFD_TWIST_ANGLE, -% FFD_ROTATION, FFD_CAMBER, FFD_THICKNESS, FFD_VOLUME -% SURFACE_FILE) -DV_KIND= FFD_SETTING -% -% Marker of the surface to which we are going apply the shape deformation -DV_MARKER= ( AIRFOIL ) -% -% Parameters of the shape deformation -% - HICKS_HENNE ( Lower Surface (0)/Upper Surface (1)/Only one Surface (2), x_Loc ) -% - NACA_4DIGITS ( 1st digit, 2nd digit, 3rd and 4th digit ) -% - PARABOLIC ( Center, Thickness ) -% - DISPLACEMENT ( x_Disp, y_Disp, z_Disp ) -% - ROTATION ( x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - OBSTACLE ( Center, Bump size ) -% - FFD_CONTROL_POINT ( FFD_BoxTag ID, i_Ind, j_Ind, k_Ind, x_Disp, y_Disp, z_Disp ) -% - FFD_DIHEDRAL_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - FFD_TWIST_ANGLE ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - FFD_ROTATION ( FFD_BoxTag ID, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% - FFD_CAMBER ( FFD_BoxTag ID, i_Ind, j_Ind ) -% - FFD_THICKNESS ( FFD_BoxTag ID, i_Ind, j_Ind ) -% - FFD_VOLUME ( FFD_BoxTag ID, i_Ind, j_Ind ) -DV_PARAM= ( 1, 0.5 ) -% -% New value of the shape deformation -DV_VALUE= 0.01 -% -% Hold the grid fixed in a region (NO, YES) -HOLD_GRID_FIXED= NO -% -% Coordinates of the box where the grid will be deformed (Xmin, Ymin, Zmin, -% Xmax, Ymax, Zmax) -HOLD_GRID_FIXED_COORD= ( -0.5, -0.49, 0.0, 2.5, 0.49, 0.0 ) - -% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------% -% -% Available flow based objective functions or constraint functions -% DRAG, LIFT, SIDEFORCE, EFFICIENCY, BUFFET, -% FORCE_X, FORCE_Y, FORCE_Z, -% MOMENT_X, MOMENT_Y, MOMENT_Z, -% THRUST, TORQUE, FIGURE_OF_MERIT, -% EQUIVALENT_AREA, NEARFIELD_PRESSURE, -% TOTAL_HEATFLUX, MAXIMUM_HEATFLUX, -% INVERSE_DESIGN_PRESSURE, INVERSE_DESIGN_HEATFLUX, -% SURFACE_TOTAL_PRESSURE, SURFACE_MASSFLOW -% SURFACE_STATIC_PRESSURE, SURFACE_MACH -% -% Available geometrical based objective functions or constraint functions -% AIRFOIL_AREA, AIRFOIL_THICKNESS, AIRFOIL_CHORD, AIRFOIL_TOC, AIRFOIL_AOA, -% WING_VOLUME, WING_MIN_THICKNESS, WING_MAX_THICKNESS, WING_MAX_CHORD, WING_MIN_TOC, WING_MAX_TWIST, WING_MAX_CURVATURE, WING_MAX_DIHEDRAL -% STATION#_WIDTH, STATION#_AREA, STATION#_THICKNESS, STATION#_CHORD, STATION#_TOC, -% STATION#_TWIST (where # is the index of the station defined in GEO_LOCATION_STATIONS) -% -% Available design variables -% 2D Design variables -% FFD_CONTROL_POINT_2D ( 19, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, x_Mov, y_Mov ) -% FFD_CAMBER_2D ( 20, Scale | Mark. List | FFD_BoxTag, i_Ind ) -% FFD_THICKNESS_2D ( 21, Scale | Mark. List | FFD_BoxTag, i_Ind ) -% FFD_TWIST_2D ( 22, Scale | Mark. List | FFD_BoxTag, x_Orig, y_Orig ) -% HICKS_HENNE ( 30, Scale | Mark. List | Lower(0)/Upper(1) side, x_Loc ) -% ANGLE_OF_ATTACK ( 101, Scale | Mark. List | 1.0 ) -% -% 3D Design variables -% FFD_CONTROL_POINT ( 11, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, k_Ind, x_Mov, y_Mov, z_Mov ) -% FFD_NACELLE ( 12, Scale | Mark. List | FFD_BoxTag, rho_Ind, theta_Ind, phi_Ind, rho_Mov, phi_Mov ) -% FFD_GULL ( 13, Scale | Mark. List | FFD_BoxTag, j_Ind ) -% FFD_CAMBER ( 14, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) -% FFD_TWIST ( 15, Scale | Mark. List | FFD_BoxTag, j_Ind, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End ) -% FFD_THICKNESS ( 16, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind ) -% FFD_ROTATION ( 18, Scale | Mark. List | FFD_BoxTag, x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) -% FFD_ANGLE_OF_ATTACK ( 24, Scale | Mark. List | FFD_BoxTag, 1.0 ) -% -% Global design variables -% TRANSLATION ( 1, Scale | Mark. List | x_Disp, y_Disp, z_Disp ) -% ROTATION ( 2, Scale | Mark. List | x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn ) - -% Optimization objective function with optional scaling factor -% ex= Objective * Scale -OPT_OBJECTIVE= DRAG * 0.001 - -% Optimization constraint functions with scaling factors, separated by semicolons -% ex= (Objective = Value ) * Scale, use '>','<','=' -OPT_CONSTRAINT= NONE - -% List of design variables (Design variables are separated by semicolons) -DEFINITION_DV= ( 30, 1.0 | AIRFOIL | 0, 0.05 ); ( 30, 1.0 | AIRFOIL | 0, 0.10 ); ( 30, 1.0 | AIRFOIL | 0, 0.15 ); ( 30, 1.0 | AIRFOIL | 0, 0.20 ); ( 30, 1.0 | AIRFOIL | 0, 0.25 ); ( 30, 1.0 | AIRFOIL | 0, 0.30 ); ( 30, 1.0 | AIRFOIL | 0, 0.35 ); ( 30, 1.0 | AIRFOIL | 0, 0.40 ); ( 30, 1.0 | AIRFOIL | 0, 0.45 ); ( 30, 1.0 | AIRFOIL | 0, 0.50 ); ( 30, 1.0 | AIRFOIL | 0, 0.55 ); ( 30, 1.0 | AIRFOIL | 0, 0.60 ); ( 30, 1.0 | AIRFOIL | 0, 0.65 ); ( 30, 1.0 | AIRFOIL | 0, 0.70 ); ( 30, 1.0 | AIRFOIL | 0, 0.75 ); ( 30, 1.0 | AIRFOIL | 0, 0.80 ); ( 30, 1.0 | AIRFOIL | 0, 0.85 ); ( 30, 1.0 | AIRFOIL | 0, 0.90 ); ( 30, 1.0 | AIRFOIL | 0, 0.95 ); ( 30, 1.0 | AIRFOIL | 1, 0.05 ); ( 30, 1.0 | AIRFOIL | 1, 0.10 ); ( 30, 1.0 | AIRFOIL | 1, 0.15 ); ( 30, 1.0 | AIRFOIL | 1, 0.20 ); ( 30, 1.0 | AIRFOIL | 1, 0.25 ); ( 30, 1.0 | AIRFOIL | 1, 0.30 ); ( 30, 1.0 | AIRFOIL | 1, 0.35 ); ( 30, 1.0 | AIRFOIL | 1, 0.40 ); ( 30, 1.0 | AIRFOIL | 1, 0.45 ); ( 30, 1.0 | AIRFOIL | 1, 0.50 ); ( 30, 1.0 | AIRFOIL | 1, 0.55 ); ( 30, 1.0 | AIRFOIL | 1, 0.60 ); ( 30, 1.0 | AIRFOIL | 1, 0.65 ); ( 30, 1.0 | AIRFOIL | 1, 0.70 ); ( 30, 1.0 | AIRFOIL | 1, 0.75 ); ( 30, 1.0 | AIRFOIL | 1, 0.80 ); ( 30, 1.0 | AIRFOIL | 1, 0.85 ); ( 30, 1.0 | AIRFOIL | 1, 0.90 ); ( 30, 1.0 | AIRFOIL | 1, 0.95 ) - +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_MOMENTUM-X, RMS_MOMENTUM-Y, RMS_NU_TILDE, LIFT, DRAG) From 3dd64f44e37b8b4ada9a31c5d450b722d3ef8554 Mon Sep 17 00:00:00 2001 From: Guillermo Suarez Date: Fri, 14 Jan 2022 14:37:02 +0100 Subject: [PATCH 06/34] Update work --- .../numerics/turbulent/turb_sources.hpp | 542 ++++++++++++++++-- 1 file changed, 491 insertions(+), 51 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 46bfd3894b2e..8f9828162df6 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -40,7 +40,7 @@ template class CSourceBase_TurbSA : public CNumerics { protected: - /*--- List of constants and auxiliary functions ---*/ + /*--- List of constants ---*/ su2double cv1_3, k2, cb1, @@ -54,6 +54,15 @@ class CSourceBase_TurbSA : public CNumerics { cw1, cr1; + /*--- List of auxiliary functions ---*/ + su2double ft2, d_ft2, + r, d_r, + g, d_g, g_6, glim, + fw, + Ji, Ji_2, Ji_3, d_Ji, + S, Omega, Shat, d_Shat, inv_Shat, + fv1, fv2; + su2double Gamma_BC = 0.0; su2double intermittency; @@ -124,7 +133,10 @@ class CSourceBase_TurbSA : public CNumerics { */ inline su2double GetCrossProduction(void) const final { return CrossProduction; } - su2double ComputeXsi(const su2double nue, const su2double nul) { return nue/nul + cr1*(roughness_i/(dist_i+EPS)); //roughness_i = 0 for smooth walls and Ji remains the same, changes only if roughness is specified.nue/nul } + inline su2double ComputeXsi(const su2double nue, const su2double nul, su2double xsi, su2double d_xsi) { + xsi = nue/nul + cr1*(roughness_i/(dist_i+EPS)); //roughness_i = 0 for smooth walls and Ji remains the same, changes only if roughness is specified.nue/nul + d_xsi = 1.0/nul; + } /*! * \brief Residual for source term integration. @@ -132,95 +144,523 @@ class CSourceBase_TurbSA : public CNumerics { * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. */ ResidualType<> ComputeResidual(const CConfig* config) final { + + // Set the boolean here depending on whether the point is closest to a rough wall or not. + roughwall = (roughness_i > 0.0); + + if (incompressible) { + Density_i = V_i[nDim+2]; + Laminar_Viscosity_i = V_i[nDim+4]; + } + else { + Density_i = V_i[nDim+2]; + Laminar_Viscosity_i = V_i[nDim+5]; + } + + Residual = 0.0; + Production = 0.0; + Destruction = 0.0; + CrossProduction = 0.0; + Jacobian_i[0] = 0.0; + + /*--- Evaluate Omega ---*/ + + Omega = sqrt(Vorticity_i[0]*Vorticity_i[0] + Vorticity_i[1]*Vorticity_i[1] + Vorticity_i[2]*Vorticity_i[2]); + + /*--- Rotational correction term ---*/ + + if (rotating_frame) { Omega += 2.0*min(0.0, StrainMag_i-Omega); } + + if (dist_i > 1e-10) { + + /*--- Production term ---*/ + + dist_i_2 = dist_i*dist_i; + nu = Laminar_Viscosity_i/Density_i; + + /*--- Modified values for roughness ---*/ + /*--- Ref: Aupoix, B. and Spalart, P. R., "Extensions of the Spalart-Allmaras Turbulence Model to Account for Wall Roughness," + * International Journal of Heat and Fluid Flow, Vol. 24, 2003, pp. 454-462. ---*/ + /* --- See https://turbmodels.larc.nasa.gov/spalart.html#sarough for detailed explanation. ---*/ + + ComputeXsi(ScalarVar_i[0], Laminar_Viscosity_i, &Ji, &d_Ji); + Ji_2 = Ji*Ji; + Ji_3 = Ji_2*Ji; + fv1 = Ji_3/(Ji_3+cv1_3); + + /*--- Using a modified relation so as to not change the Shat that depends on fv2. ---*/ + fv2 = 1.0 - ScalarVar_i[0]/(nu+ScalarVar_i[0]*fv1); // From NASA turb modeling resource and 2003 paper + + ft2 = ct3*exp(-ct4*Ji_2); + S = Omega; + inv_k2_d2 = 1.0/(k2*dist_i_2); + + Shat = S + ScalarVar_i[0]*fv2*inv_k2_d2; + Shat = max(Shat, 1.0e-10); + inv_Shat = 1.0/Shat; + + // Original SA model + // Production = cb1*(1.0-ft2)*Shat*ScalarVar_i[0]*Volume; + + if (transition) { + + /*--- BC model constants (2020 revision). ---*/ + const su2double chi_1 = 0.002; + const su2double chi_2 = 50.0; + + /*--- turbulence intensity is u'/U so we multiply by 100 to get percentage ---*/ + su2double tu = 100.0 * config->GetTurbulenceIntensity_FreeStream(); + + su2double nu_t = (ScalarVar_i[0]*fv1); //S-A variable + + su2double re_v = ((Density_i*pow(dist_i,2.))/(Laminar_Viscosity_i))*Omega; + su2double re_theta = re_v/2.193; + su2double re_theta_t = (803.73 * pow((tu + 0.6067),-1.027)); //MENTER correlation + //re_theta_t = 163.0 + exp(6.91-tu); //ABU-GHANNAM & SHAW correlation + + su2double term1 = sqrt(max(re_theta-re_theta_t,0.)/(chi_1*re_theta_t)); + su2double term2 = sqrt(max((nu_t*chi_2)/nu,0.)); + su2double term_exponential = (term1 + term2); + + Gamma_BC = 1.0 - exp(-term_exponential); + + Production = Gamma_BC*cb1*Shat*ScalarVar_i[0]*Volume; + } + else { + Production = cb1*Shat*ScalarVar_i[0]*Volume; + } + + /*--- Destruction term ---*/ + + r = min(ScalarVar_i[0]*inv_Shat*inv_k2_d2,10.0); + g = r + cw2*(pow(r,6.0)-r); + g_6 = pow(g,6.0); + glim = pow((1.0+cw3_6)/(g_6+cw3_6),1.0/6.0); + fw = g*glim; + + // Original SA model + // Destruction = (cw1*fw-cb1*ft2/k2)*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; + + Destruction = cw1*fw*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; + + /*--- Diffusion term ---*/ + + norm2_Grad = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + norm2_Grad += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; + + CrossProduction = cb2_sigma*norm2_Grad*Volume; + + Residual = Production - Destruction + CrossProduction; + + /*--- Implicit part, production term ---*/ + + dfv1 = 3.0*Ji_2*cv1_3/(nu*pow(Ji_3+cv1_3,2.)); + dfv2 = -(1/nu-Ji_2*dfv1)/pow(1.+Ji*fv1,2.); + if ( Shat <= 1.0e-10 ) dShat = 0.0; + else dShat = (fv2+ScalarVar_i[0]*dfv2)*inv_k2_d2; + + if (transition) { + Jacobian_i[0] += Gamma_BC*cb1*(ScalarVar_i[0]*dShat+Shat)*Volume; + } + else { + Jacobian_i[0] += cb1*(ScalarVar_i[0]*dShat+Shat)*Volume; + } + + /*--- Implicit part, destruction term ---*/ + + dr = (Shat-ScalarVar_i[0]*dShat)*inv_Shat*inv_Shat*inv_k2_d2; + if (r == 10.0) dr = 0.0; + dg = dr*(1.+cw2*(6.0*pow(r,5.0)-1.0)); + dfw = dg*glim*(1.-g_6/(g_6+cw3_6)); + Jacobian_i[0] -= cw1*(dfw*ScalarVar_i[0] + 2.0*fw)*ScalarVar_i[0]/dist_i_2*Volume; + + ft2_class::get(&ft2, &d_ft2); + + su2double pingu = ft2*3.14; + + ModVort_class::get(); }; }; /*------------------------------------------------------------------------------ -| Define the Spalart-Allmaras variation/corrections. -| \author A. Bueno., E.Molina, F. Palacios +| Compute the ft2-term and its derivative +| * \param[in] ct3 - constant ct3 +| * \param[in] ct4 - constant ct4 +| * \param[in] nue - nu_tilde +| * \param[in] nul - dynamic laminar viscosity +| * \param[out] ft2 - ft2 variable +| * \param[out] d_ft2 - derivative of ft2 w.r.t. nue variable ------------------------------------------------------------------------------*/ + /*! - * \brief SU2 baseline ft2 term value - * \param[in] ft2 - ft2 variable - * \param[in] d_ft2 - derivative of ft2 w.r.t. nue variable - * \return Zero + * \brief SU2 baseline ft2 term value and its derivative. ft2=0.0 */ -class ft2_bsl { static double get(su2double ft2, su2double d_ft2) { ft2 = 0.0; d_ft2 = 0.0; } }; +template +class ft2_Bsl : public Base { + static double get(su2double* ft2, su2double* d_ft2) { + *ft2 = 0.0; + *d_ft2 = 0.0; + } +}; /*! - * \brief non-zero ft2 term according to the literature. - * \param[in] ct3 - constant ct3 - * \param[in] ct4 - constant ct4 - * \param[in] nut - nu_tilde - * \param[in] nul - dynamic laminar viscosity - * \param[in] ft2 - ft2 variable - * \param[in] d_ft2 - derivative of ft2 w.r.t. nue variable + * \brief non-zero ft2 term according to the literature and its derivative. */ -class ft2_nonzero { - static void get(const su2double ct3, const su2double ct4, const su2double nue, const su2double nul, su2double ft2, su2double d_ft2) { - const su2double xsi = ComputeXsi(nue, nul), - xsi2 = xsi*xsi; +template +class ft2_nonzero : public Base { + using Base::ct3; + using Base::ct4; + using Base::xsi; + using Base::d_xsi; + + static void get(su2double* ft2, su2double* d_ft2) { - const su2double dxsi = 1.0/nul; + const su2double xsi2 = xsi*xsi; + + *ft2 = ct3*exp(-ct4*xsi2); + *d_ft2 = -2.0*ct4*xsi**ft2*d_xsi; + } +}; + +/*------------------------------------------------------------------------------ +| Compute the modified vorticity (\tilde{S}) and its derivative +| * \param[in] S - vorticity (Omega) +| * \param[in] PrimVar_Grad_i - Gradient of primitive variables at point i +| * \param[in] nul - dynamic laminar viscosity +| * \param[in] nue - nu_tilde +| * \param[in] fv1 - auxiliary function fv1 +| * \param[in] d_fv1 - derivative of fv1 w.r.t. nue variable +| * \param[in] fv2 - auxiliary function fv2 +| * \param[in] d_fv2 - derivative of fv2 w.r.t. nue variable +| * \param[in] inv_k2_d2 - 1/(k^2*d^2) +| * \param[out] Shat - modified vorticity (\tilde{S}) +| * \param[out] d_Shat - derivative of Shat w.r.t. nue variable +------------------------------------------------------------------------------*/ + +/*! + * \brief Baseline + */ +template +class ModVort_Bsl : Base { + using Base::S; + using Base::fv2; + using Base::d_fv2; + using Base::inv_k2_d2; + + static constexpr su2double nue = Base::ScalarVar_i[0]; + +public: + static void get(su2double* Shat, su2double* d_Shat) { + + const su2double Sbar = nue*fv2*inv_k2_d2; + + *Shat = S + Sbar; + *Shat = max(*Shat, 1.0e-10); + + const su2double d_Sbar = (fv2 + nue*d_fv2)*inv_k2_d2; - ft2 = ct3*exp(-ct4*xsi2); - d_ft2 = -2.0*ct4*xsi*ft2*dxsi; + *d_Shat = (*Shat <= 1.0e-10) ? 0.0 : d_Sbar; } }; -class ModVort_bsl { - static double get(const su2double S, const su2double nue, const su2double fv2, const su2double inv_k2_d2, const su2double d_fv2, su2double Shat, su2double d_Shat){ +/*! + * \brief Edward + */ +template +class ModVort_Edw { + using Base::nDim; + using Base::PrimVar_Grad_i; + using Base::fv1; + using Base::d_fv1; + using Base::rotating_frame; + using Base::StrainMag_i; + + static constexpr su2double xsi = Base::Ji; - Shat = S + nue*fv2*inv_k2_d2; - Shat = max(Shat, 1.0e-10); + static constexpr su2double nul = Base::Laminar_Viscosity_i; + static constexpr su2double nue = Base::ScalarVar_i[0]; + +public: + static void get(su2double* Shat, su2double* d_Shat) { + + unsigned short iDim, jDim; + + /*--- Evaluate Omega, here Omega is the Strain Rate ---*/ + + su2double Sbar = 0.0; + for(iDim=0;iDim +class ModVort_Neg : Base { + + static constexpr su2double nue = Base::ScalarVar_i[0]; + + static void get(su2double* Shat, su2double* d_Shat) { + + if (nue > 0.0) { + // Don't check whether Sbar <>= -cv2*S. + // Baseline solution + ModVort_Bsl::get(Shat, d_Shat); + } +// else { +// // No need for Sbar +// } - d_Shat = (Shat <= 1.0e-10) ? 0.0 : (fv2 + nue*d_fv2)*inv_k2_d2; } }; +/*------------------------------------------------------------------------------ +| Compute the auxiliary function r and its derivative. +| * \param[in] Shat - modified vorticity (\tilde{S}) +| * \param[in] d_Shat - derivative of Shat w.r.t. nue variable +| * \param[in] inv_Shat - inverse of modified vorticity (\tilde{S}) +| * \param[in] nue - nu_tilde +| * \param[in] inv_k2_d2 - 1/(k^2*d^2) +| * \param[out] r - auxiliary function r +| * \param[out] dr - derivative of auxiliary function r +------------------------------------------------------------------------------*/ -class ModVort_Edw { - static double get(const su2double nue, const su2double nul, const su2double fv1, const su2double inv_k2_d2, const su2double d_fv1, su2double Shat, su2double d_Shat){ +/*! + * \brief Baseline + */ +template +class r_Bsl { + using Base::Shat; + using Base::d_Shat; + using Base::inv_Shat; + using Base::inv_k2_d2; + + static constexpr su2double nue = Base::ScalarVar_i[0]; - /* - From NASA Turbulence model site. http://turbmodels.larc.nasa.gov/spalart.html - This form was developed primarily to improve the near-wall numerical behavior of the model (i.e., the goal was to improve the convergence behavior). The reference is: - Edwards, J. R. and Chandra, S. "Comparison of Eddy Viscosity-Transport Turbulence Models for Three-Dimensional, Shock-Separated Flowfields," AIAA Journal, Vol. 34, No. 4, 1996, pp. 756-763. - In this modificaton Omega is replaced by Strain Rate - */ +public: + static double get(su2double* r, su2double* d_r){ + + *r = min(nue*inv_Shat*inv_k2_d2,10.0); + + *d_r = (Shat-nue*d_Shat)*inv_Shat*inv_Shat*inv_k2_d2; + } +}; - const su2double xsi = ComputeXsi(nue, nul); +/*! + * \brief Edward + */ +template +class r_Edw { + using Base::Shat; + using Base::d_Shat; + using Base::inv_Shat; + using Base::inv_k2_d2; - /*--- Evaluate Omega, here Omega is the Strain Rate ---*/ + static constexpr su2double nue = Base::ScalarVar_i[0]; - su2double Sbar = 0.0; - for(iDim=0;iDim +class Production_Bsl{ + using Base::S; + using Base::ft2; + using Base::d_ft2; + using Base::Shat; + using Base::d_Shat; + using Base::ct3; + using Base::cb1; + + static constexpr su2double nue = Base::ScalarVar_i[0]; + +public: + static double get(su2double* Pr, su2double* d_Pr){ + + *Pr = cb1*(1. - ft2)*Shat*nue; + + *d_Pr = cb1*((1. - ft2)*(Shat + nue*d_Shat) - d_ft2); } }; +/*! + * \brief Negative + */ +template +class Production_Neg{ + using Base::S; + using Base::ct3; + using Base::cb1; + + static constexpr su2double nue = Base::ScalarVar_i[0]; + +public: + static double get(su2double* Pr, su2double* d_Pr){ + + if (nue > 0.0) { + // Baseline solution + Production_Bsl::get(Pr, d_Pr); + } + else { + *Pr = cb1*(1.0-ct3)*S*nue; + + *d_Pr = cb1*(1.0-ct3)*S; + } + } +}; + +/*------------------------------------------------------------------------------ +| Compute destruction term and its derivative. +| * \param[in] S - vorticity (Omega) +| * \param[in] PrimVar_Grad_i - Gradient of primitive variables at point i +| * \param[in] nul - dynamic laminar viscosity +| * \param[in] nue - nu_tilde +| * \param[in] fv1 - auxiliary function fv1 +| * \param[in] d_fv1 - derivative of fv1 w.r.t. nue variable +| * \param[in] fv2 - auxiliary function fv2 +| * \param[in] d_fv2 - derivative of fv2 w.r.t. nue variable +| * \param[in] inv_k2_d2 - 1/(k^2*d^2) +| * \param[out] Shat - modified vorticity (\tilde{S}) +| * \param[out] d_Shat - derivative of Shat w.r.t. nue variable +------------------------------------------------------------------------------*/ + +/*! + * \brief Baseline + */ +template +class Desctruction_Bsl{ + using Base::Shat; + using Base::d_Shat; + using Base::fw; + using Base::d_fw; + using Base::ft2; + using Base::d_ft2; + using Base::k2; + using Base::dist_i_2; + using Base::cw1; + using Base::cb1; + + static constexpr su2double nue = Base::ScalarVar_i[0]; + +public: + static double get(su2double* De, su2double* d_De){ + + *De = (cw1*fw-cb1*ft2/k2)*nue*nue/dist_i_2; + + *d_De = cw1*(d_fw*nue + 2.0*fw)*nue/dist_i_2; + } +}; + +/*! + * \brief Negative + */ +template +class Destruction_Neg{ + using Base::Shat; + using Base::d_Shat; + using Base::fw; + using Base::d_fw; + using Base::ft2; + using Base::d_ft2; + using Base::k2; + using Base::dist_i_2; + using Base::cw1; + using Base::cb1; + + static constexpr su2double nue = Base::ScalarVar_i[0]; + +public: + static double get(su2double* De, su2double* d_De){ + + if (nue > 0.0) { + // Baseline solution + Destruction_Bsl::get(De, d_De); + } + else { + *De = -cw1*nue*nue/dist_i_2; + + *d_De = -2.0*cw1*nue/dist_i_2; + } + } +}; +/*------------------------------------------------------------------------------ +| Compute cross production term and its derivative. +| * \param[in] S - vorticity (Omega) +| * \param[in] PrimVar_Grad_i - Gradient of primitive variables at point i +| * \param[in] nul - dynamic laminar viscosity +| * \param[in] nue - nu_tilde +| * \param[in] fv1 - auxiliary function fv1 +| * \param[in] d_fv1 - derivative of fv1 w.r.t. nue variable +| * \param[in] fv2 - auxiliary function fv2 +| * \param[in] d_fv2 - derivative of fv2 w.r.t. nue variable +| * \param[in] inv_k2_d2 - 1/(k^2*d^2) +| * \param[out] Shat - modified vorticity (\tilde{S}) +| * \param[out] d_Shat - derivative of Shat w.r.t. nue variable +------------------------------------------------------------------------------*/ +/*! + * \brief Baseline + */ +template +class CrossProduction_Bsl{ + using Base::norm2_Grad; + using Base::cb2_sigma; + static constexpr su2double nue = Base::ScalarVar_i[0]; + static double get(su2double* CrossProd, su2double* d_CrossProd){ + *CrossProd = cb2_sigma*norm2_Grad; + // No cross production influence in the Jacobian + *d_CrossProd = 0.0; + } +}; From 0cfb3b2f5f398e2f9fd96be9ed58ff2027678bd5 Mon Sep 17 00:00:00 2001 From: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> Date: Sat, 15 Jan 2022 22:22:06 +0000 Subject: [PATCH 07/34] Update TestCases/serial_regression.py --- TestCases/serial_regression.py | 88 ---------------------------------- 1 file changed, 88 deletions(-) diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 26ff7852ac64..153eda6f24a0 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -703,94 +703,6 @@ def main(): fem_ns_unsteady_cylinder_ader.tol = 0.00001 test_list.append(fem_ns_unsteady_cylinder_ader) - ########################### - ### Turbulence modeling ### - ########################### - - # SA Baseline (Identical to RANS SA RAE2822) - turbmod_sa_bsl_rae2822 = TestCase('turbmod_sa_bsl_rae2822') - turbmod_sa_bsl_rae2822.cfg_dir = "turbulence_models/sa/rae2822" - turbmod_sa_bsl_rae2822.cfg_file = "turb_SA_BSL_RAE2822.cfg" - turbmod_sa_bsl_rae2822.test_iter = rae2822_sa.test_iter - turbmod_sa_bsl_rae2822.test_vals = rae2822_sa.test_vals - turbmod_sa_bsl_rae2822.su2_exec = "SU2_CFD" - turbmod_sa_bsl_rae2822.timeout = rae2822_sa.timeout - turbmod_sa_bsl_rae2822.new_output = True - turbmod_sa_bsl_rae2822.tol = rae2822_sa.tol - test_list.append(turbmod_sa_bsl_rae2822) - - # SA Negative - turbmod_sa_neg_rae2822 = TestCase('turbmod_sa_neg_rae2822') - turbmod_sa_neg_rae2822.cfg_dir = "turbulence_models/sa/rae2822" - turbmod_sa_neg_rae2822.cfg_file = "turb_SA_NEG_RAE2822.cfg" - turbmod_sa_neg_rae2822.test_iter = 20 - turbmod_sa_neg_rae2822.test_vals = [-2.020123, -5.269330, 0.807147, 0.060499] - turbmod_sa_neg_rae2822.su2_exec = "SU2_CFD" - turbmod_sa_neg_rae2822.timeout = 1600 - turbmod_sa_neg_rae2822.new_output = True - turbmod_sa_neg_rae2822.tol = 0.00001 - test_list.append(turbmod_sa_neg_rae2822) - - # SA Compressibility Correction - turbmod_sa_comp_rae2822 = TestCase('turbmod_sa_comp_rae2822') - turbmod_sa_comp_rae2822.cfg_dir = "turbulence_models/sa/rae2822" - turbmod_sa_comp_rae2822.cfg_file = "turb_SA_COMP_RAE2822.cfg" - turbmod_sa_comp_rae2822.test_iter = 20 - turbmod_sa_comp_rae2822.test_vals = [-2.020123, -5.269330, 0.807147, 0.060499] - turbmod_sa_comp_rae2822.su2_exec = "SU2_CFD" - turbmod_sa_comp_rae2822.timeout = 1600 - turbmod_sa_comp_rae2822.new_output = True - turbmod_sa_comp_rae2822.tol = 0.00001 - test_list.append(turbmod_sa_comp_rae2822) - - # SA Edwards - turbmod_sa_edw_rae2822 = TestCase('turbmod_sa_edw_rae2822') - turbmod_sa_edw_rae2822.cfg_dir = "turbulence_models/sa/rae2822" - turbmod_sa_edw_rae2822.cfg_file = "turb_SA_EDW_RAE2822.cfg" - turbmod_sa_edw_rae2822.test_iter = 20 - turbmod_sa_edw_rae2822.test_vals = [-2.020123, -5.269330, 0.807147, 0.060499] - turbmod_sa_edw_rae2822.su2_exec = "SU2_CFD" - turbmod_sa_edw_rae2822.timeout = 1600 - turbmod_sa_edw_rae2822.new_output = True - turbmod_sa_edw_rae2822.tol = 0.00001 - test_list.append(turbmod_sa_edw_rae2822) - - # SA Compressibility and Edwards - turbmod_sa_comp_edw_rae2822 = TestCase('turbmod_sa_comp_edw_rae2822') - turbmod_sa_comp_edw_rae2822.cfg_dir = "turbulence_models/sa/rae2822" - turbmod_sa_comp_edw_rae2822.cfg_file = "turb_SA_COMP_EDW_RAE2822.cfg" - turbmod_sa_comp_edw_rae2822.test_iter = 20 - turbmod_sa_comp_edw_rae2822.test_vals = [-2.020123, -5.269330, 0.807147, 0.060499] - turbmod_sa_comp_edw_rae2822.su2_exec = "SU2_CFD" - turbmod_sa_comp_edw_rae2822.timeout = 1600 - turbmod_sa_comp_edw_rae2822.new_output = True - turbmod_sa_comp_edw_rae2822.tol = 0.00001 - test_list.append(turbmod_sa_comp_edw_rae2822) - - # SA ft2 - turbmod_sa_ft2_rae2822 = TestCase('turbmod_sa_ft2_rae2822') - turbmod_sa_ft2_rae2822.cfg_dir = "turbulence_models/sa/rae2822" - turbmod_sa_ft2_rae2822.cfg_file = "turb_SA_FT2_RAE2822.cfg" - turbmod_sa_ft2_rae2822.test_iter = 20 - turbmod_sa_ft2_rae2822.test_vals = [-2.020123, -5.269330, 0.807147, 0.060499] - turbmod_sa_ft2_rae2822.su2_exec = "SU2_CFD" - turbmod_sa_ft2_rae2822.timeout = 1600 - turbmod_sa_ft2_rae2822.new_output = True - turbmod_sa_ft2_rae2822.tol = 0.00001 - test_list.append(turbmod_sa_ft2_rae2822) - - # SA QCR - turbmod_sa_qcr_rae2822 = TestCase('turbmod_sa_qcr_rae2822') - turbmod_sa_qcr_rae2822.cfg_dir = "turbulence_models/sa/rae2822" - turbmod_sa_qcr_rae2822.cfg_file = "turb_SA_QCR_RAE2822.cfg" - turbmod_sa_qcr_rae2822.test_iter = 20 - turbmod_sa_qcr_rae2822.test_vals = [-2.020123, -5.269330, 0.807147, 0.060499] - turbmod_sa_qcr_rae2822.su2_exec = "SU2_CFD" - turbmod_sa_qcr_rae2822.timeout = 1600 - turbmod_sa_qcr_rae2822.new_output = True - turbmod_sa_qcr_rae2822.tol = 0.00001 - test_list.append(turbmod_sa_qcr_rae2822) - ######################### ### Transition ### ######################### From be7d83eea4ad1ea178b366b5b9684803f60af396 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sat, 15 Jan 2022 22:24:06 +0000 Subject: [PATCH 08/34] remove unused test --- .../sa/rae2822/turb_SA_FT2_RAE2822.cfg | 202 ------------------ 1 file changed, 202 deletions(-) delete mode 100644 TestCases/turbulence_models/sa/rae2822/turb_SA_FT2_RAE2822.cfg diff --git a/TestCases/turbulence_models/sa/rae2822/turb_SA_FT2_RAE2822.cfg b/TestCases/turbulence_models/sa/rae2822/turb_SA_FT2_RAE2822.cfg deleted file mode 100644 index 1d2efcc747b7..000000000000 --- a/TestCases/turbulence_models/sa/rae2822/turb_SA_FT2_RAE2822.cfg +++ /dev/null @@ -1,202 +0,0 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% SU2 configuration file % -% Case description: Transonic simulation RAE2822 (RANS) % -% Author: Francisco Palacios % -% Institution: Stanford University % -% Date: 5/15/2013 % -% File Version 7.2.0 "Blackbird" % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% -% -% Physical governing equations (EULER, NAVIER_STOKES, -% WAVE_EQUATION, HEAT_EQUATION, FEM_ELASTICITY, -% POISSON_EQUATION) -SOLVER= RANS -% -% Specify turbulent model (NONE, SA, SA_NEG, SST) -KIND_TURB_MODEL= SA -% -% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT) -MATH_PROBLEM= DIRECT -% -% Restart solution (NO, YES) -RESTART_SOL= NO -% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% -% -% Mach number (non-dimensional, based on the free-stream values) -MACH_NUMBER= 0.729 -% -% Angle of attack (degrees, only for compressible flows) -AOA= 2.31 -% -% Free-stream temperature (288.15 K by default) -FREESTREAM_TEMPERATURE= 288.15 -% -% Reynolds number (non-dimensional, based on the free-stream values) -REYNOLDS_NUMBER= 6.5E6 -% -% Reynolds length (1 m by default) -REYNOLDS_LENGTH= 1.0 - -% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% -% -% Reference origin for moment computation -REF_ORIGIN_MOMENT_X = 0.25 -REF_ORIGIN_MOMENT_Y = 0.00 -REF_ORIGIN_MOMENT_Z = 0.00 -% -% Reference length for pitching, rolling, and yawing non-dimensional moment -REF_LENGTH= 1.0 -% -% Reference area for force coefficients (0 implies automatic calculation) -REF_AREA= 1.0 - -% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% -% -% Navier-Stokes wall boundary marker(s) (NONE = no marker) -MARKER_HEATFLUX= ( AIRFOIL, 0.0 ) -% -% Farfield boundary marker(s) (NONE = no marker) -MARKER_FAR= ( FARFIELD ) -% -% Marker(s) of the surface to be plotted or designed -MARKER_PLOTTING= ( AIRFOIL ) -% -% Marker(s) of the surface where the functional (Cd, Cl, etc.) will be evaluated -MARKER_MONITORING= ( AIRFOIL ) - -% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% -% -% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) -NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES -% -% Courant-Friedrichs-Lewy condition of the finest grid -CFL_NUMBER= 2.5 -% -% Adaptive CFL number (NO, YES) -CFL_ADAPT= NO -% -% Parameters of the adaptive CFL number (factor down, factor up, CFL min value, -% CFL max value ) -CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) -% -% Number of total iterations -ITER= 99999 -% -% Linear solver for the implicit formulation (BCGSTAB, FGMRES) -LINEAR_SOLVER= BCGSTAB -% -% Min error of the linear solver for the implicit formulation -LINEAR_SOLVER_ERROR= 1E-6 -% -% Max number of iterations of the linear solver for the implicit formulation -LINEAR_SOLVER_ITER= 20 - -% -------------------------- MULTIGRID PARAMETERS -----------------------------% -% -% Multi-Grid Levels (0 = no multi-grid) -MGLEVEL= 3 -% -% Multi-grid cycle (V_CYCLE, W_CYCLE, FULLMG_CYCLE) -MGCYCLE= W_CYCLE -% -% Multi-grid pre-smoothing level -MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) -% -% Multi-grid post-smoothing level -MG_POST_SMOOTH= ( 0, 0, 0, 0 ) -% -% Jacobi implicit smoothing of the correction -MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) -% -% Damping factor for the residual restriction -MG_DAMP_RESTRICTION= 0.95 -% -% Damping factor for the correction prolongation -MG_DAMP_PROLONGATION= 0.95 - -% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% -% -% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, HLLC, -% TURKEL_PREC, MSW) -CONV_NUM_METHOD_FLOW= JST -% -% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. -% Required for 2nd order upwind schemes (NO, YES) -MUSCL_FLOW= YES -% -% Slope limiter (VENKATAKRISHNAN, MINMOD) -SLOPE_LIMITER_FLOW= VENKATAKRISHNAN -% -% Coefficient for the limiter (smooth regions) -VENKAT_LIMITER_COEFF= 0.03 -% -% 2nd and 4th order artificial dissipation coefficients -JST_SENSOR_COEFF= ( 0.5, 0.02 ) -% -% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) -TIME_DISCRE_FLOW= EULER_IMPLICIT - -% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% -% -% Convective numerical method (SCALAR_UPWIND) -CONV_NUM_METHOD_TURB= SCALAR_UPWIND -% -% Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence equations. -% Required for 2nd order upwind schemes (NO, YES) -MUSCL_TURB= NO -% -% Time discretization (EULER_IMPLICIT) -TIME_DISCRE_TURB= EULER_IMPLICIT - -% --------------------------- CONVERGENCE PARAMETERS --------------------------% -% -% Min value of the residual (log10 of the residual) -CONV_RESIDUAL_MINVAL= -8 -% -% Start convergence criteria at iteration number -CONV_STARTITER= 10 -% -% Number of elements to apply the criteria -CONV_CAUCHY_ELEMS= 100 -% -% Epsilon to control the series convergence -CONV_CAUCHY_EPS= 1E-6 - -% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% -% -% Mesh input file -MESH_FILENAME= mesh_RAE2822_turb.su2 -% -% Mesh input file format (SU2, CGNS, NETCDF_ASCII) -MESH_FORMAT= SU2 -% -% Mesh output file -MESH_OUT_FILENAME= mesh_out.su2 -% -% Restart flow input file -SOLUTION_FILENAME= solution_flow.dat -% -% Output file format (PARAVIEW, TECPLOT, STL) -TABULAR_FORMAT= CSV -% -% Output file convergence history (w/o extension) -CONV_FILENAME= history -% -% Output file restart flow -RESTART_FILENAME= restart_flow.dat -% -% Output file flow (w/o extension) variables -VOLUME_FILENAME= flow -% -% Output file surface flow coefficient (w/o extension) -SURFACE_FILENAME= surface_flow -% -% Writing solution file frequency -OUTPUT_WRT_FREQ= 250 -% -% Screen output fields -SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_MOMENTUM-X, RMS_MOMENTUM-Y, RMS_NU_TILDE, LIFT, DRAG) From c63c69a3ce83462afbca332218e7c66237a68750 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sat, 15 Jan 2022 22:58:35 +0000 Subject: [PATCH 09/34] apply the recent flow index changes --- .../numerics/turbulent/turb_sources.hpp | 3 +- .../numerics/turbulent/turb_sources_new.hpp | 615 +++++++++--------- .../src/numerics/turbulent/turb_sources.cpp | 2 - 3 files changed, 293 insertions(+), 327 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index b9358b81c1fd..e782804771c8 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -60,7 +60,7 @@ class CSourceBase_TurbSA : public CNumerics { su2double Jacobian_Buffer; /// Static storage for the Jacobian (which needs to be pointer for return type). protected: - const bool incompressible = false, rotating_frame = false; + const bool rotating_frame = false; bool roughwall = false; public: @@ -338,7 +338,6 @@ class CSourcePieceWise_TurbSST final : public CNumerics { su2double* Jacobian_i[2]; su2double Jacobian_Buffer[4]; /// Static storage for the Jacobian (which needs to be pointer for return type). - bool incompressible; bool sustaining_terms; bool axisymmetric; diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp index 5080b3120c23..7fbb2e161d2c 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp @@ -33,35 +33,17 @@ /*! * \class CSourcePieceWise_TurbSA * \brief Class for integrating the source terms of the Spalart-Allmaras turbulence model equation. - * \brief The variables that are subject to change in each variation/correction have their own class. Additional source terms are implemented as decorators. - * \ingroup SourceDiscr - * \author A. Bueno. + * \brief The variables that are subject to change in each variation/correction have their own class. Additional source + * terms are implemented as decorators. \ingroup SourceDiscr \author A. Bueno. */ -template +template class CSourceBase_TurbSA : public CNumerics { -protected: + protected: /*--- List of constants ---*/ - su2double cv1_3, - k2, - cb1, - cw2, - ct3, - ct4, - cw3_6, - cb2_sigma, - sigma, - cb2, - cw1, - cr1; + su2double cv1_3, k2, cb1, cw2, ct3, ct4, cw3_6, cb2_sigma, sigma, cb2, cw1, cr1; /*--- List of auxiliary functions ---*/ - su2double ft2, d_ft2, - r, d_r, - g, d_g, g_6, glim, - fw, - Ji, Ji_2, Ji_3, d_Ji, - S, Omega, Shat, d_Shat, inv_Shat, - fv1, fv2; + su2double ft2, d_ft2, r, d_r, g, d_g, g_6, glim, fw, Ji, Ji_2, Ji_3, d_Ji, S, Omega, Shat, d_Shat, inv_Shat, fv1, fv2; su2double Gamma_BC = 0.0; su2double intermittency; @@ -71,22 +53,25 @@ class CSourceBase_TurbSA : public CNumerics { /*--- Residual and Jacobian ---*/ su2double Residual, *Jacobian_i; - -private: - su2double Jacobian_Buffer; /// Static storage for the Jacobian (which needs to be pointer for return type). -protected: - const bool incompressible = false, rotating_frame = false; + private: + const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ + + su2double Jacobian_Buffer; /// Static storage for the Jacobian (which needs to be pointer for return type). + + protected: + const bool rotating_frame = false; bool roughwall = false; -public: + public: /*! * \brief Constructor of the class. * \param[in] val_nDim - Number of dimensions of the problem. * \param[in] val_nVar - Number of variables of the problem. * \param[in] config - Definition of the particular problem. */ - CSourceBase_TurbSA(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config); + CSourceBase_TurbSA(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config) + : CNumerics(val_nDim, val_nVar, config), idx(val_nDim, config->GetnSpecies()) {} /*! * \brief Residual for source term integration. @@ -133,9 +118,13 @@ class CSourceBase_TurbSA : public CNumerics { */ inline su2double GetCrossProduction(void) const final { return CrossProduction; } + /*! + * \brief ______________. + */ inline su2double ComputeXsi(const su2double nue, const su2double nul, su2double xsi, su2double d_xsi) { - xsi = nue/nul + cr1*(roughness_i/(dist_i+EPS)); //roughness_i = 0 for smooth walls and Ji remains the same, changes only if roughness is specified.nue/nul - d_xsi = 1.0/nul; + xsi = nue / nul + cr1 * (roughness_i / (dist_i + EPS)); // roughness_i = 0 for smooth walls and Ji remains the + // same, changes only if roughness is specified.nue/nul + d_xsi = 1.0 / nul; } /*! @@ -144,144 +133,136 @@ class CSourceBase_TurbSA : public CNumerics { * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. */ ResidualType<> ComputeResidual(const CConfig* config) final { + // Set the boolean here depending on whether the point is closest to a rough wall or not. + roughwall = (roughness_i > 0.0); - // Set the boolean here depending on whether the point is closest to a rough wall or not. - roughwall = (roughness_i > 0.0); - - if (incompressible) { - Density_i = V_i[nDim+2]; - Laminar_Viscosity_i = V_i[nDim+4]; - } - else { - Density_i = V_i[nDim+2]; - Laminar_Viscosity_i = V_i[nDim+5]; - } - - Residual = 0.0; - Production = 0.0; - Destruction = 0.0; - CrossProduction = 0.0; - Jacobian_i[0] = 0.0; + Density_i = V_i[idx.Density()]; + Laminar_Viscosity_i = V_i[idx.LaminarViscosity()]; - /*--- Evaluate Omega ---*/ + Residual = 0.0; + Production = 0.0; + Destruction = 0.0; + CrossProduction = 0.0; + Jacobian_i[0] = 0.0; - Omega = sqrt(Vorticity_i[0]*Vorticity_i[0] + Vorticity_i[1]*Vorticity_i[1] + Vorticity_i[2]*Vorticity_i[2]); + /*--- Evaluate Omega ---*/ - /*--- Rotational correction term ---*/ + Omega = sqrt(Vorticity_i[0] * Vorticity_i[0] + Vorticity_i[1] * Vorticity_i[1] + Vorticity_i[2] * Vorticity_i[2]); - if (rotating_frame) { Omega += 2.0*min(0.0, StrainMag_i-Omega); } + /*--- Rotational correction term ---*/ - if (dist_i > 1e-10) { - - /*--- Production term ---*/ + if (rotating_frame) { + Omega += 2.0 * min(0.0, StrainMag_i - Omega); + } - dist_i_2 = dist_i*dist_i; - nu = Laminar_Viscosity_i/Density_i; + if (dist_i > 1e-10) { + /*--- Production term ---*/ - /*--- Modified values for roughness ---*/ - /*--- Ref: Aupoix, B. and Spalart, P. R., "Extensions of the Spalart-Allmaras Turbulence Model to Account for Wall Roughness," - * International Journal of Heat and Fluid Flow, Vol. 24, 2003, pp. 454-462. ---*/ - /* --- See https://turbmodels.larc.nasa.gov/spalart.html#sarough for detailed explanation. ---*/ + dist_i_2 = dist_i * dist_i; + nu = Laminar_Viscosity_i / Density_i; - ComputeXsi(ScalarVar_i[0], Laminar_Viscosity_i, &Ji, &d_Ji); - Ji_2 = Ji*Ji; - Ji_3 = Ji_2*Ji; - fv1 = Ji_3/(Ji_3+cv1_3); + /*--- Modified values for roughness ---*/ + /*--- Ref: Aupoix, B. and Spalart, P. R., "Extensions of the Spalart-Allmaras Turbulence Model to Account for Wall + * Roughness," International Journal of Heat and Fluid Flow, Vol. 24, 2003, pp. 454-462. ---*/ + /* --- See https://turbmodels.larc.nasa.gov/spalart.html#sarough for detailed explanation. ---*/ - /*--- Using a modified relation so as to not change the Shat that depends on fv2. ---*/ - fv2 = 1.0 - ScalarVar_i[0]/(nu+ScalarVar_i[0]*fv1); // From NASA turb modeling resource and 2003 paper + ComputeXsi(ScalarVar_i[0], Laminar_Viscosity_i, &Ji, &d_Ji); + Ji_2 = Ji * Ji; + Ji_3 = Ji_2 * Ji; + fv1 = Ji_3 / (Ji_3 + cv1_3); - ft2 = ct3*exp(-ct4*Ji_2); - S = Omega; - inv_k2_d2 = 1.0/(k2*dist_i_2); + /*--- Using a modified relation so as to not change the Shat that depends on fv2. ---*/ + fv2 = 1.0 - ScalarVar_i[0] / (nu + ScalarVar_i[0] * fv1); // From NASA turb modeling resource and 2003 paper - Shat = S + ScalarVar_i[0]*fv2*inv_k2_d2; - Shat = max(Shat, 1.0e-10); - inv_Shat = 1.0/Shat; + ft2 = ct3 * exp(-ct4 * Ji_2); + S = Omega; + inv_k2_d2 = 1.0 / (k2 * dist_i_2); - // Original SA model - // Production = cb1*(1.0-ft2)*Shat*ScalarVar_i[0]*Volume; + Shat = S + ScalarVar_i[0] * fv2 * inv_k2_d2; + Shat = max(Shat, 1.0e-10); + inv_Shat = 1.0 / Shat; - if (transition) { + // Original SA model + // Production = cb1*(1.0-ft2)*Shat*ScalarVar_i[0]*Volume; - /*--- BC model constants (2020 revision). ---*/ - const su2double chi_1 = 0.002; - const su2double chi_2 = 50.0; + if (transition) { + /*--- BC model constants (2020 revision). ---*/ + const su2double chi_1 = 0.002; + const su2double chi_2 = 50.0; - /*--- turbulence intensity is u'/U so we multiply by 100 to get percentage ---*/ - su2double tu = 100.0 * config->GetTurbulenceIntensity_FreeStream(); + /*--- turbulence intensity is u'/U so we multiply by 100 to get percentage ---*/ + su2double tu = 100.0 * config->GetTurbulenceIntensity_FreeStream(); - su2double nu_t = (ScalarVar_i[0]*fv1); //S-A variable + su2double nu_t = (ScalarVar_i[0] * fv1); // S-A variable - su2double re_v = ((Density_i*pow(dist_i,2.))/(Laminar_Viscosity_i))*Omega; - su2double re_theta = re_v/2.193; - su2double re_theta_t = (803.73 * pow((tu + 0.6067),-1.027)); //MENTER correlation - //re_theta_t = 163.0 + exp(6.91-tu); //ABU-GHANNAM & SHAW correlation + su2double re_v = ((Density_i * pow(dist_i, 2.)) / (Laminar_Viscosity_i)) * Omega; + su2double re_theta = re_v / 2.193; + su2double re_theta_t = (803.73 * pow((tu + 0.6067), -1.027)); // MENTER correlation + // re_theta_t = 163.0 + exp(6.91-tu); //ABU-GHANNAM & SHAW correlation - su2double term1 = sqrt(max(re_theta-re_theta_t,0.)/(chi_1*re_theta_t)); - su2double term2 = sqrt(max((nu_t*chi_2)/nu,0.)); - su2double term_exponential = (term1 + term2); + su2double term1 = sqrt(max(re_theta - re_theta_t, 0.) / (chi_1 * re_theta_t)); + su2double term2 = sqrt(max((nu_t * chi_2) / nu, 0.)); + su2double term_exponential = (term1 + term2); - Gamma_BC = 1.0 - exp(-term_exponential); + Gamma_BC = 1.0 - exp(-term_exponential); - Production = Gamma_BC*cb1*Shat*ScalarVar_i[0]*Volume; - } - else { - Production = cb1*Shat*ScalarVar_i[0]*Volume; - } + Production = Gamma_BC * cb1 * Shat * ScalarVar_i[0] * Volume; + } else { + Production = cb1 * Shat * ScalarVar_i[0] * Volume; + } - /*--- Destruction term ---*/ + /*--- Destruction term ---*/ - r = min(ScalarVar_i[0]*inv_Shat*inv_k2_d2,10.0); - g = r + cw2*(pow(r,6.0)-r); - g_6 = pow(g,6.0); - glim = pow((1.0+cw3_6)/(g_6+cw3_6),1.0/6.0); - fw = g*glim; + r = min(ScalarVar_i[0] * inv_Shat * inv_k2_d2, 10.0); + g = r + cw2 * (pow(r, 6.0) - r); + g_6 = pow(g, 6.0); + glim = pow((1.0 + cw3_6) / (g_6 + cw3_6), 1.0 / 6.0); + fw = g * glim; - // Original SA model - // Destruction = (cw1*fw-cb1*ft2/k2)*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; + // Original SA model + // Destruction = (cw1*fw-cb1*ft2/k2)*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; - Destruction = cw1*fw*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; + Destruction = cw1 * fw * ScalarVar_i[0] * ScalarVar_i[0] / dist_i_2 * Volume; - /*--- Diffusion term ---*/ + /*--- Diffusion term ---*/ - norm2_Grad = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - norm2_Grad += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; + norm2_Grad = 0.0; + for (iDim = 0; iDim < nDim; iDim++) norm2_Grad += ScalarVar_Grad_i[0][iDim] * ScalarVar_Grad_i[0][iDim]; - CrossProduction = cb2_sigma*norm2_Grad*Volume; + CrossProduction = cb2_sigma * norm2_Grad * Volume; - Residual = Production - Destruction + CrossProduction; + Residual = Production - Destruction + CrossProduction; - /*--- Implicit part, production term ---*/ + /*--- Implicit part, production term ---*/ - dfv1 = 3.0*Ji_2*cv1_3/(nu*pow(Ji_3+cv1_3,2.)); - dfv2 = -(1/nu-Ji_2*dfv1)/pow(1.+Ji*fv1,2.); - if ( Shat <= 1.0e-10 ) dShat = 0.0; - else dShat = (fv2+ScalarVar_i[0]*dfv2)*inv_k2_d2; + dfv1 = 3.0 * Ji_2 * cv1_3 / (nu * pow(Ji_3 + cv1_3, 2.)); + dfv2 = -(1 / nu - Ji_2 * dfv1) / pow(1. + Ji * fv1, 2.); + if (Shat <= 1.0e-10) + dShat = 0.0; + else + dShat = (fv2 + ScalarVar_i[0] * dfv2) * inv_k2_d2; - if (transition) { - Jacobian_i[0] += Gamma_BC*cb1*(ScalarVar_i[0]*dShat+Shat)*Volume; - } - else { - Jacobian_i[0] += cb1*(ScalarVar_i[0]*dShat+Shat)*Volume; - } + if (transition) { + Jacobian_i[0] += Gamma_BC * cb1 * (ScalarVar_i[0] * dShat + Shat) * Volume; + } else { + Jacobian_i[0] += cb1 * (ScalarVar_i[0] * dShat + Shat) * Volume; + } - /*--- Implicit part, destruction term ---*/ + /*--- Implicit part, destruction term ---*/ - dr = (Shat-ScalarVar_i[0]*dShat)*inv_Shat*inv_Shat*inv_k2_d2; - if (r == 10.0) dr = 0.0; - dg = dr*(1.+cw2*(6.0*pow(r,5.0)-1.0)); - dfw = dg*glim*(1.-g_6/(g_6+cw3_6)); - Jacobian_i[0] -= cw1*(dfw*ScalarVar_i[0] + 2.0*fw)*ScalarVar_i[0]/dist_i_2*Volume; + dr = (Shat - ScalarVar_i[0] * dShat) * inv_Shat * inv_Shat * inv_k2_d2; + if (r == 10.0) dr = 0.0; + dg = dr * (1. + cw2 * (6.0 * pow(r, 5.0) - 1.0)); + dfw = dg * glim * (1. - g_6 / (g_6 + cw3_6)); + Jacobian_i[0] -= cw1 * (dfw * ScalarVar_i[0] + 2.0 * fw) * ScalarVar_i[0] / dist_i_2 * Volume; - ft2_class::get(&ft2, &d_ft2); + ft2_class::get(&ft2, &d_ft2); - su2double pingu = ft2*3.14; + su2double pingu = ft2 * 3.14; - ModVort_class::get(); - - }; + ModVort_class::get(); + } + } }; /*------------------------------------------------------------------------------ @@ -297,8 +278,8 @@ class CSourceBase_TurbSA : public CNumerics { /*! * \brief SU2 baseline ft2 term value and its derivative. ft2=0.0 */ -template -class ft2_Bsl : public Base { +template +class ft2_Bsl : public Base { static double get(su2double* ft2, su2double* d_ft2) { *ft2 = 0.0; *d_ft2 = 0.0; @@ -308,20 +289,19 @@ class ft2_Bsl : public Base { /*! * \brief non-zero ft2 term according to the literature and its derivative. */ -template +template class ft2_nonzero : public Base { - using Base::ct3; - using Base::ct4; - using Base::xsi; - using Base::d_xsi; - - static void get(su2double* ft2, su2double* d_ft2) { + using Base::ct3; + using Base::ct4; + using Base::d_xsi; + using Base::xsi; - const su2double xsi2 = xsi*xsi; + static void get(su2double* ft2, su2double* d_ft2) { + const su2double xsi2 = xsi * xsi; - *ft2 = ct3*exp(-ct4*xsi2); - *d_ft2 = -2.0*ct4*xsi**ft2*d_xsi; - } + *ft2 = ct3 * exp(-ct4 * xsi2); + *d_ft2 = -2.0 * ct4 * xsi * *ft2 * d_xsi; + } }; /*------------------------------------------------------------------------------ @@ -342,25 +322,24 @@ class ft2_nonzero : public Base { /*! * \brief Baseline */ -template +template class ModVort_Bsl : Base { - using Base::S; - using Base::fv2; - using Base::d_fv2; - using Base::inv_k2_d2; + using Base::d_fv2; + using Base::fv2; + using Base::inv_k2_d2; + using Base::S; - static constexpr su2double nue = Base::ScalarVar_i[0]; + static constexpr su2double nue = Base::ScalarVar_i[0]; -public: + public: static void get(su2double* Shat, su2double* d_Shat) { - - const su2double Sbar = nue*fv2*inv_k2_d2; + const su2double Sbar = nue * fv2 * inv_k2_d2; *Shat = S + Sbar; *Shat = max(*Shat, 1.0e-10); - const su2double d_Sbar = (fv2 + nue*d_fv2)*inv_k2_d2; - + const su2double d_Sbar = (fv2 + nue * d_fv2) * inv_k2_d2; + *d_Shat = (*Shat <= 1.0e-10) ? 0.0 : d_Sbar; } }; @@ -368,67 +347,68 @@ class ModVort_Bsl : Base { /*! * \brief Edward */ -template +template class ModVort_Edw { - using Base::nDim; - using Base::PrimVar_Grad_i; - using Base::fv1; - using Base::d_fv1; - using Base::rotating_frame; - using Base::StrainMag_i; + using Base::d_fv1; + using Base::fv1; + using Base::nDim; + using Base::PrimVar_Grad_i; + using Base::rotating_frame; + using Base::StrainMag_i; - static constexpr su2double xsi = Base::Ji; + static constexpr su2double xsi = Base::Ji; - static constexpr su2double nul = Base::Laminar_Viscosity_i; - static constexpr su2double nue = Base::ScalarVar_i[0]; + static constexpr su2double nul = Base::Laminar_Viscosity_i; + static constexpr su2double nue = Base::ScalarVar_i[0]; -public: - static void get(su2double* Shat, su2double* d_Shat) { - - unsigned short iDim, jDim; + public: + static void get(su2double* Shat, su2double* d_Shat) { + unsigned short iDim, jDim; - /*--- Evaluate Omega, here Omega is the Strain Rate ---*/ + /*--- Evaluate Omega, here Omega is the Strain Rate ---*/ - su2double Sbar = 0.0; - for(iDim=0;iDim +template class ModVort_Neg : Base { + static constexpr su2double nue = Base::ScalarVar_i[0]; - static constexpr su2double nue = Base::ScalarVar_i[0]; - - static void get(su2double* Shat, su2double* d_Shat) { - + static void get(su2double* Shat, su2double* d_Shat) { if (nue > 0.0) { - // Don't check whether Sbar <>= -cv2*S. - // Baseline solution - ModVort_Bsl::get(Shat, d_Shat); + // Don't check whether Sbar <>= -cv2*S. + // Baseline solution + ModVort_Bsl::get(Shat, d_Shat); } -// else { -// // No need for Sbar -// } - + // else { + // // No need for Sbar + // } } }; @@ -446,48 +426,45 @@ class ModVort_Neg : Base { /*! * \brief Baseline */ -template +template class r_Bsl { - using Base::Shat; - using Base::d_Shat; - using Base::inv_Shat; - using Base::inv_k2_d2; - - static constexpr su2double nue = Base::ScalarVar_i[0]; + using Base::d_Shat; + using Base::inv_k2_d2; + using Base::inv_Shat; + using Base::Shat; -public: - static double get(su2double* r, su2double* d_r){ + static constexpr su2double nue = Base::ScalarVar_i[0]; - *r = min(nue*inv_Shat*inv_k2_d2,10.0); + public: + static double get(su2double* r, su2double* d_r) { + *r = min(nue * inv_Shat * inv_k2_d2, 10.0); - *d_r = (Shat-nue*d_Shat)*inv_Shat*inv_Shat*inv_k2_d2; - } + *d_r = (Shat - nue * d_Shat) * inv_Shat * inv_Shat * inv_k2_d2; + } }; /*! * \brief Edward */ -template +template class r_Edw { - using Base::Shat; - using Base::d_Shat; - using Base::inv_Shat; - using Base::inv_k2_d2; - - static constexpr su2double nue = Base::ScalarVar_i[0]; + using Base::d_Shat; + using Base::inv_k2_d2; + using Base::inv_Shat; + using Base::Shat; -public: - static double get(su2double* r, su2double* d_r){ + static constexpr su2double nue = Base::ScalarVar_i[0]; - *r = min(nue*inv_Shat*inv_k2_d2,10.0); - *r = tanh(*r)/tanh(1.0); + public: + static double get(su2double* r, su2double* d_r) { + *r = min(nue * inv_Shat * inv_k2_d2, 10.0); + *r = tanh(*r) / tanh(1.0); - *d_r = (Shat-nue*d_Shat)*inv_Shat*inv_Shat*inv_k2_d2; - *d_r = (1-pow(tanh(*r),2.0))*(*d_r)/tanh(1.0); - } + *d_r = (Shat - nue * d_Shat) * inv_Shat * inv_Shat * inv_k2_d2; + *d_r = (1 - pow(tanh(*r), 2.0)) * (*d_r) / tanh(1.0); + } }; - /*------------------------------------------------------------------------------ | Compute production term and its derivative. | * \param[in] S - vorticity (Omega) @@ -506,51 +483,48 @@ class r_Edw { /*! * \brief Baseline */ -template -class Production_Bsl{ - using Base::S; - using Base::ft2; - using Base::d_ft2; - using Base::Shat; - using Base::d_Shat; - using Base::ct3; - using Base::cb1; - - static constexpr su2double nue = Base::ScalarVar_i[0]; - -public: - static double get(su2double* Pr, su2double* d_Pr){ - - *Pr = cb1*(1. - ft2)*Shat*nue; - - *d_Pr = cb1*((1. - ft2)*(Shat + nue*d_Shat) - d_ft2); +template +class Production_Bsl { + using Base::cb1; + using Base::ct3; + using Base::d_ft2; + using Base::d_Shat; + using Base::ft2; + using Base::S; + using Base::Shat; + + static constexpr su2double nue = Base::ScalarVar_i[0]; + + public: + static double get(su2double* Pr, su2double* d_Pr) { + *Pr = cb1 * (1. - ft2) * Shat * nue; + + *d_Pr = cb1 * ((1. - ft2) * (Shat + nue * d_Shat) - d_ft2); } }; /*! * \brief Negative */ -template -class Production_Neg{ - using Base::S; - using Base::ct3; - using Base::cb1; - - static constexpr su2double nue = Base::ScalarVar_i[0]; +template +class Production_Neg { + using Base::cb1; + using Base::ct3; + using Base::S; -public: - static double get(su2double* Pr, su2double* d_Pr){ + static constexpr su2double nue = Base::ScalarVar_i[0]; - if (nue > 0.0) { - // Baseline solution - Production_Bsl::get(Pr, d_Pr); - } - else { - *Pr = cb1*(1.0-ct3)*S*nue; + public: + static double get(su2double* Pr, su2double* d_Pr) { + if (nue > 0.0) { + // Baseline solution + Production_Bsl::get(Pr, d_Pr); + } else { + *Pr = cb1 * (1.0 - ct3) * S * nue; - *d_Pr = cb1*(1.0-ct3)*S; - } - } + *d_Pr = cb1 * (1.0 - ct3) * S; + } + } }; /*------------------------------------------------------------------------------ @@ -571,61 +545,58 @@ class Production_Neg{ /*! * \brief Baseline */ -template -class Desctruction_Bsl{ - using Base::Shat; - using Base::d_Shat; - using Base::fw; - using Base::d_fw; - using Base::ft2; - using Base::d_ft2; - using Base::k2; - using Base::dist_i_2; - using Base::cw1; - using Base::cb1; - - static constexpr su2double nue = Base::ScalarVar_i[0]; - -public: - static double get(su2double* De, su2double* d_De){ - - *De = (cw1*fw-cb1*ft2/k2)*nue*nue/dist_i_2; - - *d_De = cw1*(d_fw*nue + 2.0*fw)*nue/dist_i_2; - } +template +class Desctruction_Bsl { + using Base::cb1; + using Base::cw1; + using Base::d_ft2; + using Base::d_fw; + using Base::d_Shat; + using Base::dist_i_2; + using Base::ft2; + using Base::fw; + using Base::k2; + using Base::Shat; + + static constexpr su2double nue = Base::ScalarVar_i[0]; + + public: + static double get(su2double* De, su2double* d_De) { + *De = (cw1 * fw - cb1 * ft2 / k2) * nue * nue / dist_i_2; + + *d_De = cw1 * (d_fw * nue + 2.0 * fw) * nue / dist_i_2; + } }; /*! * \brief Negative */ -template -class Destruction_Neg{ - using Base::Shat; - using Base::d_Shat; - using Base::fw; - using Base::d_fw; - using Base::ft2; - using Base::d_ft2; - using Base::k2; - using Base::dist_i_2; - using Base::cw1; - using Base::cb1; - - static constexpr su2double nue = Base::ScalarVar_i[0]; - -public: - static double get(su2double* De, su2double* d_De){ - - if (nue > 0.0) { - // Baseline solution - Destruction_Bsl::get(De, d_De); - } - else { - *De = -cw1*nue*nue/dist_i_2; +template +class Destruction_Neg { + using Base::cb1; + using Base::cw1; + using Base::d_ft2; + using Base::d_fw; + using Base::d_Shat; + using Base::dist_i_2; + using Base::ft2; + using Base::fw; + using Base::k2; + using Base::Shat; + + static constexpr su2double nue = Base::ScalarVar_i[0]; + + public: + static double get(su2double* De, su2double* d_De) { + if (nue > 0.0) { + // Baseline solution + Destruction_Bsl::get(De, d_De); + } else { + *De = -cw1 * nue * nue / dist_i_2; - *d_De = -2.0*cw1*nue/dist_i_2; - } - } + *d_De = -2.0 * cw1 * nue / dist_i_2; + } + } }; /*------------------------------------------------------------------------------ @@ -646,19 +617,17 @@ class Destruction_Neg{ /*! * \brief Baseline */ -template -class CrossProduction_Bsl{ - using Base::norm2_Grad; - using Base::cb2_sigma; +template +class CrossProduction_Bsl { + using Base::cb2_sigma; + using Base::norm2_Grad; - static constexpr su2double nue = Base::ScalarVar_i[0]; + static constexpr su2double nue = Base::ScalarVar_i[0]; - static double get(su2double* CrossProd, su2double* d_CrossProd){ + static double get(su2double* CrossProd, su2double* d_CrossProd) { + *CrossProd = cb2_sigma * norm2_Grad; - *CrossProd = cb2_sigma*norm2_Grad; - - // No cross production influence in the Jacobian - *d_CrossProd = 0.0; - } + // No cross production influence in the Jacobian + *d_CrossProd = 0.0; + } }; - diff --git a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp index c2f882562061..07d31dd4a865 100644 --- a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp +++ b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp @@ -36,7 +36,6 @@ CSourceBase_TurbSA::CSourceBase_TurbSA(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config) : CNumerics(val_nDim, val_nVar, config), - incompressible(config->GetKind_Regime() == ENUM_REGIME::INCOMPRESSIBLE), rotating_frame(config->GetRotating_Frame()) { /*--- Spalart-Allmaras closure constants ---*/ @@ -763,7 +762,6 @@ CSourcePieceWise_TurbSST::CSourcePieceWise_TurbSST(unsigned short val_nDim, CNumerics(val_nDim, val_nVar, config), idx(val_nDim, config->GetnSpecies()) { - incompressible = (config->GetKind_Regime() == ENUM_REGIME::INCOMPRESSIBLE); sustaining_terms = (config->GetKind_Turb_Model() == TURB_MODEL::SST_SUST); axisymmetric = config->GetAxisymmetric(); From 2f60dbb4cae19aa15b9b6578043838f8eefd39b0 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sat, 15 Jan 2022 23:17:36 +0000 Subject: [PATCH 10/34] describe a strategy that should work --- .../numerics/turbulent/turb_sources_new.hpp | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp index 7fbb2e161d2c..5ad9734c4a8d 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp @@ -304,6 +304,35 @@ class ft2_nonzero : public Base { } }; +/* The above causes a cyclic dependency between the turbulence base and the ft2 and co. classes. + * To break that you need to template the get method instead of the class, for example: */ +struct ft2_nonzero { + template + static void get(const Base& base, su2double& ft2, su2double& d_ft2) { + const su2double xsi2 = pow(base.xsi, 2); + ft2 = base.ct3 * exp(-base.ct4 * xsi2); + d_ft2 = -2.0 * base.ct4 * base.xsi * ft2 * base.d_xsi; + } +}; +/* Now you pass the numerics class itself to "get" to access the member variables, + * which you'll have to make public, for example in ComputeResidual: + * ft2_class::get(*this, ft2, d_ft2); + * + * This is not a perfect solution because for performance we should cut down on "aux" class variables. + * An alternative is to put such variables in a struct, which can then be a local variable in ComputeResidual. */ +struct CommonVariables { + su2double ft2, d_ft2, r, d_r, g, d_g, g_6, glim, fw, Ji, Ji_2, Ji_3, d_Ji, S, Omega, Shat, d_Shat, inv_Shat, fv1, fv2; +}; +/* + * ResidualType<> ComputeResidual(const CConfig* config) final { + * CommonVariables data; + * ... + * data.Ji = ... + * ... + * ft2_class::get(data, ft2, d_ft2); + */ +/* This way you can also dispense with templating "get". */ + /*------------------------------------------------------------------------------ | Compute the modified vorticity (\tilde{S}) and its derivative | * \param[in] S - vorticity (Omega) From 35aef2073a44b2a1b7ccf77d612b4523be0209c1 Mon Sep 17 00:00:00 2001 From: Guillermo Suarez Date: Wed, 2 Feb 2022 13:41:12 +0100 Subject: [PATCH 11/34] Update turb_sources_new.hpp to implement Pedro's suggested structure (commit 2f60dbb) --- .../numerics/turbulent/turb_sources_new.hpp | 657 +++++++----------- 1 file changed, 255 insertions(+), 402 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp index 5ad9734c4a8d..f7611ce18eb1 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp @@ -36,14 +36,14 @@ * \brief The variables that are subject to change in each variation/correction have their own class. Additional source * terms are implemented as decorators. \ingroup SourceDiscr \author A. Bueno. */ -template +template class CSourceBase_TurbSA : public CNumerics { protected: - /*--- List of constants ---*/ - su2double cv1_3, k2, cb1, cw2, ct3, ct4, cw3_6, cb2_sigma, sigma, cb2, cw1, cr1; - /*--- List of auxiliary functions ---*/ - su2double ft2, d_ft2, r, d_r, g, d_g, g_6, glim, fw, Ji, Ji_2, Ji_3, d_Ji, S, Omega, Shat, d_Shat, inv_Shat, fv1, fv2; + /* For performance we should cut down on "aux" class variables. + * Such variables are now declared in the struct CommonVariables + * which can then be a local variable in ComputeResidual. + */ su2double Gamma_BC = 0.0; su2double intermittency; @@ -57,12 +57,17 @@ class CSourceBase_TurbSA : public CNumerics { private: const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ + unsigned short iDim; + su2double Jacobian_Buffer; /// Static storage for the Jacobian (which needs to be pointer for return type). protected: const bool rotating_frame = false; bool roughwall = false; + bool transition; + bool axisymmetric; + public: /*! * \brief Constructor of the class. @@ -118,21 +123,16 @@ class CSourceBase_TurbSA : public CNumerics { */ inline su2double GetCrossProduction(void) const final { return CrossProduction; } - /*! - * \brief ______________. - */ - inline su2double ComputeXsi(const su2double nue, const su2double nul, su2double xsi, su2double d_xsi) { - xsi = nue / nul + cr1 * (roughness_i / (dist_i + EPS)); // roughness_i = 0 for smooth walls and Ji remains the - // same, changes only if roughness is specified.nue/nul - d_xsi = 1.0 / nul; - } - /*! * \brief Residual for source term integration. * \param[in] config - Definition of the particular problem. * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. */ ResidualType<> ComputeResidual(const CConfig* config) final { + + /*--- Model common auxiliary and constant variables ---*/ + CommonVariables model_var; + // Set the boolean here depending on whether the point is closest to a rough wall or not. roughwall = (roughness_i > 0.0); @@ -143,520 +143,373 @@ class CSourceBase_TurbSA : public CNumerics { Production = 0.0; Destruction = 0.0; CrossProduction = 0.0; + AddSourceTerm = 0.0; Jacobian_i[0] = 0.0; /*--- Evaluate Omega ---*/ - - Omega = sqrt(Vorticity_i[0] * Vorticity_i[0] + Vorticity_i[1] * Vorticity_i[1] + Vorticity_i[2] * Vorticity_i[2]); + Omega_class::get(model_var); /*--- Rotational correction term ---*/ if (rotating_frame) { - Omega += 2.0 * min(0.0, StrainMag_i - Omega); + model_var.Omega += 2.0 * min(0.0, StrainMag_i - model_var.Omega); } if (dist_i > 1e-10) { - /*--- Production term ---*/ - dist_i_2 = dist_i * dist_i; - nu = Laminar_Viscosity_i / Density_i; + /*--- Vorticity ---*/ + model_var.S = model_var.Omega; + + model_var.dist_i_2 = dist_i * dist_i; + su2double nu = Laminar_Viscosity_i / Density_i; + model_var.inv_k2_d2 = 1.0 / (model_var.k2 * model_var.dist_i_2); /*--- Modified values for roughness ---*/ /*--- Ref: Aupoix, B. and Spalart, P. R., "Extensions of the Spalart-Allmaras Turbulence Model to Account for Wall * Roughness," International Journal of Heat and Fluid Flow, Vol. 24, 2003, pp. 454-462. ---*/ /* --- See https://turbmodels.larc.nasa.gov/spalart.html#sarough for detailed explanation. ---*/ + model_var.Ji = ScalarVar_i[0] / nu + model_var.cr1 * (roughness_i / (dist_i + EPS)); // roughness_i = 0 for smooth walls and Ji remains the + // same, changes only if roughness is specified.nue/nul + model_var.d_Ji = 1.0 / nu; - ComputeXsi(ScalarVar_i[0], Laminar_Viscosity_i, &Ji, &d_Ji); - Ji_2 = Ji * Ji; - Ji_3 = Ji_2 * Ji; - fv1 = Ji_3 / (Ji_3 + cv1_3); + const su2double Ji_2 = model_var.Ji * model_var.Ji; + const su2double Ji_3 = Ji_2 * model_var.Ji; - /*--- Using a modified relation so as to not change the Shat that depends on fv2. ---*/ - fv2 = 1.0 - ScalarVar_i[0] / (nu + ScalarVar_i[0] * fv1); // From NASA turb modeling resource and 2003 paper + model_var.fv1 = Ji_3 / (Ji_3 + model_var.cv1_3); + model_var.d_fv1 = 3.0 * Ji_2 * model_var.cv1_3 / (nu * pow(Ji_3 + model_var.cv1_3, 2.0)); - ft2 = ct3 * exp(-ct4 * Ji_2); - S = Omega; - inv_k2_d2 = 1.0 / (k2 * dist_i_2); - - Shat = S + ScalarVar_i[0] * fv2 * inv_k2_d2; - Shat = max(Shat, 1.0e-10); - inv_Shat = 1.0 / Shat; - - // Original SA model - // Production = cb1*(1.0-ft2)*Shat*ScalarVar_i[0]*Volume; + /*--- Using a modified relation so as to not change the Shat that depends on fv2. ---*/ + model_var.fv2 = 1.0 - ScalarVar_i[0] / (nu + ScalarVar_i[0] * model_var.fv1); // From NASA turb modeling resource and 2003 paper + model_var.d_fv2 = -(1.0 / nu - Ji_2 * model_var.d_fv1) / pow(1.0 + model_var.Ji * model_var.fv1, 2.0); - if (transition) { - /*--- BC model constants (2020 revision). ---*/ - const su2double chi_1 = 0.002; - const su2double chi_2 = 50.0; + /*--- Compute ft2 term ---*/ + ft2_class::get(model_var); - /*--- turbulence intensity is u'/U so we multiply by 100 to get percentage ---*/ - su2double tu = 100.0 * config->GetTurbulenceIntensity_FreeStream(); + /*--- Compute modified vorticity ---*/ + ModVort_class::get(model_var); - su2double nu_t = (ScalarVar_i[0] * fv1); // S-A variable + model_var.inv_Shat = 1.0 / model_var.Shat; - su2double re_v = ((Density_i * pow(dist_i, 2.)) / (Laminar_Viscosity_i)) * Omega; - su2double re_theta = re_v / 2.193; - su2double re_theta_t = (803.73 * pow((tu + 0.6067), -1.027)); // MENTER correlation - // re_theta_t = 163.0 + exp(6.91-tu); //ABU-GHANNAM & SHAW correlation + /*--- Compute auxiliary function r ---*/ + r_class::get(model_var); - su2double term1 = sqrt(max(re_theta - re_theta_t, 0.) / (chi_1 * re_theta_t)); - su2double term2 = sqrt(max((nu_t * chi_2) / nu, 0.)); - su2double term_exponential = (term1 + term2); + model_var.g = model_var.r + model_var.cw2 * (pow(model_var.r, 6.0) - model_var.r); + model_var.g_6 = pow(model_var.g, 6.0); + model_var.glim = pow((1.0 + model_var.cw3_6) / (model_var.g_6 + model_var.cw3_6), 1.0 / 6.0); + model_var.fw = model_var.g * model_var.glim; - Gamma_BC = 1.0 - exp(-term_exponential); + model_var.d_g = model_var.d_r * (1. + model_var.cw2 * (6.0 * pow(model_var.r, 5.0) - 1.0)); + model_var.dfw = model_var.d_g * model_var.glim * (1. - model_var.g_6 / (model_var.g_6 + model_var.cw3_6)); - Production = Gamma_BC * cb1 * Shat * ScalarVar_i[0] * Volume; - } else { - Production = cb1 * Shat * ScalarVar_i[0] * Volume; - } + model_var.norm2_Grad = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + model_var.norm2_Grad += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; - /*--- Destruction term ---*/ + /*--- Compute production, destruction and cross production and jacobian ---*/ + SourceTerms_class::get(model_var, &Production, &Destruction, &CrossProduction, &Jacobian_i[0]); - r = min(ScalarVar_i[0] * inv_Shat * inv_k2_d2, 10.0); - g = r + cw2 * (pow(r, 6.0) - r); - g_6 = pow(g, 6.0); - glim = pow((1.0 + cw3_6) / (g_6 + cw3_6), 1.0 / 6.0); - fw = g * glim; + /*--- Compute any necessary additional source term and jacobian contribution ---*/ - // Original SA model - // Destruction = (cw1*fw-cb1*ft2/k2)*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; + /*--- Residual ---*/ + Residual = Production - Destruction + CrossProduction + AddSourceTerm; + Residual *= Volume; - Destruction = cw1 * fw * ScalarVar_i[0] * ScalarVar_i[0] / dist_i_2 * Volume; + /*--- Jacobian ---*/ + Jacobian_i[0] *= Volume; + } + } +}; - /*--- Diffusion term ---*/ +/*------------------------------------------------------------------------------ +| Structure with SA common auxiliary functions and constants +------------------------------------------------------------------------------*/ +struct CommonVariables { + /*--- List of constants ---*/ + su2double cv1_3, k2, cb1, cw2, ct3, ct4, cw3_6, cb2_sigma, sigma, cb2, cw1, cr1; - norm2_Grad = 0.0; - for (iDim = 0; iDim < nDim; iDim++) norm2_Grad += ScalarVar_Grad_i[0][iDim] * ScalarVar_Grad_i[0][iDim]; + /*--- List of auxiliary functions ---*/ + su2double ft2, d_ft2, r, d_r, g, d_g, glim, fw, d_fw, Ji, d_Ji, S, Shat, d_Shat, fv1, d_fv1, fv2, d_fv2; - CrossProduction = cb2_sigma * norm2_Grad * Volume; + /*--- List of helpers ---*/ + su2double Omega, dist_i_2, inv_k2_d2, inv_Shat, g_6, norm2_Grad; +}; - Residual = Production - Destruction + CrossProduction; +/*------------------------------------------------------------------------------ +| Strain rate +------------------------------------------------------------------------------*/ - /*--- Implicit part, production term ---*/ +/*! + * \brief Baseline + */ +struct Omega_Bsl { + template + static void get(CommonVariables &model_var) { - dfv1 = 3.0 * Ji_2 * cv1_3 / (nu * pow(Ji_3 + cv1_3, 2.)); - dfv2 = -(1 / nu - Ji_2 * dfv1) / pow(1. + Ji * fv1, 2.); - if (Shat <= 1.0e-10) - dShat = 0.0; - else - dShat = (fv2 + ScalarVar_i[0] * dfv2) * inv_k2_d2; + using Base::Vorticity_i; - if (transition) { - Jacobian_i[0] += Gamma_BC * cb1 * (ScalarVar_i[0] * dShat + Shat) * Volume; - } else { - Jacobian_i[0] += cb1 * (ScalarVar_i[0] * dShat + Shat) * Volume; - } + model_var.Omega = sqrt(Vorticity_i[0] * Vorticity_i[0] + Vorticity_i[1] * Vorticity_i[1] + Vorticity_i[2] * Vorticity_i[2]); + } +}; - /*--- Implicit part, destruction term ---*/ +/*! + * \brief Edward + * + * Here Omega is the Strain Rate + */ +struct Omega_Edw { + template + static void get(CommonVariables &model_var) { - dr = (Shat - ScalarVar_i[0] * dShat) * inv_Shat * inv_Shat * inv_k2_d2; - if (r == 10.0) dr = 0.0; - dg = dr * (1. + cw2 * (6.0 * pow(r, 5.0) - 1.0)); - dfw = dg * glim * (1. - g_6 / (g_6 + cw3_6)); - Jacobian_i[0] -= cw1 * (dfw * ScalarVar_i[0] + 2.0 * fw) * ScalarVar_i[0] / dist_i_2 * Volume; + using Base::PrimVar_Grad_i; + using Base::idx; - ft2_class::get(&ft2, &d_ft2); + unsigned short iDim, jDim; - su2double pingu = ft2 * 3.14; + su2double Sbar = 0.0; + for(iDim=0;iDim -class ft2_Bsl : public Base { - static double get(su2double* ft2, su2double* d_ft2) { - *ft2 = 0.0; - *d_ft2 = 0.0; - } +struct ft2_Bsl { + template + static void get(CommonVariables &model_var) { + model_var.ft2 = 0.0; + model_var.d_ft2 = 0.0; + } }; /*! * \brief non-zero ft2 term according to the literature and its derivative. */ -template -class ft2_nonzero : public Base { - using Base::ct3; - using Base::ct4; - using Base::d_xsi; - using Base::xsi; - - static void get(su2double* ft2, su2double* d_ft2) { - const su2double xsi2 = xsi * xsi; - - *ft2 = ct3 * exp(-ct4 * xsi2); - *d_ft2 = -2.0 * ct4 * xsi * *ft2 * d_xsi; - } -}; - -/* The above causes a cyclic dependency between the turbulence base and the ft2 and co. classes. - * To break that you need to template the get method instead of the class, for example: */ struct ft2_nonzero { - template - static void get(const Base& base, su2double& ft2, su2double& d_ft2) { - const su2double xsi2 = pow(base.xsi, 2); - ft2 = base.ct3 * exp(-base.ct4 * xsi2); - d_ft2 = -2.0 * base.ct4 * base.xsi * ft2 * base.d_xsi; - } -}; -/* Now you pass the numerics class itself to "get" to access the member variables, - * which you'll have to make public, for example in ComputeResidual: - * ft2_class::get(*this, ft2, d_ft2); - * - * This is not a perfect solution because for performance we should cut down on "aux" class variables. - * An alternative is to put such variables in a struct, which can then be a local variable in ComputeResidual. */ -struct CommonVariables { - su2double ft2, d_ft2, r, d_r, g, d_g, g_6, glim, fw, Ji, Ji_2, Ji_3, d_Ji, S, Omega, Shat, d_Shat, inv_Shat, fv1, fv2; + template + static void get(CommonVariables *model_var) { + const su2double xsi2 = pow(model_var->Ji, 2); + model_var->ft2 = model_var->ct3 * exp(-model_var->ct4 * xsi2); + model_var->d_ft2 = -2.0 * model_var->ct4 * model_var->Ji * model_var->ft2 * model_var->d_Ji; + } }; -/* - * ResidualType<> ComputeResidual(const CConfig* config) final { - * CommonVariables data; - * ... - * data.Ji = ... - * ... - * ft2_class::get(data, ft2, d_ft2); - */ -/* This way you can also dispense with templating "get". */ /*------------------------------------------------------------------------------ -| Compute the modified vorticity (\tilde{S}) and its derivative -| * \param[in] S - vorticity (Omega) -| * \param[in] PrimVar_Grad_i - Gradient of primitive variables at point i -| * \param[in] nul - dynamic laminar viscosity -| * \param[in] nue - nu_tilde -| * \param[in] fv1 - auxiliary function fv1 -| * \param[in] d_fv1 - derivative of fv1 w.r.t. nue variable -| * \param[in] fv2 - auxiliary function fv2 -| * \param[in] d_fv2 - derivative of fv2 w.r.t. nue variable -| * \param[in] inv_k2_d2 - 1/(k^2*d^2) -| * \param[out] Shat - modified vorticity (\tilde{S}) -| * \param[out] d_Shat - derivative of Shat w.r.t. nue variable +| Modified vorticity (\tilde{S}) and its derivative ------------------------------------------------------------------------------*/ /*! * \brief Baseline + * + * Required values: S, fv2, d_fv2, inv_k2_d2 */ -template -class ModVort_Bsl : Base { - using Base::d_fv2; - using Base::fv2; - using Base::inv_k2_d2; - using Base::S; +struct ModVort_Bsl { + template + static void get(CommonVariables &model_var) { - static constexpr su2double nue = Base::ScalarVar_i[0]; + su2double nue = Base::ScalarVar_i[0]; - public: - static void get(su2double* Shat, su2double* d_Shat) { - const su2double Sbar = nue * fv2 * inv_k2_d2; + const su2double Sbar = nue * model_var.fv2 * model_var.inv_k2_d2; - *Shat = S + Sbar; - *Shat = max(*Shat, 1.0e-10); + model_var.Shat = model_var.S + Sbar; + model_var.Shat = max(model_var.Shat, 1.0e-10); - const su2double d_Sbar = (fv2 + nue * d_fv2) * inv_k2_d2; + const su2double d_Sbar = (model_var.fv2 + nue * model_var.d_fv2) * model_var.inv_k2_d2; - *d_Shat = (*Shat <= 1.0e-10) ? 0.0 : d_Sbar; - } + model_var.d_Shat = (model_var.Shat <= 1.0e-10) ? 0.0 : d_Sbar; + } }; /*! * \brief Edward + * + * Required values: S, nu, Ji, fv1, d_fv1, fv2, d_fv2, inv_k2_d2 */ -template -class ModVort_Edw { - using Base::d_fv1; - using Base::fv1; - using Base::nDim; - using Base::PrimVar_Grad_i; - using Base::rotating_frame; - using Base::StrainMag_i; - - static constexpr su2double xsi = Base::Ji; - - static constexpr su2double nul = Base::Laminar_Viscosity_i; - static constexpr su2double nue = Base::ScalarVar_i[0]; - - public: - static void get(su2double* Shat, su2double* d_Shat) { - unsigned short iDim, jDim; - - /*--- Evaluate Omega, here Omega is the Strain Rate ---*/ +struct ModVort_Edw { + template + static void get(CommonVariables &model_var) { - su2double Sbar = 0.0; - for (iDim = 0; iDim < nDim; ++iDim) { - for (jDim = 0; jDim < nDim; ++jDim) { - Sbar += (PrimVar_Grad_i[1 + iDim][jDim] + PrimVar_Grad_i[1 + jDim][iDim]) * (PrimVar_Grad_i[1 + iDim][jDim]); - } - } - for (iDim = 0; iDim < nDim; ++iDim) { - Sbar -= ((2.0 / 3.0) * pow(PrimVar_Grad_i[1 + iDim][iDim], 2.0)); - } - - const su2double Omega = sqrt(max(Sbar, 0.0)); - - /*--- Rotational correction term ---*/ - if (rotating_frame) { - Omega += 2.0 * min(0.0, StrainMag_i - Omega); - } + model_var.Shat = max(model_var.S*((1.0/max(model_var.Ji,1.0e-16))+model_var.fv1),1.0e-16); + model_var.Shat = max(model_var.Shat, 1.0e-10); - Base::S = Omega; - - *Shat = max(Omega * ((1.0 / max(xsi, 1.0e-16)) + fv1), 1.0e-16); - *Shat = max(*Shat, 1.0e-10); - - *d_Shat = (*Shat <= 1.0e-10) ? 0.0 : -Omega * pow(xsi, -2.0) / nul + Omega * d_fv1; - } + model_var.d_Shat = (model_var.Shat <= 1.0e-10) ? 0.0 : -model_var.S*pow(model_var.Ji,-2.0)/nu + model_var.S*model_var.d_fv1; + } }; /*! * \brief Negative + * + * Required values: same as baseline model */ -template -class ModVort_Neg : Base { - static constexpr su2double nue = Base::ScalarVar_i[0]; - - static void get(su2double* Shat, su2double* d_Shat) { - if (nue > 0.0) { - // Don't check whether Sbar <>= -cv2*S. - // Baseline solution - ModVort_Bsl::get(Shat, d_Shat); - } - // else { - // // No need for Sbar - // } - } +struct ModVort_Neg { + template + static void get(CommonVariables &model_var) { + + su2double nue = Base::ScalarVar_i[0]; + + if (nue > 0.0) { + // Don't check whether Sbar <>= -cv2*S. + // Ref: Steven R. Allmaras, Forrester T. Johnson and Philippe R. Spalart - "Modifications and Clarications for the Implementation of the Spalart-Allmaras Turbulence Model" eq. 12 + // Baseline solution + ModVort_Bsl::get(model_var); + } + // else { + // // No need for Sbar + // } + } }; /*------------------------------------------------------------------------------ -| Compute the auxiliary function r and its derivative. -| * \param[in] Shat - modified vorticity (\tilde{S}) -| * \param[in] d_Shat - derivative of Shat w.r.t. nue variable -| * \param[in] inv_Shat - inverse of modified vorticity (\tilde{S}) -| * \param[in] nue - nu_tilde -| * \param[in] inv_k2_d2 - 1/(k^2*d^2) -| * \param[out] r - auxiliary function r -| * \param[out] dr - derivative of auxiliary function r +| Auxiliary function r and its derivative. ------------------------------------------------------------------------------*/ /*! * \brief Baseline + * + * Requires: Shat, d_Shat, inv_Shat, inv_k2_d2 */ -template -class r_Bsl { - using Base::d_Shat; - using Base::inv_k2_d2; - using Base::inv_Shat; - using Base::Shat; - - static constexpr su2double nue = Base::ScalarVar_i[0]; +struct r_Bsl { + template + static void get(CommonVariables &model_var) { - public: - static double get(su2double* r, su2double* d_r) { - *r = min(nue * inv_Shat * inv_k2_d2, 10.0); + su2double nue = Base::ScalarVar_i[0]; - *d_r = (Shat - nue * d_Shat) * inv_Shat * inv_Shat * inv_k2_d2; - } + model_var.r = min(nue * model_var.inv_Shat * model_var.inv_k2_d2, 10.0); + model_var.d_r = (model_var.Shat - nue * model_var.d_Shat) * model_var.inv_Shat * model_var.inv_Shat * model_var.inv_k2_d2; + if (model_var.r == 10.0) model_var.d_r = 0.0; + } }; /*! * \brief Edward + * + * Requires: Shat, d_Shat, inv_Shat, inv_k2_d2 */ -template -class r_Edw { - using Base::d_Shat; - using Base::inv_k2_d2; - using Base::inv_Shat; - using Base::Shat; +struct r_Edw { + template + static void get(CommonVariables &model_var) { - static constexpr su2double nue = Base::ScalarVar_i[0]; + su2double nue = Base::ScalarVar_i[0]; - public: - static double get(su2double* r, su2double* d_r) { - *r = min(nue * inv_Shat * inv_k2_d2, 10.0); - *r = tanh(*r) / tanh(1.0); + model_var.r = min(nue * model_var.inv_Shat * model_var.inv_k2_d2, 10.0); + model_var.r = tanh(model_var.r) / tanh(1.0); - *d_r = (Shat - nue * d_Shat) * inv_Shat * inv_Shat * inv_k2_d2; - *d_r = (1 - pow(tanh(*r), 2.0)) * (*d_r) / tanh(1.0); - } + model_var.d_r = (model_var.Shat - nue * model_var.d_Shat) * model_var.inv_Shat * model_var.inv_Shat * model_var.inv_k2_d2; + model_var.d_r = (1 - pow(tanh(model_var.r), 2.0)) * (model_var.d_r) / tanh(1.0); + } }; /*------------------------------------------------------------------------------ -| Compute production term and its derivative. -| * \param[in] S - vorticity (Omega) -| * \param[in] PrimVar_Grad_i - Gradient of primitive variables at point i -| * \param[in] nul - dynamic laminar viscosity -| * \param[in] nue - nu_tilde -| * \param[in] fv1 - auxiliary function fv1 -| * \param[in] d_fv1 - derivative of fv1 w.r.t. nue variable -| * \param[in] fv2 - auxiliary function fv2 -| * \param[in] d_fv2 - derivative of fv2 w.r.t. nue variable -| * \param[in] inv_k2_d2 - 1/(k^2*d^2) -| * \param[out] Shat - modified vorticity (\tilde{S}) -| * \param[out] d_Shat - derivative of Shat w.r.t. nue variable +| Compute source terms: production, destruction and cross-productions term and their derivatives. ------------------------------------------------------------------------------*/ /*! - * \brief Baseline + * \brief Baseline (Original SA model) */ -template -class Production_Bsl { - using Base::cb1; - using Base::ct3; - using Base::d_ft2; - using Base::d_Shat; - using Base::ft2; - using Base::S; - using Base::Shat; - - static constexpr su2double nue = Base::ScalarVar_i[0]; +struct SourceTerms_Bsl { + template + static void get(CommonVariables &model_var, su2double* Production, su2double* Destruction, su2double* CrossProduction, su2double* Jacobian) { - public: - static double get(su2double* Pr, su2double* d_Pr) { - *Pr = cb1 * (1. - ft2) * Shat * nue; + su2double nue = Base::ScalarVar_i[0]; - *d_Pr = cb1 * ((1. - ft2) * (Shat + nue * d_Shat) - d_ft2); - } -}; + ComputeProduction(nue, model_var, Production, Jacobian); -/*! - * \brief Negative - */ -template -class Production_Neg { - using Base::cb1; - using Base::ct3; - using Base::S; + ComputeDestruction(nue, model_var, Destruction, Jacobian); - static constexpr su2double nue = Base::ScalarVar_i[0]; + ComputeCrossProduction(nue, model_var, CrossProduction, Jacobian); + } - public: - static double get(su2double* Pr, su2double* d_Pr) { - if (nue > 0.0) { - // Baseline solution - Production_Bsl::get(Pr, d_Pr); - } else { - *Pr = cb1 * (1.0 - ct3) * S * nue; - - *d_Pr = cb1 * (1.0 - ct3) * S; - } - } -}; + static void ComputeProduction(const su2double nue, const CommonVariables &model_var, su2double* Production, su2double* Jacobian) { + *Production = model_var.cb1 * (1.0 - model_var.ft2) * model_var.Shat * nue; + *Jacobian += model_var.cb1 * (-model_var.Shat * nue * model_var.d_ft2 + (1.0 - model_var.ft2) * (nue * model_var.d_Shat + model_var.Shat)); + } -/*------------------------------------------------------------------------------ -| Compute destruction term and its derivative. -| * \param[in] S - vorticity (Omega) -| * \param[in] PrimVar_Grad_i - Gradient of primitive variables at point i -| * \param[in] nul - dynamic laminar viscosity -| * \param[in] nue - nu_tilde -| * \param[in] fv1 - auxiliary function fv1 -| * \param[in] d_fv1 - derivative of fv1 w.r.t. nue variable -| * \param[in] fv2 - auxiliary function fv2 -| * \param[in] d_fv2 - derivative of fv2 w.r.t. nue variable -| * \param[in] inv_k2_d2 - 1/(k^2*d^2) -| * \param[out] Shat - modified vorticity (\tilde{S}) -| * \param[out] d_Shat - derivative of Shat w.r.t. nue variable -------------------------------------------------------------------------------*/ + static void ComputeDestruction(const su2double nue, const CommonVariables &model_var, su2double* Destruction, su2double* Jacobian) { + *Destruction = (model_var.cw1 * model_var.fw - model_var.cb1 * model_var.ft2 / model_var.k2) * nue * nue / model_var.dist_i_2; + *Jacobian -= (model_var.cw1 * model_var.d_fw - model_var.cb1 / model_var.k2 * model_var.d_ft2) * nue * nue / model_var.dist_i_2 + (model_var.cw1 * model_var.fw - model_var.cb1 * model_var.ft2 / model_var.k2) * 2.0 * nue / model_var.dist_i_2; + } -/*! - * \brief Baseline - */ -template -class Desctruction_Bsl { - using Base::cb1; - using Base::cw1; - using Base::d_ft2; - using Base::d_fw; - using Base::d_Shat; - using Base::dist_i_2; - using Base::ft2; - using Base::fw; - using Base::k2; - using Base::Shat; - - static constexpr su2double nue = Base::ScalarVar_i[0]; + static void ComputeCrossProduction(const su2double nue, const CommonVariables &model_var, su2double* CrossProduction, su2double* Jacobian) { + *CrossProduction = model_var.cb2_sigma * model_var.norm2_Grad; + /*--- No contribution to the jacobian ---*/ + } - public: - static double get(su2double* De, su2double* d_De) { - *De = (cw1 * fw - cb1 * ft2 / k2) * nue * nue / dist_i_2; - *d_De = cw1 * (d_fw * nue + 2.0 * fw) * nue / dist_i_2; - } }; /*! * \brief Negative */ -template -class Destruction_Neg { - using Base::cb1; - using Base::cw1; - using Base::d_ft2; - using Base::d_fw; - using Base::d_Shat; - using Base::dist_i_2; - using Base::ft2; - using Base::fw; - using Base::k2; - using Base::Shat; - - static constexpr su2double nue = Base::ScalarVar_i[0]; +struct SourceTerms_Neg { + template + static void get(CommonVariables &model_var, su2double* Production, su2double* Destruction, su2double* CrossProduction, su2double* Jacobian) { - public: - static double get(su2double* De, su2double* d_De) { - if (nue > 0.0) { - // Baseline solution - Destruction_Bsl::get(De, d_De); - } else { - *De = -cw1 * nue * nue / dist_i_2; - - *d_De = -2.0 * cw1 * nue / dist_i_2; - } - } + su2double nue = Base::ScalarVar_i[0]; + + if (nue > 0.0) { + + // Baseline solution + SourceTerms_Bsl::get(model_var, Production, Destruction, CrossProduction, Jacobian); + + } else { + + ComputeProduction(nue, model_var, Production, Jacobian); + + ComputeDestruction(nue, model_var, Destruction, Jacobian); + + ComputeCrossProduction(nue, model_var, CrossProduction, Jacobian); + + } + } + + static void ComputeProduction(const su2double nue, const CommonVariables &model_var, su2double* Production, su2double* Jacobian) { + *Production = model_var.cb1 * (1.0 - model_var.ct3) * model_var.S * nue; + *Jacobian += model_var.cb1 * (1.0 - model_var.ct3) * model_var.S; + } + + static void ComputeDestruction(const su2double nue, const CommonVariables &model_var, su2double* Destruction, su2double* Jacobian) { + *Destruction = model_var.cw1 * nue * nue / model_var.dist_i_2; + *Jacobian -= 2.0 * model_var.cw1 * nue / model_var.dist_i_2; + } + + static void ComputeCrossProduction(const su2double nue, const CommonVariables &model_var, su2double* CrossProduction, su2double* Jacobian) { + /*--- Same cross production as baseline. No need to duplicate code. ---*/ + SourceTerms_Bsl::ComputeCrossProduction(nue, model_var, CrossProduction, Jacobian); + } }; /*------------------------------------------------------------------------------ -| Compute cross production term and its derivative. -| * \param[in] S - vorticity (Omega) -| * \param[in] PrimVar_Grad_i - Gradient of primitive variables at point i -| * \param[in] nul - dynamic laminar viscosity -| * \param[in] nue - nu_tilde -| * \param[in] fv1 - auxiliary function fv1 -| * \param[in] d_fv1 - derivative of fv1 w.r.t. nue variable -| * \param[in] fv2 - auxiliary function fv2 -| * \param[in] d_fv2 - derivative of fv2 w.r.t. nue variable -| * \param[in] inv_k2_d2 - 1/(k^2*d^2) -| * \param[out] Shat - modified vorticity (\tilde{S}) -| * \param[out] d_Shat - derivative of Shat w.r.t. nue variable +| Additional source terms ------------------------------------------------------------------------------*/ -/*! - * \brief Baseline - */ -template -class CrossProduction_Bsl { - using Base::cb2_sigma; - using Base::norm2_Grad; +///*! +// * \brief Baseline +// */ +//template +//class CrossProduction_Bsl { +// using Base::cb2_sigma; +// using Base::norm2_Grad; - static constexpr su2double nue = Base::ScalarVar_i[0]; +// static constexpr su2double nue = Base::ScalarVar_i[0]; - static double get(su2double* CrossProd, su2double* d_CrossProd) { - *CrossProd = cb2_sigma * norm2_Grad; +// static double get(su2double* CrossProd, su2double* d_CrossProd) { +// *CrossProd = cb2_sigma * norm2_Grad; - // No cross production influence in the Jacobian - *d_CrossProd = 0.0; - } -}; +// // No cross production influence in the Jacobian +// *d_CrossProd = 0.0; +// } +//}; From f17062fd771312925d1e6b4160b235ffabb622cb Mon Sep 17 00:00:00 2001 From: Guillermo Suarez Date: Wed, 2 Feb 2022 15:27:55 +0100 Subject: [PATCH 12/34] Draft decorators --- .../numerics/turbulent/turb_sources_new.hpp | 111 ++++++++++++++---- 1 file changed, 90 insertions(+), 21 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp index f7611ce18eb1..f0c7c00a2adf 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp @@ -147,7 +147,7 @@ class CSourceBase_TurbSA : public CNumerics { Jacobian_i[0] = 0.0; /*--- Evaluate Omega ---*/ - Omega_class::get(model_var); + Omega_class::get<*this>(model_var); /*--- Rotational correction term ---*/ @@ -161,7 +161,7 @@ class CSourceBase_TurbSA : public CNumerics { model_var.S = model_var.Omega; model_var.dist_i_2 = dist_i * dist_i; - su2double nu = Laminar_Viscosity_i / Density_i; + su2double const nu = Laminar_Viscosity_i / Density_i; model_var.inv_k2_d2 = 1.0 / (model_var.k2 * model_var.dist_i_2); /*--- Modified values for roughness ---*/ @@ -183,15 +183,15 @@ class CSourceBase_TurbSA : public CNumerics { model_var.d_fv2 = -(1.0 / nu - Ji_2 * model_var.d_fv1) / pow(1.0 + model_var.Ji * model_var.fv1, 2.0); /*--- Compute ft2 term ---*/ - ft2_class::get(model_var); + ft2_class::get<*this>(model_var); /*--- Compute modified vorticity ---*/ - ModVort_class::get(model_var); + ModVort_class::get<*this>(model_var); model_var.inv_Shat = 1.0 / model_var.Shat; /*--- Compute auxiliary function r ---*/ - r_class::get(model_var); + r_class::get<*this>(model_var); model_var.g = model_var.r + model_var.cw2 * (pow(model_var.r, 6.0) - model_var.r); model_var.g_6 = pow(model_var.g, 6.0); @@ -206,7 +206,7 @@ class CSourceBase_TurbSA : public CNumerics { model_var.norm2_Grad += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; /*--- Compute production, destruction and cross production and jacobian ---*/ - SourceTerms_class::get(model_var, &Production, &Destruction, &CrossProduction, &Jacobian_i[0]); + SourceTerms_class::get<*this>(model_var, &Production, &Destruction, &CrossProduction, &Jacobian_i[0]); /*--- Compute any necessary additional source term and jacobian contribution ---*/ @@ -217,15 +217,37 @@ class CSourceBase_TurbSA : public CNumerics { /*--- Jacobian ---*/ Jacobian_i[0] *= Volume; } + + // AD::SetPreaccOut(Residual); + // AD::EndPreacc(); + + return ResidualType<>(&Residual, &Jacobian_i, nullptr); } }; +/* ============================================================================= + * SPALART-ALLMARAS VARIANT CLASSES + * ============================================================================*/ + /*------------------------------------------------------------------------------ | Structure with SA common auxiliary functions and constants ------------------------------------------------------------------------------*/ struct CommonVariables { + /*--- List of constants ---*/ - su2double cv1_3, k2, cb1, cw2, ct3, ct4, cw3_6, cb2_sigma, sigma, cb2, cw1, cr1; + const su2double + cv1_3 = pow(7.1, 3.0), + k2 = pow(0.41, 2.0), + cb1 = 0.1355, + cw2 = 0.3, + ct3 = 1.2, + ct4 = 0.5, + cw3_6 = pow(2.0, 6.0), + sigma = 2./3., + cb2 = 0.622, + cb2_sigma = cb2/sigma, + cw1 = cb1/k2+(1.0+cb2)/sigma, + cr1 = 0.5; /*--- List of auxiliary functions ---*/ su2double ft2, d_ft2, r, d_r, g, d_g, glim, fw, d_fw, Ji, d_Ji, S, Shat, d_Shat, fv1, d_fv1, fv2, d_fv2; @@ -263,6 +285,7 @@ struct Omega_Edw { using Base::PrimVar_Grad_i; using Base::idx; + using Base::nDim; unsigned short iDim, jDim; su2double Sbar = 0.0; @@ -343,6 +366,8 @@ struct ModVort_Edw { template static void get(CommonVariables &model_var) { + using Base::nu; + model_var.Shat = max(model_var.S*((1.0/max(model_var.Ji,1.0e-16))+model_var.fv1),1.0e-16); model_var.Shat = max(model_var.Shat, 1.0e-10); @@ -492,24 +517,68 @@ struct SourceTerms_Neg { } }; + +/* ============================================================================= + * SPALART-ALLMARAS ADDITIONAL SOURCE TERMS DECORATORS + * ============================================================================*/ + +/*--- Decorator ---*/ +class AdditionalSourceTerms : public CNumerics { + +protected: + CNumerics& m_Decorator; + +public: + AdditionalSourceTerms(CNumerics& decorator):m_Decorator(decorator) {} + + ResidualType<> ComputeResidual(const CConfig* config) { + m_Decorator.ComputeResidual(config); + } + +}; + /*------------------------------------------------------------------------------ | Additional source terms ------------------------------------------------------------------------------*/ -///*! -// * \brief Baseline -// */ -//template -//class CrossProduction_Bsl { -// using Base::cb2_sigma; -// using Base::norm2_Grad; -// static constexpr su2double nue = Base::ScalarVar_i[0]; +/*! + * \brief Mixing Layer Compressibility Correction (SA-comp) + */ +class CompressiblityCorrection : public AdditionalSourceTerms { + +private: + + const su2double c5 = 3.5; + + +public: + + CompressiblityCorrection(CNumerics& decorator):AdditionalSourceTerms(decorator) {} -// static double get(su2double* CrossProd, su2double* d_CrossProd) { -// *CrossProd = cb2_sigma * norm2_Grad; + ResidualType<> ComputeResidual(const CConfig* config) final { -// // No cross production influence in the Jacobian -// *d_CrossProd = 0.0; -// } -//}; + /*--- Compressibility Correction term ---*/ + Pressure_i = V_i[idx.Pressure()]; + SoundSpeed_i = sqrt(Pressure_i*Gamma/Density_i); + su2double aux_cc=0; + for(iDim=0;iDim(&Residual, &Jacobian_i, nullptr); + } +}; From 123302d8acb96c34e672afb428129d1da3a8b4ca Mon Sep 17 00:00:00 2001 From: Guillermo Suarez Date: Wed, 2 Feb 2022 17:22:12 +0100 Subject: [PATCH 13/34] Finalize SA variations implementation --- .../numerics/turbulent/turb_sources_new.hpp | 207 +++++++++--------- 1 file changed, 105 insertions(+), 102 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp index f0c7c00a2adf..331484547bca 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp @@ -30,6 +30,33 @@ #include "../scalar/scalar_sources.hpp" +/*------------------------------------------------------------------------------ +| Structure with SA common auxiliary functions and constants +------------------------------------------------------------------------------*/ +struct CommonSAVariables { + + /*--- List of constants ---*/ + const su2double + cv1_3 = pow(7.1, 3.0), + k2 = pow(0.41, 2.0), + cb1 = 0.1355, + cw2 = 0.3, + ct3 = 1.2, + ct4 = 0.5, + cw3_6 = pow(2.0, 6.0), + sigma = 2./3., + cb2 = 0.622, + cb2_sigma = cb2/sigma, + cw1 = cb1/k2+(1.0+cb2)/sigma, + cr1 = 0.5; + + /*--- List of auxiliary functions ---*/ + su2double ft2, d_ft2, r, d_r, g, d_g, glim, fw, d_fw, Ji, d_Ji, S, Shat, d_Shat, fv1, d_fv1, fv2, d_fv2; + + /*--- List of helpers ---*/ + su2double Omega, dist_i_2, inv_k2_d2, inv_Shat, g_6, norm2_Grad; +}; + /*! * \class CSourcePieceWise_TurbSA * \brief Class for integrating the source terms of the Spalart-Allmaras turbulence model equation. @@ -41,7 +68,7 @@ class CSourceBase_TurbSA : public CNumerics { protected: /* For performance we should cut down on "aux" class variables. - * Such variables are now declared in the struct CommonVariables + * Such variables are now declared in the struct CommonSAVariables * which can then be a local variable in ComputeResidual. */ @@ -131,7 +158,7 @@ class CSourceBase_TurbSA : public CNumerics { ResidualType<> ComputeResidual(const CConfig* config) final { /*--- Model common auxiliary and constant variables ---*/ - CommonVariables model_var; + CommonSAVariables model_var; // Set the boolean here depending on whether the point is closest to a rough wall or not. roughwall = (roughness_i > 0.0); @@ -147,7 +174,7 @@ class CSourceBase_TurbSA : public CNumerics { Jacobian_i[0] = 0.0; /*--- Evaluate Omega ---*/ - Omega_class::get<*this>(model_var); + Omega_class::get(Vorticity_i, PrimVar_Grad_i, idx.Velocity(), model_var); /*--- Rotational correction term ---*/ @@ -161,7 +188,7 @@ class CSourceBase_TurbSA : public CNumerics { model_var.S = model_var.Omega; model_var.dist_i_2 = dist_i * dist_i; - su2double const nu = Laminar_Viscosity_i / Density_i; + const su2double nu = Laminar_Viscosity_i / Density_i; model_var.inv_k2_d2 = 1.0 / (model_var.k2 * model_var.dist_i_2); /*--- Modified values for roughness ---*/ @@ -183,30 +210,30 @@ class CSourceBase_TurbSA : public CNumerics { model_var.d_fv2 = -(1.0 / nu - Ji_2 * model_var.d_fv1) / pow(1.0 + model_var.Ji * model_var.fv1, 2.0); /*--- Compute ft2 term ---*/ - ft2_class::get<*this>(model_var); + ft2_class::get(model_var); /*--- Compute modified vorticity ---*/ - ModVort_class::get<*this>(model_var); + ModVort_class::get(ScalarVar_i[0], nu, model_var); model_var.inv_Shat = 1.0 / model_var.Shat; /*--- Compute auxiliary function r ---*/ - r_class::get<*this>(model_var); + r_class::get(ScalarVar_i[0], model_var); model_var.g = model_var.r + model_var.cw2 * (pow(model_var.r, 6.0) - model_var.r); model_var.g_6 = pow(model_var.g, 6.0); model_var.glim = pow((1.0 + model_var.cw3_6) / (model_var.g_6 + model_var.cw3_6), 1.0 / 6.0); model_var.fw = model_var.g * model_var.glim; - model_var.d_g = model_var.d_r * (1. + model_var.cw2 * (6.0 * pow(model_var.r, 5.0) - 1.0)); - model_var.dfw = model_var.d_g * model_var.glim * (1. - model_var.g_6 / (model_var.g_6 + model_var.cw3_6)); + model_var.d_g = model_var.d_r * (1. + model_var.cw2 * (6.0 * pow(model_var.r, 5.0) - 1.0)); + model_var.d_fw = model_var.d_g * model_var.glim * (1. - model_var.g_6 / (model_var.g_6 + model_var.cw3_6)); model_var.norm2_Grad = 0.0; for (iDim = 0; iDim < nDim; iDim++) model_var.norm2_Grad += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; /*--- Compute production, destruction and cross production and jacobian ---*/ - SourceTerms_class::get<*this>(model_var, &Production, &Destruction, &CrossProduction, &Jacobian_i[0]); + SourceTerms_class::get(model_var, &Production, &Destruction, &CrossProduction, &Jacobian_i[0]); /*--- Compute any necessary additional source term and jacobian contribution ---*/ @@ -227,47 +254,33 @@ class CSourceBase_TurbSA : public CNumerics { /* ============================================================================= * SPALART-ALLMARAS VARIANT CLASSES + * + * Templating the methods "get" with Base and using the variables from Base, will + * require that the variables from Base are public. Since Base is the CNumerics + * class and they are protected, it is better to do not template "get". + * Hence, pass the additional required variables to the method. * ============================================================================*/ -/*------------------------------------------------------------------------------ -| Structure with SA common auxiliary functions and constants -------------------------------------------------------------------------------*/ -struct CommonVariables { - - /*--- List of constants ---*/ - const su2double - cv1_3 = pow(7.1, 3.0), - k2 = pow(0.41, 2.0), - cb1 = 0.1355, - cw2 = 0.3, - ct3 = 1.2, - ct4 = 0.5, - cw3_6 = pow(2.0, 6.0), - sigma = 2./3., - cb2 = 0.622, - cb2_sigma = cb2/sigma, - cw1 = cb1/k2+(1.0+cb2)/sigma, - cr1 = 0.5; - - /*--- List of auxiliary functions ---*/ - su2double ft2, d_ft2, r, d_r, g, d_g, glim, fw, d_fw, Ji, d_Ji, S, Shat, d_Shat, fv1, d_fv1, fv2, d_fv2; - - /*--- List of helpers ---*/ - su2double Omega, dist_i_2, inv_k2_d2, inv_Shat, g_6, norm2_Grad; -}; - /*------------------------------------------------------------------------------ | Strain rate +| +| \param nDim: problem dimension +| \param Vorticity_i: vorticity array +| \param PrimVar_Grad_i: primitive variables gradient at point i +| \param Velocity index +| \param model_var: Common SA varibales struct +| ------------------------------------------------------------------------------*/ /*! * \brief Baseline */ struct Omega_Bsl { - template - static void get(CommonVariables &model_var) { +// template + template + static void get(const su2double* Vorticity_i, const su2double** PrimVar_Grad_i, const unsigned short vel_idx, CommonSAVariables &model_var) { - using Base::Vorticity_i; +// using Base::Vorticity_i; model_var.Omega = sqrt(Vorticity_i[0] * Vorticity_i[0] + Vorticity_i[1] * Vorticity_i[1] + Vorticity_i[2] * Vorticity_i[2]); } @@ -279,24 +292,20 @@ struct Omega_Bsl { * Here Omega is the Strain Rate */ struct Omega_Edw { - template - static void get(CommonVariables &model_var) { + template + static void get(const su2double* Vorticity_i, const su2double** PrimVar_Grad_i, const unsigned short vel_idx, CommonSAVariables &model_var) { - using Base::PrimVar_Grad_i; - using Base::idx; - - using Base::nDim; unsigned short iDim, jDim; su2double Sbar = 0.0; for(iDim=0;iDim - static void get(CommonVariables &model_var) { + + static void get(CommonSAVariables &model_var) { model_var.ft2 = 0.0; model_var.d_ft2 = 0.0; } @@ -323,28 +335,30 @@ struct ft2_Bsl { * \brief non-zero ft2 term according to the literature and its derivative. */ struct ft2_nonzero { - template - static void get(CommonVariables *model_var) { + + static void get(CommonSAVariables *model_var) { const su2double xsi2 = pow(model_var->Ji, 2); model_var->ft2 = model_var->ct3 * exp(-model_var->ct4 * xsi2); model_var->d_ft2 = -2.0 * model_var->ct4 * model_var->Ji * model_var->ft2 * model_var->d_Ji; } }; + /*------------------------------------------------------------------------------ | Modified vorticity (\tilde{S}) and its derivative +| +| \param nue: SA variable +| \param nu: laminar viscosity +| \param model_var: Common SA varibales struct +| ------------------------------------------------------------------------------*/ /*! * \brief Baseline - * - * Required values: S, fv2, d_fv2, inv_k2_d2 */ struct ModVort_Bsl { - template - static void get(CommonVariables &model_var) { - su2double nue = Base::ScalarVar_i[0]; + static void get(const su2double nue, const su2double nu, CommonSAVariables &model_var) { const su2double Sbar = nue * model_var.fv2 * model_var.inv_k2_d2; @@ -359,14 +373,10 @@ struct ModVort_Bsl { /*! * \brief Edward - * - * Required values: S, nu, Ji, fv1, d_fv1, fv2, d_fv2, inv_k2_d2 */ struct ModVort_Edw { - template - static void get(CommonVariables &model_var) { - using Base::nu; + static void get(const su2double nue, const su2double nu, CommonSAVariables &model_var) { model_var.Shat = max(model_var.S*((1.0/max(model_var.Ji,1.0e-16))+model_var.fv1),1.0e-16); model_var.Shat = max(model_var.Shat, 1.0e-10); @@ -377,41 +387,39 @@ struct ModVort_Edw { /*! * \brief Negative - * - * Required values: same as baseline model */ struct ModVort_Neg { - template - static void get(CommonVariables &model_var) { - su2double nue = Base::ScalarVar_i[0]; + static void get(const su2double nue, const su2double nu, CommonSAVariables &model_var) { if (nue > 0.0) { - // Don't check whether Sbar <>= -cv2*S. - // Ref: Steven R. Allmaras, Forrester T. Johnson and Philippe R. Spalart - "Modifications and Clarications for the Implementation of the Spalart-Allmaras Turbulence Model" eq. 12 // Baseline solution - ModVort_Bsl::get(model_var); + ModVort_Bsl::get(nue, nu, model_var); } + /*! + * Don't check whether Sbar <>= -cv2*S. + * Ref: Steven R. Allmaras, Forrester T. Johnson and Philippe R. Spalart - "Modifications and Clarications for the Implementation of the Spalart-Allmaras Turbulence Model" eq. 12 + * No need for Sbar + */ // else { - // // No need for Sbar // } } }; + /*------------------------------------------------------------------------------ | Auxiliary function r and its derivative. +| +| \param nue: SA variable +| ------------------------------------------------------------------------------*/ /*! * \brief Baseline - * - * Requires: Shat, d_Shat, inv_Shat, inv_k2_d2 */ struct r_Bsl { - template - static void get(CommonVariables &model_var) { - su2double nue = Base::ScalarVar_i[0]; + static void get(const su2double nue, CommonSAVariables &model_var) { model_var.r = min(nue * model_var.inv_Shat * model_var.inv_k2_d2, 10.0); model_var.d_r = (model_var.Shat - nue * model_var.d_Shat) * model_var.inv_Shat * model_var.inv_Shat * model_var.inv_k2_d2; @@ -421,14 +429,10 @@ struct r_Bsl { /*! * \brief Edward - * - * Requires: Shat, d_Shat, inv_Shat, inv_k2_d2 */ struct r_Edw { - template - static void get(CommonVariables &model_var) { - su2double nue = Base::ScalarVar_i[0]; + static void get(const su2double nue, CommonSAVariables &model_var) { model_var.r = min(nue * model_var.inv_Shat * model_var.inv_k2_d2, 10.0); model_var.r = tanh(model_var.r) / tanh(1.0); @@ -438,18 +442,21 @@ struct r_Edw { } }; + /*------------------------------------------------------------------------------ | Compute source terms: production, destruction and cross-productions term and their derivatives. +| +| \brief get: +| \param nue: SA variable +| ------------------------------------------------------------------------------*/ /*! * \brief Baseline (Original SA model) */ struct SourceTerms_Bsl { - template - static void get(CommonVariables &model_var, su2double* Production, su2double* Destruction, su2double* CrossProduction, su2double* Jacobian) { - su2double nue = Base::ScalarVar_i[0]; + static void get(const su2double nue, const CommonSAVariables &model_var, su2double* Production, su2double* Destruction, su2double* CrossProduction, su2double* Jacobian) { ComputeProduction(nue, model_var, Production, Jacobian); @@ -458,37 +465,33 @@ struct SourceTerms_Bsl { ComputeCrossProduction(nue, model_var, CrossProduction, Jacobian); } - static void ComputeProduction(const su2double nue, const CommonVariables &model_var, su2double* Production, su2double* Jacobian) { + static void ComputeProduction(const su2double nue, const CommonSAVariables &model_var, su2double* Production, su2double* Jacobian) { *Production = model_var.cb1 * (1.0 - model_var.ft2) * model_var.Shat * nue; *Jacobian += model_var.cb1 * (-model_var.Shat * nue * model_var.d_ft2 + (1.0 - model_var.ft2) * (nue * model_var.d_Shat + model_var.Shat)); } - static void ComputeDestruction(const su2double nue, const CommonVariables &model_var, su2double* Destruction, su2double* Jacobian) { + static void ComputeDestruction(const su2double nue, const CommonSAVariables &model_var, su2double* Destruction, su2double* Jacobian) { *Destruction = (model_var.cw1 * model_var.fw - model_var.cb1 * model_var.ft2 / model_var.k2) * nue * nue / model_var.dist_i_2; *Jacobian -= (model_var.cw1 * model_var.d_fw - model_var.cb1 / model_var.k2 * model_var.d_ft2) * nue * nue / model_var.dist_i_2 + (model_var.cw1 * model_var.fw - model_var.cb1 * model_var.ft2 / model_var.k2) * 2.0 * nue / model_var.dist_i_2; } - static void ComputeCrossProduction(const su2double nue, const CommonVariables &model_var, su2double* CrossProduction, su2double* Jacobian) { + static void ComputeCrossProduction(const su2double nue, const CommonSAVariables &model_var, su2double* CrossProduction, su2double* Jacobian) { *CrossProduction = model_var.cb2_sigma * model_var.norm2_Grad; /*--- No contribution to the jacobian ---*/ } - - }; /*! * \brief Negative */ struct SourceTerms_Neg { - template - static void get(CommonVariables &model_var, su2double* Production, su2double* Destruction, su2double* CrossProduction, su2double* Jacobian) { - su2double nue = Base::ScalarVar_i[0]; + static void get(const su2double nue, const CommonSAVariables &model_var, su2double* Production, su2double* Destruction, su2double* CrossProduction, su2double* Jacobian) { if (nue > 0.0) { // Baseline solution - SourceTerms_Bsl::get(model_var, Production, Destruction, CrossProduction, Jacobian); + SourceTerms_Bsl::get(nue, model_var, Production, Destruction, CrossProduction, Jacobian); } else { @@ -501,17 +504,17 @@ struct SourceTerms_Neg { } } - static void ComputeProduction(const su2double nue, const CommonVariables &model_var, su2double* Production, su2double* Jacobian) { + static void ComputeProduction(const su2double nue, const CommonSAVariables &model_var, su2double* Production, su2double* Jacobian) { *Production = model_var.cb1 * (1.0 - model_var.ct3) * model_var.S * nue; *Jacobian += model_var.cb1 * (1.0 - model_var.ct3) * model_var.S; } - static void ComputeDestruction(const su2double nue, const CommonVariables &model_var, su2double* Destruction, su2double* Jacobian) { + static void ComputeDestruction(const su2double nue, const CommonSAVariables &model_var, su2double* Destruction, su2double* Jacobian) { *Destruction = model_var.cw1 * nue * nue / model_var.dist_i_2; *Jacobian -= 2.0 * model_var.cw1 * nue / model_var.dist_i_2; } - static void ComputeCrossProduction(const su2double nue, const CommonVariables &model_var, su2double* CrossProduction, su2double* Jacobian) { + static void ComputeCrossProduction(const su2double nue, const CommonSAVariables &model_var, su2double* CrossProduction, su2double* Jacobian) { /*--- Same cross production as baseline. No need to duplicate code. ---*/ SourceTerms_Bsl::ComputeCrossProduction(nue, model_var, CrossProduction, Jacobian); } @@ -522,7 +525,9 @@ struct SourceTerms_Neg { * SPALART-ALLMARAS ADDITIONAL SOURCE TERMS DECORATORS * ============================================================================*/ -/*--- Decorator ---*/ +/*! + * \brief Decorator + */ class AdditionalSourceTerms : public CNumerics { protected: @@ -534,7 +539,6 @@ class AdditionalSourceTerms : public CNumerics { ResidualType<> ComputeResidual(const CConfig* config) { m_Decorator.ComputeResidual(config); } - }; /*------------------------------------------------------------------------------ @@ -543,7 +547,7 @@ class AdditionalSourceTerms : public CNumerics { /*! - * \brief Mixing Layer Compressibility Correction (SA-comp) + * \brief Mixing Layer Compressibility Correction (SA-comp) decorator */ class CompressiblityCorrection : public AdditionalSourceTerms { @@ -551,7 +555,6 @@ class CompressiblityCorrection : public AdditionalSourceTerms { const su2double c5 = 3.5; - public: CompressiblityCorrection(CNumerics& decorator):AdditionalSourceTerms(decorator) {} @@ -575,7 +578,7 @@ class CompressiblityCorrection : public AdditionalSourceTerms { auto Residual = m_Decorator.ComputeResidual(config); /*--- Decorator residual contribution ---*/ - *Residual -= CompCorrection; + *Residual.residual -= CompCorrection; *Residual.jacobian_i -= d_CompCorrection; From 3478838ce339cee88cb9eeef01c025fbe057d7bd Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sat, 26 Feb 2022 00:18:24 +0000 Subject: [PATCH 14/34] some cleanup and fixes --- .../numerics/turbulent/turb_sources.hpp | 2 - .../numerics/turbulent/turb_sources_new.hpp | 235 +++++++----------- .../src/numerics/turbulent/turb_sources.cpp | 3 - 3 files changed, 91 insertions(+), 149 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 0c7304304ed7..2ed22cf8e486 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -61,7 +61,6 @@ class CSourceBase_TurbSA : public CNumerics { protected: const bool rotating_frame = false; - bool roughwall = false; public: /*! @@ -137,7 +136,6 @@ class CSourcePieceWise_TurbSA final : public CSourceBase_TurbSA { su2double dr, dg, dfw; unsigned short iDim; bool transition; - bool axisymmetric; public: /*! diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp index 331484547bca..0cd8f5be0d90 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp @@ -3,7 +3,7 @@ * \brief Delarations of numerics classes for integration of source * terms in turbulence problems. * \author F. Palacios, T. Economon - * \version 7.2.1 "Blackbird" + * \version 7.3.0 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -30,9 +30,10 @@ #include "../scalar/scalar_sources.hpp" -/*------------------------------------------------------------------------------ -| Structure with SA common auxiliary functions and constants -------------------------------------------------------------------------------*/ +/*! + * \class CommonSAVariables + * \brief Structure with SA common auxiliary functions and constants. + */ struct CommonSAVariables { /*--- List of constants ---*/ @@ -58,20 +59,15 @@ struct CommonSAVariables { }; /*! - * \class CSourcePieceWise_TurbSA + * \class CSourceBase_TurbSA * \brief Class for integrating the source terms of the Spalart-Allmaras turbulence model equation. - * \brief The variables that are subject to change in each variation/correction have their own class. Additional source - * terms are implemented as decorators. \ingroup SourceDiscr \author A. Bueno. + * The variables that are subject to change in each variation/correction have their own class. + * \note Additional source terms (e.g. compressibility) are implemented as decorators. */ template class CSourceBase_TurbSA : public CNumerics { protected: - /* For performance we should cut down on "aux" class variables. - * Such variables are now declared in the struct CommonSAVariables - * which can then be a local variable in ComputeResidual. - */ - su2double Gamma_BC = 0.0; su2double intermittency; @@ -83,17 +79,11 @@ class CSourceBase_TurbSA : public CNumerics { private: const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ - - unsigned short iDim; - - su2double Jacobian_Buffer; /// Static storage for the Jacobian (which needs to be pointer for return type). + su2double Jacobian_Buffer; /*!< \brief Static storage for the Jacobian (which needs to be pointer for return type). */ protected: const bool rotating_frame = false; - bool roughwall = false; - - bool transition; - bool axisymmetric; + const bool transition = false; public: /*! @@ -103,7 +93,8 @@ class CSourceBase_TurbSA : public CNumerics { * \param[in] config - Definition of the particular problem. */ CSourceBase_TurbSA(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config) - : CNumerics(val_nDim, val_nVar, config), idx(val_nDim, config->GetnSpecies()) {} + : CNumerics(val_nDim, val_nVar, config), idx(val_nDim, config->GetnSpecies()), + rotating_frame(config->GetRotating_Frame()), transition(config->GetKind_Trans_Model() == TURB_TRANS_MODEL::BC) {} /*! * \brief Residual for source term integration. @@ -155,16 +146,13 @@ class CSourceBase_TurbSA : public CNumerics { * \param[in] config - Definition of the particular problem. * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. */ - ResidualType<> ComputeResidual(const CConfig* config) final { + ResidualType<> ComputeResidual(const CConfig* config) override { /*--- Model common auxiliary and constant variables ---*/ CommonSAVariables model_var; - // Set the boolean here depending on whether the point is closest to a rough wall or not. - roughwall = (roughness_i > 0.0); - - Density_i = V_i[idx.Density()]; - Laminar_Viscosity_i = V_i[idx.LaminarViscosity()]; + const auto& Density_i = V_i[idx.Density()]; + const auto& Laminar_Viscosity_i = V_i[idx.LaminarViscosity()]; Residual = 0.0; Production = 0.0; @@ -174,7 +162,11 @@ class CSourceBase_TurbSA : public CNumerics { Jacobian_i[0] = 0.0; /*--- Evaluate Omega ---*/ - Omega_class::get(Vorticity_i, PrimVar_Grad_i, idx.Velocity(), model_var); + if (nDim == 2) { + Omega_class::get<2>(Vorticity_i, PrimVar_Grad_i, idx.Velocity(), model_var); + } else { + Omega_class::get<3>(Vorticity_i, PrimVar_Grad_i, idx.Velocity(), model_var); + } /*--- Rotational correction term ---*/ @@ -228,12 +220,10 @@ class CSourceBase_TurbSA : public CNumerics { model_var.d_g = model_var.d_r * (1. + model_var.cw2 * (6.0 * pow(model_var.r, 5.0) - 1.0)); model_var.d_fw = model_var.d_g * model_var.glim * (1. - model_var.g_6 / (model_var.g_6 + model_var.cw3_6)); - model_var.norm2_Grad = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - model_var.norm2_Grad += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; + model_var.norm2_Grad = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[0]); /*--- Compute production, destruction and cross production and jacobian ---*/ - SourceTerms_class::get(model_var, &Production, &Destruction, &CrossProduction, &Jacobian_i[0]); + SourceTerms_class::get(model_var, Production, Destruction, CrossProduction, Jacobian_i[0]); /*--- Compute any necessary additional source term and jacobian contribution ---*/ @@ -254,21 +244,16 @@ class CSourceBase_TurbSA : public CNumerics { /* ============================================================================= * SPALART-ALLMARAS VARIANT CLASSES - * - * Templating the methods "get" with Base and using the variables from Base, will - * require that the variables from Base are public. Since Base is the CNumerics - * class and they are protected, it is better to do not template "get". - * Hence, pass the additional required variables to the method. * ============================================================================*/ /*------------------------------------------------------------------------------ | Strain rate | -| \param nDim: problem dimension +| \tparam nDim: problem dimension | \param Vorticity_i: vorticity array | \param PrimVar_Grad_i: primitive variables gradient at point i | \param Velocity index -| \param model_var: Common SA varibales struct +| \param model_var: Common SA variables struct | ------------------------------------------------------------------------------*/ @@ -276,47 +261,40 @@ class CSourceBase_TurbSA : public CNumerics { * \brief Baseline */ struct Omega_Bsl { -// template - template - static void get(const su2double* Vorticity_i, const su2double** PrimVar_Grad_i, const unsigned short vel_idx, CommonSAVariables &model_var) { - -// using Base::Vorticity_i; - - model_var.Omega = sqrt(Vorticity_i[0] * Vorticity_i[0] + Vorticity_i[1] * Vorticity_i[1] + Vorticity_i[2] * Vorticity_i[2]); + template + static void get(const su2double* Vorticity_i, const MatrixType& PrimVar_Grad_i, unsigned short vel_idx, CommonSAVariables &model_var) { + model_var.Omega = GeometryToolbox::Norm(3, Vorticity_i); } }; /*! * \brief Edward - * * Here Omega is the Strain Rate */ struct Omega_Edw { - template - static void get(const su2double* Vorticity_i, const su2double** PrimVar_Grad_i, const unsigned short vel_idx, CommonSAVariables &model_var) { - - unsigned short iDim, jDim; - - su2double Sbar = 0.0; - for(iDim=0;iDim + static void get(const su2double* Vorticity_i, const MatrixType& PrimVar_Grad_i, const unsigned short vel_idx, + CommonSAVariables &model_var) { + su2double Sbar = 0.0; + for(int iDim=0; iDimJi, 2); - model_var->ft2 = model_var->ct3 * exp(-model_var->ct4 * xsi2); - model_var->d_ft2 = -2.0 * model_var->ct4 * model_var->Ji * model_var->ft2 * model_var->d_Ji; + static void get(CommonSAVariables &model_var) { + const su2double xsi2 = pow(model_var.Ji, 2); + model_var.ft2 = model_var.ct3 * exp(-model_var.ct4 * xsi2); + model_var.d_ft2 = -2.0 * model_var.ct4 * model_var.Ji * model_var.ft2 * model_var.d_Ji; } }; @@ -357,7 +333,6 @@ struct ft2_nonzero { * \brief Baseline */ struct ModVort_Bsl { - static void get(const su2double nue, const su2double nu, CommonSAVariables &model_var) { const su2double Sbar = nue * model_var.fv2 * model_var.inv_k2_d2; @@ -375,7 +350,6 @@ struct ModVort_Bsl { * \brief Edward */ struct ModVort_Edw { - static void get(const su2double nue, const su2double nu, CommonSAVariables &model_var) { model_var.Shat = max(model_var.S*((1.0/max(model_var.Ji,1.0e-16))+model_var.fv1),1.0e-16); @@ -389,21 +363,16 @@ struct ModVort_Edw { * \brief Negative */ struct ModVort_Neg { - - static void get(const su2double nue, const su2double nu, CommonSAVariables &model_var) { - - if (nue > 0.0) { - // Baseline solution - ModVort_Bsl::get(nue, nu, model_var); - } - /*! - * Don't check whether Sbar <>= -cv2*S. - * Ref: Steven R. Allmaras, Forrester T. Johnson and Philippe R. Spalart - "Modifications and Clarications for the Implementation of the Spalart-Allmaras Turbulence Model" eq. 12 - * No need for Sbar - */ - // else { - // } - } + static void get(const su2double nue, const su2double nu, CommonSAVariables &model_var) { + if (nue > 0.0) { + // Baseline solution + ModVort_Bsl::get(nue, nu, model_var); + } + /*--- Don't check whether Sbar <>= -cv2*S. + * Steven R. Allmaras, Forrester T. Johnson and Philippe R. Spalart - + * "Modifications and Clarifications for the Implementation of the Spalart-Allmaras Turbulence Model" eq. 12 + * No need for Sbar ---*/ + } }; @@ -456,7 +425,8 @@ struct r_Edw { */ struct SourceTerms_Bsl { - static void get(const su2double nue, const CommonSAVariables &model_var, su2double* Production, su2double* Destruction, su2double* CrossProduction, su2double* Jacobian) { + static void get(const su2double nue, const CommonSAVariables &model_var, su2double& Production, su2double& Destruction, + su2double& CrossProduction, su2double& Jacobian) { ComputeProduction(nue, model_var, Production, Jacobian); @@ -465,18 +435,18 @@ struct SourceTerms_Bsl { ComputeCrossProduction(nue, model_var, CrossProduction, Jacobian); } - static void ComputeProduction(const su2double nue, const CommonSAVariables &model_var, su2double* Production, su2double* Jacobian) { - *Production = model_var.cb1 * (1.0 - model_var.ft2) * model_var.Shat * nue; - *Jacobian += model_var.cb1 * (-model_var.Shat * nue * model_var.d_ft2 + (1.0 - model_var.ft2) * (nue * model_var.d_Shat + model_var.Shat)); + static void ComputeProduction(const su2double nue, const CommonSAVariables &model_var, su2double& Production, su2double& Jacobian) { + Production = model_var.cb1 * (1.0 - model_var.ft2) * model_var.Shat * nue; + Jacobian += model_var.cb1 * (-model_var.Shat * nue * model_var.d_ft2 + (1.0 - model_var.ft2) * (nue * model_var.d_Shat + model_var.Shat)); } - static void ComputeDestruction(const su2double nue, const CommonSAVariables &model_var, su2double* Destruction, su2double* Jacobian) { - *Destruction = (model_var.cw1 * model_var.fw - model_var.cb1 * model_var.ft2 / model_var.k2) * nue * nue / model_var.dist_i_2; - *Jacobian -= (model_var.cw1 * model_var.d_fw - model_var.cb1 / model_var.k2 * model_var.d_ft2) * nue * nue / model_var.dist_i_2 + (model_var.cw1 * model_var.fw - model_var.cb1 * model_var.ft2 / model_var.k2) * 2.0 * nue / model_var.dist_i_2; + static void ComputeDestruction(const su2double nue, const CommonSAVariables &model_var, su2double& Destruction, su2double& Jacobian) { + Destruction = (model_var.cw1 * model_var.fw - model_var.cb1 * model_var.ft2 / model_var.k2) * nue * nue / model_var.dist_i_2; + Jacobian -= (model_var.cw1 * model_var.d_fw - model_var.cb1 / model_var.k2 * model_var.d_ft2) * nue * nue / model_var.dist_i_2 + (model_var.cw1 * model_var.fw - model_var.cb1 * model_var.ft2 / model_var.k2) * 2.0 * nue / model_var.dist_i_2; } - static void ComputeCrossProduction(const su2double nue, const CommonSAVariables &model_var, su2double* CrossProduction, su2double* Jacobian) { - *CrossProduction = model_var.cb2_sigma * model_var.norm2_Grad; + static void ComputeCrossProduction(const su2double nue, const CommonSAVariables &model_var, su2double& CrossProduction, su2double& Jacobian) { + CrossProduction = model_var.cb2_sigma * model_var.norm2_Grad; /*--- No contribution to the jacobian ---*/ } }; @@ -486,8 +456,8 @@ struct SourceTerms_Bsl { */ struct SourceTerms_Neg { - static void get(const su2double nue, const CommonSAVariables &model_var, su2double* Production, su2double* Destruction, su2double* CrossProduction, su2double* Jacobian) { - + static void get(const su2double nue, const CommonSAVariables &model_var, su2double& Production, su2double& Destruction, + su2double& CrossProduction, su2double& Jacobian) { if (nue > 0.0) { // Baseline solution @@ -504,18 +474,18 @@ struct SourceTerms_Neg { } } - static void ComputeProduction(const su2double nue, const CommonSAVariables &model_var, su2double* Production, su2double* Jacobian) { - *Production = model_var.cb1 * (1.0 - model_var.ct3) * model_var.S * nue; - *Jacobian += model_var.cb1 * (1.0 - model_var.ct3) * model_var.S; + static void ComputeProduction(const su2double nue, const CommonSAVariables &model_var, su2double& Production, su2double& Jacobian) { + Production = model_var.cb1 * (1.0 - model_var.ct3) * model_var.S * nue; + Jacobian += model_var.cb1 * (1.0 - model_var.ct3) * model_var.S; } - static void ComputeDestruction(const su2double nue, const CommonSAVariables &model_var, su2double* Destruction, su2double* Jacobian) { - *Destruction = model_var.cw1 * nue * nue / model_var.dist_i_2; - *Jacobian -= 2.0 * model_var.cw1 * nue / model_var.dist_i_2; + static void ComputeDestruction(const su2double nue, const CommonSAVariables &model_var, su2double& Destruction, su2double& Jacobian) { + Destruction = model_var.cw1 * nue * nue / model_var.dist_i_2; + Jacobian -= 2.0 * model_var.cw1 * nue / model_var.dist_i_2; } - static void ComputeCrossProduction(const su2double nue, const CommonSAVariables &model_var, su2double* CrossProduction, su2double* Jacobian) { - /*--- Same cross production as baseline. No need to duplicate code. ---*/ + static void ComputeCrossProduction(const su2double nue, const CommonSAVariables &model_var, su2double& CrossProduction, su2double& Jacobian) { + /*--- Same cross production as baseline. ---*/ SourceTerms_Bsl::ComputeCrossProduction(nue, model_var, CrossProduction, Jacobian); } }; @@ -525,61 +495,38 @@ struct SourceTerms_Neg { * SPALART-ALLMARAS ADDITIONAL SOURCE TERMS DECORATORS * ============================================================================*/ -/*! - * \brief Decorator - */ -class AdditionalSourceTerms : public CNumerics { - -protected: - CNumerics& m_Decorator; - -public: - AdditionalSourceTerms(CNumerics& decorator):m_Decorator(decorator) {} - - ResidualType<> ComputeResidual(const CConfig* config) { - m_Decorator.ComputeResidual(config); - } -}; - -/*------------------------------------------------------------------------------ -| Additional source terms -------------------------------------------------------------------------------*/ - - /*! * \brief Mixing Layer Compressibility Correction (SA-comp) decorator */ -class CompressiblityCorrection : public AdditionalSourceTerms { - -private: - +template +class CompressiblityCorrection final : public ParentClass { + private: const su2double c5 = 3.5; -public: - - CompressiblityCorrection(CNumerics& decorator):AdditionalSourceTerms(decorator) {} + public: + template + CompressiblityCorrection(const Ts&... args) : ParentClass(args...) {} - ResidualType<> ComputeResidual(const CConfig* config) final { + ResidualType<> ComputeResidual(const CConfig* config) override { + /*--- Residual from standard SA ---*/ + ParentClass::ComputeResidual(config); /*--- Compressibility Correction term ---*/ - Pressure_i = V_i[idx.Pressure()]; - SoundSpeed_i = sqrt(Pressure_i*Gamma/Density_i); + const auto& Pressure_i = V_i[idx.Pressure()]; + const su2double SoundSpeed_i = sqrt(Pressure_i*Gamma/Density_i); su2double aux_cc=0; for(iDim=0;iDim(&Residual, &Jacobian_i, nullptr); diff --git a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp index 910153ad9020..a522f888416e 100644 --- a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp +++ b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp @@ -82,9 +82,6 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSA::ComputeResidual(const CCon // AD::SetPreaccIn(ScalarVar_Grad_i[0], nDim); // AD::SetPreaccIn(Volume); AD::SetPreaccIn(dist_i); - // Set the boolean here depending on whether the point is closest to a rough wall or not. - roughwall = (roughness_i > 0.0); - Density_i = V_i[idx.Density()]; Laminar_Viscosity_i = V_i[idx.LaminarViscosity()]; From 14955fcbd395e05b0d6d9041a6a0b85b6b2c2488 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sat, 26 Feb 2022 00:20:34 +0000 Subject: [PATCH 15/34] clang-format --- .../numerics/turbulent/turb_sources_new.hpp | 322 +++++++++--------- 1 file changed, 156 insertions(+), 166 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp index 0cd8f5be0d90..d5f43268665a 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp @@ -35,27 +35,16 @@ * \brief Structure with SA common auxiliary functions and constants. */ struct CommonSAVariables { + /*--- List of constants ---*/ + const su2double cv1_3 = pow(7.1, 3.0), k2 = pow(0.41, 2.0), cb1 = 0.1355, cw2 = 0.3, ct3 = 1.2, ct4 = 0.5, + cw3_6 = pow(2.0, 6.0), sigma = 2. / 3., cb2 = 0.622, cb2_sigma = cb2 / sigma, + cw1 = cb1 / k2 + (1.0 + cb2) / sigma, cr1 = 0.5; - /*--- List of constants ---*/ - const su2double - cv1_3 = pow(7.1, 3.0), - k2 = pow(0.41, 2.0), - cb1 = 0.1355, - cw2 = 0.3, - ct3 = 1.2, - ct4 = 0.5, - cw3_6 = pow(2.0, 6.0), - sigma = 2./3., - cb2 = 0.622, - cb2_sigma = cb2/sigma, - cw1 = cb1/k2+(1.0+cb2)/sigma, - cr1 = 0.5; - - /*--- List of auxiliary functions ---*/ - su2double ft2, d_ft2, r, d_r, g, d_g, glim, fw, d_fw, Ji, d_Ji, S, Shat, d_Shat, fv1, d_fv1, fv2, d_fv2; - - /*--- List of helpers ---*/ - su2double Omega, dist_i_2, inv_k2_d2, inv_Shat, g_6, norm2_Grad; + /*--- List of auxiliary functions ---*/ + su2double ft2, d_ft2, r, d_r, g, d_g, glim, fw, d_fw, Ji, d_Ji, S, Shat, d_Shat, fv1, d_fv1, fv2, d_fv2; + + /*--- List of helpers ---*/ + su2double Omega, dist_i_2, inv_k2_d2, inv_Shat, g_6, norm2_Grad; }; /*! @@ -64,10 +53,10 @@ struct CommonSAVariables { * The variables that are subject to change in each variation/correction have their own class. * \note Additional source terms (e.g. compressibility) are implemented as decorators. */ -template +template class CSourceBase_TurbSA : public CNumerics { protected: - su2double Gamma_BC = 0.0; su2double intermittency; @@ -78,7 +67,7 @@ class CSourceBase_TurbSA : public CNumerics { su2double Residual, *Jacobian_i; private: - const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ + const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ su2double Jacobian_Buffer; /*!< \brief Static storage for the Jacobian (which needs to be pointer for return type). */ protected: @@ -93,8 +82,10 @@ class CSourceBase_TurbSA : public CNumerics { * \param[in] config - Definition of the particular problem. */ CSourceBase_TurbSA(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config) - : CNumerics(val_nDim, val_nVar, config), idx(val_nDim, config->GetnSpecies()), - rotating_frame(config->GetRotating_Frame()), transition(config->GetKind_Trans_Model() == TURB_TRANS_MODEL::BC) {} + : CNumerics(val_nDim, val_nVar, config), + idx(val_nDim, config->GetnSpecies()), + rotating_frame(config->GetRotating_Frame()), + transition(config->GetKind_Trans_Model() == TURB_TRANS_MODEL::BC) {} /*! * \brief Residual for source term integration. @@ -147,7 +138,6 @@ class CSourceBase_TurbSA : public CNumerics { * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. */ ResidualType<> ComputeResidual(const CConfig* config) override { - /*--- Model common auxiliary and constant variables ---*/ CommonSAVariables model_var; @@ -175,20 +165,21 @@ class CSourceBase_TurbSA : public CNumerics { } if (dist_i > 1e-10) { + /*--- Vorticity ---*/ + model_var.S = model_var.Omega; - /*--- Vorticity ---*/ - model_var.S = model_var.Omega; - - model_var.dist_i_2 = dist_i * dist_i; - const su2double nu = Laminar_Viscosity_i / Density_i; - model_var.inv_k2_d2 = 1.0 / (model_var.k2 * model_var.dist_i_2); + model_var.dist_i_2 = dist_i * dist_i; + const su2double nu = Laminar_Viscosity_i / Density_i; + model_var.inv_k2_d2 = 1.0 / (model_var.k2 * model_var.dist_i_2); /*--- Modified values for roughness ---*/ /*--- Ref: Aupoix, B. and Spalart, P. R., "Extensions of the Spalart-Allmaras Turbulence Model to Account for Wall * Roughness," International Journal of Heat and Fluid Flow, Vol. 24, 2003, pp. 454-462. ---*/ /* --- See https://turbmodels.larc.nasa.gov/spalart.html#sarough for detailed explanation. ---*/ - model_var.Ji = ScalarVar_i[0] / nu + model_var.cr1 * (roughness_i / (dist_i + EPS)); // roughness_i = 0 for smooth walls and Ji remains the - // same, changes only if roughness is specified.nue/nul + model_var.Ji = + ScalarVar_i[0] / nu + + model_var.cr1 * (roughness_i / (dist_i + EPS)); // roughness_i = 0 for smooth walls and Ji remains the + // same, changes only if roughness is specified.nue/nul model_var.d_Ji = 1.0 / nu; const su2double Ji_2 = model_var.Ji * model_var.Ji; @@ -198,7 +189,9 @@ class CSourceBase_TurbSA : public CNumerics { model_var.d_fv1 = 3.0 * Ji_2 * model_var.cv1_3 / (nu * pow(Ji_3 + model_var.cv1_3, 2.0)); /*--- Using a modified relation so as to not change the Shat that depends on fv2. ---*/ - model_var.fv2 = 1.0 - ScalarVar_i[0] / (nu + ScalarVar_i[0] * model_var.fv1); // From NASA turb modeling resource and 2003 paper + model_var.fv2 = + 1.0 - + ScalarVar_i[0] / (nu + ScalarVar_i[0] * model_var.fv1); // From NASA turb modeling resource and 2003 paper model_var.d_fv2 = -(1.0 / nu - Ji_2 * model_var.d_fv1) / pow(1.0 + model_var.Ji * model_var.fv1, 2.0); /*--- Compute ft2 term ---*/ @@ -217,7 +210,7 @@ class CSourceBase_TurbSA : public CNumerics { model_var.glim = pow((1.0 + model_var.cw3_6) / (model_var.g_6 + model_var.cw3_6), 1.0 / 6.0); model_var.fw = model_var.g * model_var.glim; - model_var.d_g = model_var.d_r * (1. + model_var.cw2 * (6.0 * pow(model_var.r, 5.0) - 1.0)); + model_var.d_g = model_var.d_r * (1. + model_var.cw2 * (6.0 * pow(model_var.r, 5.0) - 1.0)); model_var.d_fw = model_var.d_g * model_var.glim * (1. - model_var.g_6 / (model_var.g_6 + model_var.cw3_6)); model_var.norm2_Grad = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[0]); @@ -261,10 +254,11 @@ class CSourceBase_TurbSA : public CNumerics { * \brief Baseline */ struct Omega_Bsl { - template - static void get(const su2double* Vorticity_i, const MatrixType& PrimVar_Grad_i, unsigned short vel_idx, CommonSAVariables &model_var) { - model_var.Omega = GeometryToolbox::Norm(3, Vorticity_i); - } + template + static void get(const su2double* Vorticity_i, const MatrixType& PrimVar_Grad_i, unsigned short vel_idx, + CommonSAVariables& model_var) { + model_var.Omega = GeometryToolbox::Norm(3, Vorticity_i); + } }; /*! @@ -272,25 +266,24 @@ struct Omega_Bsl { * Here Omega is the Strain Rate */ struct Omega_Edw { - template + template static void get(const su2double* Vorticity_i, const MatrixType& PrimVar_Grad_i, const unsigned short vel_idx, - CommonSAVariables &model_var) { + CommonSAVariables& model_var) { su2double Sbar = 0.0; - for(int iDim=0; iDim 0.0) { - // Baseline solution - ModVort_Bsl::get(nue, nu, model_var); + // Baseline solution + ModVort_Bsl::get(nue, nu, model_var); } /*--- Don't check whether Sbar <>= -cv2*S. * Steven R. Allmaras, Forrester T. Johnson and Philippe R. Spalart - @@ -375,7 +366,6 @@ struct ModVort_Neg { } }; - /*------------------------------------------------------------------------------ | Auxiliary function r and its derivative. | @@ -387,31 +377,28 @@ struct ModVort_Neg { * \brief Baseline */ struct r_Bsl { - - static void get(const su2double nue, CommonSAVariables &model_var) { - - model_var.r = min(nue * model_var.inv_Shat * model_var.inv_k2_d2, 10.0); - model_var.d_r = (model_var.Shat - nue * model_var.d_Shat) * model_var.inv_Shat * model_var.inv_Shat * model_var.inv_k2_d2; - if (model_var.r == 10.0) model_var.d_r = 0.0; - } + static void get(const su2double nue, CommonSAVariables& model_var) { + model_var.r = min(nue * model_var.inv_Shat * model_var.inv_k2_d2, 10.0); + model_var.d_r = + (model_var.Shat - nue * model_var.d_Shat) * model_var.inv_Shat * model_var.inv_Shat * model_var.inv_k2_d2; + if (model_var.r == 10.0) model_var.d_r = 0.0; + } }; /*! * \brief Edward */ struct r_Edw { + static void get(const su2double nue, CommonSAVariables& model_var) { + model_var.r = min(nue * model_var.inv_Shat * model_var.inv_k2_d2, 10.0); + model_var.r = tanh(model_var.r) / tanh(1.0); - static void get(const su2double nue, CommonSAVariables &model_var) { - - model_var.r = min(nue * model_var.inv_Shat * model_var.inv_k2_d2, 10.0); - model_var.r = tanh(model_var.r) / tanh(1.0); - - model_var.d_r = (model_var.Shat - nue * model_var.d_Shat) * model_var.inv_Shat * model_var.inv_Shat * model_var.inv_k2_d2; - model_var.d_r = (1 - pow(tanh(model_var.r), 2.0)) * (model_var.d_r) / tanh(1.0); - } + model_var.d_r = + (model_var.Shat - nue * model_var.d_Shat) * model_var.inv_Shat * model_var.inv_Shat * model_var.inv_k2_d2; + model_var.d_r = (1 - pow(tanh(model_var.r), 2.0)) * (model_var.d_r) / tanh(1.0); + } }; - /*------------------------------------------------------------------------------ | Compute source terms: production, destruction and cross-productions term and their derivatives. | @@ -424,73 +411,77 @@ struct r_Edw { * \brief Baseline (Original SA model) */ struct SourceTerms_Bsl { + static void get(const su2double nue, const CommonSAVariables& model_var, su2double& Production, + su2double& Destruction, su2double& CrossProduction, su2double& Jacobian) { + ComputeProduction(nue, model_var, Production, Jacobian); - static void get(const su2double nue, const CommonSAVariables &model_var, su2double& Production, su2double& Destruction, - su2double& CrossProduction, su2double& Jacobian) { + ComputeDestruction(nue, model_var, Destruction, Jacobian); - ComputeProduction(nue, model_var, Production, Jacobian); + ComputeCrossProduction(nue, model_var, CrossProduction, Jacobian); + } - ComputeDestruction(nue, model_var, Destruction, Jacobian); + static void ComputeProduction(const su2double nue, const CommonSAVariables& model_var, su2double& Production, + su2double& Jacobian) { + Production = model_var.cb1 * (1.0 - model_var.ft2) * model_var.Shat * nue; + Jacobian += model_var.cb1 * (-model_var.Shat * nue * model_var.d_ft2 + + (1.0 - model_var.ft2) * (nue * model_var.d_Shat + model_var.Shat)); + } - ComputeCrossProduction(nue, model_var, CrossProduction, Jacobian); - } - - static void ComputeProduction(const su2double nue, const CommonSAVariables &model_var, su2double& Production, su2double& Jacobian) { - Production = model_var.cb1 * (1.0 - model_var.ft2) * model_var.Shat * nue; - Jacobian += model_var.cb1 * (-model_var.Shat * nue * model_var.d_ft2 + (1.0 - model_var.ft2) * (nue * model_var.d_Shat + model_var.Shat)); - } - - static void ComputeDestruction(const su2double nue, const CommonSAVariables &model_var, su2double& Destruction, su2double& Jacobian) { - Destruction = (model_var.cw1 * model_var.fw - model_var.cb1 * model_var.ft2 / model_var.k2) * nue * nue / model_var.dist_i_2; - Jacobian -= (model_var.cw1 * model_var.d_fw - model_var.cb1 / model_var.k2 * model_var.d_ft2) * nue * nue / model_var.dist_i_2 + (model_var.cw1 * model_var.fw - model_var.cb1 * model_var.ft2 / model_var.k2) * 2.0 * nue / model_var.dist_i_2; - } - - static void ComputeCrossProduction(const su2double nue, const CommonSAVariables &model_var, su2double& CrossProduction, su2double& Jacobian) { - CrossProduction = model_var.cb2_sigma * model_var.norm2_Grad; - /*--- No contribution to the jacobian ---*/ - } + static void ComputeDestruction(const su2double nue, const CommonSAVariables& model_var, su2double& Destruction, + su2double& Jacobian) { + Destruction = + (model_var.cw1 * model_var.fw - model_var.cb1 * model_var.ft2 / model_var.k2) * nue * nue / model_var.dist_i_2; + Jacobian -= + (model_var.cw1 * model_var.d_fw - model_var.cb1 / model_var.k2 * model_var.d_ft2) * nue * nue / + model_var.dist_i_2 + + (model_var.cw1 * model_var.fw - model_var.cb1 * model_var.ft2 / model_var.k2) * 2.0 * nue / model_var.dist_i_2; + } + + static void ComputeCrossProduction(const su2double nue, const CommonSAVariables& model_var, + su2double& CrossProduction, su2double& Jacobian) { + CrossProduction = model_var.cb2_sigma * model_var.norm2_Grad; + /*--- No contribution to the jacobian ---*/ + } }; /*! * \brief Negative */ struct SourceTerms_Neg { + static void get(const su2double nue, const CommonSAVariables& model_var, su2double& Production, + su2double& Destruction, su2double& CrossProduction, su2double& Jacobian) { + if (nue > 0.0) { + // Baseline solution + SourceTerms_Bsl::get(nue, model_var, Production, Destruction, CrossProduction, Jacobian); - static void get(const su2double nue, const CommonSAVariables &model_var, su2double& Production, su2double& Destruction, - su2double& CrossProduction, su2double& Jacobian) { - if (nue > 0.0) { - - // Baseline solution - SourceTerms_Bsl::get(nue, model_var, Production, Destruction, CrossProduction, Jacobian); + } else { + ComputeProduction(nue, model_var, Production, Jacobian); - } else { + ComputeDestruction(nue, model_var, Destruction, Jacobian); - ComputeProduction(nue, model_var, Production, Jacobian); + ComputeCrossProduction(nue, model_var, CrossProduction, Jacobian); + } + } - ComputeDestruction(nue, model_var, Destruction, Jacobian); + static void ComputeProduction(const su2double nue, const CommonSAVariables& model_var, su2double& Production, + su2double& Jacobian) { + Production = model_var.cb1 * (1.0 - model_var.ct3) * model_var.S * nue; + Jacobian += model_var.cb1 * (1.0 - model_var.ct3) * model_var.S; + } - ComputeCrossProduction(nue, model_var, CrossProduction, Jacobian); + static void ComputeDestruction(const su2double nue, const CommonSAVariables& model_var, su2double& Destruction, + su2double& Jacobian) { + Destruction = model_var.cw1 * nue * nue / model_var.dist_i_2; + Jacobian -= 2.0 * model_var.cw1 * nue / model_var.dist_i_2; + } - } - } - - static void ComputeProduction(const su2double nue, const CommonSAVariables &model_var, su2double& Production, su2double& Jacobian) { - Production = model_var.cb1 * (1.0 - model_var.ct3) * model_var.S * nue; - Jacobian += model_var.cb1 * (1.0 - model_var.ct3) * model_var.S; - } - - static void ComputeDestruction(const su2double nue, const CommonSAVariables &model_var, su2double& Destruction, su2double& Jacobian) { - Destruction = model_var.cw1 * nue * nue / model_var.dist_i_2; - Jacobian -= 2.0 * model_var.cw1 * nue / model_var.dist_i_2; - } - - static void ComputeCrossProduction(const su2double nue, const CommonSAVariables &model_var, su2double& CrossProduction, su2double& Jacobian) { - /*--- Same cross production as baseline. ---*/ - SourceTerms_Bsl::ComputeCrossProduction(nue, model_var, CrossProduction, Jacobian); - } + static void ComputeCrossProduction(const su2double nue, const CommonSAVariables& model_var, + su2double& CrossProduction, su2double& Jacobian) { + /*--- Same cross production as baseline. ---*/ + SourceTerms_Bsl::ComputeCrossProduction(nue, model_var, CrossProduction, Jacobian); + } }; - /* ============================================================================= * SPALART-ALLMARAS ADDITIONAL SOURCE TERMS DECORATORS * ============================================================================*/ @@ -501,34 +492,33 @@ struct SourceTerms_Neg { template class CompressiblityCorrection final : public ParentClass { private: - const su2double c5 = 3.5; + const su2double c5 = 3.5; public: - template - CompressiblityCorrection(const Ts&... args) : ParentClass(args...) {} - - ResidualType<> ComputeResidual(const CConfig* config) override { - /*--- Residual from standard SA ---*/ - ParentClass::ComputeResidual(config); + template + CompressiblityCorrection(const Ts&... args) : ParentClass(args...) {} - /*--- Compressibility Correction term ---*/ - const auto& Pressure_i = V_i[idx.Pressure()]; - const su2double SoundSpeed_i = sqrt(Pressure_i*Gamma/Density_i); - su2double aux_cc=0; - for(iDim=0;iDim ComputeResidual(const CConfig* config) override { + /*--- Residual from standard SA ---*/ + ParentClass::ComputeResidual(config); + + /*--- Compressibility Correction term ---*/ + const auto& Pressure_i = V_i[idx.Pressure()]; + const su2double SoundSpeed_i = sqrt(Pressure_i * Gamma / Density_i); + su2double aux_cc = 0; + for (iDim = 0; iDim < nDim; ++iDim) { + for (jDim = 0; jDim < nDim; ++jDim) { + aux_cc += pow(PrimVar_Grad_i[idx.Velocity() + iDim][jDim], 2); + } + } - /*--- Decorator residual contribution ---*/ - Residual.residual[0] -= CompCorrection; - Residual.jacobian_i[0][0] -= d_CompCorrection; + const su2double d_CompCorrection = 2.0 * c5 * ScalarVar_i[0] / pow(SoundSpeed_i, 2) * aux_cc * Volume; + const su2double CompCorrection = 0.5 * ScalarVar_i[0] * d_CompCorrection; + /*--- Decorator residual contribution ---*/ + Residual.residual[0] -= CompCorrection; + Residual.jacobian_i[0][0] -= d_CompCorrection; - return ResidualType<>(&Residual, &Jacobian_i, nullptr); - } + return ResidualType<>(&Residual, &Jacobian_i, nullptr); + } }; From 0066b3c55fc66e30b04aef13f99569a8353d2c0c Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sat, 26 Feb 2022 11:23:09 +0000 Subject: [PATCH 16/34] doxygen friendly --- SU2_CFD/include/numerics/CNumerics.hpp | 36 -- .../numerics/turbulent/turb_sources_new.hpp | 356 ++++++++---------- 2 files changed, 150 insertions(+), 242 deletions(-) diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index 949a094969ed..a0cf5dd23a51 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -1430,42 +1430,6 @@ class CNumerics { */ inline virtual void SetIntermittency(su2double intermittency_in) { } - /*! - * \brief Residual for source term integration. - * \param[in] val_production - Value of the Production. - */ - inline virtual void SetProduction(su2double val_production) { } - - /*! - * \brief Residual for source term integration. - * \param[in] val_destruction - Value of the Destruction. - */ - inline virtual void SetDestruction(su2double val_destruction) { } - - /*! - * \brief Residual for source term integration. - * \param[in] val_crossproduction - Value of the CrossProduction. - */ - inline virtual void SetCrossProduction(su2double val_crossproduction) { } - - /*! - * \brief Residual for source term integration. - * \param[in] val_production - Value of the Production. - */ - inline virtual su2double GetProduction(void) const { return 0; } - - /*! - * \brief Residual for source term integration. - * \param[in] val_destruction - Value of the Destruction. - */ - inline virtual su2double GetDestruction(void) const { return 0; } - - /*! - * \brief Residual for source term integration. - * \param[in] val_crossproduction - Value of the CrossProduction. - */ - inline virtual su2double GetCrossProduction(void) const { return 0; } - /*! * \brief A virtual member. */ diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp index d5f43268665a..2acca319f051 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp @@ -53,37 +53,29 @@ struct CommonSAVariables { * The variables that are subject to change in each variation/correction have their own class. * \note Additional source terms (e.g. compressibility) are implemented as decorators. */ -template +template class CSourceBase_TurbSA : public CNumerics { protected: su2double Gamma_BC = 0.0; - su2double intermittency; - - /*--- Source term components ---*/ - su2double Production, Destruction, CrossProduction, AddSourceTerm; + su2double intermittency = 0.0; /*--- Residual and Jacobian ---*/ su2double Residual, *Jacobian_i; - - private: - const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ su2double Jacobian_Buffer; /*!< \brief Static storage for the Jacobian (which needs to be pointer for return type). */ - protected: + const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ const bool rotating_frame = false; const bool transition = false; public: /*! * \brief Constructor of the class. - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nVar - Number of variables of the problem. + * \param[in] nDim - Number of dimensions of the problem. * \param[in] config - Definition of the particular problem. */ - CSourceBase_TurbSA(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config) - : CNumerics(val_nDim, val_nVar, config), - idx(val_nDim, config->GetnSpecies()), + CSourceBase_TurbSA(unsigned short nDim, const CConfig* config) + : CNumerics(nDim, 1, config), + idx(nDim, config->GetnSpecies()), rotating_frame(config->GetRotating_Frame()), transition(config->GetKind_Trans_Model() == TURB_TRANS_MODEL::BC) {} @@ -93,45 +85,12 @@ class CSourceBase_TurbSA : public CNumerics { */ inline void SetIntermittency(su2double intermittency_in) final { intermittency = intermittency_in; } - /*! - * \brief Residual for source term integration. - * \param[in] val_production - Value of the Production. - */ - inline void SetProduction(su2double val_production) final { Production = val_production; } - - /*! - * \brief Residual for source term integration. - * \param[in] val_destruction - Value of the Destruction. - */ - inline void SetDestruction(su2double val_destruction) final { Destruction = val_destruction; } - - /*! - * \brief Residual for source term integration. - * \param[in] val_crossproduction - Value of the CrossProduction. - */ - inline void SetCrossProduction(su2double val_crossproduction) final { CrossProduction = val_crossproduction; } - - /*! - * \brief ______________. - */ - inline su2double GetProduction(void) const final { return Production; } - /*! * \brief Get the intermittency for the BC trans. model. * \return Value of the intermittency. */ inline su2double GetGammaBC(void) const final { return Gamma_BC; } - /*! - * \brief ______________. - */ - inline su2double GetDestruction(void) const final { return Destruction; } - - /*! - * \brief ______________. - */ - inline su2double GetCrossProduction(void) const final { return CrossProduction; } - /*! * \brief Residual for source term integration. * \param[in] config - Definition of the particular problem. @@ -145,17 +104,14 @@ class CSourceBase_TurbSA : public CNumerics { const auto& Laminar_Viscosity_i = V_i[idx.LaminarViscosity()]; Residual = 0.0; - Production = 0.0; - Destruction = 0.0; - CrossProduction = 0.0; - AddSourceTerm = 0.0; Jacobian_i[0] = 0.0; + su2double Production = 0.0, Destruction = 0.0, CrossProduction = 0.0; /*--- Evaluate Omega ---*/ if (nDim == 2) { - Omega_class::get<2>(Vorticity_i, PrimVar_Grad_i, idx.Velocity(), model_var); + OmegaType::get<2>(Vorticity_i, PrimVar_Grad_i[idx.Velocity()], model_var); } else { - Omega_class::get<3>(Vorticity_i, PrimVar_Grad_i, idx.Velocity(), model_var); + OmegaType::get<3>(Vorticity_i, PrimVar_Grad_i[idx.Velocity()], model_var); } /*--- Rotational correction term ---*/ @@ -182,28 +138,28 @@ class CSourceBase_TurbSA : public CNumerics { // same, changes only if roughness is specified.nue/nul model_var.d_Ji = 1.0 / nu; - const su2double Ji_2 = model_var.Ji * model_var.Ji; + const su2double Ji_2 = pow(model_var.Ji, 2); const su2double Ji_3 = Ji_2 * model_var.Ji; model_var.fv1 = Ji_3 / (Ji_3 + model_var.cv1_3); - model_var.d_fv1 = 3.0 * Ji_2 * model_var.cv1_3 / (nu * pow(Ji_3 + model_var.cv1_3, 2.0)); + model_var.d_fv1 = 3.0 * Ji_2 * model_var.cv1_3 / (nu * pow(Ji_3 + model_var.cv1_3, 2)); /*--- Using a modified relation so as to not change the Shat that depends on fv2. ---*/ model_var.fv2 = 1.0 - ScalarVar_i[0] / (nu + ScalarVar_i[0] * model_var.fv1); // From NASA turb modeling resource and 2003 paper - model_var.d_fv2 = -(1.0 / nu - Ji_2 * model_var.d_fv1) / pow(1.0 + model_var.Ji * model_var.fv1, 2.0); + model_var.d_fv2 = -(1.0 / nu - Ji_2 * model_var.d_fv1) / pow(1.0 + model_var.Ji * model_var.fv1, 2); /*--- Compute ft2 term ---*/ - ft2_class::get(model_var); + ft2Type::get(model_var); /*--- Compute modified vorticity ---*/ - ModVort_class::get(ScalarVar_i[0], nu, model_var); + ModVortType::get(ScalarVar_i[0], nu, model_var); model_var.inv_Shat = 1.0 / model_var.Shat; /*--- Compute auxiliary function r ---*/ - r_class::get(ScalarVar_i[0], model_var); + rType::get(ScalarVar_i[0], model_var); model_var.g = model_var.r + model_var.cw2 * (pow(model_var.r, 6.0) - model_var.r); model_var.g_6 = pow(model_var.g, 6.0); @@ -216,7 +172,7 @@ class CSourceBase_TurbSA : public CNumerics { model_var.norm2_Grad = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[0]); /*--- Compute production, destruction and cross production and jacobian ---*/ - SourceTerms_class::get(model_var, Production, Destruction, CrossProduction, Jacobian_i[0]); + SourceTermsType::get(model_var, Production, Destruction, CrossProduction, Jacobian_i[0]); /*--- Compute any necessary additional source term and jacobian contribution ---*/ @@ -239,125 +195,104 @@ class CSourceBase_TurbSA : public CNumerics { * SPALART-ALLMARAS VARIANT CLASSES * ============================================================================*/ -/*------------------------------------------------------------------------------ -| Strain rate -| -| \tparam nDim: problem dimension -| \param Vorticity_i: vorticity array -| \param PrimVar_Grad_i: primitive variables gradient at point i -| \param Velocity index -| \param model_var: Common SA variables struct -| -------------------------------------------------------------------------------*/ +namespace detail { /*! - * \brief Baseline + * \brief Strain rate classes. + * \tparam nDim: Problem dimension. + * \param[in] vorticity: Vorticity array. + * \param[in] velocity_grad: Velocity gradients. + * \param[out] model_var: Common SA variables struct (to set Omega). */ -struct Omega_Bsl { +namespace Omega { + +/*! \brief Baseline. */ +struct Bsl { template - static void get(const su2double* Vorticity_i, const MatrixType& PrimVar_Grad_i, unsigned short vel_idx, - CommonSAVariables& model_var) { - model_var.Omega = GeometryToolbox::Norm(3, Vorticity_i); + static void get(const su2double* vorticity, const MatrixType&, CommonSAVariables& model_var) { + model_var.Omega = GeometryToolbox::Norm(3, vorticity); } }; -/*! - * \brief Edward - * Here Omega is the Strain Rate - */ -struct Omega_Edw { +/*! \brief Edward. Here Omega is the Strain Rate. */ +struct Edw { template - static void get(const su2double* Vorticity_i, const MatrixType& PrimVar_Grad_i, const unsigned short vel_idx, - CommonSAVariables& model_var) { + static void get(const su2double*, const MatrixType& velocity_grad, CommonSAVariables& model_var) { su2double Sbar = 0.0; for (int iDim = 0; iDim < nDim; ++iDim) { for (int jDim = 0; jDim < nDim; ++jDim) { - Sbar += (PrimVar_Grad_i[vel_idx + iDim][jDim] + PrimVar_Grad_i[vel_idx + jDim][iDim]) * - PrimVar_Grad_i[vel_idx + iDim][jDim]; + Sbar += (velocity_grad[iDim][jDim] + velocity_grad[jDim][iDim]) * velocity_grad[iDim][jDim]; } } for (int iDim = 0; iDim < nDim; ++iDim) { - Sbar -= (2.0 / 3.0) * pow(PrimVar_Grad_i[vel_idx + iDim][iDim], 2); + Sbar -= (2.0 / 3.0) * pow(velocity_grad[iDim][iDim], 2); } - model_var.Omega = sqrt(max(Sbar, 0.0)); } }; - -/*------------------------------------------------------------------------------ -| ft2-term and its derivative -| -| \param model_var: Common SA variables struct -| -------------------------------------------------------------------------------*/ +} // namespace Omega /*! - * \brief SU2 baseline ft2 term value and its derivative. ft2=0.0 + * \brief Classes to set the ft2 term and its derivative. + * \param[in,out] model_var: Common SA variables struct. */ -struct ft2_Bsl { +namespace ft2 { + +/*! \brief SU2 baseline ft2 term value and its derivative (ft2=0.0). */ +struct Bsl { static void get(CommonSAVariables& model_var) { model_var.ft2 = 0.0; model_var.d_ft2 = 0.0; } }; -/*! - * \brief non-zero ft2 term according to the literature and its derivative. - */ -struct ft2_nonzero { +/*! \brief Non-zero ft2 term according to the literature. */ +struct Nonzero { static void get(CommonSAVariables& model_var) { const su2double xsi2 = pow(model_var.Ji, 2); model_var.ft2 = model_var.ct3 * exp(-model_var.ct4 * xsi2); model_var.d_ft2 = -2.0 * model_var.ct4 * model_var.Ji * model_var.ft2 * model_var.d_Ji; } }; - -/*------------------------------------------------------------------------------ -| Modified vorticity (\tilde{S}) and its derivative -| -| \param nue: SA variable -| \param nu: laminar viscosity -| \param model_var: Common SA varibales struct -| -------------------------------------------------------------------------------*/ +} // namespace ft2 /*! - * \brief Baseline + * \brief Classes to compute the modified vorticity (\tilde{S}) and its derivative. + * \param[in] nue: SA variable. + * \param[in] nu: Laminar viscosity. + * \param[in,out] model_var: Common SA variables struct. */ -struct ModVort_Bsl { - static void get(const su2double nue, const su2double nu, CommonSAVariables& model_var) { - const su2double Sbar = nue * model_var.fv2 * model_var.inv_k2_d2; +namespace ModVort { +/*! \brief Baseline. */ +struct Bsl { + static void get(const su2double& nue, const su2double& nu, CommonSAVariables& model_var) { + const su2double Sbar = nue * model_var.fv2 * model_var.inv_k2_d2; model_var.Shat = model_var.S + Sbar; model_var.Shat = max(model_var.Shat, 1.0e-10); const su2double d_Sbar = (model_var.fv2 + nue * model_var.d_fv2) * model_var.inv_k2_d2; - model_var.d_Shat = (model_var.Shat <= 1.0e-10) ? 0.0 : d_Sbar; } }; -/*! - * \brief Edward - */ -struct ModVort_Edw { - static void get(const su2double nue, const su2double nu, CommonSAVariables& model_var) { +/*! \brief Edward. */ +struct Edw { + static void get(const su2double& nue, const su2double& nu, CommonSAVariables& model_var) { model_var.Shat = max(model_var.S * ((1.0 / max(model_var.Ji, 1.0e-16)) + model_var.fv1), 1.0e-16); model_var.Shat = max(model_var.Shat, 1.0e-10); model_var.d_Shat = - (model_var.Shat <= 1.0e-10) ? 0.0 : -model_var.S * pow(model_var.Ji, -2.0) / nu + model_var.S * model_var.d_fv1; + (model_var.Shat <= 1.0e-10) ? 0.0 : -model_var.S * pow(model_var.Ji, -2) / nu + model_var.S * model_var.d_fv1; } }; -/*! - * \brief Negative - */ -struct ModVort_Neg { - static void get(const su2double nue, const su2double nu, CommonSAVariables& model_var) { +/*! \brief Negative. */ +struct Neg { + static void get(const su2double& nue, const su2double& nu, CommonSAVariables& model_var) { if (nue > 0.0) { // Baseline solution - ModVort_Bsl::get(nue, nu, model_var); + Bsl::get(nue, nu, model_var); } /*--- Don't check whether Sbar <>= -cv2*S. * Steven R. Allmaras, Forrester T. Johnson and Philippe R. Spalart - @@ -365,138 +300,148 @@ struct ModVort_Neg { * No need for Sbar ---*/ } }; - -/*------------------------------------------------------------------------------ -| Auxiliary function r and its derivative. -| -| \param nue: SA variable -| -------------------------------------------------------------------------------*/ +} // namespace ModVort /*! - * \brief Baseline + * \brief Auxiliary function r and its derivative. + * \param[in] nue: SA variable. + * \param[in,out] model_var: Common SA variables struct. */ -struct r_Bsl { - static void get(const su2double nue, CommonSAVariables& model_var) { +namespace r { + +/*! \brief Baseline. */ +struct Bsl { + static void get(const su2double& nue, CommonSAVariables& model_var) { model_var.r = min(nue * model_var.inv_Shat * model_var.inv_k2_d2, 10.0); - model_var.d_r = - (model_var.Shat - nue * model_var.d_Shat) * model_var.inv_Shat * model_var.inv_Shat * model_var.inv_k2_d2; + model_var.d_r = (model_var.Shat - nue * model_var.d_Shat) * pow(model_var.inv_Shat, 2) * model_var.inv_k2_d2; if (model_var.r == 10.0) model_var.d_r = 0.0; } }; -/*! - * \brief Edward - */ -struct r_Edw { - static void get(const su2double nue, CommonSAVariables& model_var) { +/*! \brief Edward. */ +struct Edw { + static void get(const su2double& nue, CommonSAVariables& model_var) { model_var.r = min(nue * model_var.inv_Shat * model_var.inv_k2_d2, 10.0); model_var.r = tanh(model_var.r) / tanh(1.0); - model_var.d_r = - (model_var.Shat - nue * model_var.d_Shat) * model_var.inv_Shat * model_var.inv_Shat * model_var.inv_k2_d2; + model_var.d_r = (model_var.Shat - nue * model_var.d_Shat) * pow(model_var.inv_Shat, 2) * model_var.inv_k2_d2; model_var.d_r = (1 - pow(tanh(model_var.r), 2.0)) * (model_var.d_r) / tanh(1.0); } }; - -/*------------------------------------------------------------------------------ -| Compute source terms: production, destruction and cross-productions term and their derivatives. -| -| \brief get: -| \param nue: SA variable -| -------------------------------------------------------------------------------*/ +} // namespace r /*! - * \brief Baseline (Original SA model) + * \brief Source terms classes: production, destruction and cross-productions term and their derivative. + * \param[in] nue: SA variable. + * \param[in] model_var: Common SA variables struct. + * \param[out] production: Production term. + * \param[out] destruction: Destruction term. + * \param[out] cross_production: CrossProduction term. + * \param[out] jacobian: Derivative of the combined source term wrt nue. */ -struct SourceTerms_Bsl { - static void get(const su2double nue, const CommonSAVariables& model_var, su2double& Production, - su2double& Destruction, su2double& CrossProduction, su2double& Jacobian) { - ComputeProduction(nue, model_var, Production, Jacobian); +namespace SourceTerms { + +/*! \brief Baseline (Original SA model). */ +struct Bsl { + static void get(const su2double& nue, const CommonSAVariables& model_var, su2double& production, + su2double& destruction, su2double& cross_production, su2double& jacobian) { + ComputeProduction(nue, model_var, production, jacobian); - ComputeDestruction(nue, model_var, Destruction, Jacobian); + ComputeDestruction(nue, model_var, destruction, jacobian); - ComputeCrossProduction(nue, model_var, CrossProduction, Jacobian); + ComputeCrossProduction(nue, model_var, cross_production, jacobian); } - static void ComputeProduction(const su2double nue, const CommonSAVariables& model_var, su2double& Production, - su2double& Jacobian) { - Production = model_var.cb1 * (1.0 - model_var.ft2) * model_var.Shat * nue; - Jacobian += model_var.cb1 * (-model_var.Shat * nue * model_var.d_ft2 + + static void ComputeProduction(const su2double& nue, const CommonSAVariables& model_var, su2double& production, + su2double& jacobian) { + production = model_var.cb1 * (1.0 - model_var.ft2) * model_var.Shat * nue; + jacobian += model_var.cb1 * (-model_var.Shat * nue * model_var.d_ft2 + (1.0 - model_var.ft2) * (nue * model_var.d_Shat + model_var.Shat)); } - static void ComputeDestruction(const su2double nue, const CommonSAVariables& model_var, su2double& Destruction, - su2double& Jacobian) { - Destruction = + static void ComputeDestruction(const su2double& nue, const CommonSAVariables& model_var, su2double& destruction, + su2double& jacobian) { + destruction = (model_var.cw1 * model_var.fw - model_var.cb1 * model_var.ft2 / model_var.k2) * nue * nue / model_var.dist_i_2; - Jacobian -= + jacobian -= (model_var.cw1 * model_var.d_fw - model_var.cb1 / model_var.k2 * model_var.d_ft2) * nue * nue / model_var.dist_i_2 + (model_var.cw1 * model_var.fw - model_var.cb1 * model_var.ft2 / model_var.k2) * 2.0 * nue / model_var.dist_i_2; } - static void ComputeCrossProduction(const su2double nue, const CommonSAVariables& model_var, - su2double& CrossProduction, su2double& Jacobian) { - CrossProduction = model_var.cb2_sigma * model_var.norm2_Grad; - /*--- No contribution to the jacobian ---*/ + static void ComputeCrossProduction(const su2double& nue, const CommonSAVariables& model_var, + su2double& cross_production, su2double&) { + cross_production = model_var.cb2_sigma * model_var.norm2_Grad; + /*--- No contribution to the jacobian. ---*/ } }; -/*! - * \brief Negative - */ -struct SourceTerms_Neg { - static void get(const su2double nue, const CommonSAVariables& model_var, su2double& Production, - su2double& Destruction, su2double& CrossProduction, su2double& Jacobian) { +/*! \brief Negative. */ +struct Neg { + static void get(const su2double& nue, const CommonSAVariables& model_var, su2double& production, + su2double& destruction, su2double& cross_production, su2double& jacobian) { if (nue > 0.0) { - // Baseline solution - SourceTerms_Bsl::get(nue, model_var, Production, Destruction, CrossProduction, Jacobian); - + Bsl::get(nue, model_var, production, destruction, cross_production, jacobian); } else { - ComputeProduction(nue, model_var, Production, Jacobian); + ComputeProduction(nue, model_var, production, jacobian); - ComputeDestruction(nue, model_var, Destruction, Jacobian); + ComputeDestruction(nue, model_var, destruction, jacobian); - ComputeCrossProduction(nue, model_var, CrossProduction, Jacobian); + ComputeCrossProduction(nue, model_var, cross_production, jacobian); } } - static void ComputeProduction(const su2double nue, const CommonSAVariables& model_var, su2double& Production, - su2double& Jacobian) { - Production = model_var.cb1 * (1.0 - model_var.ct3) * model_var.S * nue; - Jacobian += model_var.cb1 * (1.0 - model_var.ct3) * model_var.S; + static void ComputeProduction(const su2double& nue, const CommonSAVariables& model_var, su2double& production, + su2double& jacobian) { + const su2double dP_dnu = model_var.cb1 * (1.0 - model_var.ct3) * model_var.S; + production = dP_dnu * nue; + jacobian += dP_dnu; } - static void ComputeDestruction(const su2double nue, const CommonSAVariables& model_var, su2double& Destruction, - su2double& Jacobian) { - Destruction = model_var.cw1 * nue * nue / model_var.dist_i_2; - Jacobian -= 2.0 * model_var.cw1 * nue / model_var.dist_i_2; + static void ComputeDestruction(const su2double& nue, const CommonSAVariables& model_var, su2double& destruction, + su2double& jacobian) { + const su2double dD_dnu = model_var.cw1 * nue / model_var.dist_i_2; + destruction = dD_dnu * nue; + jacobian -= 2 * dD_dnu; } - static void ComputeCrossProduction(const su2double nue, const CommonSAVariables& model_var, - su2double& CrossProduction, su2double& Jacobian) { - /*--- Same cross production as baseline. ---*/ - SourceTerms_Bsl::ComputeCrossProduction(nue, model_var, CrossProduction, Jacobian); + static void ComputeCrossProduction(const su2double& nue, const CommonSAVariables& model_var, + su2double& cross_production, su2double& jacobian) { + Bsl::ComputeCrossProduction(nue, model_var, cross_production, jacobian); } }; +} // namespace SourceTerms + +} // namespace detail /* ============================================================================= * SPALART-ALLMARAS ADDITIONAL SOURCE TERMS DECORATORS * ============================================================================*/ /*! - * \brief Mixing Layer Compressibility Correction (SA-comp) decorator + * \class CompressiblityCorrection + * \brief Mixing Layer Compressibility Correction (SA-comp). */ template class CompressiblityCorrection final : public ParentClass { private: + using ParentClass::Gamma; + using ParentClass::idx; + using ParentClass::nDim; + using ParentClass::PrimVar_Grad_i; + using ParentClass::ScalarVar_i; + using ParentClass::V_i; + using ParentClass::Volume; + const su2double c5 = 3.5; public: - template - CompressiblityCorrection(const Ts&... args) : ParentClass(args...) {} + /*! + * \brief Constructor of the class. + * \param[in] nDim - Number of dimensions of the problem. + * \param[in] config - Definition of the particular problem. + */ + CompressiblityCorrection(unsigned short nDim, const CConfig* config) : ParentClass(nDim, config) {} ResidualType<> ComputeResidual(const CConfig* config) override { /*--- Residual from standard SA ---*/ @@ -504,21 +449,20 @@ class CompressiblityCorrection final : public ParentClass { /*--- Compressibility Correction term ---*/ const auto& Pressure_i = V_i[idx.Pressure()]; + const auto& Density_i = V_i[idx.Density()]; const su2double SoundSpeed_i = sqrt(Pressure_i * Gamma / Density_i); su2double aux_cc = 0; - for (iDim = 0; iDim < nDim; ++iDim) { - for (jDim = 0; jDim < nDim; ++jDim) { + for (unsigned short iDim = 0; iDim < nDim; ++iDim) { + for (unsigned short jDim = 0; jDim < nDim; ++jDim) { aux_cc += pow(PrimVar_Grad_i[idx.Velocity() + iDim][jDim], 2); } } - const su2double d_CompCorrection = 2.0 * c5 * ScalarVar_i[0] / pow(SoundSpeed_i, 2) * aux_cc * Volume; const su2double CompCorrection = 0.5 * ScalarVar_i[0] * d_CompCorrection; - /*--- Decorator residual contribution ---*/ - Residual.residual[0] -= CompCorrection; - Residual.jacobian_i[0][0] -= d_CompCorrection; + this->Residual -= CompCorrection; + this->Jacobian_i[0] -= d_CompCorrection; - return ResidualType<>(&Residual, &Jacobian_i, nullptr); + return ResidualType<>(&this->Residual, &this->Jacobian_i, nullptr); } }; From 73871e78b7d5dc749551fd05e8db5be02e3bb870 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sat, 26 Feb 2022 12:20:39 +0000 Subject: [PATCH 17/34] delete redundant methods also from old classes --- .../numerics/turbulent/turb_sources.hpp | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 2ed22cf8e486..24de648d614f 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -77,44 +77,11 @@ class CSourceBase_TurbSA : public CNumerics { */ inline void SetIntermittency(su2double intermittency_in) final { intermittency = intermittency_in; } - /*! - * \brief Residual for source term integration. - * \param[in] val_production - Value of the Production. - */ - inline void SetProduction(su2double val_production) final { Production = val_production; } - - /*! - * \brief Residual for source term integration. - * \param[in] val_destruction - Value of the Destruction. - */ - inline void SetDestruction(su2double val_destruction) final { Destruction = val_destruction; } - - /*! - * \brief Residual for source term integration. - * \param[in] val_crossproduction - Value of the CrossProduction. - */ - inline void SetCrossProduction(su2double val_crossproduction) final { CrossProduction = val_crossproduction; } - - /*! - * \brief ______________. - */ - inline su2double GetProduction(void) const final { return Production; } - /*! * \brief Get the intermittency for the BC trans. model. * \return Value of the intermittency. */ inline su2double GetGammaBC(void) const final { return Gamma_BC; } - - /*! - * \brief ______________. - */ - inline su2double GetDestruction(void) const final { return Destruction; } - - /*! - * \brief ______________. - */ - inline su2double GetCrossProduction(void) const final { return CrossProduction; } }; From 01af886b1ebcf71613becea8e2a059a92aac8601 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sat, 26 Feb 2022 15:12:39 +0000 Subject: [PATCH 18/34] base SA --- .../numerics/turbulent/turb_sources.hpp | 12 ++++++++ .../numerics/turbulent/turb_sources_new.hpp | 28 ++++++++++--------- .../src/numerics/turbulent/turb_sources.cpp | 4 +++ 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 24de648d614f..0128cf0a4e81 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -29,6 +29,7 @@ #pragma once #include "../scalar/scalar_sources.hpp" +#include "turb_sources_new.hpp" /*! * \class CSourcePieceWise_TurbSA @@ -85,6 +86,16 @@ class CSourceBase_TurbSA : public CNumerics { }; +template +using CSourcePieceWise_TurbSA = CSourceBase_TurbSA_< + FlowIndices, + detail::Omega::Bsl, + detail::ft2::Bsl, + detail::ModVort::Bsl, + detail::r::Bsl, + detail::SourceTerms::Bsl>; + +#if 0 /*! * \class CSourcePieceWise_TurbSA * \brief Class for integrating the source terms of the Spalart-Allmaras turbulence model equation. @@ -121,6 +132,7 @@ class CSourcePieceWise_TurbSA final : public CSourceBase_TurbSA { ResidualType<> ComputeResidual(const CConfig* config) override; }; +#endif /*! * \class CSourcePieceWise_TurbSA_COMP diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp index 2acca319f051..006a6486cfbf 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp @@ -1,7 +1,6 @@ /*! * \file turb_sources.hpp - * \brief Delarations of numerics classes for integration of source - * terms in turbulence problems. + * \brief Numerics classes for integration of source terms in turbulence problems. * \author F. Palacios, T. Economon * \version 7.3.0 "Blackbird" * @@ -29,6 +28,7 @@ #pragma once #include "../scalar/scalar_sources.hpp" +#include "../../../Common/include/toolboxes/geometry_toolbox.hpp" /*! * \class CommonSAVariables @@ -54,7 +54,7 @@ struct CommonSAVariables { * \note Additional source terms (e.g. compressibility) are implemented as decorators. */ template -class CSourceBase_TurbSA : public CNumerics { +class CSourceBase_TurbSA_ : public CNumerics { protected: su2double Gamma_BC = 0.0; su2double intermittency = 0.0; @@ -73,7 +73,7 @@ class CSourceBase_TurbSA : public CNumerics { * \param[in] nDim - Number of dimensions of the problem. * \param[in] config - Definition of the particular problem. */ - CSourceBase_TurbSA(unsigned short nDim, const CConfig* config) + CSourceBase_TurbSA_(unsigned short nDim, unsigned short, const CConfig* config) : CNumerics(nDim, 1, config), idx(nDim, config->GetnSpecies()), rotating_frame(config->GetRotating_Frame()), @@ -83,13 +83,13 @@ class CSourceBase_TurbSA : public CNumerics { * \brief Residual for source term integration. * \param[in] intermittency_in - Value of the intermittency. */ - inline void SetIntermittency(su2double intermittency_in) final { intermittency = intermittency_in; } + void SetIntermittency(su2double intermittency_in) final { intermittency = intermittency_in; } /*! * \brief Get the intermittency for the BC trans. model. * \return Value of the intermittency. */ - inline su2double GetGammaBC(void) const final { return Gamma_BC; } + su2double GetGammaBC() const final { return Gamma_BC; } /*! * \brief Residual for source term integration. @@ -109,9 +109,9 @@ class CSourceBase_TurbSA : public CNumerics { /*--- Evaluate Omega ---*/ if (nDim == 2) { - OmegaType::get<2>(Vorticity_i, PrimVar_Grad_i[idx.Velocity()], model_var); + OmegaType::template get<2>(Vorticity_i, PrimVar_Grad_i[idx.Velocity()], model_var); } else { - OmegaType::get<3>(Vorticity_i, PrimVar_Grad_i[idx.Velocity()], model_var); + OmegaType::template get<3>(Vorticity_i, PrimVar_Grad_i[idx.Velocity()], model_var); } /*--- Rotational correction term ---*/ @@ -172,12 +172,12 @@ class CSourceBase_TurbSA : public CNumerics { model_var.norm2_Grad = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[0]); /*--- Compute production, destruction and cross production and jacobian ---*/ - SourceTermsType::get(model_var, Production, Destruction, CrossProduction, Jacobian_i[0]); + SourceTermsType::get(ScalarVar_i[0], model_var, Production, Destruction, CrossProduction, Jacobian_i[0]); /*--- Compute any necessary additional source term and jacobian contribution ---*/ /*--- Residual ---*/ - Residual = Production - Destruction + CrossProduction + AddSourceTerm; + Residual = Production - Destruction + CrossProduction; Residual *= Volume; /*--- Jacobian ---*/ @@ -433,6 +433,8 @@ class CompressiblityCorrection final : public ParentClass { using ParentClass::V_i; using ParentClass::Volume; + using ResidualType = typename ParentClass::template ResidualType<>; + const su2double c5 = 3.5; public: @@ -441,9 +443,9 @@ class CompressiblityCorrection final : public ParentClass { * \param[in] nDim - Number of dimensions of the problem. * \param[in] config - Definition of the particular problem. */ - CompressiblityCorrection(unsigned short nDim, const CConfig* config) : ParentClass(nDim, config) {} + CompressiblityCorrection(unsigned short nDim, unsigned short, const CConfig* config) : ParentClass(nDim, 0, config) {} - ResidualType<> ComputeResidual(const CConfig* config) override { + ResidualType ComputeResidual(const CConfig* config) override { /*--- Residual from standard SA ---*/ ParentClass::ComputeResidual(config); @@ -463,6 +465,6 @@ class CompressiblityCorrection final : public ParentClass { this->Residual -= CompCorrection; this->Jacobian_i[0] -= d_CompCorrection; - return ResidualType<>(&this->Residual, &this->Jacobian_i, nullptr); + return ResidualType(&this->Residual, &this->Jacobian_i, nullptr); } }; diff --git a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp index a522f888416e..cdac7277c7be 100644 --- a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp +++ b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp @@ -61,6 +61,7 @@ CSourceBase_TurbSA::CSourceBase_TurbSA(unsigned short val_nDim, } +#if 0 template CSourcePieceWise_TurbSA::CSourcePieceWise_TurbSA(unsigned short val_nDim, unsigned short val_nVar, @@ -211,6 +212,7 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSA::ComputeResidual(const CCon return ResidualType<>(&Residual, &Jacobian_i, nullptr); } +#endif template CSourcePieceWise_TurbSA_COMP::CSourcePieceWise_TurbSA_COMP(unsigned short val_nDim, @@ -922,9 +924,11 @@ void CSourcePieceWise_TurbSST::SetPerturbedStrainMag(su2double turb_ke) { } /*--- Explicit instantiations until we don't move this to the hpp. ---*/ +#if 0 template class CSourcePieceWise_TurbSA >; template class CSourcePieceWise_TurbSA >; template class CSourcePieceWise_TurbSA >; +#endif template class CSourcePieceWise_TurbSA_COMP >; template class CSourcePieceWise_TurbSA_COMP >; From b6c9a3fac073c08ba176f296e3f866f9fd8e3a78 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sat, 26 Feb 2022 18:35:35 +0000 Subject: [PATCH 19/34] ad fix --- .../numerics/turbulent/turb_sources_new.hpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp index 006a6486cfbf..e5750104be83 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp @@ -270,9 +270,11 @@ struct Bsl { const su2double Sbar = nue * model_var.fv2 * model_var.inv_k2_d2; model_var.Shat = model_var.S + Sbar; model_var.Shat = max(model_var.Shat, 1.0e-10); - - const su2double d_Sbar = (model_var.fv2 + nue * model_var.d_fv2) * model_var.inv_k2_d2; - model_var.d_Shat = (model_var.Shat <= 1.0e-10) ? 0.0 : d_Sbar; + if (model_var.Shat <= 1.0e-10) { + model_var.d_Shat = 0.0; + } else { + model_var.d_Shat = (model_var.fv2 + nue * model_var.d_fv2) * model_var.inv_k2_d2; + } } }; @@ -281,9 +283,11 @@ struct Edw { static void get(const su2double& nue, const su2double& nu, CommonSAVariables& model_var) { model_var.Shat = max(model_var.S * ((1.0 / max(model_var.Ji, 1.0e-16)) + model_var.fv1), 1.0e-16); model_var.Shat = max(model_var.Shat, 1.0e-10); - - model_var.d_Shat = - (model_var.Shat <= 1.0e-10) ? 0.0 : -model_var.S * pow(model_var.Ji, -2) / nu + model_var.S * model_var.d_fv1; + if (model_var.Shat <= 1.0e-10) { + model_var.d_Shat = 0.0; + } else { + model_var.d_Shat = -model_var.S * pow(model_var.Ji, -2) / nu + model_var.S * model_var.d_fv1; + } } }; From e5bf4e0c813e71c2d1caad4ced1d319422352370 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sat, 26 Feb 2022 20:23:51 +0000 Subject: [PATCH 20/34] fix a leak --- .../numerics/turbulent/turb_sources_new.hpp | 45 ++++++++++--------- .../src/numerics/turbulent/turb_sources.cpp | 2 +- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp index e5750104be83..af903deef97e 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp @@ -27,8 +27,8 @@ #pragma once -#include "../scalar/scalar_sources.hpp" #include "../../../Common/include/toolboxes/geometry_toolbox.hpp" +#include "../scalar/scalar_sources.hpp" /*! * \class CommonSAVariables @@ -77,7 +77,11 @@ class CSourceBase_TurbSA_ : public CNumerics { : CNumerics(nDim, 1, config), idx(nDim, config->GetnSpecies()), rotating_frame(config->GetRotating_Frame()), - transition(config->GetKind_Trans_Model() == TURB_TRANS_MODEL::BC) {} + transition(config->GetKind_Trans_Model() == TURB_TRANS_MODEL::BC) { + /*--- Setup the Jacobian pointer, we need to return su2double** but we know + * the Jacobian is 1x1 so we use this trick to avoid heap allocation. ---*/ + Jacobian_i = &Jacobian_Buffer; + } /*! * \brief Residual for source term integration. @@ -124,7 +128,7 @@ class CSourceBase_TurbSA_ : public CNumerics { /*--- Vorticity ---*/ model_var.S = model_var.Omega; - model_var.dist_i_2 = dist_i * dist_i; + model_var.dist_i_2 = pow(dist_i, 2); const su2double nu = Laminar_Viscosity_i / Density_i; model_var.inv_k2_d2 = 1.0 / (model_var.k2 * model_var.dist_i_2); @@ -142,13 +146,12 @@ class CSourceBase_TurbSA_ : public CNumerics { const su2double Ji_3 = Ji_2 * model_var.Ji; model_var.fv1 = Ji_3 / (Ji_3 + model_var.cv1_3); - model_var.d_fv1 = 3.0 * Ji_2 * model_var.cv1_3 / (nu * pow(Ji_3 + model_var.cv1_3, 2)); + model_var.d_fv1 = 3 * Ji_2 * model_var.cv1_3 / (nu * pow(Ji_3 + model_var.cv1_3, 2)); /*--- Using a modified relation so as to not change the Shat that depends on fv2. ---*/ - model_var.fv2 = - 1.0 - - ScalarVar_i[0] / (nu + ScalarVar_i[0] * model_var.fv1); // From NASA turb modeling resource and 2003 paper - model_var.d_fv2 = -(1.0 / nu - Ji_2 * model_var.d_fv1) / pow(1.0 + model_var.Ji * model_var.fv1, 2); + // From NASA turb modeling resource and 2003 paper + model_var.fv2 = 1 - ScalarVar_i[0] / (nu + ScalarVar_i[0] * model_var.fv1); + model_var.d_fv2 = -(1 / nu - Ji_2 * model_var.d_fv1) / pow(1 + model_var.Ji * model_var.fv1, 2); /*--- Compute ft2 term ---*/ ft2Type::get(model_var); @@ -161,13 +164,13 @@ class CSourceBase_TurbSA_ : public CNumerics { /*--- Compute auxiliary function r ---*/ rType::get(ScalarVar_i[0], model_var); - model_var.g = model_var.r + model_var.cw2 * (pow(model_var.r, 6.0) - model_var.r); - model_var.g_6 = pow(model_var.g, 6.0); - model_var.glim = pow((1.0 + model_var.cw3_6) / (model_var.g_6 + model_var.cw3_6), 1.0 / 6.0); + model_var.g = model_var.r + model_var.cw2 * (pow(model_var.r, 6) - model_var.r); + model_var.g_6 = pow(model_var.g, 6); + model_var.glim = pow((1 + model_var.cw3_6) / (model_var.g_6 + model_var.cw3_6), 1.0 / 6.0); model_var.fw = model_var.g * model_var.glim; - model_var.d_g = model_var.d_r * (1. + model_var.cw2 * (6.0 * pow(model_var.r, 5.0) - 1.0)); - model_var.d_fw = model_var.d_g * model_var.glim * (1. - model_var.g_6 / (model_var.g_6 + model_var.cw3_6)); + model_var.d_g = model_var.d_r * (1 + model_var.cw2 * (6 * pow(model_var.r, 5) - 1)); + model_var.d_fw = model_var.d_g * model_var.glim * (1 - model_var.g_6 / (model_var.g_6 + model_var.cw3_6)); model_var.norm2_Grad = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[0]); @@ -177,8 +180,7 @@ class CSourceBase_TurbSA_ : public CNumerics { /*--- Compute any necessary additional source term and jacobian contribution ---*/ /*--- Residual ---*/ - Residual = Production - Destruction + CrossProduction; - Residual *= Volume; + Residual = (Production - Destruction + CrossProduction) * Volume; /*--- Jacobian ---*/ Jacobian_i[0] *= Volume; @@ -318,7 +320,7 @@ struct Bsl { static void get(const su2double& nue, CommonSAVariables& model_var) { model_var.r = min(nue * model_var.inv_Shat * model_var.inv_k2_d2, 10.0); model_var.d_r = (model_var.Shat - nue * model_var.d_Shat) * pow(model_var.inv_Shat, 2) * model_var.inv_k2_d2; - if (model_var.r == 10.0) model_var.d_r = 0.0; + if (model_var.r >= 10.0) model_var.d_r = 0.0; } }; @@ -365,12 +367,11 @@ struct Bsl { static void ComputeDestruction(const su2double& nue, const CommonSAVariables& model_var, su2double& destruction, su2double& jacobian) { - destruction = - (model_var.cw1 * model_var.fw - model_var.cb1 * model_var.ft2 / model_var.k2) * nue * nue / model_var.dist_i_2; - jacobian -= - (model_var.cw1 * model_var.d_fw - model_var.cb1 / model_var.k2 * model_var.d_ft2) * nue * nue / - model_var.dist_i_2 + - (model_var.cw1 * model_var.fw - model_var.cb1 * model_var.ft2 / model_var.k2) * 2.0 * nue / model_var.dist_i_2; + const su2double cb1_k2 = model_var.cb1 / model_var.k2; + const su2double factor = model_var.cw1 * model_var.fw - cb1_k2 * model_var.ft2; + destruction = factor * pow(nue, 2) / model_var.dist_i_2; + jacobian -= ((model_var.cw1 * model_var.d_fw - cb1_k2 * model_var.d_ft2) * pow(nue, 2) + factor * 2 * nue) / + model_var.dist_i_2; } static void ComputeCrossProduction(const su2double& nue, const CommonSAVariables& model_var, diff --git a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp index cdac7277c7be..2b7bd6735d57 100644 --- a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp +++ b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp @@ -202,7 +202,7 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSA::ComputeResidual(const CCon if (r == 10.0) dr = 0.0; dg = dr*(1.+cw2*(6.0*pow(r,5.0)-1.0)); dfw = dg*glim*(1.-g_6/(g_6+cw3_6)); - Jacobian_i[0] -= cw1*(dfw*ScalarVar_i[0] + 2.0*fw)*ScalarVar_i[0]/dist_i_2*Volume; + Jacobian_i[0] -= cw1*(dfw*ScalarVar_i[0] + 2.0*fw)*ScalarVar_i[0]/dist_i_2*Volume; } From e3d5ae7cccd4c2c730e6200ca5858018d4f9cb54 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sat, 26 Feb 2022 22:10:41 +0000 Subject: [PATCH 21/34] transition and SA-Comp --- .../numerics/turbulent/turb_sources.hpp | 78 +---- .../numerics/turbulent/turb_sources_new.hpp | 40 ++- .../src/numerics/turbulent/turb_sources.cpp | 282 ------------------ 3 files changed, 39 insertions(+), 361 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 0128cf0a4e81..403b71e3f7d6 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -85,7 +85,10 @@ class CSourceBase_TurbSA : public CNumerics { inline su2double GetGammaBC(void) const final { return Gamma_BC; } }; - +/*! + * \class CSourcePieceWise_TurbSA + * \brief Class for integrating the source terms of the Spalart-Allmaras turbulence model equation. + */ template using CSourcePieceWise_TurbSA = CSourceBase_TurbSA_< FlowIndices, @@ -95,82 +98,13 @@ using CSourcePieceWise_TurbSA = CSourceBase_TurbSA_< detail::r::Bsl, detail::SourceTerms::Bsl>; -#if 0 -/*! - * \class CSourcePieceWise_TurbSA - * \brief Class for integrating the source terms of the Spalart-Allmaras turbulence model equation. - * \ingroup SourceDiscr - * \author A. Bueno. - */ -template -class CSourcePieceWise_TurbSA final : public CSourceBase_TurbSA { -private: - const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ - - su2double nu, Ji, fv1, fv2, ft2, Omega, S, Shat, inv_Shat, dist_i_2, Ji_2, Ji_3, inv_k2_d2; - su2double r, g, g_6, glim, fw; - su2double norm2_Grad; - su2double dfv1, dfv2, dShat; - su2double dr, dg, dfw; - unsigned short iDim; - bool transition; - -public: - /*! - * \brief Constructor of the class. - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nVar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CSourcePieceWise_TurbSA(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config); - - /*! - * \brief Residual for source term integration. - * \param[in] config - Definition of the particular problem. - * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. - */ - ResidualType<> ComputeResidual(const CConfig* config) override; - -}; -#endif - /*! * \class CSourcePieceWise_TurbSA_COMP - * \brief Class for integrating the source terms of the Spalart-Allmaras CC modification turbulence model equation. - * \ingroup SourceDiscr - * \author E.Molina, A. Bueno. - * \version 7.3.0 "Blackbird" + * \brief Class for integrating the source terms of the Spalart-Allmaras model with compressibility correction. */ template -class CSourcePieceWise_TurbSA_COMP final : public CSourceBase_TurbSA { -private: - const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ - - su2double nu, Ji, fv1, fv2, ft2, Omega, S, Shat, inv_Shat, dist_i_2, Ji_2, Ji_3, inv_k2_d2; - su2double r, g, g_6, glim, fw; - su2double norm2_Grad; - su2double dfv1, dfv2, dShat; - su2double dr, dg, dfw; - su2double aux_cc, CompCorrection, c5; - unsigned short iDim, jDim; +using CSourcePieceWise_TurbSA_COMP = CompressibilityCorrection>; -public: - /*! - * \brief Constructor of the class. - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nVar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CSourcePieceWise_TurbSA_COMP(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config); - - /*! - * \brief Residual for source term integration. - * \param[in] config - Definition of the particular problem. - * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. - */ - ResidualType<> ComputeResidual(const CConfig* config) override; - -}; /*! * \class CSourcePieceWise_TurbSA_E diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp index af903deef97e..54163878a5e1 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp @@ -44,7 +44,7 @@ struct CommonSAVariables { su2double ft2, d_ft2, r, d_r, g, d_g, glim, fw, d_fw, Ji, d_Ji, S, Shat, d_Shat, fv1, d_fv1, fv2, d_fv2; /*--- List of helpers ---*/ - su2double Omega, dist_i_2, inv_k2_d2, inv_Shat, g_6, norm2_Grad; + su2double Omega, dist_i_2, inv_k2_d2, inv_Shat, g_6, norm2_Grad, gamma_bc; }; /*! @@ -174,6 +174,31 @@ class CSourceBase_TurbSA_ : public CNumerics { model_var.norm2_Grad = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[0]); + /// TODO: Make this one of the template parameters? + if (transition) { + /*--- BC model constants (2020 revision). ---*/ + const su2double chi_1 = 0.002; + const su2double chi_2 = 50.0; + + /*--- turbulence intensity is u'/U so we multiply by 100 to get percentage ---*/ + const su2double tu = 100.0 * config->GetTurbulenceIntensity_FreeStream(); + const su2double nu_t = ScalarVar_i[0]*model_var.fv1; + + const su2double re_v = Density_i*model_var.dist_i_2/Laminar_Viscosity_i*model_var.Omega; + const su2double re_theta = re_v/2.193; + const su2double re_theta_t = 803.73 * pow(tu + 0.6067,-1.027); //MENTER correlation + //re_theta_t = 163.0 + exp(6.91-tu); //ABU-GHANNAM & SHAW correlation + + su2double term1 = sqrt(max(re_theta-re_theta_t,0.0)/(chi_1*re_theta_t)); + su2double term2 = sqrt(max((nu_t*chi_2)/nu,0.0)); + su2double term_exponential = (term1 + term2); + + Gamma_BC = 1.0 - exp(-term_exponential); + model_var.gamma_bc = Gamma_BC; + } else { + model_var.gamma_bc = 1.0; + } + /*--- Compute production, destruction and cross production and jacobian ---*/ SourceTermsType::get(ScalarVar_i[0], model_var, Production, Destruction, CrossProduction, Jacobian_i[0]); @@ -360,8 +385,9 @@ struct Bsl { static void ComputeProduction(const su2double& nue, const CommonSAVariables& model_var, su2double& production, su2double& jacobian) { - production = model_var.cb1 * (1.0 - model_var.ft2) * model_var.Shat * nue; - jacobian += model_var.cb1 * (-model_var.Shat * nue * model_var.d_ft2 + + const su2double factor = model_var.gamma_bc * model_var.cb1; + production = factor * (1.0 - model_var.ft2) * model_var.Shat * nue; + jacobian += factor * (-model_var.Shat * nue * model_var.d_ft2 + (1.0 - model_var.ft2) * (nue * model_var.d_Shat + model_var.Shat)); } @@ -398,7 +424,7 @@ struct Neg { static void ComputeProduction(const su2double& nue, const CommonSAVariables& model_var, su2double& production, su2double& jacobian) { - const su2double dP_dnu = model_var.cb1 * (1.0 - model_var.ct3) * model_var.S; + const su2double dP_dnu = model_var.gamma_bc * model_var.cb1 * (1.0 - model_var.ct3) * model_var.S; production = dP_dnu * nue; jacobian += dP_dnu; } @@ -424,11 +450,11 @@ struct Neg { * ============================================================================*/ /*! - * \class CompressiblityCorrection + * \class CompressibilityCorrection * \brief Mixing Layer Compressibility Correction (SA-comp). */ template -class CompressiblityCorrection final : public ParentClass { +class CompressibilityCorrection final : public ParentClass { private: using ParentClass::Gamma; using ParentClass::idx; @@ -448,7 +474,7 @@ class CompressiblityCorrection final : public ParentClass { * \param[in] nDim - Number of dimensions of the problem. * \param[in] config - Definition of the particular problem. */ - CompressiblityCorrection(unsigned short nDim, unsigned short, const CConfig* config) : ParentClass(nDim, 0, config) {} + CompressibilityCorrection(unsigned short nDim, unsigned short, const CConfig* config) : ParentClass(nDim, 0, config) {} ResidualType ComputeResidual(const CConfig* config) override { /*--- Residual from standard SA ---*/ diff --git a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp index 2b7bd6735d57..3f468d345013 100644 --- a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp +++ b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp @@ -61,279 +61,6 @@ CSourceBase_TurbSA::CSourceBase_TurbSA(unsigned short val_nDim, } -#if 0 -template -CSourcePieceWise_TurbSA::CSourcePieceWise_TurbSA(unsigned short val_nDim, - unsigned short val_nVar, - const CConfig* config) : - CSourceBase_TurbSA(val_nDim, val_nVar, config), - idx(val_nDim, config->GetnSpecies()) { - - transition = (config->GetKind_Trans_Model() == TURB_TRANS_MODEL::BC); -} - -template -CNumerics::ResidualType<> CSourcePieceWise_TurbSA::ComputeResidual(const CConfig* config) { - -// AD::StartPreacc(); -// AD::SetPreaccIn(V_i, nDim+6); -// AD::SetPreaccIn(Vorticity_i, nDim); -// AD::SetPreaccIn(StrainMag_i); -// AD::SetPreaccIn(ScalarVar_i[0]); -// AD::SetPreaccIn(ScalarVar_Grad_i[0], nDim); -// AD::SetPreaccIn(Volume); AD::SetPreaccIn(dist_i); - - Density_i = V_i[idx.Density()]; - Laminar_Viscosity_i = V_i[idx.LaminarViscosity()]; - - Residual = 0.0; - Production = 0.0; - Destruction = 0.0; - CrossProduction = 0.0; - Jacobian_i[0] = 0.0; - - /*--- Evaluate Omega ---*/ - - Omega = sqrt(Vorticity_i[0]*Vorticity_i[0] + Vorticity_i[1]*Vorticity_i[1] + Vorticity_i[2]*Vorticity_i[2]); - - /*--- Rotational correction term ---*/ - - if (rotating_frame) { Omega += 2.0*min(0.0, StrainMag_i-Omega); } - - if (dist_i > 1e-10) { - - /*--- Production term ---*/ - - dist_i_2 = dist_i*dist_i; - nu = Laminar_Viscosity_i/Density_i; - - /*--- Modified values for roughness ---*/ - /*--- Ref: Aupoix, B. and Spalart, P. R., "Extensions of the Spalart-Allmaras Turbulence Model to Account for Wall Roughness," - * International Journal of Heat and Fluid Flow, Vol. 24, 2003, pp. 454-462. ---*/ - /* --- See https://turbmodels.larc.nasa.gov/spalart.html#sarough for detailed explanation. ---*/ - - Ji = ScalarVar_i[0]/nu + cr1*(roughness_i/(dist_i+EPS)); //roughness_i = 0 for smooth walls and Ji remains the same, changes only if roughness is specified. - Ji_2 = Ji*Ji; - Ji_3 = Ji_2*Ji; - fv1 = Ji_3/(Ji_3+cv1_3); - - /*--- Using a modified relation so as to not change the Shat that depends on fv2. ---*/ - fv2 = 1.0 - ScalarVar_i[0]/(nu+ScalarVar_i[0]*fv1); // From NASA turb modeling resource and 2003 paper - - ft2 = ct3*exp(-ct4*Ji_2); - S = Omega; - inv_k2_d2 = 1.0/(k2*dist_i_2); - - Shat = S + ScalarVar_i[0]*fv2*inv_k2_d2; - Shat = max(Shat, 1.0e-10); - inv_Shat = 1.0/Shat; - -// Original SA model -// Production = cb1*(1.0-ft2)*Shat*ScalarVar_i[0]*Volume; - - if (transition) { - - /*--- BC model constants (2020 revision). ---*/ - const su2double chi_1 = 0.002; - const su2double chi_2 = 50.0; - - /*--- turbulence intensity is u'/U so we multiply by 100 to get percentage ---*/ - su2double tu = 100.0 * config->GetTurbulenceIntensity_FreeStream(); - - su2double nu_t = (ScalarVar_i[0]*fv1); //S-A variable - - su2double re_v = ((Density_i*pow(dist_i,2.))/(Laminar_Viscosity_i))*Omega; - su2double re_theta = re_v/2.193; - su2double re_theta_t = (803.73 * pow((tu + 0.6067),-1.027)); //MENTER correlation - //re_theta_t = 163.0 + exp(6.91-tu); //ABU-GHANNAM & SHAW correlation - - su2double term1 = sqrt(max(re_theta-re_theta_t,0.)/(chi_1*re_theta_t)); - su2double term2 = sqrt(max((nu_t*chi_2)/nu,0.)); - su2double term_exponential = (term1 + term2); - - Gamma_BC = 1.0 - exp(-term_exponential); - - Production = Gamma_BC*cb1*Shat*ScalarVar_i[0]*Volume; - } - else { - Production = cb1*Shat*ScalarVar_i[0]*Volume; - } - - /*--- Destruction term ---*/ - - r = min(ScalarVar_i[0]*inv_Shat*inv_k2_d2,10.0); - g = r + cw2*(pow(r,6.0)-r); - g_6 = pow(g,6.0); - glim = pow((1.0+cw3_6)/(g_6+cw3_6),1.0/6.0); - fw = g*glim; - -// Original SA model -// Destruction = (cw1*fw-cb1*ft2/k2)*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; - - Destruction = cw1*fw*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; - - /*--- Diffusion term ---*/ - - norm2_Grad = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - norm2_Grad += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; - - CrossProduction = cb2_sigma*norm2_Grad*Volume; - - Residual = Production - Destruction + CrossProduction; - - /*--- Implicit part, production term ---*/ - - dfv1 = 3.0*Ji_2*cv1_3/(nu*pow(Ji_3+cv1_3,2.)); - dfv2 = -(1/nu-Ji_2*dfv1)/pow(1.+Ji*fv1,2.); - if ( Shat <= 1.0e-10 ) dShat = 0.0; - else dShat = (fv2+ScalarVar_i[0]*dfv2)*inv_k2_d2; - - if (transition) { - Jacobian_i[0] += Gamma_BC*cb1*(ScalarVar_i[0]*dShat+Shat)*Volume; - } - else { - Jacobian_i[0] += cb1*(ScalarVar_i[0]*dShat+Shat)*Volume; - } - - /*--- Implicit part, destruction term ---*/ - - dr = (Shat-ScalarVar_i[0]*dShat)*inv_Shat*inv_Shat*inv_k2_d2; - if (r == 10.0) dr = 0.0; - dg = dr*(1.+cw2*(6.0*pow(r,5.0)-1.0)); - dfw = dg*glim*(1.-g_6/(g_6+cw3_6)); - Jacobian_i[0] -= cw1*(dfw*ScalarVar_i[0] + 2.0*fw)*ScalarVar_i[0]/dist_i_2*Volume; - - } - -// AD::SetPreaccOut(Residual); -// AD::EndPreacc(); - - return ResidualType<>(&Residual, &Jacobian_i, nullptr); - -} -#endif - -template -CSourcePieceWise_TurbSA_COMP::CSourcePieceWise_TurbSA_COMP(unsigned short val_nDim, - unsigned short val_nVar, - const CConfig* config) : - CSourceBase_TurbSA(val_nDim, val_nVar, config), - idx(val_nDim, config->GetnSpecies()), - c5(3.5) { } - -template -CNumerics::ResidualType<> CSourcePieceWise_TurbSA_COMP::ComputeResidual(const CConfig* config) { - - // AD::StartPreacc(); - // AD::SetPreaccIn(V_i, nDim+6); - // AD::SetPreaccIn(Vorticity_i, nDim); - // AD::SetPreaccIn(StrainMag_i); - // AD::SetPreaccIn(ScalarVar_i[0]); - // AD::SetPreaccIn(ScalarVar_Grad_i[0], nDim); - // AD::SetPreaccIn(Volume); AD::SetPreaccIn(dist_i); - - Density_i = V_i[idx.Density()]; - Laminar_Viscosity_i = V_i[idx.LaminarViscosity()]; - - Residual = 0.0; - Production = 0.0; - Destruction = 0.0; - CrossProduction = 0.0; - Jacobian_i[0] = 0.0; - - /*--- Evaluate Omega ---*/ - - Omega = sqrt(Vorticity_i[0]*Vorticity_i[0] + Vorticity_i[1]*Vorticity_i[1] + Vorticity_i[2]*Vorticity_i[2]); - - /*--- Rotational correction term ---*/ - - if (rotating_frame) { Omega += 2.0*min(0.0, StrainMag_i-Omega); } - - if (dist_i > 1e-10) { - - /*--- Production term ---*/ - - dist_i_2 = dist_i*dist_i; - nu = Laminar_Viscosity_i/Density_i; - Ji = ScalarVar_i[0]/nu; - Ji_2 = Ji*Ji; - Ji_3 = Ji_2*Ji; - fv1 = Ji_3/(Ji_3+cv1_3); - fv2 = 1.0 - Ji/(1.0+Ji*fv1); - ft2 = ct3*exp(-ct4*Ji_2); - S = Omega; - inv_k2_d2 = 1.0/(k2*dist_i_2); - - Shat = S + ScalarVar_i[0]*fv2*inv_k2_d2; - Shat = max(Shat, 1.0e-10); - inv_Shat = 1.0/Shat; - - /*--- Production term ---*/; - - Production = cb1*Shat*ScalarVar_i[0]*Volume; - - /*--- Destruction term ---*/ - - r = min(ScalarVar_i[0]*inv_Shat*inv_k2_d2,10.0); - g = r + cw2*(pow(r,6.0)-r); - g_6 = pow(g,6.0); - glim = pow((1.0+cw3_6)/(g_6+cw3_6),1.0/6.0); - fw = g*glim; - - Destruction = cw1*fw*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; - - /*--- Diffusion term ---*/ - - norm2_Grad = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - norm2_Grad += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; - - CrossProduction = cb2_sigma*norm2_Grad*Volume; - - Residual = Production - Destruction + CrossProduction; - - /*--- Compressibility Correction term ---*/ - Pressure_i = V_i[idx.Pressure()]; - SoundSpeed_i = sqrt(Pressure_i*Gamma/Density_i); - aux_cc=0; - for(iDim=0;iDim(&Residual, &Jacobian_i, nullptr); - -} - template CSourcePieceWise_TurbSA_E::CSourcePieceWise_TurbSA_E(unsigned short val_nDim, unsigned short val_nVar, @@ -924,15 +651,6 @@ void CSourcePieceWise_TurbSST::SetPerturbedStrainMag(su2double turb_ke) { } /*--- Explicit instantiations until we don't move this to the hpp. ---*/ -#if 0 -template class CSourcePieceWise_TurbSA >; -template class CSourcePieceWise_TurbSA >; -template class CSourcePieceWise_TurbSA >; -#endif - -template class CSourcePieceWise_TurbSA_COMP >; -template class CSourcePieceWise_TurbSA_COMP >; -template class CSourcePieceWise_TurbSA_COMP >; template class CSourcePieceWise_TurbSA_E >; template class CSourcePieceWise_TurbSA_E >; From d963fa189c6e9c19bd53a08d107d42d4c3569154 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sun, 27 Feb 2022 10:30:07 +0000 Subject: [PATCH 22/34] rest of the family --- SU2_CFD/include/numerics/CNumerics.hpp | 5 - .../numerics/turbulent/turb_sources.hpp | 183 -------- .../numerics/turbulent/turb_sources_new.hpp | 399 ++++++++++-------- .../src/numerics/turbulent/turb_sources.cpp | 23 +- SU2_CFD/src/solvers/CTurbSASolver.cpp | 7 - 5 files changed, 224 insertions(+), 393 deletions(-) diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index a0cf5dd23a51..27891731a68d 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -1425,11 +1425,6 @@ class CNumerics { return ERR; } - /*! - * \brief Set intermittency for numerics (used in SA with LM transition model) - */ - inline virtual void SetIntermittency(su2double intermittency_in) { } - /*! * \brief A virtual member. */ diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 403b71e3f7d6..2f8d5603893c 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -31,189 +31,6 @@ #include "../scalar/scalar_sources.hpp" #include "turb_sources_new.hpp" -/*! - * \class CSourcePieceWise_TurbSA - * \brief Class for integrating the source terms of the Spalart-Allmaras turbulence model equation. - * \ingroup SourceDiscr - * \author A. Bueno. - */ -class CSourceBase_TurbSA : public CNumerics { -protected: - su2double cv1_3; - su2double k2; - su2double cb1; - su2double cw2; - su2double ct3; - su2double ct4; - su2double cw3_6; - su2double cb2_sigma; - su2double sigma; - su2double cb2; - su2double cw1; - su2double cr1; - - su2double Gamma_BC = 0.0; - su2double intermittency; - su2double Production, Destruction, CrossProduction; - - su2double Residual, *Jacobian_i; -private: - su2double Jacobian_Buffer; /// Static storage for the Jacobian (which needs to be pointer for return type). - -protected: - const bool rotating_frame = false; - -public: - /*! - * \brief Constructor of the class. - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nVar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CSourceBase_TurbSA(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config); - - /*! - * \brief Residual for source term integration. - * \param[in] intermittency_in - Value of the intermittency. - */ - inline void SetIntermittency(su2double intermittency_in) final { intermittency = intermittency_in; } - - /*! - * \brief Get the intermittency for the BC trans. model. - * \return Value of the intermittency. - */ - inline su2double GetGammaBC(void) const final { return Gamma_BC; } -}; - -/*! - * \class CSourcePieceWise_TurbSA - * \brief Class for integrating the source terms of the Spalart-Allmaras turbulence model equation. - */ -template -using CSourcePieceWise_TurbSA = CSourceBase_TurbSA_< - FlowIndices, - detail::Omega::Bsl, - detail::ft2::Bsl, - detail::ModVort::Bsl, - detail::r::Bsl, - detail::SourceTerms::Bsl>; - -/*! - * \class CSourcePieceWise_TurbSA_COMP - * \brief Class for integrating the source terms of the Spalart-Allmaras model with compressibility correction. - */ -template -using CSourcePieceWise_TurbSA_COMP = CompressibilityCorrection>; - - -/*! - * \class CSourcePieceWise_TurbSA_E - * \brief Class for integrating the source terms of the Spalart-Allmaras Edwards modification turbulence model equation. - * \ingroup SourceDiscr - * \author E.Molina, A. Bueno. - * \version 7.3.0 "Blackbird" - */ -template -class CSourcePieceWise_TurbSA_E final : public CSourceBase_TurbSA { -private: - const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ - - su2double nu, Ji, fv1, fv2, ft2, Omega, S, Shat, inv_Shat, dist_i_2, Ji_2, Ji_3, inv_k2_d2; - su2double r, g, g_6, glim, fw; - su2double norm2_Grad; - su2double dfv1, dfv2, dShat; - su2double dr, dg, dfw; - su2double Sbar; - -public: - /*! - * \brief Constructor of the class. - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nVar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CSourcePieceWise_TurbSA_E(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config); - - /*! - * \brief Residual for source term integration. - * \param[in] config - Definition of the particular problem. - * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. - */ - ResidualType<> ComputeResidual(const CConfig* config) override; -}; - -/*! - * \class CSourcePieceWise_TurbSA_E_COMP - * \brief Class for integrating the source terms of the Spalart-Allmaras Edwards modification with CC turbulence model equation. - * \ingroup SourceDiscr - * \author E.Molina, A. Bueno. - * \version 7.3.0 "Blackbird" - */ -template -class CSourcePieceWise_TurbSA_E_COMP : public CSourceBase_TurbSA { -private: - const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ - - su2double nu, Ji, fv1, fv2, ft2, Omega, S, Shat, inv_Shat, dist_i_2, Ji_2, Ji_3, inv_k2_d2; - su2double r, g, g_6, glim, fw; - su2double norm2_Grad; - su2double dfv1, dfv2, dShat; - su2double dr, dg, dfw; - su2double Sbar; - su2double aux_cc, CompCorrection, c5; - -public: - /*! - * \brief Constructor of the class. - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nVar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CSourcePieceWise_TurbSA_E_COMP(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config); - - /*! - * \brief Residual for source term integration. - * \param[in] config - Definition of the particular problem. - * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. - */ - ResidualType<> ComputeResidual(const CConfig* config) override; -}; - -/*! - * \class CSourcePieceWise_TurbSA_Neg - * \brief Class for integrating the source terms of the Spalart-Allmaras turbulence model equation. - * \ingroup SourceDiscr - * \author F. Palacios - */ -template -class CSourcePieceWise_TurbSA_Neg : public CSourceBase_TurbSA { -private: - const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ - - su2double nu, Ji, fv1, fv2, ft2, Omega, S, Shat, inv_Shat, dist_i_2, Ji_2, Ji_3, inv_k2_d2; - su2double r, g, g_6, glim, fw; - su2double norm2_Grad; - su2double dfv1, dfv2, dShat; - su2double dr, dg, dfw; - -public: - /*! - * \brief Constructor of the class. - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nVar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CSourcePieceWise_TurbSA_Neg(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config); - - /*! - * \brief Residual for source term integration. - * \param[in] config - Definition of the particular problem. - * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. - */ - ResidualType<> ComputeResidual(const CConfig* config) override; - -}; - /*! * \class CSourcePieceWise_TurbSST * \brief Class for integrating the source terms of the Menter SST turbulence model equations. diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp index 54163878a5e1..081b9027d26f 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp @@ -1,7 +1,6 @@ /*! * \file turb_sources.hpp * \brief Numerics classes for integration of source terms in turbulence problems. - * \author F. Palacios, T. Economon * \version 7.3.0 "Blackbird" * * SU2 Project Website: https://su2code.github.io @@ -31,14 +30,14 @@ #include "../scalar/scalar_sources.hpp" /*! - * \class CommonSAVariables + * \class CSAVariables * \brief Structure with SA common auxiliary functions and constants. */ -struct CommonSAVariables { +struct CSAVariables { /*--- List of constants ---*/ - const su2double cv1_3 = pow(7.1, 3.0), k2 = pow(0.41, 2.0), cb1 = 0.1355, cw2 = 0.3, ct3 = 1.2, ct4 = 0.5, - cw3_6 = pow(2.0, 6.0), sigma = 2. / 3., cb2 = 0.622, cb2_sigma = cb2 / sigma, - cw1 = cb1 / k2 + (1.0 + cb2) / sigma, cr1 = 0.5; + const su2double cv1_3 = pow(7.1, 3), k2 = pow(0.41, 2), cb1 = 0.1355, cw2 = 0.3, ct3 = 1.2, ct4 = 0.5, + cw3_6 = pow(2, 6), sigma = 2.0 / 3.0, cb2 = 0.622, cb2_sigma = cb2 / sigma, + cw1 = cb1 / k2 + (1 + cb2) / sigma, cr1 = 0.5; /*--- List of auxiliary functions ---*/ su2double ft2, d_ft2, r, d_r, g, d_g, glim, fw, d_fw, Ji, d_Ji, S, Shat, d_Shat, fv1, d_fv1, fv2, d_fv2; @@ -53,11 +52,10 @@ struct CommonSAVariables { * The variables that are subject to change in each variation/correction have their own class. * \note Additional source terms (e.g. compressibility) are implemented as decorators. */ -template -class CSourceBase_TurbSA_ : public CNumerics { +template +class CSourceBase_TurbSA : public CNumerics { protected: su2double Gamma_BC = 0.0; - su2double intermittency = 0.0; /*--- Residual and Jacobian ---*/ su2double Residual, *Jacobian_i; @@ -73,7 +71,7 @@ class CSourceBase_TurbSA_ : public CNumerics { * \param[in] nDim - Number of dimensions of the problem. * \param[in] config - Definition of the particular problem. */ - CSourceBase_TurbSA_(unsigned short nDim, unsigned short, const CConfig* config) + CSourceBase_TurbSA(unsigned short nDim, unsigned short, const CConfig* config) : CNumerics(nDim, 1, config), idx(nDim, config->GetnSpecies()), rotating_frame(config->GetRotating_Frame()), @@ -84,13 +82,7 @@ class CSourceBase_TurbSA_ : public CNumerics { } /*! - * \brief Residual for source term integration. - * \param[in] intermittency_in - Value of the intermittency. - */ - void SetIntermittency(su2double intermittency_in) final { intermittency = intermittency_in; } - - /*! - * \brief Get the intermittency for the BC trans. model. + * \brief Get the intermittency for the BC transition model. * \return Value of the intermittency. */ su2double GetGammaBC() const final { return Gamma_BC; } @@ -101,78 +93,79 @@ class CSourceBase_TurbSA_ : public CNumerics { * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. */ ResidualType<> ComputeResidual(const CConfig* config) override { - /*--- Model common auxiliary and constant variables ---*/ - CommonSAVariables model_var; - - const auto& Density_i = V_i[idx.Density()]; - const auto& Laminar_Viscosity_i = V_i[idx.LaminarViscosity()]; + /// TODO: Fix AD preaccumulation. + // AD::StartPreacc(); + // AD::SetPreaccIn(V_i, nDim+6); + // AD::SetPreaccIn(Vorticity_i, nDim); + // AD::SetPreaccIn(StrainMag_i); + // AD::SetPreaccIn(ScalarVar_i[0]); + // AD::SetPreaccIn(ScalarVar_Grad_i[0], nDim); + // AD::SetPreaccIn(Volume); + // AD::SetPreaccIn(dist_i); + + /*--- Common auxiliary variables and constants of the model. ---*/ + CSAVariables var; + + const auto& density = V_i[idx.Density()]; + const auto& laminar_viscosity = V_i[idx.LaminarViscosity()]; Residual = 0.0; Jacobian_i[0] = 0.0; - su2double Production = 0.0, Destruction = 0.0, CrossProduction = 0.0; - /*--- Evaluate Omega ---*/ - if (nDim == 2) { - OmegaType::template get<2>(Vorticity_i, PrimVar_Grad_i[idx.Velocity()], model_var); - } else { - OmegaType::template get<3>(Vorticity_i, PrimVar_Grad_i[idx.Velocity()], model_var); - } + /*--- Evaluate Omega with a rotational correction term. ---*/ - /*--- Rotational correction term ---*/ + Omega::get(Vorticity_i, nDim, PrimVar_Grad_i + idx.Velocity(), var); + /// TODO: Make this one of the template parameters? if (rotating_frame) { - model_var.Omega += 2.0 * min(0.0, StrainMag_i - model_var.Omega); + var.Omega += 2.0 * min(0.0, StrainMag_i - var.Omega); } if (dist_i > 1e-10) { /*--- Vorticity ---*/ - model_var.S = model_var.Omega; + var.S = var.Omega; - model_var.dist_i_2 = pow(dist_i, 2); - const su2double nu = Laminar_Viscosity_i / Density_i; - model_var.inv_k2_d2 = 1.0 / (model_var.k2 * model_var.dist_i_2); + var.dist_i_2 = pow(dist_i, 2); + const su2double nu = laminar_viscosity / density; + var.inv_k2_d2 = 1.0 / (var.k2 * var.dist_i_2); - /*--- Modified values for roughness ---*/ - /*--- Ref: Aupoix, B. and Spalart, P. R., "Extensions of the Spalart-Allmaras Turbulence Model to Account for Wall - * Roughness," International Journal of Heat and Fluid Flow, Vol. 24, 2003, pp. 454-462. ---*/ - /* --- See https://turbmodels.larc.nasa.gov/spalart.html#sarough for detailed explanation. ---*/ - model_var.Ji = - ScalarVar_i[0] / nu + - model_var.cr1 * (roughness_i / (dist_i + EPS)); // roughness_i = 0 for smooth walls and Ji remains the - // same, changes only if roughness is specified.nue/nul - model_var.d_Ji = 1.0 / nu; + /*--- Modified values for roughness, roughness_i = 0 for smooth walls and Ji remains the same. + * Ref: Aupoix, B. and Spalart, P. R., "Extensions of the Spalart-Allmaras Turbulence Model to Account for Wall + * Roughness," International Journal of Heat and Fluid Flow, Vol. 24, 2003, pp. 454-462. + * See https://turbmodels.larc.nasa.gov/spalart.html#sarough for detailed explanation. ---*/ + var.Ji = ScalarVar_i[0] / nu + var.cr1 * (roughness_i / (dist_i + EPS)); + var.d_Ji = 1.0 / nu; - const su2double Ji_2 = pow(model_var.Ji, 2); - const su2double Ji_3 = Ji_2 * model_var.Ji; + const su2double Ji_2 = pow(var.Ji, 2); + const su2double Ji_3 = Ji_2 * var.Ji; - model_var.fv1 = Ji_3 / (Ji_3 + model_var.cv1_3); - model_var.d_fv1 = 3 * Ji_2 * model_var.cv1_3 / (nu * pow(Ji_3 + model_var.cv1_3, 2)); + var.fv1 = Ji_3 / (Ji_3 + var.cv1_3); + var.d_fv1 = 3 * Ji_2 * var.cv1_3 / (nu * pow(Ji_3 + var.cv1_3, 2)); - /*--- Using a modified relation so as to not change the Shat that depends on fv2. ---*/ - // From NASA turb modeling resource and 2003 paper - model_var.fv2 = 1 - ScalarVar_i[0] / (nu + ScalarVar_i[0] * model_var.fv1); - model_var.d_fv2 = -(1 / nu - Ji_2 * model_var.d_fv1) / pow(1 + model_var.Ji * model_var.fv1, 2); + /*--- Using a modified relation so as to not change the Shat that depends on fv2. + * From NASA turb modeling resource and 2003 paper. ---*/ + var.fv2 = 1 - ScalarVar_i[0] / (nu + ScalarVar_i[0] * var.fv1); + var.d_fv2 = -(1 / nu - Ji_2 * var.d_fv1) / pow(1 + var.Ji * var.fv1, 2); /*--- Compute ft2 term ---*/ - ft2Type::get(model_var); + ft2::get(var); /*--- Compute modified vorticity ---*/ - ModVortType::get(ScalarVar_i[0], nu, model_var); - - model_var.inv_Shat = 1.0 / model_var.Shat; + ModVort::get(ScalarVar_i[0], nu, var); + var.inv_Shat = 1.0 / var.Shat; /*--- Compute auxiliary function r ---*/ - rType::get(ScalarVar_i[0], model_var); + rFunc::get(ScalarVar_i[0], var); - model_var.g = model_var.r + model_var.cw2 * (pow(model_var.r, 6) - model_var.r); - model_var.g_6 = pow(model_var.g, 6); - model_var.glim = pow((1 + model_var.cw3_6) / (model_var.g_6 + model_var.cw3_6), 1.0 / 6.0); - model_var.fw = model_var.g * model_var.glim; + var.g = var.r + var.cw2 * (pow(var.r, 6) - var.r); + var.g_6 = pow(var.g, 6); + var.glim = pow((1 + var.cw3_6) / (var.g_6 + var.cw3_6), 1.0 / 6.0); + var.fw = var.g * var.glim; - model_var.d_g = model_var.d_r * (1 + model_var.cw2 * (6 * pow(model_var.r, 5) - 1)); - model_var.d_fw = model_var.d_g * model_var.glim * (1 - model_var.g_6 / (model_var.g_6 + model_var.cw3_6)); + var.d_g = var.d_r * (1 + var.cw2 * (6 * pow(var.r, 5) - 1)); + var.d_fw = var.d_g * var.glim * (1 - var.g_6 / (var.g_6 + var.cw3_6)); - model_var.norm2_Grad = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[0]); + var.norm2_Grad = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[0]); /// TODO: Make this one of the template parameters? if (transition) { @@ -182,103 +175,100 @@ class CSourceBase_TurbSA_ : public CNumerics { /*--- turbulence intensity is u'/U so we multiply by 100 to get percentage ---*/ const su2double tu = 100.0 * config->GetTurbulenceIntensity_FreeStream(); - const su2double nu_t = ScalarVar_i[0]*model_var.fv1; + const su2double nu_t = ScalarVar_i[0] * var.fv1; - const su2double re_v = Density_i*model_var.dist_i_2/Laminar_Viscosity_i*model_var.Omega; - const su2double re_theta = re_v/2.193; - const su2double re_theta_t = 803.73 * pow(tu + 0.6067,-1.027); //MENTER correlation - //re_theta_t = 163.0 + exp(6.91-tu); //ABU-GHANNAM & SHAW correlation + const su2double re_v = density * var.dist_i_2 / laminar_viscosity * var.Omega; + const su2double re_theta = re_v / 2.193; + const su2double re_theta_t = 803.73 * pow(tu + 0.6067, -1.027); // MENTER correlation + // re_theta_t = 163.0 + exp(6.91-tu); //ABU-GHANNAM & SHAW correlation - su2double term1 = sqrt(max(re_theta-re_theta_t,0.0)/(chi_1*re_theta_t)); - su2double term2 = sqrt(max((nu_t*chi_2)/nu,0.0)); - su2double term_exponential = (term1 + term2); + const su2double term1 = sqrt(max(re_theta - re_theta_t, 0.0) / (chi_1 * re_theta_t)); + const su2double term2 = sqrt(max((nu_t * chi_2) / nu, 0.0)); + const su2double term_exponential = (term1 + term2); Gamma_BC = 1.0 - exp(-term_exponential); - model_var.gamma_bc = Gamma_BC; + var.gamma_bc = Gamma_BC; } else { - model_var.gamma_bc = 1.0; + /*--- Do not modify the production. ---*/ + var.gamma_bc = 1.0; } /*--- Compute production, destruction and cross production and jacobian ---*/ - SourceTermsType::get(ScalarVar_i[0], model_var, Production, Destruction, CrossProduction, Jacobian_i[0]); - - /*--- Compute any necessary additional source term and jacobian contribution ---*/ + su2double Production = 0.0, Destruction = 0.0, CrossProduction = 0.0; + SourceTerms::get(ScalarVar_i[0], var, Production, Destruction, CrossProduction, Jacobian_i[0]); - /*--- Residual ---*/ Residual = (Production - Destruction + CrossProduction) * Volume; - - /*--- Jacobian ---*/ Jacobian_i[0] *= Volume; } - // AD::SetPreaccOut(Residual); - // AD::EndPreacc(); + // AD::SetPreaccOut(Residual); + // AD::EndPreacc(); return ResidualType<>(&Residual, &Jacobian_i, nullptr); } }; +namespace detail { + /* ============================================================================= - * SPALART-ALLMARAS VARIANT CLASSES + * SPALART-ALLMARAS VARIATIONS AND CORRECTIONS * ============================================================================*/ -namespace detail { - /*! * \brief Strain rate classes. - * \tparam nDim: Problem dimension. * \param[in] vorticity: Vorticity array. + * \param[in] nDim: Problem dimension. * \param[in] velocity_grad: Velocity gradients. - * \param[out] model_var: Common SA variables struct (to set Omega). + * \param[out] var: Common SA variables struct (to set Omega). */ namespace Omega { /*! \brief Baseline. */ struct Bsl { - template - static void get(const su2double* vorticity, const MatrixType&, CommonSAVariables& model_var) { - model_var.Omega = GeometryToolbox::Norm(3, vorticity); + template + static void get(const su2double* vorticity, unsigned short, const MatrixType&, CSAVariables& var) { + var.Omega = GeometryToolbox::Norm(3, vorticity); } }; /*! \brief Edward. Here Omega is the Strain Rate. */ struct Edw { - template - static void get(const su2double*, const MatrixType& velocity_grad, CommonSAVariables& model_var) { + template + static void get(const su2double*, unsigned short nDim, const MatrixType& velocity_grad, CSAVariables& var) { su2double Sbar = 0.0; - for (int iDim = 0; iDim < nDim; ++iDim) { - for (int jDim = 0; jDim < nDim; ++jDim) { + for (unsigned short iDim = 0; iDim < nDim; ++iDim) { + for (unsigned short jDim = 0; jDim < nDim; ++jDim) { Sbar += (velocity_grad[iDim][jDim] + velocity_grad[jDim][iDim]) * velocity_grad[iDim][jDim]; } } - for (int iDim = 0; iDim < nDim; ++iDim) { + for (unsigned short iDim = 0; iDim < nDim; ++iDim) { Sbar -= (2.0 / 3.0) * pow(velocity_grad[iDim][iDim], 2); } - model_var.Omega = sqrt(max(Sbar, 0.0)); + var.Omega = sqrt(max(Sbar, 0.0)); } }; } // namespace Omega /*! * \brief Classes to set the ft2 term and its derivative. - * \param[in,out] model_var: Common SA variables struct. + * \param[in,out] var: Common SA variables struct. */ namespace ft2 { -/*! \brief SU2 baseline ft2 term value and its derivative (ft2=0.0). */ -struct Bsl { - static void get(CommonSAVariables& model_var) { - model_var.ft2 = 0.0; - model_var.d_ft2 = 0.0; +/*! \brief No-ft2 term. */ +struct Zero { + static void get(CSAVariables& var) { + var.ft2 = 0.0; + var.d_ft2 = 0.0; } }; /*! \brief Non-zero ft2 term according to the literature. */ struct Nonzero { - static void get(CommonSAVariables& model_var) { - const su2double xsi2 = pow(model_var.Ji, 2); - model_var.ft2 = model_var.ct3 * exp(-model_var.ct4 * xsi2); - model_var.d_ft2 = -2.0 * model_var.ct4 * model_var.Ji * model_var.ft2 * model_var.d_Ji; + static void get(CSAVariables& var) { + const su2double xsi2 = pow(var.Ji, 2); + var.ft2 = var.ct3 * exp(-var.ct4 * xsi2); + var.d_ft2 = -2.0 * var.ct4 * var.Ji * var.ft2 * var.d_Ji; } }; } // namespace ft2 @@ -287,43 +277,46 @@ struct Nonzero { * \brief Classes to compute the modified vorticity (\tilde{S}) and its derivative. * \param[in] nue: SA variable. * \param[in] nu: Laminar viscosity. - * \param[in,out] model_var: Common SA variables struct. + * \param[in,out] var: Common SA variables struct. */ namespace ModVort { /*! \brief Baseline. */ struct Bsl { - static void get(const su2double& nue, const su2double& nu, CommonSAVariables& model_var) { - const su2double Sbar = nue * model_var.fv2 * model_var.inv_k2_d2; - model_var.Shat = model_var.S + Sbar; - model_var.Shat = max(model_var.Shat, 1.0e-10); - if (model_var.Shat <= 1.0e-10) { - model_var.d_Shat = 0.0; + static void get(const su2double& nue, const su2double& nu, CSAVariables& var) { + const su2double Sbar = nue * var.fv2 * var.inv_k2_d2; + var.Shat = var.S + Sbar; + var.Shat = max(var.Shat, 1.0e-10); + if (var.Shat <= 1.0e-10) { + var.d_Shat = 0.0; } else { - model_var.d_Shat = (model_var.fv2 + nue * model_var.d_fv2) * model_var.inv_k2_d2; + var.d_Shat = (var.fv2 + nue * var.d_fv2) * var.inv_k2_d2; } } }; /*! \brief Edward. */ struct Edw { - static void get(const su2double& nue, const su2double& nu, CommonSAVariables& model_var) { - model_var.Shat = max(model_var.S * ((1.0 / max(model_var.Ji, 1.0e-16)) + model_var.fv1), 1.0e-16); - model_var.Shat = max(model_var.Shat, 1.0e-10); - if (model_var.Shat <= 1.0e-10) { - model_var.d_Shat = 0.0; + static void get(const su2double& nue, const su2double& nu, CSAVariables& var) { + var.Shat = max(var.S * ((1.0 / max(var.Ji, 1.0e-16)) + var.fv1), 1.0e-16); + var.Shat = max(var.Shat, 1.0e-10); + if (var.Shat <= 1.0e-10) { + var.d_Shat = 0.0; } else { - model_var.d_Shat = -model_var.S * pow(model_var.Ji, -2) / nu + model_var.S * model_var.d_fv1; + var.d_Shat = -var.S * pow(var.Ji, -2) / nu + var.S * var.d_fv1; } } }; /*! \brief Negative. */ struct Neg { - static void get(const su2double& nue, const su2double& nu, CommonSAVariables& model_var) { + static void get(const su2double& nue, const su2double& nu, CSAVariables& var) { if (nue > 0.0) { // Baseline solution - Bsl::get(nue, nu, model_var); + Bsl::get(nue, nu, var); + } else { + var.Shat = 1.0e-10; + var.d_Shat = 0.0; } /*--- Don't check whether Sbar <>= -cv2*S. * Steven R. Allmaras, Forrester T. Johnson and Philippe R. Spalart - @@ -336,27 +329,27 @@ struct Neg { /*! * \brief Auxiliary function r and its derivative. * \param[in] nue: SA variable. - * \param[in,out] model_var: Common SA variables struct. + * \param[in,out] var: Common SA variables struct. */ namespace r { /*! \brief Baseline. */ struct Bsl { - static void get(const su2double& nue, CommonSAVariables& model_var) { - model_var.r = min(nue * model_var.inv_Shat * model_var.inv_k2_d2, 10.0); - model_var.d_r = (model_var.Shat - nue * model_var.d_Shat) * pow(model_var.inv_Shat, 2) * model_var.inv_k2_d2; - if (model_var.r >= 10.0) model_var.d_r = 0.0; + static void get(const su2double& nue, CSAVariables& var) { + var.r = min(nue * var.inv_Shat * var.inv_k2_d2, 10.0); + var.d_r = (var.Shat - nue * var.d_Shat) * pow(var.inv_Shat, 2) * var.inv_k2_d2; + if (var.r >= 10.0) var.d_r = 0.0; } }; /*! \brief Edward. */ struct Edw { - static void get(const su2double& nue, CommonSAVariables& model_var) { - model_var.r = min(nue * model_var.inv_Shat * model_var.inv_k2_d2, 10.0); - model_var.r = tanh(model_var.r) / tanh(1.0); + static void get(const su2double& nue, CSAVariables& var) { + var.r = min(nue * var.inv_Shat * var.inv_k2_d2, 10.0); + var.r = tanh(var.r) / tanh(1.0); - model_var.d_r = (model_var.Shat - nue * model_var.d_Shat) * pow(model_var.inv_Shat, 2) * model_var.inv_k2_d2; - model_var.d_r = (1 - pow(tanh(model_var.r), 2.0)) * (model_var.d_r) / tanh(1.0); + var.d_r = (var.Shat - nue * var.d_Shat) * pow(var.inv_Shat, 2) * var.inv_k2_d2; + var.d_r = (1 - pow(tanh(var.r), 2.0)) * (var.d_r) / tanh(1.0); } }; } // namespace r @@ -364,7 +357,7 @@ struct Edw { /*! * \brief Source terms classes: production, destruction and cross-productions term and their derivative. * \param[in] nue: SA variable. - * \param[in] model_var: Common SA variables struct. + * \param[in] var: Common SA variables struct. * \param[out] production: Production term. * \param[out] destruction: Destruction term. * \param[out] cross_production: CrossProduction term. @@ -374,87 +367,79 @@ namespace SourceTerms { /*! \brief Baseline (Original SA model). */ struct Bsl { - static void get(const su2double& nue, const CommonSAVariables& model_var, su2double& production, - su2double& destruction, su2double& cross_production, su2double& jacobian) { - ComputeProduction(nue, model_var, production, jacobian); - - ComputeDestruction(nue, model_var, destruction, jacobian); - - ComputeCrossProduction(nue, model_var, cross_production, jacobian); + static void get(const su2double& nue, const CSAVariables& var, su2double& production, su2double& destruction, + su2double& cross_production, su2double& jacobian) { + ComputeProduction(nue, var, production, jacobian); + ComputeDestruction(nue, var, destruction, jacobian); + ComputeCrossProduction(nue, var, cross_production, jacobian); } - static void ComputeProduction(const su2double& nue, const CommonSAVariables& model_var, su2double& production, + static void ComputeProduction(const su2double& nue, const CSAVariables& var, su2double& production, su2double& jacobian) { - const su2double factor = model_var.gamma_bc * model_var.cb1; - production = factor * (1.0 - model_var.ft2) * model_var.Shat * nue; - jacobian += factor * (-model_var.Shat * nue * model_var.d_ft2 + - (1.0 - model_var.ft2) * (nue * model_var.d_Shat + model_var.Shat)); + const su2double factor = var.gamma_bc * var.cb1; + production = factor * (1.0 - var.ft2) * var.Shat * nue; + jacobian += factor * (-var.Shat * nue * var.d_ft2 + (1.0 - var.ft2) * (nue * var.d_Shat + var.Shat)); } - static void ComputeDestruction(const su2double& nue, const CommonSAVariables& model_var, su2double& destruction, + static void ComputeDestruction(const su2double& nue, const CSAVariables& var, su2double& destruction, su2double& jacobian) { - const su2double cb1_k2 = model_var.cb1 / model_var.k2; - const su2double factor = model_var.cw1 * model_var.fw - cb1_k2 * model_var.ft2; - destruction = factor * pow(nue, 2) / model_var.dist_i_2; - jacobian -= ((model_var.cw1 * model_var.d_fw - cb1_k2 * model_var.d_ft2) * pow(nue, 2) + factor * 2 * nue) / - model_var.dist_i_2; + const su2double cb1_k2 = var.cb1 / var.k2; + const su2double factor = var.cw1 * var.fw - cb1_k2 * var.ft2; + destruction = factor * pow(nue, 2) / var.dist_i_2; + jacobian -= ((var.cw1 * var.d_fw - cb1_k2 * var.d_ft2) * pow(nue, 2) + factor * 2 * nue) / var.dist_i_2; } - static void ComputeCrossProduction(const su2double& nue, const CommonSAVariables& model_var, - su2double& cross_production, su2double&) { - cross_production = model_var.cb2_sigma * model_var.norm2_Grad; + static void ComputeCrossProduction(const su2double& nue, const CSAVariables& var, su2double& cross_production, + su2double&) { + cross_production = var.cb2_sigma * var.norm2_Grad; /*--- No contribution to the jacobian. ---*/ } }; /*! \brief Negative. */ struct Neg { - static void get(const su2double& nue, const CommonSAVariables& model_var, su2double& production, - su2double& destruction, su2double& cross_production, su2double& jacobian) { + static void get(const su2double& nue, const CSAVariables& var, su2double& production, su2double& destruction, + su2double& cross_production, su2double& jacobian) { if (nue > 0.0) { - Bsl::get(nue, model_var, production, destruction, cross_production, jacobian); + Bsl::get(nue, var, production, destruction, cross_production, jacobian); } else { - ComputeProduction(nue, model_var, production, jacobian); - - ComputeDestruction(nue, model_var, destruction, jacobian); - - ComputeCrossProduction(nue, model_var, cross_production, jacobian); + ComputeProduction(nue, var, production, jacobian); + ComputeDestruction(nue, var, destruction, jacobian); + ComputeCrossProduction(nue, var, cross_production, jacobian); } } - static void ComputeProduction(const su2double& nue, const CommonSAVariables& model_var, su2double& production, + static void ComputeProduction(const su2double& nue, const CSAVariables& var, su2double& production, su2double& jacobian) { - const su2double dP_dnu = model_var.gamma_bc * model_var.cb1 * (1.0 - model_var.ct3) * model_var.S; + const su2double dP_dnu = var.gamma_bc * var.cb1 * (1.0 - var.ct3) * var.S; production = dP_dnu * nue; jacobian += dP_dnu; } - static void ComputeDestruction(const su2double& nue, const CommonSAVariables& model_var, su2double& destruction, + static void ComputeDestruction(const su2double& nue, const CSAVariables& var, su2double& destruction, su2double& jacobian) { - const su2double dD_dnu = model_var.cw1 * nue / model_var.dist_i_2; + const su2double dD_dnu = var.cw1 * nue / var.dist_i_2; destruction = dD_dnu * nue; jacobian -= 2 * dD_dnu; } - static void ComputeCrossProduction(const su2double& nue, const CommonSAVariables& model_var, - su2double& cross_production, su2double& jacobian) { - Bsl::ComputeCrossProduction(nue, model_var, cross_production, jacobian); + static void ComputeCrossProduction(const su2double& nue, const CSAVariables& var, su2double& cross_production, + su2double& jacobian) { + Bsl::ComputeCrossProduction(nue, var, cross_production, jacobian); } }; } // namespace SourceTerms -} // namespace detail - /* ============================================================================= * SPALART-ALLMARAS ADDITIONAL SOURCE TERMS DECORATORS * ============================================================================*/ /*! - * \class CompressibilityCorrection + * \class CCompressibilityCorrection * \brief Mixing Layer Compressibility Correction (SA-comp). */ template -class CompressibilityCorrection final : public ParentClass { +class CCompressibilityCorrection final : public ParentClass { private: using ParentClass::Gamma; using ParentClass::idx; @@ -474,23 +459,29 @@ class CompressibilityCorrection final : public ParentClass { * \param[in] nDim - Number of dimensions of the problem. * \param[in] config - Definition of the particular problem. */ - CompressibilityCorrection(unsigned short nDim, unsigned short, const CConfig* config) : ParentClass(nDim, 0, config) {} + CCompressibilityCorrection(unsigned short nDim, unsigned short, const CConfig* config) + : ParentClass(nDim, 0, config) {} + /*! + * \brief Residual for source term integration. + * \param[in] config - Definition of the particular problem. + * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. + */ ResidualType ComputeResidual(const CConfig* config) override { /*--- Residual from standard SA ---*/ ParentClass::ComputeResidual(config); /*--- Compressibility Correction term ---*/ - const auto& Pressure_i = V_i[idx.Pressure()]; - const auto& Density_i = V_i[idx.Density()]; - const su2double SoundSpeed_i = sqrt(Pressure_i * Gamma / Density_i); + const auto& pressure = V_i[idx.Pressure()]; + const auto& density = V_i[idx.Density()]; + const su2double sound_speed = sqrt(pressure * Gamma / density); su2double aux_cc = 0; for (unsigned short iDim = 0; iDim < nDim; ++iDim) { for (unsigned short jDim = 0; jDim < nDim; ++jDim) { aux_cc += pow(PrimVar_Grad_i[idx.Velocity() + iDim][jDim], 2); } } - const su2double d_CompCorrection = 2.0 * c5 * ScalarVar_i[0] / pow(SoundSpeed_i, 2) * aux_cc * Volume; + const su2double d_CompCorrection = 2.0 * c5 * ScalarVar_i[0] / pow(sound_speed, 2) * aux_cc * Volume; const su2double CompCorrection = 0.5 * ScalarVar_i[0] * d_CompCorrection; this->Residual -= CompCorrection; @@ -499,3 +490,55 @@ class CompressibilityCorrection final : public ParentClass { return ResidualType(&this->Residual, &this->Jacobian_i, nullptr); } }; + +} // namespace detail + +/* ============================================================================= + * SPALART-ALLMARAS CLASSES + * ============================================================================*/ + +/// TODO: Factory method to create combinations of the different variations based on the config. + +/*! + * \class CSourcePieceWise_TurbSA + * \brief Class for integrating the source terms of the Spalart-Allmaras turbulence model equation. + */ +template +using CSourcePieceWise_TurbSA = CSourceBase_TurbSA; + +/*! + * \class CSourcePieceWise_TurbSA_COMP + * \brief Class for integrating the source terms of the Spalart-Allmaras model with compressibility correction. + */ +template +using CSourcePieceWise_TurbSA_COMP = detail::CCompressibilityCorrection>; + +/*! + * \class CSourcePieceWise_TurbSA_E + * \brief Class for integrating the source terms of the Spalart-Allmaras model with Edwards modification. + * \note From NASA Turbulence model site. http://turbmodels.larc.nasa.gov/spalart.html + * This form was developed primarily to improve the near-wall numerical behavior of the model (i.e. the goal was to + * improve the convergence behavior). The reference is: Edwards, J. R. and Chandra, S. "Comparison of Eddy + * Viscosity-Transport Turbulence Models for Three-Dimensional, Shock-Separated Flowfields," AIAA Journal, Vol. 34, No. + * 4, 1996, pp. 756-763. + */ +template +using CSourcePieceWise_TurbSA_E = CSourceBase_TurbSA; + +/*! + * \class CSourcePieceWise_TurbSA_E_COMP + * \brief Class for integrating the source terms of the Spalart-Allmaras model with Edwards modification + * and compressibility correction. + */ +template +using CSourcePieceWise_TurbSA_E_COMP = detail::CCompressibilityCorrection>; + +/*! + * \class CSourcePieceWise_TurbSA_Neg + * \brief Class for integrating the source terms of the negative Spalart-Allmaras model. + */ +template +using CSourcePieceWise_TurbSA_Neg = CSourceBase_TurbSA; diff --git a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp index 3f468d345013..4786e5f0ac4f 100644 --- a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp +++ b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp @@ -32,6 +32,7 @@ #include "../../../include/variables/CIncEulerVariable.hpp" #include "../../../include/variables/CNEMOEulerVariable.hpp" +#if 0 CSourceBase_TurbSA::CSourceBase_TurbSA(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config) : @@ -90,13 +91,6 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSA_E::ComputeResidual(const CC CrossProduction = 0.0; Jacobian_i[0] = 0.0; - /* - From NASA Turbulence model site. http://turbmodels.larc.nasa.gov/spalart.html - This form was developed primarily to improve the near-wall numerical behavior of the model (i.e., the goal was to improve the convergence behavior). The reference is: - Edwards, J. R. and Chandra, S. "Comparison of Eddy Viscosity-Transport Turbulence Models for Three-Dimensional, Shock-Separated Flowfields," AIAA Journal, Vol. 34, No. 4, 1996, pp. 756-763. - In this modificaton Omega is replaced by Strain Rate - */ - /*--- Evaluate Omega, here Omega is the Strain Rate ---*/ Sbar = 0.0; @@ -137,7 +131,7 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSA_E::ComputeResidual(const CC Shat = max(Shat, 1.0e-10); inv_Shat = 1.0/Shat; - /*--- Production term ---*/; + /*--- Production term ---*/ Production = cb1*Shat*ScalarVar_i[0]*Volume; @@ -477,6 +471,7 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSA_Neg::ComputeResidual(const return ResidualType<>(&Residual, &Jacobian_i, nullptr); } +#endif template CSourcePieceWise_TurbSST::CSourcePieceWise_TurbSST(unsigned short val_nDim, @@ -652,18 +647,6 @@ void CSourcePieceWise_TurbSST::SetPerturbedStrainMag(su2double turb_ke) { /*--- Explicit instantiations until we don't move this to the hpp. ---*/ -template class CSourcePieceWise_TurbSA_E >; -template class CSourcePieceWise_TurbSA_E >; -template class CSourcePieceWise_TurbSA_E >; - -template class CSourcePieceWise_TurbSA_E_COMP >; -template class CSourcePieceWise_TurbSA_E_COMP >; -template class CSourcePieceWise_TurbSA_E_COMP >; - -template class CSourcePieceWise_TurbSA_Neg >; -template class CSourcePieceWise_TurbSA_Neg >; -template class CSourcePieceWise_TurbSA_Neg >; - template class CSourcePieceWise_TurbSST >; template class CSourcePieceWise_TurbSST >; template class CSourcePieceWise_TurbSST >; diff --git a/SU2_CFD/src/solvers/CTurbSASolver.cpp b/SU2_CFD/src/solvers/CTurbSASolver.cpp index f88a04b35abd..d28520ef186d 100644 --- a/SU2_CFD/src/solvers/CTurbSASolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSASolver.cpp @@ -275,7 +275,6 @@ void CTurbSASolver::Source_Residual(CGeometry *geometry, CSolver **solver_contai const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool harmonic_balance = (config->GetTime_Marching() == TIME_MARCHING::HARMONIC_BALANCE); - const bool transition = (config->GetKind_Trans_Model() == TURB_TRANS_MODEL::LM); const bool transition_BC = (config->GetKind_Trans_Model() == TURB_TRANS_MODEL::BC); auto* flowNodes = su2staticcast_p(solver_container[FLOW_SOL]->GetNodes()); @@ -304,12 +303,6 @@ void CTurbSASolver::Source_Residual(CGeometry *geometry, CSolver **solver_contai numerics->SetStrainMag(flowNodes->GetStrainMag(iPoint), 0.0); - /*--- Set intermittency ---*/ - - if (transition) { - numerics->SetIntermittency(solver_container[TRANS_SOL]->GetNodes()->GetIntermittency(iPoint)); - } - /*--- Turbulent variables w/o reconstruction, and its gradient ---*/ numerics->SetScalarVar(nodes->GetSolution(iPoint), nullptr); From e4f6228796ace5e337a31fe57785b67abb76f28c Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sun, 27 Feb 2022 10:54:41 +0000 Subject: [PATCH 23/34] cleanup --- .../numerics/turbulent/turb_sources.hpp | 740 ++++++++++++++++-- .../numerics/turbulent/turb_sources_new.hpp | 544 ------------- SU2_CFD/obj/Makefile.am | 1 - SU2_CFD/src/meson.build | 1 - .../src/numerics/turbulent/turb_sources.cpp | 652 --------------- TestCases/vandv.py | 2 +- 6 files changed, 695 insertions(+), 1245 deletions(-) delete mode 100644 SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp delete mode 100644 SU2_CFD/src/numerics/turbulent/turb_sources.cpp diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 2f8d5603893c..8734024e76c9 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -1,8 +1,6 @@ /*! * \file turb_sources.hpp - * \brief Delarations of numerics classes for integration of source - * terms in turbulence problems. - * \author F. Palacios, T. Economon + * \brief Numerics classes for integration of source terms in turbulence problems. * \version 7.3.0 "Blackbird" * * SU2 Project Website: https://su2code.github.io @@ -10,7 +8,7 @@ * The SU2 Project is maintained by the SU2 Foundation * (http://su2foundation.org) * - * Copyright 2012-2022, SU2 Contributors (cf. AUTHORS.md) + * Copyright 2012-2021, SU2 Contributors (cf. AUTHORS.md) * * SU2 is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -28,35 +26,535 @@ #pragma once +#include "../../../Common/include/toolboxes/geometry_toolbox.hpp" #include "../scalar/scalar_sources.hpp" -#include "turb_sources_new.hpp" + +/*! + * \class CSAVariables + * \brief Structure with SA common auxiliary functions and constants. + */ +struct CSAVariables { + /*--- List of constants ---*/ + const su2double cv1_3 = pow(7.1, 3), k2 = pow(0.41, 2), cb1 = 0.1355, cw2 = 0.3, ct3 = 1.2, ct4 = 0.5, + cw3_6 = pow(2, 6), sigma = 2.0 / 3.0, cb2 = 0.622, cb2_sigma = cb2 / sigma, + cw1 = cb1 / k2 + (1 + cb2) / sigma, cr1 = 0.5; + + /*--- List of auxiliary functions ---*/ + su2double ft2, d_ft2, r, d_r, g, d_g, glim, fw, d_fw, Ji, d_Ji, S, Shat, d_Shat, fv1, d_fv1, fv2, d_fv2; + + /*--- List of helpers ---*/ + su2double Omega, dist_i_2, inv_k2_d2, inv_Shat, g_6, norm2_Grad, gamma_bc; +}; + +/*! + * \class CSourceBase_TurbSA + * \brief Class for integrating the source terms of the Spalart-Allmaras turbulence model equation. + * The variables that are subject to change in each variation/correction have their own class. + * \note Additional source terms (e.g. compressibility) are implemented as decorators. + */ +template +class CSourceBase_TurbSA : public CNumerics { + protected: + su2double Gamma_BC = 0.0; + + /*--- Residual and Jacobian ---*/ + su2double Residual, *Jacobian_i; + su2double Jacobian_Buffer; /*!< \brief Static storage for the Jacobian (which needs to be pointer for return type). */ + + const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ + const bool rotating_frame = false; + const bool transition = false; + + public: + /*! + * \brief Constructor of the class. + * \param[in] nDim - Number of dimensions of the problem. + * \param[in] config - Definition of the particular problem. + */ + CSourceBase_TurbSA(unsigned short nDim, unsigned short, const CConfig* config) + : CNumerics(nDim, 1, config), + idx(nDim, config->GetnSpecies()), + rotating_frame(config->GetRotating_Frame()), + transition(config->GetKind_Trans_Model() == TURB_TRANS_MODEL::BC) { + /*--- Setup the Jacobian pointer, we need to return su2double** but we know + * the Jacobian is 1x1 so we use this trick to avoid heap allocation. ---*/ + Jacobian_i = &Jacobian_Buffer; + } + + /*! + * \brief Get the intermittency for the BC transition model. + * \return Value of the intermittency. + */ + su2double GetGammaBC() const final { return Gamma_BC; } + + /*! + * \brief Residual for source term integration. + * \param[in] config - Definition of the particular problem. + * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. + */ + ResidualType<> ComputeResidual(const CConfig* config) override { + /// TODO: Fix AD preaccumulation. + // AD::StartPreacc(); + // AD::SetPreaccIn(V_i, nDim+6); + // AD::SetPreaccIn(Vorticity_i, nDim); + // AD::SetPreaccIn(StrainMag_i); + // AD::SetPreaccIn(ScalarVar_i[0]); + // AD::SetPreaccIn(ScalarVar_Grad_i[0], nDim); + // AD::SetPreaccIn(Volume); + // AD::SetPreaccIn(dist_i); + + /*--- Common auxiliary variables and constants of the model. ---*/ + CSAVariables var; + + const auto& density = V_i[idx.Density()]; + const auto& laminar_viscosity = V_i[idx.LaminarViscosity()]; + + Residual = 0.0; + Jacobian_i[0] = 0.0; + + /*--- Evaluate Omega with a rotational correction term. ---*/ + + Omega::get(Vorticity_i, nDim, PrimVar_Grad_i + idx.Velocity(), var); + + /// TODO: Make this one of the template parameters? + if (rotating_frame) { + var.Omega += 2.0 * min(0.0, StrainMag_i - var.Omega); + } + + if (dist_i > 1e-10) { + /*--- Vorticity ---*/ + var.S = var.Omega; + + var.dist_i_2 = pow(dist_i, 2); + const su2double nu = laminar_viscosity / density; + var.inv_k2_d2 = 1.0 / (var.k2 * var.dist_i_2); + + /*--- Modified values for roughness, roughness_i = 0 for smooth walls and Ji remains the same. + * Ref: Aupoix, B. and Spalart, P. R., "Extensions of the Spalart-Allmaras Turbulence Model to Account for Wall + * Roughness," International Journal of Heat and Fluid Flow, Vol. 24, 2003, pp. 454-462. + * See https://turbmodels.larc.nasa.gov/spalart.html#sarough for detailed explanation. ---*/ + var.Ji = ScalarVar_i[0] / nu + var.cr1 * (roughness_i / (dist_i + EPS)); + var.d_Ji = 1.0 / nu; + + const su2double Ji_2 = pow(var.Ji, 2); + const su2double Ji_3 = Ji_2 * var.Ji; + + var.fv1 = Ji_3 / (Ji_3 + var.cv1_3); + var.d_fv1 = 3 * Ji_2 * var.cv1_3 / (nu * pow(Ji_3 + var.cv1_3, 2)); + + /*--- Using a modified relation so as to not change the Shat that depends on fv2. + * From NASA turb modeling resource and 2003 paper. ---*/ + var.fv2 = 1 - ScalarVar_i[0] / (nu + ScalarVar_i[0] * var.fv1); + var.d_fv2 = -(1 / nu - Ji_2 * var.d_fv1) / pow(1 + var.Ji * var.fv1, 2); + + /*--- Compute ft2 term ---*/ + ft2::get(var); + + /*--- Compute modified vorticity ---*/ + ModVort::get(ScalarVar_i[0], nu, var); + var.inv_Shat = 1.0 / var.Shat; + + /*--- Compute auxiliary function r ---*/ + rFunc::get(ScalarVar_i[0], var); + + var.g = var.r + var.cw2 * (pow(var.r, 6) - var.r); + var.g_6 = pow(var.g, 6); + var.glim = pow((1 + var.cw3_6) / (var.g_6 + var.cw3_6), 1.0 / 6.0); + var.fw = var.g * var.glim; + + var.d_g = var.d_r * (1 + var.cw2 * (6 * pow(var.r, 5) - 1)); + var.d_fw = var.d_g * var.glim * (1 - var.g_6 / (var.g_6 + var.cw3_6)); + + var.norm2_Grad = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[0]); + + /// TODO: Make this one of the template parameters? + if (transition) { + /*--- BC model constants (2020 revision). ---*/ + const su2double chi_1 = 0.002; + const su2double chi_2 = 50.0; + + /*--- turbulence intensity is u'/U so we multiply by 100 to get percentage ---*/ + const su2double tu = 100.0 * config->GetTurbulenceIntensity_FreeStream(); + const su2double nu_t = ScalarVar_i[0] * var.fv1; + + const su2double re_v = density * var.dist_i_2 / laminar_viscosity * var.Omega; + const su2double re_theta = re_v / 2.193; + const su2double re_theta_t = 803.73 * pow(tu + 0.6067, -1.027); // MENTER correlation + // re_theta_t = 163.0 + exp(6.91-tu); //ABU-GHANNAM & SHAW correlation + + const su2double term1 = sqrt(max(re_theta - re_theta_t, 0.0) / (chi_1 * re_theta_t)); + const su2double term2 = sqrt(max((nu_t * chi_2) / nu, 0.0)); + const su2double term_exponential = (term1 + term2); + + Gamma_BC = 1.0 - exp(-term_exponential); + var.gamma_bc = Gamma_BC; + } else { + /*--- Do not modify the production. ---*/ + var.gamma_bc = 1.0; + } + + /*--- Compute production, destruction and cross production and jacobian ---*/ + su2double Production = 0.0, Destruction = 0.0, CrossProduction = 0.0; + SourceTerms::get(ScalarVar_i[0], var, Production, Destruction, CrossProduction, Jacobian_i[0]); + + Residual = (Production - Destruction + CrossProduction) * Volume; + Jacobian_i[0] *= Volume; + } + + // AD::SetPreaccOut(Residual); + // AD::EndPreacc(); + + return ResidualType<>(&Residual, &Jacobian_i, nullptr); + } +}; + +namespace detail { + +/* ============================================================================= + * SPALART-ALLMARAS VARIATIONS AND CORRECTIONS + * ============================================================================*/ + +/*! + * \brief Strain rate classes. + * \param[in] vorticity: Vorticity array. + * \param[in] nDim: Problem dimension. + * \param[in] velocity_grad: Velocity gradients. + * \param[out] var: Common SA variables struct (to set Omega). + */ +namespace Omega { + +/*! \brief Baseline. */ +struct Bsl { + template + static void get(const su2double* vorticity, unsigned short, const MatrixType&, CSAVariables& var) { + var.Omega = GeometryToolbox::Norm(3, vorticity); + } +}; + +/*! \brief Edward. Here Omega is the Strain Rate. */ +struct Edw { + template + static void get(const su2double*, unsigned short nDim, const MatrixType& velocity_grad, CSAVariables& var) { + su2double Sbar = 0.0; + for (unsigned short iDim = 0; iDim < nDim; ++iDim) { + for (unsigned short jDim = 0; jDim < nDim; ++jDim) { + Sbar += (velocity_grad[iDim][jDim] + velocity_grad[jDim][iDim]) * velocity_grad[iDim][jDim]; + } + } + for (unsigned short iDim = 0; iDim < nDim; ++iDim) { + Sbar -= (2.0 / 3.0) * pow(velocity_grad[iDim][iDim], 2); + } + var.Omega = sqrt(max(Sbar, 0.0)); + } +}; +} // namespace Omega + +/*! + * \brief Classes to set the ft2 term and its derivative. + * \param[in,out] var: Common SA variables struct. + */ +namespace ft2 { + +/*! \brief No-ft2 term. */ +struct Zero { + static void get(CSAVariables& var) { + var.ft2 = 0.0; + var.d_ft2 = 0.0; + } +}; + +/*! \brief Non-zero ft2 term according to the literature. */ +struct Nonzero { + static void get(CSAVariables& var) { + const su2double xsi2 = pow(var.Ji, 2); + var.ft2 = var.ct3 * exp(-var.ct4 * xsi2); + var.d_ft2 = -2.0 * var.ct4 * var.Ji * var.ft2 * var.d_Ji; + } +}; +} // namespace ft2 + +/*! + * \brief Classes to compute the modified vorticity (\tilde{S}) and its derivative. + * \param[in] nue: SA variable. + * \param[in] nu: Laminar viscosity. + * \param[in,out] var: Common SA variables struct. + */ +namespace ModVort { + +/*! \brief Baseline. */ +struct Bsl { + static void get(const su2double& nue, const su2double& nu, CSAVariables& var) { + const su2double Sbar = nue * var.fv2 * var.inv_k2_d2; + var.Shat = var.S + Sbar; + var.Shat = max(var.Shat, 1.0e-10); + if (var.Shat <= 1.0e-10) { + var.d_Shat = 0.0; + } else { + var.d_Shat = (var.fv2 + nue * var.d_fv2) * var.inv_k2_d2; + } + } +}; + +/*! \brief Edward. */ +struct Edw { + static void get(const su2double& nue, const su2double& nu, CSAVariables& var) { + var.Shat = max(var.S * ((1.0 / max(var.Ji, 1.0e-16)) + var.fv1), 1.0e-16); + var.Shat = max(var.Shat, 1.0e-10); + if (var.Shat <= 1.0e-10) { + var.d_Shat = 0.0; + } else { + var.d_Shat = -var.S * pow(var.Ji, -2) / nu + var.S * var.d_fv1; + } + } +}; + +/*! \brief Negative. */ +struct Neg { + static void get(const su2double& nue, const su2double& nu, CSAVariables& var) { + if (nue > 0.0) { + // Baseline solution + Bsl::get(nue, nu, var); + } else { + var.Shat = 1.0e-10; + var.d_Shat = 0.0; + } + /*--- Don't check whether Sbar <>= -cv2*S. + * Steven R. Allmaras, Forrester T. Johnson and Philippe R. Spalart - + * "Modifications and Clarifications for the Implementation of the Spalart-Allmaras Turbulence Model" eq. 12 + * No need for Sbar ---*/ + } +}; +} // namespace ModVort + +/*! + * \brief Auxiliary function r and its derivative. + * \param[in] nue: SA variable. + * \param[in,out] var: Common SA variables struct. + */ +namespace r { + +/*! \brief Baseline. */ +struct Bsl { + static void get(const su2double& nue, CSAVariables& var) { + var.r = min(nue * var.inv_Shat * var.inv_k2_d2, 10.0); + var.d_r = (var.Shat - nue * var.d_Shat) * pow(var.inv_Shat, 2) * var.inv_k2_d2; + if (var.r >= 10.0) var.d_r = 0.0; + } +}; + +/*! \brief Edward. */ +struct Edw { + static void get(const su2double& nue, CSAVariables& var) { + var.r = min(nue * var.inv_Shat * var.inv_k2_d2, 10.0); + var.r = tanh(var.r) / tanh(1.0); + + var.d_r = (var.Shat - nue * var.d_Shat) * pow(var.inv_Shat, 2) * var.inv_k2_d2; + var.d_r = (1 - pow(tanh(var.r), 2.0)) * (var.d_r) / tanh(1.0); + } +}; +} // namespace r + +/*! + * \brief Source terms classes: production, destruction and cross-productions term and their derivative. + * \param[in] nue: SA variable. + * \param[in] var: Common SA variables struct. + * \param[out] production: Production term. + * \param[out] destruction: Destruction term. + * \param[out] cross_production: CrossProduction term. + * \param[out] jacobian: Derivative of the combined source term wrt nue. + */ +namespace SourceTerms { + +/*! \brief Baseline (Original SA model). */ +struct Bsl { + static void get(const su2double& nue, const CSAVariables& var, su2double& production, su2double& destruction, + su2double& cross_production, su2double& jacobian) { + ComputeProduction(nue, var, production, jacobian); + ComputeDestruction(nue, var, destruction, jacobian); + ComputeCrossProduction(nue, var, cross_production, jacobian); + } + + static void ComputeProduction(const su2double& nue, const CSAVariables& var, su2double& production, + su2double& jacobian) { + const su2double factor = var.gamma_bc * var.cb1; + production = factor * (1.0 - var.ft2) * var.Shat * nue; + jacobian += factor * (-var.Shat * nue * var.d_ft2 + (1.0 - var.ft2) * (nue * var.d_Shat + var.Shat)); + } + + static void ComputeDestruction(const su2double& nue, const CSAVariables& var, su2double& destruction, + su2double& jacobian) { + const su2double cb1_k2 = var.cb1 / var.k2; + const su2double factor = var.cw1 * var.fw - cb1_k2 * var.ft2; + destruction = factor * pow(nue, 2) / var.dist_i_2; + jacobian -= ((var.cw1 * var.d_fw - cb1_k2 * var.d_ft2) * pow(nue, 2) + factor * 2 * nue) / var.dist_i_2; + } + + static void ComputeCrossProduction(const su2double& nue, const CSAVariables& var, su2double& cross_production, + su2double&) { + cross_production = var.cb2_sigma * var.norm2_Grad; + /*--- No contribution to the jacobian. ---*/ + } +}; + +/*! \brief Negative. */ +struct Neg { + static void get(const su2double& nue, const CSAVariables& var, su2double& production, su2double& destruction, + su2double& cross_production, su2double& jacobian) { + if (nue > 0.0) { + Bsl::get(nue, var, production, destruction, cross_production, jacobian); + } else { + ComputeProduction(nue, var, production, jacobian); + ComputeDestruction(nue, var, destruction, jacobian); + ComputeCrossProduction(nue, var, cross_production, jacobian); + } + } + + static void ComputeProduction(const su2double& nue, const CSAVariables& var, su2double& production, + su2double& jacobian) { + const su2double dP_dnu = var.gamma_bc * var.cb1 * (1.0 - var.ct3) * var.S; + production = dP_dnu * nue; + jacobian += dP_dnu; + } + + static void ComputeDestruction(const su2double& nue, const CSAVariables& var, su2double& destruction, + su2double& jacobian) { + const su2double dD_dnu = var.cw1 * nue / var.dist_i_2; + destruction = dD_dnu * nue; + jacobian -= 2 * dD_dnu; + } + + static void ComputeCrossProduction(const su2double& nue, const CSAVariables& var, su2double& cross_production, + su2double& jacobian) { + Bsl::ComputeCrossProduction(nue, var, cross_production, jacobian); + } +}; +} // namespace SourceTerms + +/* ============================================================================= + * SPALART-ALLMARAS ADDITIONAL SOURCE TERMS DECORATORS + * ============================================================================*/ + +/*! + * \class CCompressibilityCorrection + * \brief Mixing Layer Compressibility Correction (SA-comp). + */ +template +class CCompressibilityCorrection final : public ParentClass { + private: + using ParentClass::Gamma; + using ParentClass::idx; + using ParentClass::nDim; + using ParentClass::PrimVar_Grad_i; + using ParentClass::ScalarVar_i; + using ParentClass::V_i; + using ParentClass::Volume; + + using ResidualType = typename ParentClass::template ResidualType<>; + + const su2double c5 = 3.5; + + public: + /*! + * \brief Constructor of the class. + * \param[in] nDim - Number of dimensions of the problem. + * \param[in] config - Definition of the particular problem. + */ + CCompressibilityCorrection(unsigned short nDim, unsigned short, const CConfig* config) + : ParentClass(nDim, 0, config) {} + + /*! + * \brief Residual for source term integration. + * \param[in] config - Definition of the particular problem. + * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. + */ + ResidualType ComputeResidual(const CConfig* config) override { + /*--- Residual from standard SA ---*/ + ParentClass::ComputeResidual(config); + + /*--- Compressibility Correction term ---*/ + const auto& pressure = V_i[idx.Pressure()]; + const auto& density = V_i[idx.Density()]; + const su2double sound_speed = sqrt(pressure * Gamma / density); + su2double aux_cc = 0; + for (unsigned short iDim = 0; iDim < nDim; ++iDim) { + for (unsigned short jDim = 0; jDim < nDim; ++jDim) { + aux_cc += pow(PrimVar_Grad_i[idx.Velocity() + iDim][jDim], 2); + } + } + const su2double d_CompCorrection = 2.0 * c5 * ScalarVar_i[0] / pow(sound_speed, 2) * aux_cc * Volume; + const su2double CompCorrection = 0.5 * ScalarVar_i[0] * d_CompCorrection; + + this->Residual -= CompCorrection; + this->Jacobian_i[0] -= d_CompCorrection; + + return ResidualType(&this->Residual, &this->Jacobian_i, nullptr); + } +}; + +} // namespace detail + +/* ============================================================================= + * SPALART-ALLMARAS CLASSES + * ============================================================================*/ + +/// TODO: Factory method to create combinations of the different variations based on the config. + +/*! + * \class CSourcePieceWise_TurbSA + * \brief Class for integrating the source terms of the Spalart-Allmaras turbulence model equation. + */ +template +using CSourcePieceWise_TurbSA = CSourceBase_TurbSA; + +/*! + * \class CSourcePieceWise_TurbSA_COMP + * \brief Class for integrating the source terms of the Spalart-Allmaras model with compressibility correction. + */ +template +using CSourcePieceWise_TurbSA_COMP = detail::CCompressibilityCorrection>; + +/*! + * \class CSourcePieceWise_TurbSA_E + * \brief Class for integrating the source terms of the Spalart-Allmaras model with Edwards modification. + * \note From NASA Turbulence model site. http://turbmodels.larc.nasa.gov/spalart.html + * This form was developed primarily to improve the near-wall numerical behavior of the model (i.e. the goal was to + * improve the convergence behavior). The reference is: Edwards, J. R. and Chandra, S. "Comparison of Eddy + * Viscosity-Transport Turbulence Models for Three-Dimensional, Shock-Separated Flowfields," AIAA Journal, Vol. 34, No. + * 4, 1996, pp. 756-763. + */ +template +using CSourcePieceWise_TurbSA_E = CSourceBase_TurbSA; + +/*! + * \class CSourcePieceWise_TurbSA_E_COMP + * \brief Class for integrating the source terms of the Spalart-Allmaras model with Edwards modification + * and compressibility correction. + */ +template +using CSourcePieceWise_TurbSA_E_COMP = detail::CCompressibilityCorrection>; + +/*! + * \class CSourcePieceWise_TurbSA_Neg + * \brief Class for integrating the source terms of the negative Spalart-Allmaras model. + */ +template +using CSourcePieceWise_TurbSA_Neg = CSourceBase_TurbSA; /*! * \class CSourcePieceWise_TurbSST * \brief Class for integrating the source terms of the Menter SST turbulence model equations. - * \ingroup SourceDiscr - * \author A. Campos. */ template class CSourcePieceWise_TurbSST final : public CNumerics { -private: - const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ - - su2double F1_i, - F1_j, - F2_i, - F2_j; - - su2double alfa_1, - alfa_2, - beta_1, - beta_2, - sigma_k_1, - sigma_k_2, - sigma_w_1, - sigma_w_2, - beta_star, - a1; + private: + const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ + + su2double F1_i, F1_j, F2_i, F2_j; + + su2double alfa_1, alfa_2, beta_1, beta_2, sigma_k_1, sigma_k_2, sigma_w_1, sigma_w_2, beta_star, a1; su2double CDkw_i, CDkw_j; @@ -64,22 +562,34 @@ class CSourcePieceWise_TurbSST final : public CNumerics { su2double Residual[2]; su2double* Jacobian_i[2]; - su2double Jacobian_Buffer[4]; /// Static storage for the Jacobian (which needs to be pointer for return type). + su2double Jacobian_Buffer[4]; /// Static storage for the Jacobian (which needs to be pointer for return type). - bool sustaining_terms; - bool axisymmetric; + const bool sustaining_terms = false; + const bool axisymmetric = false; /*! * \brief A virtual member. Get strain magnitude based on perturbed reynolds stress matrix * \param[in] turb_ke: turbulent kinetic energy of the node */ - void SetPerturbedStrainMag(su2double turb_ke); + inline void SetPerturbedStrainMag(su2double turb_ke) { + /*--- Compute norm of perturbed strain rate tensor. ---*/ + + PerturbedStrainMag = 0; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + for (unsigned short jDim = 0; jDim < nDim; jDim++) { + su2double StrainRate_ij = MeanPerturbedRSM[iDim][jDim] - TWO3 * turb_ke * delta[iDim][jDim]; + StrainRate_ij = -StrainRate_ij * Density_i / (2 * Eddy_Viscosity_i); + + PerturbedStrainMag += pow(StrainRate_ij, 2.0); + } + } + PerturbedStrainMag = sqrt(2.0 * PerturbedStrainMag); + } /*! * \brief Add contribution due to axisymmetric formulation to 2D residual */ inline void ResidualAxisymmetric(su2double alfa_blended, su2double zeta) { - if (Coord_i[1] < EPS) return; su2double yinv, rhov, k, w; @@ -88,38 +598,64 @@ class CSourcePieceWise_TurbSST final : public CNumerics { AD::SetPreaccIn(Coord_i[1]); - yinv = 1.0/Coord_i[1]; - rhov = Density_i*V_i[2]; + yinv = 1.0 / Coord_i[1]; + rhov = Density_i * V_i[2]; k = ScalarVar_i[0]; w = ScalarVar_i[1]; /*--- Compute blended constants ---*/ - sigma_k_i = F1_i*sigma_k_1+(1.0-F1_i)*sigma_k_2; - sigma_w_i = F1_i*sigma_w_1+(1.0-F1_i)*sigma_w_2; + sigma_k_i = F1_i * sigma_k_1 + (1.0 - F1_i) * sigma_k_2; + sigma_w_i = F1_i * sigma_w_1 + (1.0 - F1_i) * sigma_w_2; /*--- Production ---*/ - pk_axi = max(0.0,2.0/3.0*rhov*k*((2.0*yinv*V_i[2]-PrimVar_Grad_i[2][1]-PrimVar_Grad_i[1][0])/zeta-1.0)); - pw_axi = alfa_blended*zeta/k*pk_axi; + pk_axi = max( + 0.0, 2.0 / 3.0 * rhov * k * ((2.0 * yinv * V_i[2] - PrimVar_Grad_i[2][1] - PrimVar_Grad_i[1][0]) / zeta - 1.0)); + pw_axi = alfa_blended * zeta / k * pk_axi; /*--- Convection-Diffusion ---*/ - cdk_axi = rhov*k-(Laminar_Viscosity_i+sigma_k_i*Eddy_Viscosity_i)*ScalarVar_Grad_i[0][1]; - cdw_axi = rhov*w-(Laminar_Viscosity_i+sigma_w_i*Eddy_Viscosity_i)*ScalarVar_Grad_i[1][1]; + cdk_axi = rhov * k - (Laminar_Viscosity_i + sigma_k_i * Eddy_Viscosity_i) * ScalarVar_Grad_i[0][1]; + cdw_axi = rhov * w - (Laminar_Viscosity_i + sigma_w_i * Eddy_Viscosity_i) * ScalarVar_Grad_i[1][1]; /*--- Add terms to the residuals ---*/ - Residual[0] += yinv*Volume*(pk_axi-cdk_axi); - Residual[1] += yinv*Volume*(pw_axi-cdw_axi); - + Residual[0] += yinv * Volume * (pk_axi - cdk_axi); + Residual[1] += yinv * Volume * (pw_axi - cdw_axi); } -public: + public: /*! * \brief Constructor of the class. * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nVar - Number of variables of the problem. + * \param[in] constants - SST model constants. + * \param[in] val_kine_Inf - Freestream k, for SST with sustaining terms. + * \param[in] val_omega_Inf - Freestream w, for SST with sustaining terms. * \param[in] config - Definition of the particular problem. */ - CSourcePieceWise_TurbSST(unsigned short val_nDim, unsigned short val_nVar, const su2double* constants, - su2double val_kine_Inf, su2double val_omega_Inf, const CConfig* config); + CSourcePieceWise_TurbSST(unsigned short val_nDim, unsigned short, const su2double* constants, su2double val_kine_Inf, + su2double val_omega_Inf, const CConfig* config) + : CNumerics(val_nDim, 2, config), + idx(val_nDim, config->GetnSpecies()), + sustaining_terms(config->GetKind_Turb_Model() == TURB_MODEL::SST_SUST), + axisymmetric(config->GetAxisymmetric()) { + /*--- Closure constants ---*/ + sigma_k_1 = constants[0]; + sigma_k_2 = constants[1]; + sigma_w_1 = constants[2]; + sigma_w_2 = constants[3]; + beta_1 = constants[4]; + beta_2 = constants[5]; + beta_star = constants[6]; + a1 = constants[7]; + alfa_1 = constants[8]; + alfa_2 = constants[9]; + + /*--- Set the ambient values of k and omega to the free stream values. ---*/ + kAmb = val_kine_Inf; + omegaAmb = val_omega_Inf; + + /*--- "Allocate" the Jacobian using the static buffer. ---*/ + Jacobian_i[0] = Jacobian_Buffer; + Jacobian_i[1] = Jacobian_Buffer + 2; + } /*! * \brief Set the value of the first blending function. @@ -156,6 +692,118 @@ class CSourcePieceWise_TurbSST final : public CNumerics { * \param[in] config - Definition of the particular problem. * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. */ - ResidualType<> ComputeResidual(const CConfig* config) override; + ResidualType<> ComputeResidual(const CConfig* config) override { + AD::StartPreacc(); + AD::SetPreaccIn(StrainMag_i); + AD::SetPreaccIn(ScalarVar_i, nVar); + AD::SetPreaccIn(ScalarVar_Grad_i, nVar, nDim); + AD::SetPreaccIn(Volume); + AD::SetPreaccIn(dist_i); + AD::SetPreaccIn(F1_i); + AD::SetPreaccIn(F2_i); + AD::SetPreaccIn(CDkw_i); + AD::SetPreaccIn(PrimVar_Grad_i, nDim + idx.Velocity(), nDim); + AD::SetPreaccIn(Vorticity_i, 3); + + unsigned short iDim; + su2double alfa_blended, beta_blended; + su2double diverg, pk, pw, zeta; + const su2double VorticityMag = GeometryToolbox::Norm(3, Vorticity_i); + + AD::SetPreaccIn(V_i[idx.Density()], V_i[idx.LaminarViscosity()], V_i[idx.EddyViscosity()]); + + Density_i = V_i[idx.Density()]; + Laminar_Viscosity_i = V_i[idx.LaminarViscosity()]; + Eddy_Viscosity_i = V_i[idx.EddyViscosity()]; + + Residual[0] = 0.0; + Residual[1] = 0.0; + Jacobian_i[0][0] = 0.0; + Jacobian_i[0][1] = 0.0; + Jacobian_i[1][0] = 0.0; + Jacobian_i[1][1] = 0.0; + /*--- Computation of blended constants for the source terms---*/ + + alfa_blended = F1_i * alfa_1 + (1.0 - F1_i) * alfa_2; + beta_blended = F1_i * beta_1 + (1.0 - F1_i) * beta_2; + + if (dist_i > 1e-10) { + /*--- Production ---*/ + + diverg = 0.0; + for (iDim = 0; iDim < nDim; iDim++) diverg += PrimVar_Grad_i[iDim + idx.Velocity()][iDim]; + + /* if using UQ methodolgy, calculate production using perturbed Reynolds stress matrix */ + + if (using_uq) { + ComputePerturbedRSM(nDim, Eig_Val_Comp, uq_permute, uq_delta_b, uq_urlx, PrimVar_Grad_i + idx.Velocity(), + Density_i, Eddy_Viscosity_i, ScalarVar_i[0], MeanPerturbedRSM); + SetPerturbedStrainMag(ScalarVar_i[0]); + pk = Eddy_Viscosity_i * PerturbedStrainMag * PerturbedStrainMag - + 2.0 / 3.0 * Density_i * ScalarVar_i[0] * diverg; + } else { + pk = Eddy_Viscosity_i * StrainMag_i * StrainMag_i - 2.0 / 3.0 * Density_i * ScalarVar_i[0] * diverg; + } + + pk = min(pk, 20.0 * beta_star * Density_i * ScalarVar_i[1] * ScalarVar_i[0]); + pk = max(pk, 0.0); + + zeta = max(ScalarVar_i[1], VorticityMag * F2_i / a1); + + /* if using UQ methodolgy, calculate production using perturbed Reynolds stress matrix */ + + if (using_uq) { + pw = PerturbedStrainMag * PerturbedStrainMag - 2.0 / 3.0 * zeta * diverg; + } else { + pw = StrainMag_i * StrainMag_i - 2.0 / 3.0 * zeta * diverg; + } + pw = alfa_blended * Density_i * max(pw, 0.0); + + /*--- Sustaining terms, if desired. Note that if the production terms are + larger equal than the sustaining terms, the original formulation is + obtained again. This is in contrast to the version in literature + where the sustaining terms are simply added. This latter approach could + lead to problems for very big values of the free-stream turbulence + intensity. ---*/ + + if (sustaining_terms) { + const su2double sust_k = beta_star * Density_i * kAmb * omegaAmb; + const su2double sust_w = beta_blended * Density_i * omegaAmb * omegaAmb; + + pk = max(pk, sust_k); + pw = max(pw, sust_w); + } + + /*--- Add the production terms to the residuals. ---*/ + + Residual[0] += pk * Volume; + Residual[1] += pw * Volume; + + /*--- Dissipation ---*/ + + Residual[0] -= beta_star * Density_i * ScalarVar_i[1] * ScalarVar_i[0] * Volume; + Residual[1] -= beta_blended * Density_i * ScalarVar_i[1] * ScalarVar_i[1] * Volume; + + /*--- Cross diffusion ---*/ + + Residual[1] += (1.0 - F1_i) * CDkw_i * Volume; + + /*--- Contribution due to 2D axisymmetric formulation ---*/ + + if (axisymmetric) ResidualAxisymmetric(alfa_blended, zeta); + + /*--- Implicit part ---*/ + + Jacobian_i[0][0] = -beta_star * ScalarVar_i[1] * Volume; + Jacobian_i[0][1] = -beta_star * ScalarVar_i[0] * Volume; + Jacobian_i[1][0] = 0.0; + Jacobian_i[1][1] = -2.0 * beta_blended * ScalarVar_i[1] * Volume; + } + + AD::SetPreaccOut(Residual, nVar); + AD::EndPreacc(); + + return ResidualType<>(Residual, Jacobian_i, nullptr); + } }; diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp deleted file mode 100644 index 081b9027d26f..000000000000 --- a/SU2_CFD/include/numerics/turbulent/turb_sources_new.hpp +++ /dev/null @@ -1,544 +0,0 @@ -/*! - * \file turb_sources.hpp - * \brief Numerics classes for integration of source terms in turbulence problems. - * \version 7.3.0 "Blackbird" - * - * SU2 Project Website: https://su2code.github.io - * - * The SU2 Project is maintained by the SU2 Foundation - * (http://su2foundation.org) - * - * Copyright 2012-2021, SU2 Contributors (cf. AUTHORS.md) - * - * SU2 is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * SU2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with SU2. If not, see . - */ - -#pragma once - -#include "../../../Common/include/toolboxes/geometry_toolbox.hpp" -#include "../scalar/scalar_sources.hpp" - -/*! - * \class CSAVariables - * \brief Structure with SA common auxiliary functions and constants. - */ -struct CSAVariables { - /*--- List of constants ---*/ - const su2double cv1_3 = pow(7.1, 3), k2 = pow(0.41, 2), cb1 = 0.1355, cw2 = 0.3, ct3 = 1.2, ct4 = 0.5, - cw3_6 = pow(2, 6), sigma = 2.0 / 3.0, cb2 = 0.622, cb2_sigma = cb2 / sigma, - cw1 = cb1 / k2 + (1 + cb2) / sigma, cr1 = 0.5; - - /*--- List of auxiliary functions ---*/ - su2double ft2, d_ft2, r, d_r, g, d_g, glim, fw, d_fw, Ji, d_Ji, S, Shat, d_Shat, fv1, d_fv1, fv2, d_fv2; - - /*--- List of helpers ---*/ - su2double Omega, dist_i_2, inv_k2_d2, inv_Shat, g_6, norm2_Grad, gamma_bc; -}; - -/*! - * \class CSourceBase_TurbSA - * \brief Class for integrating the source terms of the Spalart-Allmaras turbulence model equation. - * The variables that are subject to change in each variation/correction have their own class. - * \note Additional source terms (e.g. compressibility) are implemented as decorators. - */ -template -class CSourceBase_TurbSA : public CNumerics { - protected: - su2double Gamma_BC = 0.0; - - /*--- Residual and Jacobian ---*/ - su2double Residual, *Jacobian_i; - su2double Jacobian_Buffer; /*!< \brief Static storage for the Jacobian (which needs to be pointer for return type). */ - - const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ - const bool rotating_frame = false; - const bool transition = false; - - public: - /*! - * \brief Constructor of the class. - * \param[in] nDim - Number of dimensions of the problem. - * \param[in] config - Definition of the particular problem. - */ - CSourceBase_TurbSA(unsigned short nDim, unsigned short, const CConfig* config) - : CNumerics(nDim, 1, config), - idx(nDim, config->GetnSpecies()), - rotating_frame(config->GetRotating_Frame()), - transition(config->GetKind_Trans_Model() == TURB_TRANS_MODEL::BC) { - /*--- Setup the Jacobian pointer, we need to return su2double** but we know - * the Jacobian is 1x1 so we use this trick to avoid heap allocation. ---*/ - Jacobian_i = &Jacobian_Buffer; - } - - /*! - * \brief Get the intermittency for the BC transition model. - * \return Value of the intermittency. - */ - su2double GetGammaBC() const final { return Gamma_BC; } - - /*! - * \brief Residual for source term integration. - * \param[in] config - Definition of the particular problem. - * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. - */ - ResidualType<> ComputeResidual(const CConfig* config) override { - /// TODO: Fix AD preaccumulation. - // AD::StartPreacc(); - // AD::SetPreaccIn(V_i, nDim+6); - // AD::SetPreaccIn(Vorticity_i, nDim); - // AD::SetPreaccIn(StrainMag_i); - // AD::SetPreaccIn(ScalarVar_i[0]); - // AD::SetPreaccIn(ScalarVar_Grad_i[0], nDim); - // AD::SetPreaccIn(Volume); - // AD::SetPreaccIn(dist_i); - - /*--- Common auxiliary variables and constants of the model. ---*/ - CSAVariables var; - - const auto& density = V_i[idx.Density()]; - const auto& laminar_viscosity = V_i[idx.LaminarViscosity()]; - - Residual = 0.0; - Jacobian_i[0] = 0.0; - - /*--- Evaluate Omega with a rotational correction term. ---*/ - - Omega::get(Vorticity_i, nDim, PrimVar_Grad_i + idx.Velocity(), var); - - /// TODO: Make this one of the template parameters? - if (rotating_frame) { - var.Omega += 2.0 * min(0.0, StrainMag_i - var.Omega); - } - - if (dist_i > 1e-10) { - /*--- Vorticity ---*/ - var.S = var.Omega; - - var.dist_i_2 = pow(dist_i, 2); - const su2double nu = laminar_viscosity / density; - var.inv_k2_d2 = 1.0 / (var.k2 * var.dist_i_2); - - /*--- Modified values for roughness, roughness_i = 0 for smooth walls and Ji remains the same. - * Ref: Aupoix, B. and Spalart, P. R., "Extensions of the Spalart-Allmaras Turbulence Model to Account for Wall - * Roughness," International Journal of Heat and Fluid Flow, Vol. 24, 2003, pp. 454-462. - * See https://turbmodels.larc.nasa.gov/spalart.html#sarough for detailed explanation. ---*/ - var.Ji = ScalarVar_i[0] / nu + var.cr1 * (roughness_i / (dist_i + EPS)); - var.d_Ji = 1.0 / nu; - - const su2double Ji_2 = pow(var.Ji, 2); - const su2double Ji_3 = Ji_2 * var.Ji; - - var.fv1 = Ji_3 / (Ji_3 + var.cv1_3); - var.d_fv1 = 3 * Ji_2 * var.cv1_3 / (nu * pow(Ji_3 + var.cv1_3, 2)); - - /*--- Using a modified relation so as to not change the Shat that depends on fv2. - * From NASA turb modeling resource and 2003 paper. ---*/ - var.fv2 = 1 - ScalarVar_i[0] / (nu + ScalarVar_i[0] * var.fv1); - var.d_fv2 = -(1 / nu - Ji_2 * var.d_fv1) / pow(1 + var.Ji * var.fv1, 2); - - /*--- Compute ft2 term ---*/ - ft2::get(var); - - /*--- Compute modified vorticity ---*/ - ModVort::get(ScalarVar_i[0], nu, var); - var.inv_Shat = 1.0 / var.Shat; - - /*--- Compute auxiliary function r ---*/ - rFunc::get(ScalarVar_i[0], var); - - var.g = var.r + var.cw2 * (pow(var.r, 6) - var.r); - var.g_6 = pow(var.g, 6); - var.glim = pow((1 + var.cw3_6) / (var.g_6 + var.cw3_6), 1.0 / 6.0); - var.fw = var.g * var.glim; - - var.d_g = var.d_r * (1 + var.cw2 * (6 * pow(var.r, 5) - 1)); - var.d_fw = var.d_g * var.glim * (1 - var.g_6 / (var.g_6 + var.cw3_6)); - - var.norm2_Grad = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[0]); - - /// TODO: Make this one of the template parameters? - if (transition) { - /*--- BC model constants (2020 revision). ---*/ - const su2double chi_1 = 0.002; - const su2double chi_2 = 50.0; - - /*--- turbulence intensity is u'/U so we multiply by 100 to get percentage ---*/ - const su2double tu = 100.0 * config->GetTurbulenceIntensity_FreeStream(); - const su2double nu_t = ScalarVar_i[0] * var.fv1; - - const su2double re_v = density * var.dist_i_2 / laminar_viscosity * var.Omega; - const su2double re_theta = re_v / 2.193; - const su2double re_theta_t = 803.73 * pow(tu + 0.6067, -1.027); // MENTER correlation - // re_theta_t = 163.0 + exp(6.91-tu); //ABU-GHANNAM & SHAW correlation - - const su2double term1 = sqrt(max(re_theta - re_theta_t, 0.0) / (chi_1 * re_theta_t)); - const su2double term2 = sqrt(max((nu_t * chi_2) / nu, 0.0)); - const su2double term_exponential = (term1 + term2); - - Gamma_BC = 1.0 - exp(-term_exponential); - var.gamma_bc = Gamma_BC; - } else { - /*--- Do not modify the production. ---*/ - var.gamma_bc = 1.0; - } - - /*--- Compute production, destruction and cross production and jacobian ---*/ - su2double Production = 0.0, Destruction = 0.0, CrossProduction = 0.0; - SourceTerms::get(ScalarVar_i[0], var, Production, Destruction, CrossProduction, Jacobian_i[0]); - - Residual = (Production - Destruction + CrossProduction) * Volume; - Jacobian_i[0] *= Volume; - } - - // AD::SetPreaccOut(Residual); - // AD::EndPreacc(); - - return ResidualType<>(&Residual, &Jacobian_i, nullptr); - } -}; - -namespace detail { - -/* ============================================================================= - * SPALART-ALLMARAS VARIATIONS AND CORRECTIONS - * ============================================================================*/ - -/*! - * \brief Strain rate classes. - * \param[in] vorticity: Vorticity array. - * \param[in] nDim: Problem dimension. - * \param[in] velocity_grad: Velocity gradients. - * \param[out] var: Common SA variables struct (to set Omega). - */ -namespace Omega { - -/*! \brief Baseline. */ -struct Bsl { - template - static void get(const su2double* vorticity, unsigned short, const MatrixType&, CSAVariables& var) { - var.Omega = GeometryToolbox::Norm(3, vorticity); - } -}; - -/*! \brief Edward. Here Omega is the Strain Rate. */ -struct Edw { - template - static void get(const su2double*, unsigned short nDim, const MatrixType& velocity_grad, CSAVariables& var) { - su2double Sbar = 0.0; - for (unsigned short iDim = 0; iDim < nDim; ++iDim) { - for (unsigned short jDim = 0; jDim < nDim; ++jDim) { - Sbar += (velocity_grad[iDim][jDim] + velocity_grad[jDim][iDim]) * velocity_grad[iDim][jDim]; - } - } - for (unsigned short iDim = 0; iDim < nDim; ++iDim) { - Sbar -= (2.0 / 3.0) * pow(velocity_grad[iDim][iDim], 2); - } - var.Omega = sqrt(max(Sbar, 0.0)); - } -}; -} // namespace Omega - -/*! - * \brief Classes to set the ft2 term and its derivative. - * \param[in,out] var: Common SA variables struct. - */ -namespace ft2 { - -/*! \brief No-ft2 term. */ -struct Zero { - static void get(CSAVariables& var) { - var.ft2 = 0.0; - var.d_ft2 = 0.0; - } -}; - -/*! \brief Non-zero ft2 term according to the literature. */ -struct Nonzero { - static void get(CSAVariables& var) { - const su2double xsi2 = pow(var.Ji, 2); - var.ft2 = var.ct3 * exp(-var.ct4 * xsi2); - var.d_ft2 = -2.0 * var.ct4 * var.Ji * var.ft2 * var.d_Ji; - } -}; -} // namespace ft2 - -/*! - * \brief Classes to compute the modified vorticity (\tilde{S}) and its derivative. - * \param[in] nue: SA variable. - * \param[in] nu: Laminar viscosity. - * \param[in,out] var: Common SA variables struct. - */ -namespace ModVort { - -/*! \brief Baseline. */ -struct Bsl { - static void get(const su2double& nue, const su2double& nu, CSAVariables& var) { - const su2double Sbar = nue * var.fv2 * var.inv_k2_d2; - var.Shat = var.S + Sbar; - var.Shat = max(var.Shat, 1.0e-10); - if (var.Shat <= 1.0e-10) { - var.d_Shat = 0.0; - } else { - var.d_Shat = (var.fv2 + nue * var.d_fv2) * var.inv_k2_d2; - } - } -}; - -/*! \brief Edward. */ -struct Edw { - static void get(const su2double& nue, const su2double& nu, CSAVariables& var) { - var.Shat = max(var.S * ((1.0 / max(var.Ji, 1.0e-16)) + var.fv1), 1.0e-16); - var.Shat = max(var.Shat, 1.0e-10); - if (var.Shat <= 1.0e-10) { - var.d_Shat = 0.0; - } else { - var.d_Shat = -var.S * pow(var.Ji, -2) / nu + var.S * var.d_fv1; - } - } -}; - -/*! \brief Negative. */ -struct Neg { - static void get(const su2double& nue, const su2double& nu, CSAVariables& var) { - if (nue > 0.0) { - // Baseline solution - Bsl::get(nue, nu, var); - } else { - var.Shat = 1.0e-10; - var.d_Shat = 0.0; - } - /*--- Don't check whether Sbar <>= -cv2*S. - * Steven R. Allmaras, Forrester T. Johnson and Philippe R. Spalart - - * "Modifications and Clarifications for the Implementation of the Spalart-Allmaras Turbulence Model" eq. 12 - * No need for Sbar ---*/ - } -}; -} // namespace ModVort - -/*! - * \brief Auxiliary function r and its derivative. - * \param[in] nue: SA variable. - * \param[in,out] var: Common SA variables struct. - */ -namespace r { - -/*! \brief Baseline. */ -struct Bsl { - static void get(const su2double& nue, CSAVariables& var) { - var.r = min(nue * var.inv_Shat * var.inv_k2_d2, 10.0); - var.d_r = (var.Shat - nue * var.d_Shat) * pow(var.inv_Shat, 2) * var.inv_k2_d2; - if (var.r >= 10.0) var.d_r = 0.0; - } -}; - -/*! \brief Edward. */ -struct Edw { - static void get(const su2double& nue, CSAVariables& var) { - var.r = min(nue * var.inv_Shat * var.inv_k2_d2, 10.0); - var.r = tanh(var.r) / tanh(1.0); - - var.d_r = (var.Shat - nue * var.d_Shat) * pow(var.inv_Shat, 2) * var.inv_k2_d2; - var.d_r = (1 - pow(tanh(var.r), 2.0)) * (var.d_r) / tanh(1.0); - } -}; -} // namespace r - -/*! - * \brief Source terms classes: production, destruction and cross-productions term and their derivative. - * \param[in] nue: SA variable. - * \param[in] var: Common SA variables struct. - * \param[out] production: Production term. - * \param[out] destruction: Destruction term. - * \param[out] cross_production: CrossProduction term. - * \param[out] jacobian: Derivative of the combined source term wrt nue. - */ -namespace SourceTerms { - -/*! \brief Baseline (Original SA model). */ -struct Bsl { - static void get(const su2double& nue, const CSAVariables& var, su2double& production, su2double& destruction, - su2double& cross_production, su2double& jacobian) { - ComputeProduction(nue, var, production, jacobian); - ComputeDestruction(nue, var, destruction, jacobian); - ComputeCrossProduction(nue, var, cross_production, jacobian); - } - - static void ComputeProduction(const su2double& nue, const CSAVariables& var, su2double& production, - su2double& jacobian) { - const su2double factor = var.gamma_bc * var.cb1; - production = factor * (1.0 - var.ft2) * var.Shat * nue; - jacobian += factor * (-var.Shat * nue * var.d_ft2 + (1.0 - var.ft2) * (nue * var.d_Shat + var.Shat)); - } - - static void ComputeDestruction(const su2double& nue, const CSAVariables& var, su2double& destruction, - su2double& jacobian) { - const su2double cb1_k2 = var.cb1 / var.k2; - const su2double factor = var.cw1 * var.fw - cb1_k2 * var.ft2; - destruction = factor * pow(nue, 2) / var.dist_i_2; - jacobian -= ((var.cw1 * var.d_fw - cb1_k2 * var.d_ft2) * pow(nue, 2) + factor * 2 * nue) / var.dist_i_2; - } - - static void ComputeCrossProduction(const su2double& nue, const CSAVariables& var, su2double& cross_production, - su2double&) { - cross_production = var.cb2_sigma * var.norm2_Grad; - /*--- No contribution to the jacobian. ---*/ - } -}; - -/*! \brief Negative. */ -struct Neg { - static void get(const su2double& nue, const CSAVariables& var, su2double& production, su2double& destruction, - su2double& cross_production, su2double& jacobian) { - if (nue > 0.0) { - Bsl::get(nue, var, production, destruction, cross_production, jacobian); - } else { - ComputeProduction(nue, var, production, jacobian); - ComputeDestruction(nue, var, destruction, jacobian); - ComputeCrossProduction(nue, var, cross_production, jacobian); - } - } - - static void ComputeProduction(const su2double& nue, const CSAVariables& var, su2double& production, - su2double& jacobian) { - const su2double dP_dnu = var.gamma_bc * var.cb1 * (1.0 - var.ct3) * var.S; - production = dP_dnu * nue; - jacobian += dP_dnu; - } - - static void ComputeDestruction(const su2double& nue, const CSAVariables& var, su2double& destruction, - su2double& jacobian) { - const su2double dD_dnu = var.cw1 * nue / var.dist_i_2; - destruction = dD_dnu * nue; - jacobian -= 2 * dD_dnu; - } - - static void ComputeCrossProduction(const su2double& nue, const CSAVariables& var, su2double& cross_production, - su2double& jacobian) { - Bsl::ComputeCrossProduction(nue, var, cross_production, jacobian); - } -}; -} // namespace SourceTerms - -/* ============================================================================= - * SPALART-ALLMARAS ADDITIONAL SOURCE TERMS DECORATORS - * ============================================================================*/ - -/*! - * \class CCompressibilityCorrection - * \brief Mixing Layer Compressibility Correction (SA-comp). - */ -template -class CCompressibilityCorrection final : public ParentClass { - private: - using ParentClass::Gamma; - using ParentClass::idx; - using ParentClass::nDim; - using ParentClass::PrimVar_Grad_i; - using ParentClass::ScalarVar_i; - using ParentClass::V_i; - using ParentClass::Volume; - - using ResidualType = typename ParentClass::template ResidualType<>; - - const su2double c5 = 3.5; - - public: - /*! - * \brief Constructor of the class. - * \param[in] nDim - Number of dimensions of the problem. - * \param[in] config - Definition of the particular problem. - */ - CCompressibilityCorrection(unsigned short nDim, unsigned short, const CConfig* config) - : ParentClass(nDim, 0, config) {} - - /*! - * \brief Residual for source term integration. - * \param[in] config - Definition of the particular problem. - * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. - */ - ResidualType ComputeResidual(const CConfig* config) override { - /*--- Residual from standard SA ---*/ - ParentClass::ComputeResidual(config); - - /*--- Compressibility Correction term ---*/ - const auto& pressure = V_i[idx.Pressure()]; - const auto& density = V_i[idx.Density()]; - const su2double sound_speed = sqrt(pressure * Gamma / density); - su2double aux_cc = 0; - for (unsigned short iDim = 0; iDim < nDim; ++iDim) { - for (unsigned short jDim = 0; jDim < nDim; ++jDim) { - aux_cc += pow(PrimVar_Grad_i[idx.Velocity() + iDim][jDim], 2); - } - } - const su2double d_CompCorrection = 2.0 * c5 * ScalarVar_i[0] / pow(sound_speed, 2) * aux_cc * Volume; - const su2double CompCorrection = 0.5 * ScalarVar_i[0] * d_CompCorrection; - - this->Residual -= CompCorrection; - this->Jacobian_i[0] -= d_CompCorrection; - - return ResidualType(&this->Residual, &this->Jacobian_i, nullptr); - } -}; - -} // namespace detail - -/* ============================================================================= - * SPALART-ALLMARAS CLASSES - * ============================================================================*/ - -/// TODO: Factory method to create combinations of the different variations based on the config. - -/*! - * \class CSourcePieceWise_TurbSA - * \brief Class for integrating the source terms of the Spalart-Allmaras turbulence model equation. - */ -template -using CSourcePieceWise_TurbSA = CSourceBase_TurbSA; - -/*! - * \class CSourcePieceWise_TurbSA_COMP - * \brief Class for integrating the source terms of the Spalart-Allmaras model with compressibility correction. - */ -template -using CSourcePieceWise_TurbSA_COMP = detail::CCompressibilityCorrection>; - -/*! - * \class CSourcePieceWise_TurbSA_E - * \brief Class for integrating the source terms of the Spalart-Allmaras model with Edwards modification. - * \note From NASA Turbulence model site. http://turbmodels.larc.nasa.gov/spalart.html - * This form was developed primarily to improve the near-wall numerical behavior of the model (i.e. the goal was to - * improve the convergence behavior). The reference is: Edwards, J. R. and Chandra, S. "Comparison of Eddy - * Viscosity-Transport Turbulence Models for Three-Dimensional, Shock-Separated Flowfields," AIAA Journal, Vol. 34, No. - * 4, 1996, pp. 756-763. - */ -template -using CSourcePieceWise_TurbSA_E = CSourceBase_TurbSA; - -/*! - * \class CSourcePieceWise_TurbSA_E_COMP - * \brief Class for integrating the source terms of the Spalart-Allmaras model with Edwards modification - * and compressibility correction. - */ -template -using CSourcePieceWise_TurbSA_E_COMP = detail::CCompressibilityCorrection>; - -/*! - * \class CSourcePieceWise_TurbSA_Neg - * \brief Class for integrating the source terms of the negative Spalart-Allmaras model. - */ -template -using CSourcePieceWise_TurbSA_Neg = CSourceBase_TurbSA; diff --git a/SU2_CFD/obj/Makefile.am b/SU2_CFD/obj/Makefile.am index 7af3c2d9e585..2b031040559c 100644 --- a/SU2_CFD/obj/Makefile.am +++ b/SU2_CFD/obj/Makefile.am @@ -108,7 +108,6 @@ libSU2Core_sources = ../src/definition_structure.cpp \ ../src/numerics/continuous_adjoint/adj_sources.cpp \ ../src/numerics/scalar/scalar_sources.cpp \ ../src/numerics/species/species_sources.cpp \ - ../src/numerics/turbulent/turb_sources.cpp \ ../src/numerics/elasticity/CFEAElasticity.cpp \ ../src/numerics/elasticity/CFEALinearElasticity.cpp \ ../src/numerics/elasticity/CFEANonlinearElasticity.cpp \ diff --git a/SU2_CFD/src/meson.build b/SU2_CFD/src/meson.build index a99192bc4ecb..39934aa7926e 100644 --- a/SU2_CFD/src/meson.build +++ b/SU2_CFD/src/meson.build @@ -141,7 +141,6 @@ su2_cfd_src += files(['numerics/CNumerics.cpp', 'numerics/continuous_adjoint/adj_diffusion.cpp', 'numerics/continuous_adjoint/adj_sources.cpp', 'numerics/scalar/scalar_sources.cpp', - 'numerics/turbulent/turb_sources.cpp', 'numerics/species/species_sources.cpp', 'numerics/elasticity/CFEAElasticity.cpp', 'numerics/elasticity/CFEALinearElasticity.cpp', diff --git a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp deleted file mode 100644 index 4786e5f0ac4f..000000000000 --- a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp +++ /dev/null @@ -1,652 +0,0 @@ -/*! - * \file turb_sources.cpp - * \brief Implementation of numerics classes for integration of - * turbulence source-terms. - * \author F. Palacios, T. Economon - * \version 7.3.0 "Blackbird" - * - * SU2 Project Website: https://su2code.github.io - * - * The SU2 Project is maintained by the SU2 Foundation - * (http://su2foundation.org) - * - * Copyright 2012-2022, SU2 Contributors (cf. AUTHORS.md) - * - * SU2 is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * SU2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with SU2. If not, see . - */ - -#include "../../../include/numerics/turbulent/turb_sources.hpp" - -#include "../../../include/variables/CEulerVariable.hpp" -#include "../../../include/variables/CIncEulerVariable.hpp" -#include "../../../include/variables/CNEMOEulerVariable.hpp" - -#if 0 -CSourceBase_TurbSA::CSourceBase_TurbSA(unsigned short val_nDim, - unsigned short val_nVar, - const CConfig* config) : - CNumerics(val_nDim, val_nVar, config), - rotating_frame(config->GetRotating_Frame()) -{ - /*--- Spalart-Allmaras closure constants ---*/ - - cv1_3 = pow(7.1, 3.0); - k2 = pow(0.41, 2.0); - cb1 = 0.1355; - cw2 = 0.3; - ct3 = 1.2; - ct4 = 0.5; - cw3_6 = pow(2.0, 6.0); - sigma = 2./3.; - cb2 = 0.622; - cb2_sigma = cb2/sigma; - cw1 = cb1/k2+(1.0+cb2)/sigma; - cr1 = 0.5; - - /*--- Setup the Jacobian pointer, we need to return su2double** but - * we know the Jacobian is 1x1 so we use this "trick" to avoid - * having to dynamically allocate. ---*/ - - Jacobian_i = &Jacobian_Buffer; - -} - -template -CSourcePieceWise_TurbSA_E::CSourcePieceWise_TurbSA_E(unsigned short val_nDim, - unsigned short val_nVar, - const CConfig* config) : - CSourceBase_TurbSA(val_nDim, val_nVar, config), - idx(val_nDim, config->GetnSpecies()) { } - -template -CNumerics::ResidualType<> CSourcePieceWise_TurbSA_E::ComputeResidual(const CConfig* config) { - - unsigned short iDim, jDim; - - // AD::StartPreacc(); - // AD::SetPreaccIn(V_i, nDim+6); - // AD::SetPreaccIn(Vorticity_i, nDim); - // AD::SetPreaccIn(StrainMag_i); - // AD::SetPreaccIn(ScalarVar_i[0]); - // AD::SetPreaccIn(ScalarVar_Grad_i[0], nDim); - // AD::SetPreaccIn(Volume); AD::SetPreaccIn(dist_i); - - Density_i = V_i[idx.Density()]; - Laminar_Viscosity_i = V_i[idx.LaminarViscosity()]; - - Residual = 0.0; - Production = 0.0; - Destruction = 0.0; - CrossProduction = 0.0; - Jacobian_i[0] = 0.0; - - /*--- Evaluate Omega, here Omega is the Strain Rate ---*/ - - Sbar = 0.0; - for(iDim=0;iDim 1e-10) { - - /*--- Production term ---*/ - - dist_i_2 = dist_i*dist_i; - nu = Laminar_Viscosity_i/Density_i; - Ji = ScalarVar_i[0]/nu; - Ji_2 = Ji*Ji; - Ji_3 = Ji_2*Ji; - fv1 = Ji_3/(Ji_3+cv1_3); - fv2 = 1.0 - Ji/(1.0+Ji*fv1); - ft2 = ct3*exp(-ct4*Ji_2); - S = Omega; - inv_k2_d2 = 1.0/(k2*dist_i_2); - - //Shat = S + ScalarVar_i[0]*fv2*inv_k2_d2; - Shat = max(S*((1.0/max(Ji,1.0e-16))+fv1),1.0e-16); - - Shat = max(Shat, 1.0e-10); - inv_Shat = 1.0/Shat; - - /*--- Production term ---*/ - - Production = cb1*Shat*ScalarVar_i[0]*Volume; - - /*--- Destruction term ---*/ - - r = min(ScalarVar_i[0]*inv_Shat*inv_k2_d2,10.0); - r=tanh(r)/tanh(1.0); - - g = r + cw2*(pow(r,6.0)-r); - g_6 = pow(g,6.0); - glim = pow((1.0+cw3_6)/(g_6+cw3_6),1.0/6.0); - fw = g*glim; - - Destruction = cw1*fw*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; - - /*--- Diffusion term ---*/ - - norm2_Grad = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - norm2_Grad += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; - - CrossProduction = cb2_sigma*norm2_Grad*Volume; - - Residual = Production - Destruction + CrossProduction; - - /*--- Implicit part, production term ---*/ - - dfv1 = 3.0*Ji_2*cv1_3/(nu*pow(Ji_3+cv1_3,2.)); - dfv2 = -(1/nu-Ji_2*dfv1)/pow(1.+Ji*fv1,2.); - - if ( Shat <= 1.0e-10 ) dShat = 0.0; - else dShat = -S*pow(Ji,-2.0)/nu + S*dfv1; - Jacobian_i[0] += cb1*(ScalarVar_i[0]*dShat+Shat)*Volume; - - /*--- Implicit part, destruction term ---*/ - - dr = (Shat-ScalarVar_i[0]*dShat)*inv_Shat*inv_Shat*inv_k2_d2; - dr=(1-pow(tanh(r),2.0))*(dr)/tanh(1.0); - dg = dr*(1.+cw2*(6.0*pow(r,5.0)-1.0)); - dfw = dg*glim*(1.-g_6/(g_6+cw3_6)); - Jacobian_i[0] -= cw1*(dfw*ScalarVar_i[0] + 2.0*fw)*ScalarVar_i[0]/dist_i_2*Volume; - - } - - // AD::SetPreaccOut(Residual); - // AD::EndPreacc(); - - return ResidualType<>(&Residual, &Jacobian_i, nullptr); - -} - -template -CSourcePieceWise_TurbSA_E_COMP::CSourcePieceWise_TurbSA_E_COMP(unsigned short val_nDim, - unsigned short val_nVar, - const CConfig* config) : - CSourceBase_TurbSA(val_nDim, val_nVar, config), - idx(val_nDim, config->GetnSpecies()) { } - -template -CNumerics::ResidualType<> CSourcePieceWise_TurbSA_E_COMP::ComputeResidual(const CConfig* config) { - - unsigned short iDim, jDim; - - // AD::StartPreacc(); - // AD::SetPreaccIn(V_i, nDim+6); - // AD::SetPreaccIn(Vorticity_i, nDim); - // AD::SetPreaccIn(StrainMag_i); - // AD::SetPreaccIn(ScalarVar_i[0]); - // AD::SetPreaccIn(ScalarVar_Grad_i[0], nDim); - // AD::SetPreaccIn(Volume); AD::SetPreaccIn(dist_i); - - Density_i = V_i[idx.Density()]; - Laminar_Viscosity_i = V_i[idx.LaminarViscosity()]; - - Residual = 0.0; - Production = 0.0; - Destruction = 0.0; - CrossProduction = 0.0; - Jacobian_i[0] = 0.0; - - /* - From NASA Turbulence model site. http://turbmodels.larc.nasa.gov/spalart.html - This form was developed primarily to improve the near-wall numerical behavior of the model (i.e., the goal was to improve the convergence behavior). The reference is: - Edwards, J. R. and Chandra, S. "Comparison of Eddy Viscosity-Transport Turbulence Models for Three-Dimensional, Shock-Separated Flowfields," AIAA Journal, Vol. 34, No. 4, 1996, pp. 756-763. - In this modificaton Omega is replaced by Strain Rate - */ - - /*--- Evaluate Omega, here Omega is the Strain Rate ---*/ - - Sbar = 0.0; - for(iDim=0;iDim 1e-10) { - - /*--- Production term ---*/ - - dist_i_2 = dist_i*dist_i; - nu = Laminar_Viscosity_i/Density_i; - Ji = ScalarVar_i[0]/nu; - Ji_2 = Ji*Ji; - Ji_3 = Ji_2*Ji; - fv1 = Ji_3/(Ji_3+cv1_3); - fv2 = 1.0 - Ji/(1.0+Ji*fv1); - ft2 = ct3*exp(-ct4*Ji_2); - S = Omega; - inv_k2_d2 = 1.0/(k2*dist_i_2); - - Shat = max(S*((1.0/max(Ji,1.0e-16))+fv1),1.0e-16); - - Shat = max(Shat, 1.0e-10); - inv_Shat = 1.0/Shat; - - /*--- Production term ---*/; - - Production = cb1*Shat*ScalarVar_i[0]*Volume; - - /*--- Destruction term ---*/ - - r = min(ScalarVar_i[0]*inv_Shat*inv_k2_d2,10.0); - r=tanh(r)/tanh(1.0); - - g = r + cw2*(pow(r,6.0)-r); - g_6 = pow(g,6.0); - glim = pow((1.0+cw3_6)/(g_6+cw3_6),1.0/6.0); - fw = g*glim; - - Destruction = cw1*fw*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; - - /*--- Diffusion term ---*/ - - norm2_Grad = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - norm2_Grad += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; - - CrossProduction = cb2_sigma*norm2_Grad*Volume; - - Residual = Production - Destruction + CrossProduction; - - /*--- Compressibility Correction term ---*/ - Pressure_i = V_i[idx.Pressure()]; - SoundSpeed_i = sqrt(Pressure_i*Gamma/Density_i); - aux_cc=0; - for(iDim=0;iDim(&Residual, &Jacobian_i, nullptr); - -} - -template -CSourcePieceWise_TurbSA_Neg::CSourcePieceWise_TurbSA_Neg(unsigned short val_nDim, - unsigned short val_nVar, - const CConfig* config) : - CSourceBase_TurbSA(val_nDim, val_nVar, config), - idx(val_nDim, config->GetnSpecies()) { } - -template -CNumerics::ResidualType<> CSourcePieceWise_TurbSA_Neg::ComputeResidual(const CConfig* config) { - - unsigned short iDim; - -// AD::StartPreacc(); -// AD::SetPreaccIn(V_i, nDim+6); -// AD::SetPreaccIn(Vorticity_i, nDim); -// AD::SetPreaccIn(StrainMag_i); -// AD::SetPreaccIn(ScalarVar_i[0]); -// AD::SetPreaccIn(ScalarVar_Grad_i[0], nDim); -// AD::SetPreaccIn(Volume); AD::SetPreaccIn(dist_i); - - Density_i = V_i[idx.Density()]; - Laminar_Viscosity_i = V_i[idx.LaminarViscosity()]; - - Residual = 0.0; - Production = 0.0; - Destruction = 0.0; - CrossProduction = 0.0; - Jacobian_i[0] = 0.0; - - /*--- Evaluate Omega ---*/ - - Omega = sqrt(Vorticity_i[0]*Vorticity_i[0] + Vorticity_i[1]*Vorticity_i[1] + Vorticity_i[2]*Vorticity_i[2]); - - /*--- Rotational correction term ---*/ - - if (rotating_frame) { Omega += 2.0*min(0.0, StrainMag_i-Omega); } - - if (dist_i > 1e-10) { - - if (ScalarVar_i[0] > 0.0) { - - /*--- Production term ---*/ - - dist_i_2 = dist_i*dist_i; - nu = Laminar_Viscosity_i/Density_i; - Ji = ScalarVar_i[0]/nu; - Ji_2 = Ji*Ji; - Ji_3 = Ji_2*Ji; - fv1 = Ji_3/(Ji_3+cv1_3); - fv2 = 1.0 - Ji/(1.0+Ji*fv1); - ft2 = ct3*exp(-ct4*Ji_2); - S = Omega; - inv_k2_d2 = 1.0/(k2*dist_i_2); - - Shat = S + ScalarVar_i[0]*fv2*inv_k2_d2; - Shat = max(Shat, 1.0e-10); - inv_Shat = 1.0/Shat; - - /*--- Production term ---*/; - - // Original SA model - // Production = cb1*(1.0-ft2)*Shat*ScalarVar_i[0]*Volume; - - Production = cb1*Shat*ScalarVar_i[0]*Volume; - - /*--- Destruction term ---*/ - - r = min(ScalarVar_i[0]*inv_Shat*inv_k2_d2,10.0); - g = r + cw2*(pow(r,6.0)-r); - g_6 = pow(g,6.0); - glim = pow((1.0+cw3_6)/(g_6+cw3_6),1.0/6.0); - fw = g*glim; - - Destruction = cw1*fw*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; - - /*--- Diffusion term ---*/ - - norm2_Grad = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - norm2_Grad += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; - - CrossProduction = cb2_sigma*norm2_Grad*Volume; - - Residual = Production - Destruction + CrossProduction; - - /*--- Implicit part, production term ---*/ - - dfv1 = 3.0*Ji_2*cv1_3/(nu*pow(Ji_3+cv1_3,2.)); - dfv2 = -(1/nu-Ji_2*dfv1)/pow(1.+Ji*fv1,2.); - if ( Shat <= 1.0e-10 ) dShat = 0.0; - else dShat = (fv2+ScalarVar_i[0]*dfv2)*inv_k2_d2; - Jacobian_i[0] += cb1*(ScalarVar_i[0]*dShat+Shat)*Volume; - - /*--- Implicit part, destruction term ---*/ - - dr = (Shat-ScalarVar_i[0]*dShat)*inv_Shat*inv_Shat*inv_k2_d2; - if (r == 10.0) dr = 0.0; - dg = dr*(1.+cw2*(6.0*pow(r,5.0)-1.0)); - dfw = dg*glim*(1.-g_6/(g_6+cw3_6)); - Jacobian_i[0] -= cw1*(dfw*ScalarVar_i[0] + 2.0*fw)*ScalarVar_i[0]/dist_i_2*Volume; - - } - - else { - - /*--- Production term ---*/ - - dist_i_2 = dist_i*dist_i; - - /*--- Production term ---*/; - - Production = cb1*(1.0-ct3)*Omega*ScalarVar_i[0]*Volume; - - /*--- Destruction term ---*/ - - Destruction = cw1*ScalarVar_i[0]*ScalarVar_i[0]/dist_i_2*Volume; - - /*--- Diffusion term ---*/ - - norm2_Grad = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - norm2_Grad += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; - - CrossProduction = cb2_sigma*norm2_Grad*Volume; - - Residual = Production + Destruction + CrossProduction; - - /*--- Implicit part, production term ---*/ - - Jacobian_i[0] += cb1*(1.0-ct3)*Omega*Volume; - - /*--- Implicit part, destruction term ---*/ - - Jacobian_i[0] += 2.0*cw1*ScalarVar_i[0]/dist_i_2*Volume; - - } - - } - -// AD::SetPreaccOut(Residual); -// AD::EndPreacc(); - - return ResidualType<>(&Residual, &Jacobian_i, nullptr); - -} -#endif - -template -CSourcePieceWise_TurbSST::CSourcePieceWise_TurbSST(unsigned short val_nDim, - unsigned short val_nVar, - const su2double *constants, - su2double val_kine_Inf, - su2double val_omega_Inf, - const CConfig* config) : - CNumerics(val_nDim, val_nVar, config), - idx(val_nDim, config->GetnSpecies()) { - - sustaining_terms = (config->GetKind_Turb_Model() == TURB_MODEL::SST_SUST); - axisymmetric = config->GetAxisymmetric(); - - /*--- Closure constants ---*/ - sigma_k_1 = constants[0]; - sigma_k_2 = constants[1]; - sigma_w_1 = constants[2]; - sigma_w_2 = constants[3]; - beta_1 = constants[4]; - beta_2 = constants[5]; - beta_star = constants[6]; - a1 = constants[7]; - alfa_1 = constants[8]; - alfa_2 = constants[9]; - - /*--- Set the ambient values of k and omega to the free stream values. ---*/ - kAmb = val_kine_Inf; - omegaAmb = val_omega_Inf; - - /*--- "Allocate" the Jacobian using the static buffer. ---*/ - Jacobian_i[0] = Jacobian_Buffer; - Jacobian_i[1] = Jacobian_Buffer+2; - -} - -template -CNumerics::ResidualType<> CSourcePieceWise_TurbSST::ComputeResidual(const CConfig* config) { - - AD::StartPreacc(); - AD::SetPreaccIn(StrainMag_i); - AD::SetPreaccIn(ScalarVar_i, nVar); - AD::SetPreaccIn(ScalarVar_Grad_i, nVar, nDim); - AD::SetPreaccIn(Volume); AD::SetPreaccIn(dist_i); - AD::SetPreaccIn(F1_i); AD::SetPreaccIn(F2_i); AD::SetPreaccIn(CDkw_i); - AD::SetPreaccIn(PrimVar_Grad_i, nDim+idx.Velocity(), nDim); - AD::SetPreaccIn(Vorticity_i, 3); - - unsigned short iDim; - su2double alfa_blended, beta_blended; - su2double diverg, pk, pw, zeta; - su2double VorticityMag = sqrt(Vorticity_i[0]*Vorticity_i[0] + - Vorticity_i[1]*Vorticity_i[1] + - Vorticity_i[2]*Vorticity_i[2]); - - AD::SetPreaccIn(V_i[idx.Density()], V_i[idx.LaminarViscosity()], V_i[idx.EddyViscosity()]); - - Density_i = V_i[idx.Density()]; - Laminar_Viscosity_i = V_i[idx.LaminarViscosity()]; - Eddy_Viscosity_i = V_i[idx.EddyViscosity()]; - - Residual[0] = 0.0; Residual[1] = 0.0; - Jacobian_i[0][0] = 0.0; Jacobian_i[0][1] = 0.0; - Jacobian_i[1][0] = 0.0; Jacobian_i[1][1] = 0.0; - - /*--- Computation of blended constants for the source terms---*/ - - alfa_blended = F1_i*alfa_1 + (1.0 - F1_i)*alfa_2; - beta_blended = F1_i*beta_1 + (1.0 - F1_i)*beta_2; - - if (dist_i > 1e-10) { - - /*--- Production ---*/ - - diverg = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - diverg += PrimVar_Grad_i[iDim+idx.Velocity()][iDim]; - - /* if using UQ methodolgy, calculate production using perturbed Reynolds stress matrix */ - - if (using_uq){ - ComputePerturbedRSM(nDim, Eig_Val_Comp, uq_permute, uq_delta_b, uq_urlx, - PrimVar_Grad_i+idx.Velocity(), Density_i, Eddy_Viscosity_i, - ScalarVar_i[0], MeanPerturbedRSM); - SetPerturbedStrainMag(ScalarVar_i[0]); - pk = Eddy_Viscosity_i*PerturbedStrainMag*PerturbedStrainMag - - 2.0/3.0*Density_i*ScalarVar_i[0]*diverg; - } - else { - pk = Eddy_Viscosity_i*StrainMag_i*StrainMag_i - 2.0/3.0*Density_i*ScalarVar_i[0]*diverg; - } - - pk = min(pk,20.0*beta_star*Density_i*ScalarVar_i[1]*ScalarVar_i[0]); - pk = max(pk,0.0); - - zeta = max(ScalarVar_i[1], VorticityMag*F2_i/a1); - - /* if using UQ methodolgy, calculate production using perturbed Reynolds stress matrix */ - - if (using_uq){ - pw = PerturbedStrainMag * PerturbedStrainMag - 2.0/3.0*zeta*diverg; - } - else { - pw = StrainMag_i*StrainMag_i - 2.0/3.0*zeta*diverg; - } - pw = alfa_blended*Density_i*max(pw,0.0); - - /*--- Sustaining terms, if desired. Note that if the production terms are - larger equal than the sustaining terms, the original formulation is - obtained again. This is in contrast to the version in literature - where the sustaining terms are simply added. This latter approach could - lead to problems for very big values of the free-stream turbulence - intensity. ---*/ - - if ( sustaining_terms ) { - const su2double sust_k = beta_star*Density_i*kAmb*omegaAmb; - const su2double sust_w = beta_blended*Density_i*omegaAmb*omegaAmb; - - pk = max(pk, sust_k); - pw = max(pw, sust_w); - } - - /*--- Add the production terms to the residuals. ---*/ - - Residual[0] += pk*Volume; - Residual[1] += pw*Volume; - - /*--- Dissipation ---*/ - - Residual[0] -= beta_star*Density_i*ScalarVar_i[1]*ScalarVar_i[0]*Volume; - Residual[1] -= beta_blended*Density_i*ScalarVar_i[1]*ScalarVar_i[1]*Volume; - - /*--- Cross diffusion ---*/ - - Residual[1] += (1.0 - F1_i)*CDkw_i*Volume; - - /*--- Contribution due to 2D axisymmetric formulation ---*/ - - if (axisymmetric) ResidualAxisymmetric(alfa_blended,zeta); - - /*--- Implicit part ---*/ - - Jacobian_i[0][0] = -beta_star*ScalarVar_i[1]*Volume; - Jacobian_i[0][1] = -beta_star*ScalarVar_i[0]*Volume; - Jacobian_i[1][0] = 0.0; - Jacobian_i[1][1] = -2.0*beta_blended*ScalarVar_i[1]*Volume; - } - - AD::SetPreaccOut(Residual, nVar); - AD::EndPreacc(); - - return ResidualType<>(Residual, Jacobian_i, nullptr); - -} - -template -void CSourcePieceWise_TurbSST::SetPerturbedStrainMag(su2double turb_ke) { - - /*--- Compute norm of perturbed strain rate tensor. ---*/ - - PerturbedStrainMag = 0; - for (unsigned short iDim = 0; iDim < nDim; iDim++){ - for (unsigned short jDim = 0; jDim < nDim; jDim++){ - su2double StrainRate_ij = MeanPerturbedRSM[iDim][jDim] - TWO3 * turb_ke * delta[iDim][jDim]; - StrainRate_ij = - StrainRate_ij * Density_i / (2 * Eddy_Viscosity_i); - - PerturbedStrainMag += pow(StrainRate_ij, 2.0); - } - } - PerturbedStrainMag = sqrt(2.0*PerturbedStrainMag); - -} - -/*--- Explicit instantiations until we don't move this to the hpp. ---*/ - -template class CSourcePieceWise_TurbSST >; -template class CSourcePieceWise_TurbSST >; -template class CSourcePieceWise_TurbSST >; diff --git a/TestCases/vandv.py b/TestCases/vandv.py index a3f7daaa5b3f..35d6b4a514c0 100644 --- a/TestCases/vandv.py +++ b/TestCases/vandv.py @@ -45,7 +45,7 @@ def main(): p30n30.cfg_dir = "vandv/rans/30p30n" p30n30.cfg_file = "config.cfg" p30n30.test_iter = 20 - p30n30.test_vals = [-10.628370, -10.299097, -10.485327, -10.238060, -13.517229, 0.050962, 2.828563, 1.317849, -0.227233] + p30n30.test_vals = [-10.642687, -10.303442, -10.496806, -10.253229, -13.517216, 0.050962, 2.828563, 1.317849, -0.215792] test_list.append(p30n30) ################# From a7f6b471bc86bcc82cac90467ded182eb345afb4 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sun, 27 Feb 2022 11:33:50 +0000 Subject: [PATCH 24/34] update sa_comp_edw --- TestCases/parallel_regression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index b0052c9645a2..2e8762e3b74e 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -710,7 +710,7 @@ def main(): turbmod_sa_comp_edw_rae2822.cfg_dir = "turbulence_models/sa/rae2822" turbmod_sa_comp_edw_rae2822.cfg_file = "turb_SA_COMP_EDW_RAE2822.cfg" turbmod_sa_comp_edw_rae2822.test_iter = 20 - turbmod_sa_comp_edw_rae2822.test_vals = [-2.004687, 0.742306, 0.497310, -5.290769, 0.809485, 0.062036] + turbmod_sa_comp_edw_rae2822.test_vals = [-2.004685, 0.742307, 0.497311, -5.290750, 0.809487, 0.062045] turbmod_sa_comp_edw_rae2822.su2_exec = "mpirun -n 2 SU2_CFD" turbmod_sa_comp_edw_rae2822.timeout = 1600 turbmod_sa_comp_edw_rae2822.new_output = True From bd4021020147e8e03d519cad2ddbaeef10c0bf3d Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sun, 27 Feb 2022 12:29:15 +0000 Subject: [PATCH 25/34] sa-neg fix --- SU2_CFD/include/numerics/turbulent/turb_sources.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 8734024e76c9..ee1cdf7268db 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -418,7 +418,8 @@ struct Neg { static void ComputeDestruction(const su2double& nue, const CSAVariables& var, su2double& destruction, su2double& jacobian) { - const su2double dD_dnu = var.cw1 * nue / var.dist_i_2; + /*--- The destruction when nue < 0 is added instead of the usual subtraction, hence the negative sign. ---*/ + const su2double dD_dnu = -var.cw1 * nue / var.dist_i_2; destruction = dD_dnu * nue; jacobian -= 2 * dD_dnu; } From b3d97e58f2f9d563db59db870833aa6b62d33019 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sun, 27 Feb 2022 13:29:56 +0000 Subject: [PATCH 26/34] sa ad preacc --- .../numerics/turbulent/turb_sources.hpp | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index ee1cdf7268db..5eea6fd20666 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -93,22 +93,18 @@ class CSourceBase_TurbSA : public CNumerics { * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. */ ResidualType<> ComputeResidual(const CConfig* config) override { - /// TODO: Fix AD preaccumulation. - // AD::StartPreacc(); - // AD::SetPreaccIn(V_i, nDim+6); - // AD::SetPreaccIn(Vorticity_i, nDim); - // AD::SetPreaccIn(StrainMag_i); - // AD::SetPreaccIn(ScalarVar_i[0]); - // AD::SetPreaccIn(ScalarVar_Grad_i[0], nDim); - // AD::SetPreaccIn(Volume); - // AD::SetPreaccIn(dist_i); + const auto& density = V_i[idx.Density()]; + const auto& laminar_viscosity = V_i[idx.LaminarViscosity()]; + + AD::StartPreacc(); + AD::SetPreaccIn(density, laminar_viscosity, StrainMag_i, ScalarVar_i[0], Volume, dist_i, roughness_i); + AD::SetPreaccIn(Vorticity_i, 3); + AD::SetPreaccIn(PrimVar_Grad_i + idx.Velocity(), nDim, nDim); + AD::SetPreaccIn(ScalarVar_Grad_i[0], nDim); /*--- Common auxiliary variables and constants of the model. ---*/ CSAVariables var; - const auto& density = V_i[idx.Density()]; - const auto& laminar_viscosity = V_i[idx.LaminarViscosity()]; - Residual = 0.0; Jacobian_i[0] = 0.0; @@ -201,8 +197,8 @@ class CSourceBase_TurbSA : public CNumerics { Jacobian_i[0] *= Volume; } - // AD::SetPreaccOut(Residual); - // AD::EndPreacc(); + AD::SetPreaccOut(Residual); + AD::EndPreacc(); return ResidualType<>(&Residual, &Jacobian_i, nullptr); } From e9421f56886e067f654b6e82c9a35927d96259f5 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Wed, 2 Mar 2022 23:35:59 +0000 Subject: [PATCH 27/34] cleanup sst a bit --- SU2_CFD/include/numerics/CNumerics.hpp | 9 +- .../numerics/turbulent/turb_sources.hpp | 99 +++++++------------ SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 4 +- 3 files changed, 41 insertions(+), 71 deletions(-) diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index 27891731a68d..9f170cac9b83 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -182,7 +182,6 @@ class CNumerics { su2double MeanPerturbedRSM[3][3];/*!< \brief Perturbed Reynolds stress tensor */ bool using_uq; /*!< \brief Flag for UQ methodology */ - su2double PerturbedStrainMag; /*!< \brief Strain magnitude calculated using perturbed stress tensor */ unsigned short Eig_Val_Comp; /*!< \brief Component towards which perturbation is perfromed */ su2double uq_delta_b; /*!< \brief Magnitude of perturbation */ su2double uq_urlx; /*!< \brief Under-relaxation factor for numerical stability */ @@ -689,17 +688,15 @@ class CNumerics { /*! * \brief Set the value of the second blending function. - * \param[in] val_F1_i - Value of the second Menter blending function at point i. - * \param[in] val_F1_j - Value of the second Menter blending function at point j. + * \param[in] val_F2_i - Value of the second Menter blending function at point i. */ - virtual void SetF2blending(su2double val_F1_i, su2double val_F1_j) {/* empty */}; + virtual void SetF2blending(su2double val_F2_i) {/* empty */}; /*! * \brief Set the value of the cross diffusion for the SST model. * \param[in] val_CDkw_i - Value of the cross diffusion at point i. - * \param[in] val_CDkw_j - Value of the cross diffusion at point j. */ - virtual void SetCrossDiff(su2double val_CDkw_i, su2double val_CDkw_j) {/* empty */}; + virtual void SetCrossDiff(su2double val_CDkw_i) {/* empty */}; /*! * \brief Set the gradient of the auxiliary variables. diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 5eea6fd20666..7ec841507769 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -549,12 +549,9 @@ class CSourcePieceWise_TurbSST final : public CNumerics { private: const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ - su2double F1_i, F1_j, F2_i, F2_j; + su2double F1_i, F2_i, CDkw_i; su2double alfa_1, alfa_2, beta_1, beta_2, sigma_k_1, sigma_k_2, sigma_w_1, sigma_w_2, beta_star, a1; - - su2double CDkw_i, CDkw_j; - su2double kAmb, omegaAmb; su2double Residual[2]; @@ -565,22 +562,22 @@ class CSourcePieceWise_TurbSST final : public CNumerics { const bool axisymmetric = false; /*! - * \brief A virtual member. Get strain magnitude based on perturbed reynolds stress matrix - * \param[in] turb_ke: turbulent kinetic energy of the node + * \brief Get strain magnitude based on perturbed reynolds stress matrix. + * \param[in] turb_ke: turbulent kinetic energy of the node. */ - inline void SetPerturbedStrainMag(su2double turb_ke) { + inline su2double PerturbedStrainMag(su2double turb_ke) const { /*--- Compute norm of perturbed strain rate tensor. ---*/ - PerturbedStrainMag = 0; + su2double perturbedStrainMag = 0; for (unsigned short iDim = 0; iDim < nDim; iDim++) { for (unsigned short jDim = 0; jDim < nDim; jDim++) { su2double StrainRate_ij = MeanPerturbedRSM[iDim][jDim] - TWO3 * turb_ke * delta[iDim][jDim]; StrainRate_ij = -StrainRate_ij * Density_i / (2 * Eddy_Viscosity_i); - PerturbedStrainMag += pow(StrainRate_ij, 2.0); + perturbedStrainMag += pow(StrainRate_ij, 2.0); } } - PerturbedStrainMag = sqrt(2.0 * PerturbedStrainMag); + return sqrt(2.0 * perturbedStrainMag); } /*! @@ -589,29 +586,25 @@ class CSourcePieceWise_TurbSST final : public CNumerics { inline void ResidualAxisymmetric(su2double alfa_blended, su2double zeta) { if (Coord_i[1] < EPS) return; - su2double yinv, rhov, k, w; - su2double sigma_k_i, sigma_w_i; - su2double pk_axi, pw_axi, cdk_axi, cdw_axi; - AD::SetPreaccIn(Coord_i[1]); - yinv = 1.0 / Coord_i[1]; - rhov = Density_i * V_i[2]; - k = ScalarVar_i[0]; - w = ScalarVar_i[1]; + const su2double yinv = 1.0 / Coord_i[1]; + const su2double rhov = Density_i * V_i[2]; + const su2double& k = ScalarVar_i[0]; + const su2double& w = ScalarVar_i[1]; /*--- Compute blended constants ---*/ - sigma_k_i = F1_i * sigma_k_1 + (1.0 - F1_i) * sigma_k_2; - sigma_w_i = F1_i * sigma_w_1 + (1.0 - F1_i) * sigma_w_2; + const su2double sigma_k_i = F1_i * sigma_k_1 + (1.0 - F1_i) * sigma_k_2; + const su2double sigma_w_i = F1_i * sigma_w_1 + (1.0 - F1_i) * sigma_w_2; /*--- Production ---*/ - pk_axi = max( + const su2double pk_axi = max( 0.0, 2.0 / 3.0 * rhov * k * ((2.0 * yinv * V_i[2] - PrimVar_Grad_i[2][1] - PrimVar_Grad_i[1][0]) / zeta - 1.0)); - pw_axi = alfa_blended * zeta / k * pk_axi; + const su2double pw_axi = alfa_blended * zeta / k * pk_axi; /*--- Convection-Diffusion ---*/ - cdk_axi = rhov * k - (Laminar_Viscosity_i + sigma_k_i * Eddy_Viscosity_i) * ScalarVar_Grad_i[0][1]; - cdw_axi = rhov * w - (Laminar_Viscosity_i + sigma_w_i * Eddy_Viscosity_i) * ScalarVar_Grad_i[1][1]; + const su2double cdk_axi = rhov * k - (Laminar_Viscosity_i + sigma_k_i * Eddy_Viscosity_i) * ScalarVar_Grad_i[0][1]; + const su2double cdw_axi = rhov * w - (Laminar_Viscosity_i + sigma_w_i * Eddy_Viscosity_i) * ScalarVar_Grad_i[1][1]; /*--- Add terms to the residuals ---*/ Residual[0] += yinv * Volume * (pk_axi - cdk_axi); @@ -657,31 +650,26 @@ class CSourcePieceWise_TurbSST final : public CNumerics { /*! * \brief Set the value of the first blending function. * \param[in] val_F1_i - Value of the first blending function at point i. - * \param[in] val_F1_j - Value of the first blending function at point j. + * \param[in] Not used. */ - inline void SetF1blending(su2double val_F1_i, su2double val_F1_j) override { + inline void SetF1blending(su2double val_F1_i, su2double) override { F1_i = val_F1_i; - F1_j = val_F1_j; } /*! * \brief Set the value of the second blending function. * \param[in] val_F2_i - Value of the second blending function at point i. - * \param[in] val_F2_j - Value of the second blending function at point j. */ - inline void SetF2blending(su2double val_F2_i, su2double val_F2_j) override { + inline void SetF2blending(su2double val_F2_i) override { F2_i = val_F2_i; - F2_j = val_F2_j; } /*! * \brief Set the value of the cross diffusion for the SST model. * \param[in] val_CDkw_i - Value of the cross diffusion at point i. - * \param[in] val_CDkw_j - Value of the cross diffusion at point j. */ - inline void SetCrossDiff(su2double val_CDkw_i, su2double val_CDkw_j) override { + inline void SetCrossDiff(su2double val_CDkw_i) override { CDkw_i = val_CDkw_i; - CDkw_j = val_CDkw_j; } /*! @@ -701,12 +689,6 @@ class CSourcePieceWise_TurbSST final : public CNumerics { AD::SetPreaccIn(CDkw_i); AD::SetPreaccIn(PrimVar_Grad_i, nDim + idx.Velocity(), nDim); AD::SetPreaccIn(Vorticity_i, 3); - - unsigned short iDim; - su2double alfa_blended, beta_blended; - su2double diverg, pk, pw, zeta; - const su2double VorticityMag = GeometryToolbox::Norm(3, Vorticity_i); - AD::SetPreaccIn(V_i[idx.Density()], V_i[idx.LaminarViscosity()], V_i[idx.EddyViscosity()]); Density_i = V_i[idx.Density()]; @@ -720,42 +702,34 @@ class CSourcePieceWise_TurbSST final : public CNumerics { Jacobian_i[1][0] = 0.0; Jacobian_i[1][1] = 0.0; - /*--- Computation of blended constants for the source terms---*/ + /*--- Computation of blended constants for the source terms ---*/ - alfa_blended = F1_i * alfa_1 + (1.0 - F1_i) * alfa_2; - beta_blended = F1_i * beta_1 + (1.0 - F1_i) * beta_2; + const su2double alfa_blended = F1_i * alfa_1 + (1.0 - F1_i) * alfa_2; + const su2double beta_blended = F1_i * beta_1 + (1.0 - F1_i) * beta_2; if (dist_i > 1e-10) { /*--- Production ---*/ - diverg = 0.0; - for (iDim = 0; iDim < nDim; iDim++) diverg += PrimVar_Grad_i[iDim + idx.Velocity()][iDim]; + su2double diverg = 0.0; + for (unsigned short iDim = 0; iDim < nDim; iDim++) + diverg += PrimVar_Grad_i[iDim + idx.Velocity()][iDim]; + + /*--- If using UQ methodolgy, calculate production using perturbed Reynolds stress matrix ---*/ - /* if using UQ methodolgy, calculate production using perturbed Reynolds stress matrix */ + su2double StrainMag = StrainMag_i; if (using_uq) { ComputePerturbedRSM(nDim, Eig_Val_Comp, uq_permute, uq_delta_b, uq_urlx, PrimVar_Grad_i + idx.Velocity(), Density_i, Eddy_Viscosity_i, ScalarVar_i[0], MeanPerturbedRSM); - SetPerturbedStrainMag(ScalarVar_i[0]); - pk = Eddy_Viscosity_i * PerturbedStrainMag * PerturbedStrainMag - - 2.0 / 3.0 * Density_i * ScalarVar_i[0] * diverg; - } else { - pk = Eddy_Viscosity_i * StrainMag_i * StrainMag_i - 2.0 / 3.0 * Density_i * ScalarVar_i[0] * diverg; + StrainMag = PerturbedStrainMag(ScalarVar_i[0]); } - pk = min(pk, 20.0 * beta_star * Density_i * ScalarVar_i[1] * ScalarVar_i[0]); - pk = max(pk, 0.0); + su2double pk = Eddy_Viscosity_i * pow(StrainMag, 2) - 2.0 / 3.0 * Density_i * ScalarVar_i[0] * diverg; + pk = max(0.0, min(pk, 20.0 * beta_star * Density_i * ScalarVar_i[1] * ScalarVar_i[0])); - zeta = max(ScalarVar_i[1], VorticityMag * F2_i / a1); - - /* if using UQ methodolgy, calculate production using perturbed Reynolds stress matrix */ - - if (using_uq) { - pw = PerturbedStrainMag * PerturbedStrainMag - 2.0 / 3.0 * zeta * diverg; - } else { - pw = StrainMag_i * StrainMag_i - 2.0 / 3.0 * zeta * diverg; - } - pw = alfa_blended * Density_i * max(pw, 0.0); + const su2double VorticityMag = GeometryToolbox::Norm(3, Vorticity_i); + const su2double zeta = max(ScalarVar_i[1], VorticityMag * F2_i / a1); + su2double pw = alfa_blended * Density_i * max(pow(StrainMag, 2) - 2.0 / 3.0 * zeta * diverg, 0.0); /*--- Sustaining terms, if desired. Note that if the production terms are larger equal than the sustaining terms, the original formulation is @@ -767,7 +741,6 @@ class CSourcePieceWise_TurbSST final : public CNumerics { if (sustaining_terms) { const su2double sust_k = beta_star * Density_i * kAmb * omegaAmb; const su2double sust_w = beta_blended * Density_i * omegaAmb * omegaAmb; - pk = max(pk, sust_k); pw = max(pw, sust_w); } diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 121e4a12fe18..dcf255af0bc6 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -300,7 +300,7 @@ void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta /*--- Menter's second blending function ---*/ - numerics->SetF2blending(nodes->GetF2blending(iPoint),0.0); + numerics->SetF2blending(nodes->GetF2blending(iPoint)); /*--- Set vorticity and strain rate magnitude ---*/ @@ -310,7 +310,7 @@ void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta /*--- Cross diffusion ---*/ - numerics->SetCrossDiff(nodes->GetCrossDiff(iPoint),0.0); + numerics->SetCrossDiff(nodes->GetCrossDiff(iPoint)); if (axisymmetric){ /*--- Set y coordinate ---*/ From b7885625b6e3119f1edaac974beba5ab84a5cf86 Mon Sep 17 00:00:00 2001 From: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> Date: Wed, 2 Mar 2022 23:53:11 +0000 Subject: [PATCH 28/34] Update SU2_CFD/include/numerics/turbulent/turb_sources.hpp Co-authored-by: TobiKattmann <31306376+TobiKattmann@users.noreply.github.com> --- .../include/numerics/turbulent/turb_sources.hpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 5eea6fd20666..0e77201bc598 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -35,9 +35,18 @@ */ struct CSAVariables { /*--- List of constants ---*/ - const su2double cv1_3 = pow(7.1, 3), k2 = pow(0.41, 2), cb1 = 0.1355, cw2 = 0.3, ct3 = 1.2, ct4 = 0.5, - cw3_6 = pow(2, 6), sigma = 2.0 / 3.0, cb2 = 0.622, cb2_sigma = cb2 / sigma, - cw1 = cb1 / k2 + (1 + cb2) / sigma, cr1 = 0.5; + const su2double cv1_3 = pow(7.1, 3); + const su2double k2 = pow(0.41, 2); + const su2double cb1 = 0.1355; + const su2double cw2 = 0.3; + const su2double ct3 = 1.2; + const su2double ct4 = 0.5; + const su2double cw3_6 = pow(2, 6); + const su2double sigma = 2.0 / 3.0; + const su2double cb2 = 0.622; + const su2double cb2_sigma = cb2 / sigma; + const su2double cw1 = cb1 / k2 + (1 + cb2) / sigma; + const su2double cr1 = 0.5; /*--- List of auxiliary functions ---*/ su2double ft2, d_ft2, r, d_r, g, d_g, glim, fw, d_fw, Ji, d_Ji, S, Shat, d_Shat, fv1, d_fv1, fv2, d_fv2; From 16604d76eae220691408ec4e3445e44f1aaf732e Mon Sep 17 00:00:00 2001 From: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> Date: Wed, 2 Mar 2022 23:53:25 +0000 Subject: [PATCH 29/34] Update SU2_CFD/include/numerics/turbulent/turb_sources.hpp Co-authored-by: TobiKattmann <31306376+TobiKattmann@users.noreply.github.com> --- SU2_CFD/include/numerics/turbulent/turb_sources.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 0e77201bc598..20cb89d2292d 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -185,7 +185,6 @@ class CSourceBase_TurbSA : public CNumerics { const su2double re_v = density * var.dist_i_2 / laminar_viscosity * var.Omega; const su2double re_theta = re_v / 2.193; const su2double re_theta_t = 803.73 * pow(tu + 0.6067, -1.027); // MENTER correlation - // re_theta_t = 163.0 + exp(6.91-tu); //ABU-GHANNAM & SHAW correlation const su2double term1 = sqrt(max(re_theta - re_theta_t, 0.0) / (chi_1 * re_theta_t)); const su2double term2 = sqrt(max((nu_t * chi_2) / nu, 0.0)); From 0f4977f4b761df87737ac283518870fb7cbbd466 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Thu, 3 Mar 2022 00:25:04 +0000 Subject: [PATCH 30/34] review comments --- .../numerics/turbulent/turb_sources.hpp | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index fab5378cfbbc..3166d7f30ae4 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -121,7 +121,8 @@ class CSourceBase_TurbSA : public CNumerics { Omega::get(Vorticity_i, nDim, PrimVar_Grad_i + idx.Velocity(), var); - /// TODO: Make this one of the template parameters? + /*--- Dacles-Mariani et. al. rotation correction ("-R"), this is applied by + * default for rotating frame, but should be controled in the config. ---*/ if (rotating_frame) { var.Omega += 2.0 * min(0.0, StrainMag_i - var.Omega); } @@ -172,19 +173,20 @@ class CSourceBase_TurbSA : public CNumerics { var.norm2_Grad = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[0]); - /// TODO: Make this one of the template parameters? if (transition) { - /*--- BC model constants (2020 revision). ---*/ + /*--- BC transition model (2020 revision). This should only be used with SA-noft2. + * TODO: Consider making this part of the "SourceTerms" template. ---*/ const su2double chi_1 = 0.002; const su2double chi_2 = 50.0; - /*--- turbulence intensity is u'/U so we multiply by 100 to get percentage ---*/ + /*--- Turbulence intensity is u'/U so we multiply by 100 to get percentage. ---*/ const su2double tu = 100.0 * config->GetTurbulenceIntensity_FreeStream(); const su2double nu_t = ScalarVar_i[0] * var.fv1; const su2double re_v = density * var.dist_i_2 / laminar_viscosity * var.Omega; const su2double re_theta = re_v / 2.193; - const su2double re_theta_t = 803.73 * pow(tu + 0.6067, -1.027); // MENTER correlation + /*--- Menter correlation. ---*/ + const su2double re_theta_t = 803.73 * pow(tu + 0.6067, -1.027); const su2double term1 = sqrt(max(re_theta - re_theta_t, 0.0) / (chi_1 * re_theta_t)); const su2double term2 = sqrt(max((nu_t * chi_2) / nu, 0.0)); @@ -503,6 +505,7 @@ class CCompressibilityCorrection final : public ParentClass { * ============================================================================*/ /// TODO: Factory method to create combinations of the different variations based on the config. +/// See PR #1413, the combinations exposed should follow https://turbmodels.larc.nasa.gov/spalart.html /*! * \class CSourcePieceWise_TurbSA @@ -556,19 +559,20 @@ template class CSourcePieceWise_TurbSST final : public CNumerics { private: const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ + const bool sustaining_terms = false; + const bool axisymmetric = false; - su2double F1_i, F2_i, CDkw_i; + /*--- Closure constants ---*/ + const su2double sigma_k_1, sigma_k_2, sigma_w_1, sigma_w_2, beta_1, beta_2, beta_star, a1, alfa_1, alfa_2; - su2double alfa_1, alfa_2, beta_1, beta_2, sigma_k_1, sigma_k_2, sigma_w_1, sigma_w_2, beta_star, a1; - su2double kAmb, omegaAmb; + /*--- Ambient values for SST-SUST. ---*/ + const su2double kAmb, omegaAmb; + su2double F1_i, F2_i, CDkw_i; su2double Residual[2]; su2double* Jacobian_i[2]; su2double Jacobian_Buffer[4]; /// Static storage for the Jacobian (which needs to be pointer for return type). - const bool sustaining_terms = false; - const bool axisymmetric = false; - /*! * \brief Get strain magnitude based on perturbed reynolds stress matrix. * \param[in] turb_ke: turbulent kinetic energy of the node. @@ -633,23 +637,19 @@ class CSourcePieceWise_TurbSST final : public CNumerics { : CNumerics(val_nDim, 2, config), idx(val_nDim, config->GetnSpecies()), sustaining_terms(config->GetKind_Turb_Model() == TURB_MODEL::SST_SUST), - axisymmetric(config->GetAxisymmetric()) { - /*--- Closure constants ---*/ - sigma_k_1 = constants[0]; - sigma_k_2 = constants[1]; - sigma_w_1 = constants[2]; - sigma_w_2 = constants[3]; - beta_1 = constants[4]; - beta_2 = constants[5]; - beta_star = constants[6]; - a1 = constants[7]; - alfa_1 = constants[8]; - alfa_2 = constants[9]; - - /*--- Set the ambient values of k and omega to the free stream values. ---*/ - kAmb = val_kine_Inf; - omegaAmb = val_omega_Inf; - + axisymmetric(config->GetAxisymmetric()), + sigma_k_1(constants[0]), + sigma_k_2(constants[1]), + sigma_w_1(constants[2]), + sigma_w_2(constants[3]), + beta_1(constants[4]), + beta_2(constants[5]), + beta_star(constants[6]), + a1(constants[7]), + alfa_1(constants[8]), + alfa_2(constants[9]), + kAmb(val_kine_Inf), + omegaAmb(val_omega_Inf) { /*--- "Allocate" the Jacobian using the static buffer. ---*/ Jacobian_i[0] = Jacobian_Buffer; Jacobian_i[1] = Jacobian_Buffer + 2; From 0f11171218775b04e562e580f89361aee074ab3d Mon Sep 17 00:00:00 2001 From: Guillermo Suarez Date: Thu, 3 Mar 2022 10:45:07 +0100 Subject: [PATCH 31/34] Minor modifications and TODO annotation in turb_sources.hpp --- .../numerics/turbulent/turb_sources.hpp | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 3166d7f30ae4..dfe67afcc495 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -35,18 +35,19 @@ */ struct CSAVariables { /*--- List of constants ---*/ - const su2double cv1_3 = pow(7.1, 3); - const su2double k2 = pow(0.41, 2); - const su2double cb1 = 0.1355; - const su2double cw2 = 0.3; - const su2double ct3 = 1.2; - const su2double ct4 = 0.5; - const su2double cw3_6 = pow(2, 6); - const su2double sigma = 2.0 / 3.0; - const su2double cb2 = 0.622; - const su2double cb2_sigma = cb2 / sigma; - const su2double cw1 = cb1 / k2 + (1 + cb2) / sigma; - const su2double cr1 = 0.5; + const su2double + cv1_3 = pow(7.1, 3.0), + k2 = pow(0.41, 2.0), + cb1 = 0.1355, + cw2 = 0.3, + ct3 = 1.2, + ct4 = 0.5, + cw3_6 = pow(2.0, 6.0), + sigma = 2./3., + cb2 = 0.622, + cb2_sigma = cb2/sigma, + cw1 = cb1/k2+(1.0+cb2)/sigma, + cr1 = 0.5; /*--- List of auxiliary functions ---*/ su2double ft2, d_ft2, r, d_r, g, d_g, glim, fw, d_fw, Ji, d_Ji, S, Shat, d_Shat, fv1, d_fv1, fv2, d_fv2; @@ -85,6 +86,8 @@ class CSourceBase_TurbSA : public CNumerics { idx(nDim, config->GetnSpecies()), rotating_frame(config->GetRotating_Frame()), transition(config->GetKind_Trans_Model() == TURB_TRANS_MODEL::BC) { + /// TODO: make transition bool more general to consider other transition models + /*--- Setup the Jacobian pointer, we need to return su2double** but we know * the Jacobian is 1x1 so we use this trick to avoid heap allocation. ---*/ Jacobian_i = &Jacobian_Buffer; From 720838c451c22f8528e26cda15007f3b72716f71 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Thu, 3 Mar 2022 10:00:36 +0000 Subject: [PATCH 32/34] update pins --- SU2_CFD/src/numerics/flow/flow_diffusion.cpp | 7 ++++--- .../chtPinArray_2d/of_grad_findiff.csv.ref | 2 +- TestCases/parallel_regression.py | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp index dbad754d5d0e..dc9a68d9082e 100644 --- a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp +++ b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp @@ -131,15 +131,16 @@ void CAvgGrad_Base::SetStressTensor(const su2double *val_primvar, * parts of tau can be computed with the total viscosity. --- */ if (using_uq){ - ComputeStressTensor(nDim, tau, val_gradprimvar+1, val_laminar_viscosity); // laminar part + // laminar part + ComputeStressTensor(nDim, tau, val_gradprimvar+1, val_laminar_viscosity); // add turbulent part which was perturbed for (unsigned short iDim = 0 ; iDim < nDim; iDim++) for (unsigned short jDim = 0 ; jDim < nDim; jDim++) tau[iDim][jDim] += (-Density) * MeanPerturbedRSM[iDim][jDim]; } else { - // compute both parts in one step const su2double total_viscosity = val_laminar_viscosity + val_eddy_viscosity; - ComputeStressTensor(nDim, tau, val_gradprimvar+1, total_viscosity, Density, su2double(0.0)); // TODO why ignore turb_ke? + // turb_ke is not considered in the stress tensor, see #797 + ComputeStressTensor(nDim, tau, val_gradprimvar+1, total_viscosity, Density, su2double(0.0)); } } diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref index 90fc07b20e38..8c4cf0f978ca 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref @@ -1,2 +1,2 @@ "VARIABLE" , "AVG_DENSITY[0]", "AVG_ENTHALPY[0]", "AVG_NORMALVEL[0]", "DRAG[0]" , "EFFICIENCY[0]" , "FORCE_X[0]" , "FORCE_Y[0]" , "FORCE_Z[0]" , "LIFT[0]" , "MOMENT_X[0]" , "MOMENT_Y[0]" , "MOMENT_Z[0]" , "SIDEFORCE[0]" , "SURFACE_MACH[0]", "SURFACE_MASSFLOW[0]", "SURFACE_MOM_DISTORTION[0]", "SURFACE_PRESSURE_DROP[0]", "SURFACE_SECONDARY[0]", "SURFACE_SECOND_OVER_UNIFORM[0]", "SURFACE_STATIC_PRESSURE[0]", "SURFACE_STATIC_TEMPERATURE[0]", "SURFACE_TOTAL_PRESSURE[0]", "SURFACE_TOTAL_TEMPERATURE[0]", "SURFACE_UNIFORMITY[0]", "AVG_TEMPERATURE[1]", "MAXIMUM_HEATFLUX[1]", "TOTAL_HEATFLUX[1]", "FINDIFF_STEP" -0 , 0.0 , -100000.01639127731, -2.2204999999731917e-08, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , -0.04999999997368221, 1.1109999995104307e-08, -2.0599999983605954 , 0.0 , 2.12000000054946 , 3.709999998879887 , 330.00000030369847 , -39.999997625272954 , 315.0000011942211 , -39.999997625272954 , -1.400000004814217 , -129.99999512430804, 0.0 , -509.99999530176865, 1e-08 +0 , 0.0 , -100000.01639127731, 1.1102999999850092e-08, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , -0.04999999997368221, -4.4410000000756306e-08, -2.0599999983605954 , 0.0 , 2.12000000054946 , 3.709999998879887 , 330.00000030369847 , -39.999997625272954 , 315.0000011942211 , -39.999997625272954 , -1.400000004814217 , -129.99999512430804, 0.0 , -509.99999530176865, 1e-08 diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 2e8762e3b74e..e59579bd53df 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1428,7 +1428,7 @@ def main(): sp_pinArray_3d_cht_mf_hf_tp.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_3d" sp_pinArray_3d_cht_mf_hf_tp.cfg_file = "configMaster.cfg" sp_pinArray_3d_cht_mf_hf_tp.test_iter = 30 - sp_pinArray_3d_cht_mf_hf_tp.test_vals = [-13.380025, -7.476945, -7.025285, -0.009675, 99.879812, 4.1920e+02] + sp_pinArray_3d_cht_mf_hf_tp.test_vals = [-13.380430, -7.476945, -7.025285, -0.009675, 99.879812, 4.1920e+02] sp_pinArray_3d_cht_mf_hf_tp.su2_exec = "mpirun -n 2 SU2_CFD" sp_pinArray_3d_cht_mf_hf_tp.timeout = 1600 sp_pinArray_3d_cht_mf_hf_tp.tol = 0.00001 From cb40f95b3291d00c86a6fbcb9460e5b3b77d1be5 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Thu, 3 Mar 2022 10:01:37 +0000 Subject: [PATCH 33/34] Revert "Minor modifications and TODO annotation in turb_sources.hpp" This reverts commit 0f11171218775b04e562e580f89361aee074ab3d. --- .../numerics/turbulent/turb_sources.hpp | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index dfe67afcc495..3166d7f30ae4 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -35,19 +35,18 @@ */ struct CSAVariables { /*--- List of constants ---*/ - const su2double - cv1_3 = pow(7.1, 3.0), - k2 = pow(0.41, 2.0), - cb1 = 0.1355, - cw2 = 0.3, - ct3 = 1.2, - ct4 = 0.5, - cw3_6 = pow(2.0, 6.0), - sigma = 2./3., - cb2 = 0.622, - cb2_sigma = cb2/sigma, - cw1 = cb1/k2+(1.0+cb2)/sigma, - cr1 = 0.5; + const su2double cv1_3 = pow(7.1, 3); + const su2double k2 = pow(0.41, 2); + const su2double cb1 = 0.1355; + const su2double cw2 = 0.3; + const su2double ct3 = 1.2; + const su2double ct4 = 0.5; + const su2double cw3_6 = pow(2, 6); + const su2double sigma = 2.0 / 3.0; + const su2double cb2 = 0.622; + const su2double cb2_sigma = cb2 / sigma; + const su2double cw1 = cb1 / k2 + (1 + cb2) / sigma; + const su2double cr1 = 0.5; /*--- List of auxiliary functions ---*/ su2double ft2, d_ft2, r, d_r, g, d_g, glim, fw, d_fw, Ji, d_Ji, S, Shat, d_Shat, fv1, d_fv1, fv2, d_fv2; @@ -86,8 +85,6 @@ class CSourceBase_TurbSA : public CNumerics { idx(nDim, config->GetnSpecies()), rotating_frame(config->GetRotating_Frame()), transition(config->GetKind_Trans_Model() == TURB_TRANS_MODEL::BC) { - /// TODO: make transition bool more general to consider other transition models - /*--- Setup the Jacobian pointer, we need to return su2double** but we know * the Jacobian is 1x1 so we use this trick to avoid heap allocation. ---*/ Jacobian_i = &Jacobian_Buffer; From fb33fbdd76e8b6eb3cae95e247fa651ab01b7ba8 Mon Sep 17 00:00:00 2001 From: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> Date: Thu, 3 Mar 2022 10:03:51 +0000 Subject: [PATCH 34/34] Update SU2_CFD/include/numerics/turbulent/turb_sources.hpp --- SU2_CFD/include/numerics/turbulent/turb_sources.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 3166d7f30ae4..9e778ea70b60 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -8,7 +8,7 @@ * The SU2 Project is maintained by the SU2 Foundation * (http://su2foundation.org) * - * Copyright 2012-2021, SU2 Contributors (cf. AUTHORS.md) + * Copyright 2012-2022, SU2 Contributors (cf. AUTHORS.md) * * SU2 is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public