From 320599236a0e44f2cf7955d308c1cf0037a05725 Mon Sep 17 00:00:00 2001 From: WallyMaier Date: Thu, 7 Jul 2022 08:32:03 -0700 Subject: [PATCH 1/3] Add in Sutherland's law for NEMO problems + some clean up to viscous functions --- Common/include/option_structure.hpp | 2 + Common/src/CConfig.cpp | 4 +- SU2_CFD/include/fluid/CSU2TCLib.hpp | 16 ++++ SU2_CFD/src/fluid/CSU2TCLib.cpp | 86 ++++++++++++++++++-- SU2_CFD/src/numerics/NEMO/CNEMONumerics.cpp | 70 ++++++++-------- SU2_CFD/src/numerics/NEMO/NEMO_diffusion.cpp | 12 +-- SU2_CFD/src/solvers/CNEMOEulerSolver.cpp | 5 ++ config_template.cfg | 2 +- 8 files changed, 142 insertions(+), 55 deletions(-) diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 21dbf108bf2d..1b5d870b467d 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -613,11 +613,13 @@ MakePair("ONESPECIES", ONESPECIES) * \brief types of coefficient transport model */ enum class TRANSCOEFFMODEL { + SUTHERLAND, WILKE, GUPTAYOS, CHAPMANN_ENSKOG }; static const MapType TransCoeffModel_Map = { +MakePair("SUTHERLAND", TRANSCOEFFMODEL::SUTHERLAND) MakePair("WILKE", TRANSCOEFFMODEL::WILKE) MakePair("GUPTA-YOS", TRANSCOEFFMODEL::GUPTAYOS) MakePair("CHAPMANN-ENSKOG", TRANSCOEFFMODEL::CHAPMANN_ENSKOG) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 64f1035b936d..705429a94d1e 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -3792,8 +3792,8 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i SU2_MPI::Error("Only STANDARD_AIR fluid model can be used with US Measurement System", CURRENT_FUNCTION); } - if (Kind_FluidModel == SU2_NONEQ && Kind_TransCoeffModel != TRANSCOEFFMODEL::WILKE ) { - SU2_MPI::Error("Only WILKE transport model is stable for the NEMO solver using SU2TClib. Use Mutation++ instead.", CURRENT_FUNCTION); + if (Kind_FluidModel == SU2_NONEQ && (Kind_TransCoeffModel != TRANSCOEFFMODEL::WILKE && Kind_TransCoeffModel != TRANSCOEFFMODEL::SUTHERLAND) ) { + SU2_MPI::Error("Only WILKE and SUTHERLAND transport models are stable for the NEMO solver using SU2TClib. Use Mutation++ instead.", CURRENT_FUNCTION); } if (Kind_FluidModel == MUTATIONPP && (Kind_TransCoeffModel != TRANSCOEFFMODEL::WILKE && Kind_TransCoeffModel != TRANSCOEFFMODEL::CHAPMANN_ENSKOG)) { diff --git a/SU2_CFD/include/fluid/CSU2TCLib.hpp b/SU2_CFD/include/fluid/CSU2TCLib.hpp index dd10c2b2afb4..338b8ff8d778 100644 --- a/SU2_CFD/include/fluid/CSU2TCLib.hpp +++ b/SU2_CFD/include/fluid/CSU2TCLib.hpp @@ -64,6 +64,12 @@ class CSU2TCLib : public CNEMOGas { phis, mus, /*!< \brief Auxiliary vectors to be used in Wilke/Blottner/Eucken model */ A; /*!< \brief Auxiliary vector to be used in net production rate computation */ + vector + mu_ref, /*!< \brief Vector containing reference viscosity for Sutherland's law */ + k_ref, /*!< \brief Vector containing reference thermal conducivities for Sutherland's law */ + Sm_ref, /*!< \brief Vector containing Sutherland's constant for viscosity */ + Sk_ref; /*!< \brief Vector containing Sutherland's constant for thermal conductivities */ + su2activematrix CharElTemp, /*!< \brief Characteristic temperature of electron states. */ ElDegeneracy, /*!< \brief Degeneracy of electron states. */ RxnConstantTable, /*!< \brief Table of chemical equiibrium reaction constants */ @@ -232,6 +238,16 @@ class CSU2TCLib : public CNEMOGas { */ void ThermalConductivitiesGY(); + /*! + * \brief Get viscosity with Sutherland's transport model. + */ + void ViscositySuth(); + + /*! + * \brief Get T-R and V-E thermal conductivities vector with Sutherland's transport model. + */ + void ThermalConductivitiesSuth(); + /*! * \brief Get reference temperature. */ diff --git a/SU2_CFD/src/fluid/CSU2TCLib.cpp b/SU2_CFD/src/fluid/CSU2TCLib.cpp index 8d46a3747dbd..81942b1bc9ea 100644 --- a/SU2_CFD/src/fluid/CSU2TCLib.cpp +++ b/SU2_CFD/src/fluid/CSU2TCLib.cpp @@ -52,10 +52,17 @@ CSU2TCLib::CSU2TCLib(const CConfig* config, unsigned short val_nDim, bool viscou eve_eq.resize(nSpecies,0.0); eve.resize(nSpecies,0.0); - if(viscous){ + if (viscous) { MolarFracWBE.resize(nSpecies,0.0); phis.resize(nSpecies,0.0); mus.resize(nSpecies,0.0); + + /*--- Reference values for Sutherland's law viscosity ---*/ + //Note: Can be extended with better coefficients of individual species,. + k_ref.resize(1,0.0); + mu_ref.resize(1,0.0); + Sm_ref.resize(1,0.0); + Sk_ref.resize(1,0.0); } if (gas_model =="ARGON"){ @@ -110,6 +117,13 @@ CSU2TCLib::CSU2TCLib(const CConfig* config, unsigned short val_nDim, bool viscou ElDegeneracy(0,5) = 5; ElDegeneracy(0,6) = 15; + if (viscous) { + mu_ref[0] = 2.125E-5; + k_ref[0] = 0.0163; + Sm_ref[0] = 114.0; + Sk_ref[0] = 170; + } + } else if (gas_model == "N2"){ /*--- Check for errors in the initialization ---*/ if (nSpecies != 2) { @@ -252,6 +266,13 @@ CSU2TCLib::CSU2TCLib(const CConfig* config, unsigned short val_nDim, bool viscou Omega11(1,0,0) = -8.3493693E-03; Omega11(1,0,1) = 1.7808911E-01; Omega11(1,0,2) = -1.4466155E+00; Omega11(1,0,3) = 1.9324210E+03; Omega11(1,1,0) = -7.7439615E-03; Omega11(1,1,1) = 1.7129007E-01; Omega11(1,1,2) = -1.4809088E+00; Omega11(1,1,3) = 2.1284951E+03; + if (viscous) { + k_ref[0] = 0.0242; + mu_ref[0] = 1.663E-5; + Sm_ref[0] = 107.0; + Sk_ref[0] = 150.0; + } + } else if (gas_model == "AIR-5"){ /*--- Check for errors in the initialization ---*/ @@ -598,6 +619,13 @@ CSU2TCLib::CSU2TCLib(const CConfig* config, unsigned short val_nDim, bool viscou Omega11(4,3,0) = -5.0478143E-03; Omega11(4,3,1) = 1.0236186E-01; Omega11(4,3,2) = -9.0058935E-01; Omega11(4,3,3) = 4.4472565E+02; Omega11(4,4,0) = -4.2451096E-03; Omega11(4,4,1) = 9.6820337E-02; Omega11(4,4,2) = -9.9770795E-01; Omega11(4,4,3) = 8.3320644E+02; + if (viscous) { + k_ref[0] = 0.0241; + mu_ref[0] = 1.716E-5; + Sm_ref[0] = 111.0; + Sk_ref[0] = 194.0; + } + } else if (gas_model == "AIR-7"){ /*--- Check for errors in the initialization ---*/ @@ -1027,6 +1055,13 @@ CSU2TCLib::CSU2TCLib(const CConfig* config, unsigned short val_nDim, bool viscou Omega11(4,2,0) = -1.0066279E-03; Omega11(4,2,1) = 1.1029264E-02; Omega11(4,2,2) = -2.0671266E-01; Omega11(4,2,3) = 8.2644384E+01; Omega11(4,3,0) = -5.0478143E-03; Omega11(4,3,1) = 1.0236186E-01; Omega11(4,3,2) = -9.0058935E-01; Omega11(4,3,3) = 4.4472565E+02; Omega11(4,4,0) = -4.2451096E-03; Omega11(4,4,1) = 9.6820337E-02; Omega11(4,4,2) = -9.9770795E-01; Omega11(4,4,3) = 8.3320644E+02; + + if (viscous) { + k_ref[0] = 0.0241; + mu_ref[0] = 1.716E-5; + Sm_ref[0] = 111.0; + Sk_ref[0] = 194.0; + } } if (ionization) { nHeavy = nSpecies-1; nEl = 1; } @@ -1598,6 +1633,8 @@ vector& CSU2TCLib::GetDiffusionCoeff(){ DiffusionCoeffWBE(); if(Kind_TransCoeffModel == TRANSCOEFFMODEL::GUPTAYOS) DiffusionCoeffGY(); + if(Kind_TransCoeffModel == TRANSCOEFFMODEL::SUTHERLAND) + DiffusionCoeffWBE(); return DiffusionCoeff; @@ -1609,6 +1646,8 @@ su2double CSU2TCLib::GetViscosity(){ ViscosityWBE(); if(Kind_TransCoeffModel == TRANSCOEFFMODEL::GUPTAYOS) ViscosityGY(); + if(Kind_TransCoeffModel == TRANSCOEFFMODEL::SUTHERLAND) + ViscositySuth(); return Mu; @@ -1620,6 +1659,8 @@ vector& CSU2TCLib::GetThermalConductivities(){ ThermalConductivitiesWBE(); if(Kind_TransCoeffModel == TRANSCOEFFMODEL::GUPTAYOS) ThermalConductivitiesGY(); + if(Kind_TransCoeffModel == TRANSCOEFFMODEL::SUTHERLAND) + ThermalConductivitiesSuth(); return ThermalConductivities; @@ -1802,7 +1843,8 @@ void CSU2TCLib::DiffusionCoeffGY(){ //} /*--- Assign species diffusion coefficient ---*/ - DiffusionCoeff[iSpecies] = gam_t*gam_t*Mi*(1-Mi*gam_i) / denom; + if (denom == 0) { DiffusionCoeff[iSpecies] = 0.0; } + else { DiffusionCoeff[iSpecies] = gam_t*gam_t*Mi*(1-Mi*gam_i) / denom; } } // if (ionization) { //TODO: Update correct iElectron.... @@ -1971,18 +2013,50 @@ void CSU2TCLib::ThermalConductivitiesGY(){ } /*--- Translational contribution to thermal conductivity ---*/ - ThermalCond_tr += (15.0/4.0)*kb*gam_i/denom_t; + if (denom_t != 0) ThermalCond_tr += (15.0/4.0)*kb*gam_i/denom_t; /*--- Translational contribution to thermal conductivity ---*/ - if (RotationModes[iSpecies] != 0.0) - ThermalCond_tr += kb*gam_i/denom_r; + if (RotationModes[iSpecies] != 0.0 && denom_r != 0) ThermalCond_tr += kb*gam_i/denom_r; /*--- Vibrational-electronic contribution to thermal conductivity ---*/ - ThermalCond_ve += kb*Cvve/R*gam_i / denom_r; + if (denom_r != 0) ThermalCond_ve += kb*Cvve/R*gam_i / denom_r; } ThermalConductivities[0] = ThermalCond_tr; ThermalConductivities[1] = ThermalCond_ve; +} + +void CSU2TCLib::ViscositySuth(){ + + su2double T_ref = 273.15; + su2double T_nd = T / T_ref; + + /*--- Calculate mixture laminar viscosity ---*/ + Mu = mu_ref[0] * T_nd * sqrt(T_nd) * ((T_ref + Sm_ref[0]) / (T + Sm_ref[0])); + +} + +void CSU2TCLib::ThermalConductivitiesSuth(){ + + /*--- Compute mixture quantities ---*/ + su2double mass = 0.0, rho = 0.0; + for (unsigned short ii=0; iiGetSpeciesMolarMass(); - su2activematrix Flux_Tensor(nVar,nDim); /*--- Initialize ---*/ - for (iVar = 0; iVar < nVar; iVar++) { + for (auto iVar = 0; iVar < nVar; iVar++) { Proj_Flux_Tensor[iVar] = 0.0; - for (iDim = 0; iDim < nDim; iDim++) + for (auto iDim = 0; iDim < nDim; iDim++) Flux_Tensor[iVar][iDim] = 0.0; } - /*--- Rename for convenience ---*/ + /*--- Rename variables for convenience ---*/ + const auto& Ms = fluidmodel->GetSpeciesMolarMass(); const auto& Ds = val_diffusioncoeff; - mu = val_lam_viscosity+val_eddy_viscosity; - ktr = val_therm_conductivity; - kve = val_therm_conductivity_ve; - rho = val_primvar[RHO_INDEX]; - T = val_primvar[T_INDEX]; - Tve = val_primvar[TVE_INDEX]; + const su2double mu = val_lam_viscosity+val_eddy_viscosity; + su2double ktr = val_therm_conductivity; + su2double kve = val_therm_conductivity_ve; + const su2double rho = val_primvar[RHO_INDEX]; + const su2double T = val_primvar[T_INDEX]; + const su2double Tve = val_primvar[TVE_INDEX]; const auto& V = val_primvar; const auto& GV = val_gradprimvar; - RuSI= UNIVERSAL_GAS_CONSTANT; - Ru = 1000.0*RuSI; - + const su2double Ru = 1000.0*UNIVERSAL_GAS_CONSTANT; const auto& hs = fluidmodel->ComputeSpeciesEnthalpy(T, Tve, val_eve); /*--- Scale thermal conductivity with turb visc ---*/ @@ -266,23 +265,21 @@ void CNEMONumerics::GetViscousProjFlux(const su2double *val_primvar, // This is only scaling Kve by same factor as ktr // NOTE: V[iSpecies] is == Ys. su2double Mass = 0.0; - su2double tmp1, scl, Cptr; - for (iSpecies=0;iSpecies CAvgGrad_NEMO::ComputeResidual(const CConfig *config) PrimVar_j[iSpecies] = V_j[iSpecies]/V_j[RHO_INDEX]; Mean_PrimVar[iSpecies] = 0.5*(PrimVar_i[iSpecies] + PrimVar_j[iSpecies]); for (auto iDim = 0; iDim < nDim; iDim++) { - Mean_GradPrimVar[iSpecies][iDim] = 0.5*(1.0/V_i[RHO_INDEX] * - (PrimVar_Grad_i[iSpecies][iDim] - - PrimVar_i[iSpecies] * - PrimVar_Grad_i[RHO_INDEX][iDim]) + - 1.0/V_j[RHO_INDEX] * - (PrimVar_Grad_j[iSpecies][iDim] - - PrimVar_j[iSpecies] * - PrimVar_Grad_j[RHO_INDEX][iDim])); + Mean_GradPrimVar[iSpecies][iDim] = 0.5*(1.0/V_i[RHO_INDEX] * (PrimVar_Grad_i[iSpecies][iDim] - + PrimVar_i[iSpecies] * PrimVar_Grad_i[RHO_INDEX][iDim]) + + 1.0/V_j[RHO_INDEX] * (PrimVar_Grad_j[iSpecies][iDim] - + PrimVar_j[iSpecies] * PrimVar_Grad_j[RHO_INDEX][iDim])); } } diff --git a/SU2_CFD/src/solvers/CNEMOEulerSolver.cpp b/SU2_CFD/src/solvers/CNEMOEulerSolver.cpp index 7b45c9479561..28f04d4e8d4b 100644 --- a/SU2_CFD/src/solvers/CNEMOEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CNEMOEulerSolver.cpp @@ -1312,6 +1312,11 @@ void CNEMOEulerSolver::SetNondimensionalization(CConfig *config, unsigned short if (viscous) { switch(config->GetKind_TransCoeffModel()){ + case TRANSCOEFFMODEL::SUTHERLAND: + ModelTable << "Sutherland + WBE"; + NonDimTable.PrintFooter(); + break; + case TRANSCOEFFMODEL::WILKE: ModelTable << "Wilke-Blottner-Eucken"; NonDimTable.PrintFooter(); diff --git a/config_template.cfg b/config_template.cfg index 5609f60dccbc..7b9b46b1b659 100644 --- a/config_template.cfg +++ b/config_template.cfg @@ -1346,7 +1346,7 @@ CFL_REDUCTION_ADJTURB= 0.01 % -------------------- NEMO NUMERICAL METHOD DEFINITION -----------------------% % -% Mixture transport properties (WILKE,GUPTA-YOS,CHAPMANN-ENSKOG) +% Mixture transport properties (WILKE,GUPTA-YOS,CHAPMANN-ENSKOG, SUTHERLAND) TRANSPORT_COEFF_MODEL = WILKE % ----------------------- GEOMETRY EVALUATION PARAMETERS ----------------------% From 6c3eff1028f6fab65b0621b61148decc3f95ff8f Mon Sep 17 00:00:00 2001 From: WallyMaier Date: Sun, 10 Jul 2022 12:26:22 -0700 Subject: [PATCH 2/3] PR comments --- Common/src/CConfig.cpp | 2 +- SU2_CFD/include/fluid/CSU2TCLib.hpp | 27 ++++++++++++++------------- SU2_CFD/src/fluid/CSU2TCLib.cpp | 26 ++++++++------------------ 3 files changed, 23 insertions(+), 32 deletions(-) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 705429a94d1e..1adf855f93ff 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -3793,7 +3793,7 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i } if (Kind_FluidModel == SU2_NONEQ && (Kind_TransCoeffModel != TRANSCOEFFMODEL::WILKE && Kind_TransCoeffModel != TRANSCOEFFMODEL::SUTHERLAND) ) { - SU2_MPI::Error("Only WILKE and SUTHERLAND transport models are stable for the NEMO solver using SU2TClib. Use Mutation++ instead.", CURRENT_FUNCTION); + SU2_MPI::Error("Only WILKE and SUTHERLAND transport models are stable for the NEMO solver using SU2TClib. Use Mutation++ instead.", CURRENT_FUNCTION); } if (Kind_FluidModel == MUTATIONPP && (Kind_TransCoeffModel != TRANSCOEFFMODEL::WILKE && Kind_TransCoeffModel != TRANSCOEFFMODEL::CHAPMANN_ENSKOG)) { diff --git a/SU2_CFD/include/fluid/CSU2TCLib.hpp b/SU2_CFD/include/fluid/CSU2TCLib.hpp index 338b8ff8d778..f0e84abd0054 100644 --- a/SU2_CFD/include/fluid/CSU2TCLib.hpp +++ b/SU2_CFD/include/fluid/CSU2TCLib.hpp @@ -64,11 +64,12 @@ class CSU2TCLib : public CNEMOGas { phis, mus, /*!< \brief Auxiliary vectors to be used in Wilke/Blottner/Eucken model */ A; /*!< \brief Auxiliary vector to be used in net production rate computation */ - vector - mu_ref, /*!< \brief Vector containing reference viscosity for Sutherland's law */ - k_ref, /*!< \brief Vector containing reference thermal conducivities for Sutherland's law */ - Sm_ref, /*!< \brief Vector containing Sutherland's constant for viscosity */ - Sk_ref; /*!< \brief Vector containing Sutherland's constant for thermal conductivities */ + std::array mu_ref; /*!< \brief Vector containing reference viscosity for Sutherland's law */ + std::array k_ref; /*!< \brief Vector containing reference thermal conducivities for Sutherland's law */ + std::array Sm_ref; /*!< \brief Vector containing Sutherland's constant for viscosity */ + std::array Sk_ref; /*!< \brief Vector containing Sutherland's constant for thermal conductivities */ + + const su2double T_ref_suth = 273.15; /*!<\brief Reference temperature for Sutherland's model [K] */ su2activematrix CharElTemp, /*!< \brief Characteristic temperature of electron states. */ ElDegeneracy, /*!< \brief Degeneracy of electron states. */ @@ -209,42 +210,42 @@ class CSU2TCLib : public CNEMOGas { void ComputeKeqConstants(unsigned short val_Reaction); /*! - * \brief Get species diffusion coefficients with Wilke/Blottner/Eucken transport model. + * \brief Calculate species diffusion coefficients with Wilke/Blottner/Eucken transport model. */ void DiffusionCoeffWBE(); /*! - * \brief Get viscosity with Wilke/Blottner/Eucken transport model. + * \brief Calculate viscosity with Wilke/Blottner/Eucken transport model. */ void ViscosityWBE(); /*! - * \brief Get T-R and V-E thermal conductivities vector with Wilke/Blottner/Eucken transport model. + * \brief Calculate T-R and V-E thermal conductivities vector with Wilke/Blottner/Eucken transport model. */ void ThermalConductivitiesWBE(); /*! - * \brief Get species diffusion coefficients with Gupta-Yos transport model. + * \brief Calculate species diffusion coefficients with Gupta-Yos transport model. */ void DiffusionCoeffGY(); /*! - * \brief Get viscosity with Gupta-Yos transport model. + * \brief Calculate viscosity with Gupta-Yos transport model. */ void ViscosityGY(); /*! - * \brief Get T-R and V-E thermal conductivities vector with Gupta-Yos transport model. + * \brief Calculate T-R and V-E thermal conductivities vector with Gupta-Yos transport model. */ void ThermalConductivitiesGY(); /*! - * \brief Get viscosity with Sutherland's transport model. + * \brief Calculate viscosity with Sutherland's transport model. */ void ViscositySuth(); /*! - * \brief Get T-R and V-E thermal conductivities vector with Sutherland's transport model. + * \brief Calculate T-R and V-E thermal conductivities vector with Sutherland's transport model. */ void ThermalConductivitiesSuth(); diff --git a/SU2_CFD/src/fluid/CSU2TCLib.cpp b/SU2_CFD/src/fluid/CSU2TCLib.cpp index 81942b1bc9ea..d48a8bf682e3 100644 --- a/SU2_CFD/src/fluid/CSU2TCLib.cpp +++ b/SU2_CFD/src/fluid/CSU2TCLib.cpp @@ -56,13 +56,6 @@ CSU2TCLib::CSU2TCLib(const CConfig* config, unsigned short val_nDim, bool viscou MolarFracWBE.resize(nSpecies,0.0); phis.resize(nSpecies,0.0); mus.resize(nSpecies,0.0); - - /*--- Reference values for Sutherland's law viscosity ---*/ - //Note: Can be extended with better coefficients of individual species,. - k_ref.resize(1,0.0); - mu_ref.resize(1,0.0); - Sm_ref.resize(1,0.0); - Sk_ref.resize(1,0.0); } if (gas_model =="ARGON"){ @@ -1843,8 +1836,7 @@ void CSU2TCLib::DiffusionCoeffGY(){ //} /*--- Assign species diffusion coefficient ---*/ - if (denom == 0) { DiffusionCoeff[iSpecies] = 0.0; } - else { DiffusionCoeff[iSpecies] = gam_t*gam_t*Mi*(1-Mi*gam_i) / denom; } + DiffusionCoeff[iSpecies] = (denom > EPS) ? (gam_t*gam_t*Mi*(1-Mi*gam_i) / denom) : su2double(0.0); } // if (ionization) { //TODO: Update correct iElectron.... @@ -2013,13 +2005,13 @@ void CSU2TCLib::ThermalConductivitiesGY(){ } /*--- Translational contribution to thermal conductivity ---*/ - if (denom_t != 0) ThermalCond_tr += (15.0/4.0)*kb*gam_i/denom_t; + ThermalCond_tr += (denom_t > EPS) ? ((15.0/4.0)*kb*gam_i/denom_t) : su2double(0.0); /*--- Translational contribution to thermal conductivity ---*/ - if (RotationModes[iSpecies] != 0.0 && denom_r != 0) ThermalCond_tr += kb*gam_i/denom_r; + if (RotationModes[iSpecies] != 0.0) ThermalCond_tr += (denom_r > EPS) ? (kb*gam_i/denom_r) : su2double(0.0); /*--- Vibrational-electronic contribution to thermal conductivity ---*/ - if (denom_r != 0) ThermalCond_ve += kb*Cvve/R*gam_i / denom_r; + ThermalCond_ve += (denom_r > EPS) ? (kb*Cvve/R*gam_i / denom_r) : su2double(0.0); } ThermalConductivities[0] = ThermalCond_tr; @@ -2028,11 +2020,10 @@ void CSU2TCLib::ThermalConductivitiesGY(){ void CSU2TCLib::ViscositySuth(){ - su2double T_ref = 273.15; - su2double T_nd = T / T_ref; + su2double T_nd = T / T_ref_suth; /*--- Calculate mixture laminar viscosity ---*/ - Mu = mu_ref[0] * T_nd * sqrt(T_nd) * ((T_ref + Sm_ref[0]) / (T + Sm_ref[0])); + Mu = mu_ref[0] * T_nd * sqrt(T_nd) * ((T_ref_suth + Sm_ref[0]) / (T + Sm_ref[0])); } @@ -2050,9 +2041,8 @@ void CSU2TCLib::ThermalConductivitiesSuth(){ su2double scl = Cvve/Cvtr; /*--- Compute k's using Sutherland's law ---*/ - su2double T_ref = 273.15; - su2double T_nd = T / T_ref; - su2double k = k_ref[0] * T_nd * sqrt(T_nd) * ((T_ref + Sk_ref[0]) / (T + Sk_ref[0])); + su2double T_nd = T / T_ref_suth; + su2double k = k_ref[0] * T_nd * sqrt(T_nd) * ((T_ref_suth + Sk_ref[0]) / (T + Sk_ref[0])); su2double kve = scl*k; ThermalConductivities[0] = k; From 15ae0bf4db8fe1b0318d2d6ad0a9df00fd61be38 Mon Sep 17 00:00:00 2001 From: Wally Maier Date: Thu, 14 Jul 2022 22:58:58 -0700 Subject: [PATCH 3/3] Apply suggestions from code review --- SU2_CFD/src/fluid/CSU2TCLib.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SU2_CFD/src/fluid/CSU2TCLib.cpp b/SU2_CFD/src/fluid/CSU2TCLib.cpp index d48a8bf682e3..5df07a7fe3d0 100644 --- a/SU2_CFD/src/fluid/CSU2TCLib.cpp +++ b/SU2_CFD/src/fluid/CSU2TCLib.cpp @@ -111,6 +111,7 @@ CSU2TCLib::CSU2TCLib(const CConfig* config, unsigned short val_nDim, bool viscou ElDegeneracy(0,6) = 15; if (viscous) { + //F.M. White, Viscous Fluid Flow, 3rd ed., McGraw-Hill, 2006. mu_ref[0] = 2.125E-5; k_ref[0] = 0.0163; Sm_ref[0] = 114.0; @@ -260,6 +261,7 @@ CSU2TCLib::CSU2TCLib(const CConfig* config, unsigned short val_nDim, bool viscou Omega11(1,1,0) = -7.7439615E-03; Omega11(1,1,1) = 1.7129007E-01; Omega11(1,1,2) = -1.4809088E+00; Omega11(1,1,3) = 2.1284951E+03; if (viscous) { + //F.M. White, Viscous Fluid Flow, 3rd ed., McGraw-Hill, 2006. k_ref[0] = 0.0242; mu_ref[0] = 1.663E-5; Sm_ref[0] = 107.0; @@ -613,6 +615,7 @@ CSU2TCLib::CSU2TCLib(const CConfig* config, unsigned short val_nDim, bool viscou Omega11(4,4,0) = -4.2451096E-03; Omega11(4,4,1) = 9.6820337E-02; Omega11(4,4,2) = -9.9770795E-01; Omega11(4,4,3) = 8.3320644E+02; if (viscous) { + //F.M. White, Viscous Fluid Flow, 3rd ed., McGraw-Hill, 2006. k_ref[0] = 0.0241; mu_ref[0] = 1.716E-5; Sm_ref[0] = 111.0; @@ -1050,6 +1053,7 @@ CSU2TCLib::CSU2TCLib(const CConfig* config, unsigned short val_nDim, bool viscou Omega11(4,4,0) = -4.2451096E-03; Omega11(4,4,1) = 9.6820337E-02; Omega11(4,4,2) = -9.9770795E-01; Omega11(4,4,3) = 8.3320644E+02; if (viscous) { + //F.M. White, Viscous Fluid Flow, 3rd ed., McGraw-Hill, 2006. k_ref[0] = 0.0241; mu_ref[0] = 1.716E-5; Sm_ref[0] = 111.0;