From 388f85a3da092d3b74be4786b2c9bdf692ad4151 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 15 Sep 2023 09:21:47 +0200 Subject: [PATCH 01/56] - Added computation of desired grid size for Scale Resolving Simulations based on k and w - Added computation of k and w starting from SA variables - Added first implementation of SAS (Scale Adaptive Simulation) model --- Common/include/option_structure.hpp | 5 +++ SU2_CFD/include/numerics/CNumerics.hpp | 7 ++++ .../numerics/turbulent/turb_sources.hpp | 20 +++++++-- SU2_CFD/include/variables/CTurbSAVariable.hpp | 24 +++++++++++ .../include/variables/CTurbSSTVariable.hpp | 14 +++++++ SU2_CFD/include/variables/CTurbVariable.hpp | 19 ++++++++- SU2_CFD/include/variables/CVariable.hpp | 41 +++++++++++++++++++ SU2_CFD/src/output/CFlowOutput.cpp | 6 +++ SU2_CFD/src/solvers/CTurbSASolver.cpp | 29 ++++++++++++- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 11 +++++ SU2_CFD/src/variables/CTurbSSTVariable.cpp | 2 + SU2_CFD/src/variables/CTurbVariable.cpp | 2 + 12 files changed, 173 insertions(+), 7 deletions(-) diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index c8181a3a13f4..dabddf8a974f 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -990,6 +990,7 @@ enum class SST_OPTIONS { V, /*!< \brief Menter k-w SST model with vorticity production terms. */ KL, /*!< \brief Menter k-w SST model with Kato-Launder production terms. */ UQ, /*!< \brief Menter k-w SST model with uncertainty quantification modifications. */ + SAS, /*!< \brief Menter k-w SST model with Scale Adaptive Simulations modifications. */ }; static const MapType SST_Options_Map = { MakePair("NONE", SST_OPTIONS::NONE) @@ -1002,6 +1003,7 @@ static const MapType SST_Options_Map = { MakePair("VORTICITY", SST_OPTIONS::V) MakePair("KATO-LAUNDER", SST_OPTIONS::KL) MakePair("UQ", SST_OPTIONS::UQ) + MakePair("SAS", SST_OPTIONS::SAS) }; /*! @@ -1012,6 +1014,7 @@ struct SST_ParsedOptions { SST_OPTIONS production = SST_OPTIONS::NONE; /*!< \brief Enum for production corrections/modifiers for SST model. */ bool sust = false; /*!< \brief Bool for SST model with sustaining terms. */ bool uq = false; /*!< \brief Bool for using uncertainty quantification. */ + bool sas = false; /*!< \brief Bool for using Scale Adaptive Simulations. */ bool modified = false; /*!< \brief Bool for modified (m) SST model. */ }; @@ -1048,6 +1051,7 @@ inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigne const bool sst_v = IsPresent(SST_OPTIONS::V); const bool sst_kl = IsPresent(SST_OPTIONS::KL); const bool sst_uq = IsPresent(SST_OPTIONS::UQ); + const bool sst_sas = IsPresent(SST_OPTIONS::SAS); if (sst_1994 && sst_2003) { SU2_MPI::Error("Two versions (1994 and 2003) selected for SST_OPTIONS. Please choose only one.", CURRENT_FUNCTION); @@ -1071,6 +1075,7 @@ inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigne SSTParsedOptions.sust = sst_sust; SSTParsedOptions.modified = sst_m; SSTParsedOptions.uq = sst_uq; + SSTParsedOptions.sas = sst_sas; return SSTParsedOptions; } diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index 14088f021cd6..e90dae26a231 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -190,6 +190,8 @@ class CNumerics { bool bounded_scalar = false; /*!< \brief Flag for bounded scalar problem */ + su2double FTrans; /*!< \brief SAS function */ + public: /*! * \brief Return type used in some "ComputeResidual" overloads to give a @@ -707,6 +709,11 @@ class CNumerics { */ virtual void SetCrossDiff(su2double val_CDkw_i) {/* empty */}; + /*! + * \brief Get the value of the value of FTrans. + */ + inline virtual su2double GetFTrans() const { return 0.0; } + /*! * \brief Set the value of the effective intermittency for the LM model. * \param[in] intermittency_eff_i - Value of the effective intermittency at point i. diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index af920cd34c1e..1b7d3baed1e2 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -605,6 +605,7 @@ class CSourcePieceWise_TurbSST final : public CNumerics { /*--- 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; const su2double prod_lim_const; + const su2double cTrans; /*--- Ambient values for SST-SUST. ---*/ const su2double kAmb, omegaAmb; @@ -689,6 +690,7 @@ class CSourcePieceWise_TurbSST final : public CNumerics { alfa_1(constants[8]), alfa_2(constants[9]), prod_lim_const(constants[10]), + cTrans(1.25), kAmb(val_kine_Inf), omegaAmb(val_omega_Inf) { /*--- "Allocate" the Jacobian using the static buffer. ---*/ @@ -848,8 +850,11 @@ class CSourcePieceWise_TurbSST final : public CNumerics { Residual[1] += pw * Volume; /*--- Add the dissipation terms to the residuals.---*/ - - Residual[0] -= dk * Volume; + FTrans = 1.0; + if (sstParsedOptions.sas) { + FTrans = max(1.0, pow(StrainMag_i / (cTrans * VorticityMag), 2.0)); + } + Residual[0] -= dk * Volume * FTrans; Residual[1] -= dw * Volume; /*--- Cross diffusion ---*/ @@ -862,8 +867,8 @@ class CSourcePieceWise_TurbSST final : public CNumerics { /*--- Implicit part ---*/ - Jacobian_i[0][0] = -beta_star * ScalarVar_i[1] * Volume; - Jacobian_i[0][1] = -beta_star * ScalarVar_i[0] * Volume; + Jacobian_i[0][0] = -beta_star * ScalarVar_i[1] * Volume * FTrans; + Jacobian_i[0][1] = -beta_star * ScalarVar_i[0] * Volume * FTrans; Jacobian_i[1][0] = 0.0; Jacobian_i[1][1] = -2.0 * beta_blended * ScalarVar_i[1] * Volume; } @@ -873,4 +878,11 @@ class CSourcePieceWise_TurbSST final : public CNumerics { return ResidualType<>(Residual, Jacobian_i, nullptr); } + + /*! + * \brief Get the value of the FTrans. + */ + inline su2double GetFTrans() const override { return FTrans; } + + }; diff --git a/SU2_CFD/include/variables/CTurbSAVariable.hpp b/SU2_CFD/include/variables/CTurbSAVariable.hpp index 569e416fa159..b76539d4c05f 100644 --- a/SU2_CFD/include/variables/CTurbSAVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSAVariable.hpp @@ -42,6 +42,8 @@ class CTurbSAVariable final : public CTurbVariable { VectorType DES_LengthScale; VectorType Vortex_Tilting; + VectorType k, Omega; /*!< \brief SST variables as computed through SA solution. */ + public: /*! * \brief Constructor of the class. @@ -87,4 +89,26 @@ class CTurbSAVariable final : public CTurbVariable { */ inline su2double GetVortex_Tilting(unsigned long iPoint) const override { return Vortex_Tilting(iPoint); } + /*! + * \brief Get the value of the turbulence kinetic energy. + * \return the value of the turbulence kinetic energy. + */ + inline su2double GetSSTVariables_k(unsigned long iPoint) const { return k(iPoint); } + + /*! + * \brief Get the value of the turbulence frequency Omega. + * \return the value of the turbulence frequency Omega. + */ + inline su2double GetSSTVariables_omega(unsigned long iPoint) const { return Omega(iPoint); } + + /*! + * \brief Set the value of the SST variables computed with SA solution. + * \param[in] val_k + * \param[in] val_Omega + */ + void SetSSTVariables(unsigned long iPoint, su2double val_k, su2double val_Omega) { + k(iPoint) = val_k; + Omega(iPoint) = val_Omega; + } + }; diff --git a/SU2_CFD/include/variables/CTurbSSTVariable.hpp b/SU2_CFD/include/variables/CTurbSSTVariable.hpp index 0113a0ead3ad..384fe86f95af 100644 --- a/SU2_CFD/include/variables/CTurbSSTVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSSTVariable.hpp @@ -45,6 +45,7 @@ class CTurbSSTVariable final : public CTurbVariable { VectorType F2; /*!< \brief Menter blending function for blending of k-w and k-eps. */ VectorType CDkw; /*!< \brief Cross-diffusion. */ SST_ParsedOptions sstParsedOptions; + VectorType FTrans; public: /*! * \brief Constructor of the class. @@ -87,4 +88,17 @@ class CTurbSSTVariable final : public CTurbVariable { * \brief Get the value of the cross diffusion of tke and omega. */ inline su2double GetCrossDiff(unsigned long iPoint) const override { return CDkw(iPoint); } + + /*! + * \brief Get the value of the FTrans. + */ + inline su2double GetFTrans(unsigned long iPoint) const override { return FTrans(iPoint); } + + /*! + * \brief Set the value of the FTrans. + */ + inline void SetFTrans(unsigned long iPoint, su2double val_FTrans) override { + FTrans(iPoint) = val_FTrans; + }; + }; diff --git a/SU2_CFD/include/variables/CTurbVariable.hpp b/SU2_CFD/include/variables/CTurbVariable.hpp index 1a476fdac70e..ba3a0651253f 100644 --- a/SU2_CFD/include/variables/CTurbVariable.hpp +++ b/SU2_CFD/include/variables/CTurbVariable.hpp @@ -41,8 +41,9 @@ class CTurbVariable : public CScalarVariable { public: static constexpr size_t MAXNVAR = 2; - VectorType turb_index; - VectorType intermittency; /*!< \brief Value of the intermittency for the trans. model. */ + VectorType turb_index; /*!< \brief Value of the turbulence index for transition simulations. */ + VectorType intermittency; /*!< \brief Value of the intermittency for the transition model. */ + VectorType SRSGridSize; /*!< \brief alue of the desired grid size for Scale Resolving Simulations. */ /*! * \brief Constructor of the class. @@ -99,6 +100,20 @@ class CTurbVariable : public CScalarVariable { * \param[in] val_intermittency - New value of the intermittency. */ inline void SetIntermittency(unsigned long iPoint, su2double val_intermittency) final { intermittency(iPoint) = val_intermittency; } + + /*! + * \brief Get the desired grid size for Scale Resolving Simulations. + * \param[in] iPoint - Point index. + * \return the value of the desired grid size for Scale Resolving Simulations. + */ + inline su2double GetSRSGridSize(unsigned long iPoint) const final { return SRSGridSize(iPoint); } + + /*! + * \brief Set the value of the desired grid size for Scale Resolving Simulations. + * \param[in] iPoint - Point index. + * \param[in] val_muT - Value of the desired grid size for Scale Resolving Simulations. + */ + inline void SetSRSGridSize(unsigned long iPoint, su2double val_gridSize) final { SRSGridSize(iPoint) = val_gridSize; } }; diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index 050be2b77874..363fad7a7b7f 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -1647,6 +1647,16 @@ class CVariable { */ inline virtual su2double GetCrossDiff(unsigned long iPoint) const { return 0.0; } + /*! + * \brief Get the value of the value of FTrans. + */ + inline virtual su2double GetFTrans(unsigned long iPoint) const { return 0.0; } + + /*! + * \brief Set the value of the value of FTrans. + */ + inline virtual void SetFTrans(unsigned long iPoint, su2double val_FTrans) {} + /*! * \brief Get the value of the eddy viscosity. * \return the value of the eddy viscosity. @@ -1695,6 +1705,37 @@ class CVariable { */ inline virtual void SetmuT(unsigned long iPoint, su2double val_muT) {} + /*! + * \brief Get the value of the turbulence kinetic energy. + * \return the value of the turbulence kinetic energy. + */ + inline virtual su2double GetSSTVariables_k(unsigned long iPoint) const { return 0.0; } + + /*! + * \brief Get the value of the Rate of dissipation Omega. + * \return the value of the Rate of dissipation Omega. + */ + inline virtual su2double GetSSTVariables_omega(unsigned long iPoint) const { return 0.0; } + + /*! + * \brief Set the value of the SST variables computed with SA solution. + * \param[in] val_k + * \param[in] val_Omega + */ + inline virtual void SetSSTVariables(unsigned long iPoint, su2double val_k, su2double val_Omega) {} + + /*! + * \brief Get the value of the desired grid size for Scale Resolving Simulations. + * \return the value of the desired grid size for Scale Resolving Simulations. + */ + inline virtual su2double GetSRSGridSize(unsigned long iPoint) const { return 0.0; } + + /*! + * \brief Set the value of the desired grid size for Scale Resolving Simulations. + * \param[in] val_gridSize + */ + inline virtual void SetSRSGridSize(unsigned long iPoint, su2double val_gridSize) {} + /*! * \brief Set the value of the turbulence index. * \param[in] val_turb_index - turbulence index diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 75bd80feebb2..bf9d989d2021 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1243,11 +1243,14 @@ void CFlowOutput::SetVolumeOutputFieldsScalarSolution(const CConfig* config){ switch (TurbModelFamily(config->GetKind_Turb_Model())) { case TURB_FAMILY::SA: AddVolumeOutput("NU_TILDE", "Nu_Tilde", "SOLUTION", "Spalart-Allmaras variable"); + AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "SOLUTION", "desired grid size for Scale Resolving Simulations"); break; case TURB_FAMILY::KW: AddVolumeOutput("TKE", "Turb_Kin_Energy", "SOLUTION", "Turbulent kinetic energy"); AddVolumeOutput("DISSIPATION", "Omega", "SOLUTION", "Rate of dissipation"); + AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "SOLUTION", "desired grid size for Scale Resolving Simulations"); + if (config->GetSSTParsedOptions().sas) AddVolumeOutput("FTRANS", "FTrans", "SOLUTION", "value of FTrans for SAS simulation"); break; case TURB_FAMILY::NONE: @@ -1516,6 +1519,7 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con case TURB_FAMILY::SA: SetVolumeOutputValue("NU_TILDE", iPoint, Node_Turb->GetSolution(iPoint, 0)); SetVolumeOutputValue("RES_NU_TILDE", iPoint, turb_solver->LinSysRes(iPoint, 0)); + SetVolumeOutputValue("SRS_GRID_SIZE", iPoint, Node_Turb->GetSRSGridSize(iPoint)); if (limiter) { SetVolumeOutputValue("LIMITER_NU_TILDE", iPoint, Node_Turb->GetLimiter(iPoint, 0)); } @@ -1526,6 +1530,8 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con SetVolumeOutputValue("DISSIPATION", iPoint, Node_Turb->GetSolution(iPoint, 1)); SetVolumeOutputValue("RES_TKE", iPoint, turb_solver->LinSysRes(iPoint, 0)); SetVolumeOutputValue("RES_DISSIPATION", iPoint, turb_solver->LinSysRes(iPoint, 1)); + SetVolumeOutputValue("SRS_GRID_SIZE", iPoint, Node_Turb->GetSRSGridSize(iPoint)); + if (config->GetSSTParsedOptions().sas) SetVolumeOutputValue("FTRANS", iPoint, Node_Turb->GetFTrans(iPoint)); if (limiter) { SetVolumeOutputValue("LIMITER_TKE", iPoint, Node_Turb->GetLimiter(iPoint, 0)); SetVolumeOutputValue("LIMITER_DISSIPATION", iPoint, Node_Turb->GetLimiter(iPoint, 1)); diff --git a/SU2_CFD/src/solvers/CTurbSASolver.cpp b/SU2_CFD/src/solvers/CTurbSASolver.cpp index 2d301dc77220..a81f75a5e09f 100644 --- a/SU2_CFD/src/solvers/CTurbSASolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSASolver.cpp @@ -224,7 +224,8 @@ void CTurbSASolver::Postprocessing(CGeometry *geometry, CSolver **solver_contain const su2double nu = mu/rho; const su2double nu_hat = nodes->GetSolution(iPoint,0); const su2double roughness = geometry->nodes->GetRoughnessHeight(iPoint); - const su2double dist = geometry->nodes->GetWall_Distance(iPoint) + rough_const * roughness; + const su2double wallDistance = geometry->nodes->GetWall_Distance(iPoint); + const su2double dist = wallDistance + rough_const * roughness; su2double Ji = nu_hat/nu; if (roughness > 1.0e-10) @@ -239,6 +240,32 @@ void CTurbSASolver::Postprocessing(CGeometry *geometry, CSolver **solver_contain nodes->SetmuT(iPoint,muT); + // Now compute k and w + auto* flowNodes = su2staticcast_p(solver_container[FLOW_SOL]->GetNodes()); + + const su2double BetaStar = 0.09; + const su2double a1 = 0.31; + + const su2double Omega = GeometryToolbox::Norm(nDim, flowNodes->GetVorticity(iPoint))/sqrt(BetaStar); + + const su2double nut = muT / rho; + const su2double arg2_1 = 2.0 * sqrt(nut / Omega) / (BetaStar * wallDistance); + const su2double arg2_2 = 500.0 * flowNodes->GetLaminarViscosity(iPoint) / (wallDistance*wallDistance * Omega); + + const su2double arg2 = max(arg2_1, arg2_2); + const su2double F2 = tanh(arg2*arg2); + + const su2double k = nut * max(Omega, flowNodes->GetStrainMag(iPoint) * F2 / a1); + + nodes->SetSSTVariables(iPoint, k, Omega); + + // Now compute desired cell size for Scale Resolving Simulations + const su2double Cmu = 0.09; + const su2double RANSLength = sqrt(k) / max(1e-20, (Cmu * Omega)); + const su2double RatioL = 0.1; // it should be less or equal than 0.2 - 0.1. Should be taken as input from config? + const su2double SRSGridSize = RANSLength * RatioL; + nodes->SetSRSGridSize(iPoint, SRSGridSize); + } END_SU2_OMP_FOR diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index e1e9ef644c71..e149df25bd8d 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -236,6 +236,12 @@ void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai nodes->SetmuT(iPoint, muT); + // Now compute desired cell size for Scale Resolving Simulations + const su2double RANSLength = sqrt(nodes->GetSolution(iPoint, 0)) / max(1e-20, (constants[6] * nodes->GetSolution(iPoint, 1))); + const su2double RatioL = 0.1; // it should be less or equal than 0.2 - 0.1. Should be taken as input from config? + const su2double SRSGridSize = RANSLength * RatioL; + nodes->SetSRSGridSize(iPoint, SRSGridSize); + } END_SU2_OMP_FOR @@ -362,6 +368,11 @@ void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta auto residual = numerics->ComputeResidual(config); + /*--- Store the SAS function ---*/ + if (sstParsedOptions.sas) { + nodes->SetFTrans(iPoint, numerics->GetFTrans()); + } + /*--- Store the intermittency ---*/ if (config->GetKind_Trans_Model() != TURB_TRANS_MODEL::NONE) { diff --git a/SU2_CFD/src/variables/CTurbSSTVariable.cpp b/SU2_CFD/src/variables/CTurbSSTVariable.cpp index 9778f1e37cc7..4a477665f234 100644 --- a/SU2_CFD/src/variables/CTurbSSTVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSSTVariable.cpp @@ -51,6 +51,8 @@ CTurbSSTVariable::CTurbSSTVariable(su2double kine, su2double omega, su2double mu CDkw.resize(nPoint) = su2double(0.0); muT.resize(nPoint) = mut; + + if(sstParsedOptions.sas) FTrans.resize(nPoint) = su2double(1.0); } void CTurbSSTVariable::SetBlendingFunc(unsigned long iPoint, su2double val_viscosity, diff --git a/SU2_CFD/src/variables/CTurbVariable.cpp b/SU2_CFD/src/variables/CTurbVariable.cpp index 54bede5033f0..2b2069b35906 100644 --- a/SU2_CFD/src/variables/CTurbVariable.cpp +++ b/SU2_CFD/src/variables/CTurbVariable.cpp @@ -35,4 +35,6 @@ CTurbVariable::CTurbVariable(unsigned long npoint, unsigned long ndim, unsigned turb_index.resize(nPoint) = su2double(1.0); intermittency.resize(nPoint) = su2double(1.0); + SRSGridSize.resize(nPoint) = su2double(0.0); + } From 41cb27e83c1d19b475644f82a639321dacbd27d7 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 15 Sep 2023 16:25:24 +0200 Subject: [PATCH 02/56] - Added a more complex SAS model named SAS_COMPLICATED - Changed previous SAS model to SAS_SIMPLE --- Common/include/option_structure.hpp | 20 +++++- SU2_CFD/include/numerics/CNumerics.hpp | 16 +++++ .../numerics/turbulent/turb_sources.hpp | 47 +++++++++++- .../include/variables/CTurbSSTVariable.hpp | 49 +++++++++++++ SU2_CFD/include/variables/CVariable.hpp | 30 ++++++++ SU2_CFD/src/solvers/CSolver.cpp | 71 +++++++++++++++++++ SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 62 +++++++++++++++- SU2_CFD/src/variables/CTurbSSTVariable.cpp | 7 +- 8 files changed, 296 insertions(+), 6 deletions(-) diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index dabddf8a974f..e00ac40d7dd5 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -990,7 +990,8 @@ enum class SST_OPTIONS { V, /*!< \brief Menter k-w SST model with vorticity production terms. */ KL, /*!< \brief Menter k-w SST model with Kato-Launder production terms. */ UQ, /*!< \brief Menter k-w SST model with uncertainty quantification modifications. */ - SAS, /*!< \brief Menter k-w SST model with Scale Adaptive Simulations modifications. */ + SAS_SIMPLE, /*!< \brief Menter k-w SST model with Scale Adaptive Simulations modifications. */ + SAS_COMPLICATED, /*!< \brief Menter k-w SST model with Scale Adaptive Simulations modifications. */ }; static const MapType SST_Options_Map = { MakePair("NONE", SST_OPTIONS::NONE) @@ -1003,7 +1004,8 @@ static const MapType SST_Options_Map = { MakePair("VORTICITY", SST_OPTIONS::V) MakePair("KATO-LAUNDER", SST_OPTIONS::KL) MakePair("UQ", SST_OPTIONS::UQ) - MakePair("SAS", SST_OPTIONS::SAS) + MakePair("SAS_SIMPLE", SST_OPTIONS::SAS_SIMPLE) + MakePair("SAS_COMPLICATED", SST_OPTIONS::SAS_COMPLICATED) }; /*! @@ -1012,6 +1014,7 @@ static const MapType SST_Options_Map = { struct SST_ParsedOptions { SST_OPTIONS version = SST_OPTIONS::V1994; /*!< \brief Enum SST base model. */ SST_OPTIONS production = SST_OPTIONS::NONE; /*!< \brief Enum for production corrections/modifiers for SST model. */ + SST_OPTIONS sasModel = SST_OPTIONS::SAS_SIMPLE; /*!< \brief Enum SST base model. */ bool sust = false; /*!< \brief Bool for SST model with sustaining terms. */ bool uq = false; /*!< \brief Bool for using uncertainty quantification. */ bool sas = false; /*!< \brief Bool for using Scale Adaptive Simulations. */ @@ -1051,7 +1054,16 @@ inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigne const bool sst_v = IsPresent(SST_OPTIONS::V); const bool sst_kl = IsPresent(SST_OPTIONS::KL); const bool sst_uq = IsPresent(SST_OPTIONS::UQ); - const bool sst_sas = IsPresent(SST_OPTIONS::SAS); + const bool sst_sas_simple = IsPresent(SST_OPTIONS::SAS_SIMPLE); + const bool sst_sas_comp = IsPresent(SST_OPTIONS::SAS_COMPLICATED); + const bool sst_sas = sst_sas_simple || sst_sas_comp; + if (sst_sas_simple && sst_sas_comp) { + SU2_MPI::Error("Two versions (Simple and Complicated) selected for SAS under SST_OPTIONS. Please choose only one.", CURRENT_FUNCTION); + } else if (sst_sas_simple) { + SSTParsedOptions.sasModel = SST_OPTIONS::SAS_SIMPLE; + } else { + SSTParsedOptions.sasModel = SST_OPTIONS::SAS_COMPLICATED; + } if (sst_1994 && sst_2003) { SU2_MPI::Error("Two versions (1994 and 2003) selected for SST_OPTIONS. Please choose only one.", CURRENT_FUNCTION); @@ -2455,6 +2467,7 @@ enum PERIODIC_QUANTITIES { PERIODIC_LIM_PRIM_1 , /*!< \brief Primitive limiter communication phase 1 of 2 (periodic only). */ PERIODIC_LIM_PRIM_2 , /*!< \brief Primitive limiter communication phase 2 of 2 (periodic only). */ PERIODIC_IMPLICIT , /*!< \brief Implicit update communication to ensure consistency across periodic boundaries. */ + PERIODIC_VEL_LAPLACIAN , /*!< \brief Velocity Laplacian communication for SAS (periodic only). */ }; /*! @@ -2486,6 +2499,7 @@ enum MPI_QUANTITIES { MESH_DISPLACEMENTS , /*!< \brief Mesh displacements at the interface. */ SOLUTION_TIME_N , /*!< \brief Solution at time n. */ SOLUTION_TIME_N1 , /*!< \brief Solution at time n-1. */ + VELOCITY_LAPLACIAN , /*!< \brief Velocity Laplacian communication. */ }; /*! diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index e90dae26a231..5b375d05887b 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -191,6 +191,7 @@ class CNumerics { bool bounded_scalar = false; /*!< \brief Flag for bounded scalar problem */ su2double FTrans; /*!< \brief SAS function */ + su2double VelLapl_X, VelLapl_Y, VelLapl_Z; public: /*! @@ -714,6 +715,21 @@ class CNumerics { */ inline virtual su2double GetFTrans() const { return 0.0; } + /*! + * \brief Get the value of the value of FTrans. + */ + inline void SetVelLapl(su2double val_VelLapl_X, su2double val_VelLapl_Y) { + VelLapl_X = val_VelLapl_X; + VelLapl_Y = val_VelLapl_Y; + } + + /*! + * \brief Get the value of the value of FTrans. + */ + inline void SetVelLapl_Z(su2double val_VelLapl_Z) { + VelLapl_Z = val_VelLapl_Z; + } + /*! * \brief Set the value of the effective intermittency for the LM model. * \param[in] intermittency_eff_i - Value of the effective intermittency at point i. diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 1b7d3baed1e2..87e6657e0537 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -849,9 +849,50 @@ class CSourcePieceWise_TurbSST final : public CNumerics { Residual[0] += pk * Volume; Residual[1] += pw * Volume; + /*--- Compute SAS source term. ---*/ + su2double Q_SAS = 0.0; + + if (sstParsedOptions.sas && sstParsedOptions.sasModel == SST_OPTIONS::SAS_COMPLICATED) { + + const su2double KolmConst = 0.41; + const su2double csi2 = 3.51; + const su2double sigma_phi = 2.0/3.0; + const su2double C = 2.0; + const su2double C_s = 0.5; // Honestly I do not know if it is the right one. + const su2double gridSize = pow(Volume, 1.0/3.0); + // Scale of the modeled turbulence + const su2double L = sqrt(ScalarVar_i[0]) / (pow(beta_star, 0.25) * ScalarVar_i[1]); + // Von Karman Length Scale + su2double VelLaplMag = VelLapl_X*VelLapl_X + VelLapl_Y*VelLapl_Y; + if (nDim == 3) VelLaplMag += VelLapl_Z*VelLapl_Z; + const su2double L_vK_1 = KolmConst * StrainMag_i / sqrt(VelLaplMag); + const su2double L_vK_2 = C_s * sqrt(KolmConst * csi2 / (beta_blended/beta_star - alfa_blended)) * gridSize; + const su2double L_vK = max(L_vK_1, L_vK_2); + + su2double gradOmega = 0.0; + for (unsigned short iDim = 0; iDim < nDim; iDim++) + gradOmega += ScalarVar_Grad_i[1][iDim]*ScalarVar_Grad_i[1][iDim]; + + gradOmega /= ScalarVar_i[1]; + + su2double gradTKE = 0.0; + for (unsigned short iDim = 0; iDim < nDim; iDim++) + gradTKE += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; + + gradTKE /= ScalarVar_i[0]; + + const su2double Q_SAS_1 = csi2 * KolmConst * StrainMag_i * StrainMag_i * (L/L_vK) * (L/L_vK); + const su2double Q_SAS_2 = C * (2*ScalarVar_i[0] / sigma_phi) * max(gradOmega, gradTKE); + + Q_SAS = max(Q_SAS_1 - Q_SAS_2, 0.0); + + Residual[1] += Density_i * Q_SAS * Volume; + + } + /*--- Add the dissipation terms to the residuals.---*/ FTrans = 1.0; - if (sstParsedOptions.sas) { + if (sstParsedOptions.sas && sstParsedOptions.sasModel == SST_OPTIONS::SAS_SIMPLE) { FTrans = max(1.0, pow(StrainMag_i / (cTrans * VorticityMag), 2.0)); } Residual[0] -= dk * Volume * FTrans; @@ -871,6 +912,10 @@ class CSourcePieceWise_TurbSST final : public CNumerics { Jacobian_i[0][1] = -beta_star * ScalarVar_i[0] * Volume * FTrans; Jacobian_i[1][0] = 0.0; Jacobian_i[1][1] = -2.0 * beta_blended * ScalarVar_i[1] * Volume; + + if (sstParsedOptions.sas && sstParsedOptions.sasModel == SST_OPTIONS::SAS_COMPLICATED) { + Jacobian_i[0][0] += Q_SAS * Volume / ScalarVar_i[0]; + } } AD::SetPreaccOut(Residual, nVar); diff --git a/SU2_CFD/include/variables/CTurbSSTVariable.hpp b/SU2_CFD/include/variables/CTurbSSTVariable.hpp index 384fe86f95af..5cfe6270569d 100644 --- a/SU2_CFD/include/variables/CTurbSSTVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSSTVariable.hpp @@ -46,6 +46,10 @@ class CTurbSSTVariable final : public CTurbVariable { VectorType CDkw; /*!< \brief Cross-diffusion. */ SST_ParsedOptions sstParsedOptions; VectorType FTrans; + VectorType VelocityLaplacian_X; + VectorType VelocityLaplacian_Y; + VectorType VelocityLaplacian_Z; + public: /*! * \brief Constructor of the class. @@ -101,4 +105,49 @@ class CTurbSSTVariable final : public CTurbVariable { FTrans(iPoint) = val_FTrans; }; + /*! + * \brief Get the value of the FTrans. + */ + inline su2double GetVelLapl_X(unsigned long iPoint) const override { return VelocityLaplacian_X(iPoint); } + + /*! + * \brief Get the value of the FTrans. + */ + inline su2double GetVelLapl_Y(unsigned long iPoint) const override { return VelocityLaplacian_Y(iPoint); } + + /*! + * \brief Get the value of the FTrans. + */ + inline su2double GetVelLapl_Z(unsigned long iPoint) const override { return VelocityLaplacian_Z(iPoint); } + + /*! + * \brief Set the value of the FTrans. + */ + inline void AddVelLapl(unsigned long iPoint, su2double val_VelLapl_X, su2double val_VelLapl_Y) override { + VelocityLaplacian_X(iPoint) += val_VelLapl_X; + VelocityLaplacian_Y(iPoint) += val_VelLapl_Y; + }; + + /*! + * \brief Set the value of the FTrans. + */ + inline void AddVelLapl_Z(unsigned long iPoint, su2double val_VelLapl_Z) override { + VelocityLaplacian_Z(iPoint) += val_VelLapl_Z; + }; + + /*! + * \brief Set the value of the FTrans. + */ + inline void SetVelLapl(unsigned long iPoint, su2double val_VelLapl_X, su2double val_VelLapl_Y) override { + VelocityLaplacian_X(iPoint) = val_VelLapl_X; + VelocityLaplacian_Y(iPoint) = val_VelLapl_Y; + }; + + /*! + * \brief Set the value of the FTrans. + */ + inline void SetVelLapl_Z(unsigned long iPoint, su2double val_VelLapl_Z) override { + VelocityLaplacian_Z(iPoint) = val_VelLapl_Z; + }; + }; diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index 363fad7a7b7f..82fe43caa47a 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -1657,6 +1657,36 @@ class CVariable { */ inline virtual void SetFTrans(unsigned long iPoint, su2double val_FTrans) {} + /*! + * \brief Get the value of the value of FTrans. + */ + inline virtual su2double GetVelLapl_X(unsigned long iPoint) const { return 0.0; } + /*! + * \brief Get the value of the value of FTrans. + */ + inline virtual su2double GetVelLapl_Y(unsigned long iPoint) const { return 0.0; } + /*! + * \brief Get the value of the value of FTrans. + */ + inline virtual su2double GetVelLapl_Z(unsigned long iPoint) const { return 0.0; } + + /*! + * \brief Set the value of the value of FTrans. + */ + inline virtual void AddVelLapl(unsigned long iPoint, su2double val_VelLapl_X, su2double val_VelLapl_Y) {} + /*! + * \brief Set the value of the value of FTrans. + */ + inline virtual void AddVelLapl_Z(unsigned long iPoint, su2double val_VelLapl_Z) {} + /*! + * \brief Set the value of the value of FTrans. + */ + inline virtual void SetVelLapl(unsigned long iPoint, su2double val_VelLapl_X, su2double val_VelLapl_Y) {} + /*! + * \brief Set the value of the value of FTrans. + */ + inline virtual void SetVelLapl_Z(unsigned long iPoint, su2double val_VelLapl_Z) {} + /*! * \brief Get the value of the eddy viscosity. * \return the value of the eddy viscosity. diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index 5cd2fd93425b..a0afe86738e3 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -364,6 +364,7 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, auto *Diff = new su2double[nVar]; auto *Und_Lapl = new su2double[nVar]; + auto *Vel_Lapl = new su2double[nDim]; auto *Sol_Min = new su2double[nPrimVarGrad]; auto *Sol_Max = new su2double[nPrimVarGrad]; auto *rotPrim_i = new su2double[nPrimVar]; @@ -969,6 +970,58 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, } break; + case PERIODIC_VEL_LAPLACIAN: + + /*--- For JST, the undivided Laplacian must be computed + consistently by using the complete control volume info + from both sides of the periodic face. ---*/ + + for (iDim = 0; iDim < nDim; iDim++) + Vel_Lapl[iDim] = 0.0; + + for (auto jPoint : geometry->nodes->GetPoints(iPoint)) { + + /*--- Avoid periodic boundary points so that we do not + duplicate edges on both sides of the periodic BC. ---*/ + + if (!geometry->nodes->GetPeriodicBoundary(jPoint)) { + + /*--- Solution differences ---*/ + const su2double distance = GeometryToolbox::Distance(nDim, base_nodes->GetMesh_Coord(iPoint), base_nodes->GetMesh_Coord(jPoint)); + + for (iDim = 0; iDim < nDim; iDim++) + Diff[iDim] = (base_nodes->GetVelocity(iPoint, iDim) - + base_nodes->GetVelocity(jPoint, iDim))/distance; + + + boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint); + boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint); + + /*--- Both points inside the domain, or both in the boundary ---*/ + /*--- iPoint inside the domain, jPoint on the boundary ---*/ + + if (!boundary_i || boundary_j) { + if (geometry->nodes->GetDomain(iPoint)){ + for (iDim = 0; iDim< nDim; iDim++) + Vel_Lapl[iDim] -= Diff[iDim]; + } + } + } + } + + /*--- Store the components to be communicated in the buffer. ---*/ + + for (iDim = 0; iDim < nDim; iDim++) + bufDSend[buf_offset+iDim] = Vel_Lapl[iDim]; + + /*--- Rotate the momentum components of the Laplacian. ---*/ + + if (rotate_periodic) { + Rotate(zeros, &Vel_Lapl[0], &bufDSend[buf_offset+0]); + } + + break; + default: SU2_MPI::Error("Unrecognized quantity for periodic communication.", @@ -1291,6 +1344,15 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, limiter(iPoint, iVar) = min(limiter(iPoint, iVar), bufDRecv[buf_offset+iVar]); break; + case PERIODIC_VEL_LAPLACIAN: + + /*--- Adjust the undivided Laplacian. The accumulation was + with a subtraction before communicating, so now just add. ---*/ + + base_nodes->AddVelLapl(iPoint, bufDRecv[buf_offset+0], bufDRecv[buf_offset+1]); + if(nDim == 3) base_nodes->AddVelLapl_Z(iPoint, bufDRecv[buf_offset+2]); + + break; default: @@ -1529,6 +1591,11 @@ void CSolver::InitiateComms(CGeometry *geometry, for (iVar = 0; iVar < nVar; iVar++) bufDSend[buf_offset+iVar] = base_nodes->GetSolution_time_n1(iPoint, iVar); break; + case VELOCITY_LAPLACIAN: + bufDSend[buf_offset+0] = base_nodes->GetVelLapl_X(iPoint); + bufDSend[buf_offset+1] = base_nodes->GetVelLapl_Y(iPoint); + if(nDim == 3) bufDSend[buf_offset+2] = base_nodes->GetVelLapl_Z(iPoint); + break; default: SU2_MPI::Error("Unrecognized quantity for point-to-point MPI comms.", CURRENT_FUNCTION); @@ -1677,6 +1744,10 @@ void CSolver::CompleteComms(CGeometry *geometry, for (iVar = 0; iVar < nVar; iVar++) base_nodes->Set_Solution_time_n1(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; + case VELOCITY_LAPLACIAN: + base_nodes->SetVelLapl(iPoint, bufDRecv[buf_offset+0], bufDRecv[buf_offset+1]); + if(nDim == 3) base_nodes->SetVelLapl_Z(iPoint, bufDRecv[buf_offset+2]); + break; default: SU2_MPI::Error("Unrecognized quantity for point-to-point MPI comms.", CURRENT_FUNCTION); diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index e149df25bd8d..b65ee9136867 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -190,6 +190,61 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain /*--- Upwind second order reconstruction and gradients ---*/ CommonPreprocessing(geometry, config, Output); + + if (sstParsedOptions.sas && sstParsedOptions.sasModel == SST_OPTIONS::SAS_COMPLICATED){ + auto* flowNodes = su2staticcast_p(solver_container[FLOW_SOL]->GetNodes()); + + SU2_OMP_FOR_DYN(256) + for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) { + + const bool boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint); + + /*--- Initialize. ---*/ + nodes->SetVelLapl(iPoint, 0.0, 0.0); + if (nDim == 3) { + nodes->SetVelLapl_Z(iPoint, 0.0); + } + + /*--- Loop over the neighbors of point i. ---*/ + for (auto jPoint : geometry->nodes->GetPoints(iPoint)) { + + bool boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint); + + /*--- If iPoint is boundary it only takes contributions from other boundary points. ---*/ + if (boundary_i && !boundary_j) continue; + + /*--- Add solution differences, with correction for compressible flows which use the enthalpy. ---*/ + const su2double distance = GeometryToolbox::Distance(nDim, nodes->GetMesh_Coord(iPoint), nodes->GetMesh_Coord(jPoint)); + + const su2double delta_x = (flowNodes->GetVelocity(jPoint,0)-flowNodes->GetVelocity(iPoint,0))/distance; + const su2double delta_y = (flowNodes->GetVelocity(jPoint,1)-flowNodes->GetVelocity(iPoint,1))/distance; + + nodes->AddVelLapl(iPoint, delta_x, delta_y); + if (nDim == 3) { + const su2double delta_z = (flowNodes->GetVelocity(jPoint,2)-flowNodes->GetVelocity(iPoint,2))/distance; + nodes->AddVelLapl_Z(iPoint, delta_z); + } + + } + + + } + END_SU2_OMP_FOR + + /*--- Correct the Laplacian across any periodic boundaries. ---*/ + + for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { + InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_VEL_LAPLACIAN); + CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_VEL_LAPLACIAN); + } + + /*--- MPI parallelization ---*/ + + InitiateComms(geometry, config, VELOCITY_LAPLACIAN); + CompleteComms(geometry, config, VELOCITY_LAPLACIAN); + + } + } void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_container, @@ -364,12 +419,17 @@ void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(iPoint)); } + if (sstParsedOptions.sas && sstParsedOptions.sasModel == SST_OPTIONS::SAS_COMPLICATED){ + numerics->SetVelLapl(nodes->GetVelLapl_X(iPoint), nodes->GetVelLapl_Y(iPoint)); + if (nDim == 3) numerics->SetVelLapl_Z(nodes->GetVelLapl_Z(iPoint)); + } + /*--- Compute the source term ---*/ auto residual = numerics->ComputeResidual(config); /*--- Store the SAS function ---*/ - if (sstParsedOptions.sas) { + if (sstParsedOptions.sas && sstParsedOptions.sasModel == SST_OPTIONS::SAS_SIMPLE) { nodes->SetFTrans(iPoint, numerics->GetFTrans()); } diff --git a/SU2_CFD/src/variables/CTurbSSTVariable.cpp b/SU2_CFD/src/variables/CTurbSSTVariable.cpp index 4a477665f234..a8ca6b18cf7b 100644 --- a/SU2_CFD/src/variables/CTurbSSTVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSSTVariable.cpp @@ -52,7 +52,12 @@ CTurbSSTVariable::CTurbSSTVariable(su2double kine, su2double omega, su2double mu muT.resize(nPoint) = mut; - if(sstParsedOptions.sas) FTrans.resize(nPoint) = su2double(1.0); + if(sstParsedOptions.sas && sstParsedOptions.sasModel == SST_OPTIONS::SAS_SIMPLE) FTrans.resize(nPoint) = su2double(1.0); + if(sstParsedOptions.sas && sstParsedOptions.sasModel == SST_OPTIONS::SAS_COMPLICATED) { + VelocityLaplacian_X.resize(nPoint) = su2double(0.0); + VelocityLaplacian_Y.resize(nPoint) = su2double(0.0); + if (nDim == 3) VelocityLaplacian_Z.resize(nPoint) = su2double(0.0); + } } void CTurbSSTVariable::SetBlendingFunc(unsigned long iPoint, su2double val_viscosity, From a6be2cf6d44d88449e71a71b826c028f58458ef2 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 15 Sep 2023 17:53:45 +0200 Subject: [PATCH 03/56] - Fixed getting coordinates of points - Fixed DataType for Periodic Comms --- SU2_CFD/src/output/CFlowOutput.cpp | 4 ++-- SU2_CFD/src/solvers/CSolver.cpp | 11 ++++++++++- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 3 ++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index bf9d989d2021..dc9263576278 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1250,7 +1250,7 @@ void CFlowOutput::SetVolumeOutputFieldsScalarSolution(const CConfig* config){ AddVolumeOutput("TKE", "Turb_Kin_Energy", "SOLUTION", "Turbulent kinetic energy"); AddVolumeOutput("DISSIPATION", "Omega", "SOLUTION", "Rate of dissipation"); AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "SOLUTION", "desired grid size for Scale Resolving Simulations"); - if (config->GetSSTParsedOptions().sas) AddVolumeOutput("FTRANS", "FTrans", "SOLUTION", "value of FTrans for SAS simulation"); + if (config->GetSSTParsedOptions().sas && config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_SIMPLE) AddVolumeOutput("FTRANS", "FTrans", "SOLUTION", "value of FTrans for SAS simulation"); break; case TURB_FAMILY::NONE: @@ -1531,7 +1531,7 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con SetVolumeOutputValue("RES_TKE", iPoint, turb_solver->LinSysRes(iPoint, 0)); SetVolumeOutputValue("RES_DISSIPATION", iPoint, turb_solver->LinSysRes(iPoint, 1)); SetVolumeOutputValue("SRS_GRID_SIZE", iPoint, Node_Turb->GetSRSGridSize(iPoint)); - if (config->GetSSTParsedOptions().sas) SetVolumeOutputValue("FTRANS", iPoint, Node_Turb->GetFTrans(iPoint)); + if (config->GetSSTParsedOptions().sas && config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_SIMPLE) SetVolumeOutputValue("FTRANS", iPoint, Node_Turb->GetFTrans(iPoint)); if (limiter) { SetVolumeOutputValue("LIMITER_TKE", iPoint, Node_Turb->GetLimiter(iPoint, 0)); SetVolumeOutputValue("LIMITER_DISSIPATION", iPoint, Node_Turb->GetLimiter(iPoint, 1)); diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index a0afe86738e3..dae8335567bc 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -276,6 +276,11 @@ void CSolver::GetPeriodicCommCountAndType(const CConfig* config, MPI_TYPE = COMM_TYPE_DOUBLE; ICOUNT = nVar; break; + case PERIODIC_VEL_LAPLACIAN: + COUNT_PER_POINT = nDim; + MPI_TYPE = COMM_TYPE_DOUBLE; + ICOUNT = nDim; + break; default: SU2_MPI::Error("Unrecognized quantity for periodic communication.", CURRENT_FUNCTION); @@ -987,7 +992,7 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, if (!geometry->nodes->GetPeriodicBoundary(jPoint)) { /*--- Solution differences ---*/ - const su2double distance = GeometryToolbox::Distance(nDim, base_nodes->GetMesh_Coord(iPoint), base_nodes->GetMesh_Coord(jPoint)); + const su2double distance = GeometryToolbox::Distance(nDim, geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(jPoint)); for (iDim = 0; iDim < nDim; iDim++) Diff[iDim] = (base_nodes->GetVelocity(iPoint, iDim) - @@ -1442,6 +1447,10 @@ void CSolver::GetCommCountAndType(const CConfig* config, COUNT_PER_POINT = nVar; MPI_TYPE = COMM_TYPE_DOUBLE; break; + case VELOCITY_LAPLACIAN: + COUNT_PER_POINT = nDim; + MPI_TYPE = COMM_TYPE_DOUBLE; + break; default: SU2_MPI::Error("Unrecognized quantity for point-to-point MPI comms.", CURRENT_FUNCTION); diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index b65ee9136867..da08a8f4903b 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -28,6 +28,7 @@ #include "../../include/solvers/CTurbSSTSolver.hpp" #include "../../include/variables/CTurbSSTVariable.hpp" #include "../../include/variables/CFlowVariable.hpp" +#include "../../include/variables/CMeshVariable.hpp" #include "../../../Common/include/parallelization/omp_structure.hpp" #include "../../../Common/include/toolboxes/geometry_toolbox.hpp" @@ -214,7 +215,7 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain if (boundary_i && !boundary_j) continue; /*--- Add solution differences, with correction for compressible flows which use the enthalpy. ---*/ - const su2double distance = GeometryToolbox::Distance(nDim, nodes->GetMesh_Coord(iPoint), nodes->GetMesh_Coord(jPoint)); + const su2double distance = GeometryToolbox::Distance(nDim, geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(jPoint)); const su2double delta_x = (flowNodes->GetVelocity(jPoint,0)-flowNodes->GetVelocity(iPoint,0))/distance; const su2double delta_y = (flowNodes->GetVelocity(jPoint,1)-flowNodes->GetVelocity(iPoint,1))/distance; From d1f4db63260f1eab2e71cda6c87352e160b0bdc1 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Tue, 19 Sep 2023 18:59:50 +0200 Subject: [PATCH 04/56] - Added output of laplacian --- SU2_CFD/src/output/CFlowOutput.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index dc9263576278..2caa44a4ae62 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1251,6 +1251,11 @@ void CFlowOutput::SetVolumeOutputFieldsScalarSolution(const CConfig* config){ AddVolumeOutput("DISSIPATION", "Omega", "SOLUTION", "Rate of dissipation"); AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "SOLUTION", "desired grid size for Scale Resolving Simulations"); if (config->GetSSTParsedOptions().sas && config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_SIMPLE) AddVolumeOutput("FTRANS", "FTrans", "SOLUTION", "value of FTrans for SAS simulation"); + if (config->GetSSTParsedOptions().sas && config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_COMPLICATED){ + AddVolumeOutput("VEL_LAPLACIAN_X", "Vel Laplacian x", "SOLUTION", "value of laplacian of velocity for SAS simulation"); + AddVolumeOutput("VEL_LAPLACIAN_Y", "Vel Laplacian y", "SOLUTION", "value of laplacian of velocity for SAS simulation"); + if (nDim == 3) AddVolumeOutput("VEL_LAPLACIAN_Z", "Vel Laplacian z", "SOLUTION", "value of laplacian of velocity for SAS simulation"); + } break; case TURB_FAMILY::NONE: @@ -1532,6 +1537,11 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con SetVolumeOutputValue("RES_DISSIPATION", iPoint, turb_solver->LinSysRes(iPoint, 1)); SetVolumeOutputValue("SRS_GRID_SIZE", iPoint, Node_Turb->GetSRSGridSize(iPoint)); if (config->GetSSTParsedOptions().sas && config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_SIMPLE) SetVolumeOutputValue("FTRANS", iPoint, Node_Turb->GetFTrans(iPoint)); + if (config->GetSSTParsedOptions().sas && config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_COMPLICATED){ + SetVolumeOutputValue("VEL_LAPLACIAN_X", iPoint, Node_Turb->GetVelLapl_X(iPoint)); + SetVolumeOutputValue("VEL_LAPLACIAN_Y", iPoint, Node_Turb->GetVelLapl_Y(iPoint)); + if (nDim == 3) SetVolumeOutputValue("VEL_LAPLACIAN_Z", iPoint, Node_Turb->GetVelLapl_Z(iPoint)); + } if (limiter) { SetVolumeOutputValue("LIMITER_TKE", iPoint, Node_Turb->GetLimiter(iPoint, 0)); SetVolumeOutputValue("LIMITER_DISSIPATION", iPoint, Node_Turb->GetLimiter(iPoint, 1)); From 35958b82fa9fa7345ea993c3250929bc89313649 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Tue, 19 Sep 2023 19:16:08 +0200 Subject: [PATCH 05/56] - Fixed missing variable initialization for CTurbSAVariable --- SU2_CFD/src/variables/CTurbSAVariable.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SU2_CFD/src/variables/CTurbSAVariable.cpp b/SU2_CFD/src/variables/CTurbSAVariable.cpp index 454ce5734a83..7e0e24756a0a 100644 --- a/SU2_CFD/src/variables/CTurbSAVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSAVariable.cpp @@ -48,6 +48,9 @@ CTurbSAVariable::CTurbSAVariable(su2double val_nu_tilde, su2double val_muT, unsi DES_LengthScale.resize(nPoint) = su2double(0.0); Vortex_Tilting.resize(nPoint); + + k.resize(nPoint) = su2double(0.0); + Omega.resize(nPoint) = su2double(0.0); } void CTurbSAVariable::SetVortex_Tilting(unsigned long iPoint, CMatrixView PrimGrad_Flow, From 09e977f35dd781bf6737d3b8e2a15c7bd14f440a Mon Sep 17 00:00:00 2001 From: rois1995 Date: Thu, 5 Oct 2023 18:13:05 +0200 Subject: [PATCH 06/56] - Added DES implementations to SST: DDES, Improved DDES (IDDES), Simplified IDDES (SIDDES) --- Common/include/option_structure.hpp | 8 +- SU2_CFD/include/numerics/CNumerics.hpp | 12 ++ .../numerics/turbulent/turb_sources.hpp | 3 + SU2_CFD/include/solvers/CTurbSSTSolver.hpp | 10 ++ SU2_CFD/include/variables/CTurbSAVariable.hpp | 14 --- .../include/variables/CTurbSSTVariable.hpp | 1 + SU2_CFD/include/variables/CTurbVariable.hpp | 14 +++ SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 118 ++++++++++++++++++ SU2_CFD/src/variables/CTurbSAVariable.cpp | 1 - SU2_CFD/src/variables/CTurbVariable.cpp | 2 + 10 files changed, 167 insertions(+), 16 deletions(-) diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 5fe8228925e9..96d7b55aa38c 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -1380,7 +1380,10 @@ enum ENUM_HYBRIDRANSLES { SA_DES = 1, /*!< \brief Kind of Hybrid RANS/LES (SA - Detached Eddy Simulation (DES)). */ SA_DDES = 2, /*!< \brief Kind of Hybrid RANS/LES (SA - Delayed DES (DDES) with Delta_max SGS ). */ SA_ZDES = 3, /*!< \brief Kind of Hybrid RANS/LES (SA - Delayed DES (DDES) with Vorticity based SGS like Zonal DES). */ - SA_EDDES = 4 /*!< \brief Kind of Hybrid RANS/LES (SA - Delayed DES (DDES) with Shear Layer Adapted SGS: Enhanced DDES). */ + SA_EDDES = 4, /*!< \brief Kind of Hybrid RANS/LES (SA - Delayed DES (DDES) with Shear Layer Adapted SGS: Enhanced DDES). */ + SST_DDES = 5, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): DDES). */ + SST_IDDES = 6, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Improved DDES). */ + SST_SIDDES = 7 /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Simplified Improved DDES). */ }; static const MapType HybridRANSLES_Map = { MakePair("NONE", NO_HYBRIDRANSLES) @@ -1388,6 +1391,9 @@ static const MapType HybridRANSLES_Map = { MakePair("SA_DDES", SA_DDES) MakePair("SA_ZDES", SA_ZDES) MakePair("SA_EDDES", SA_EDDES) + MakePair("SST_DDES", SST_DDES) + MakePair("SST_IDDES", SST_IDDES) + MakePair("SST_SIDDES", SST_SIDDES) }; /*! diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index 14088f021cd6..ffa7f1dec44c 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -190,6 +190,8 @@ class CNumerics { bool bounded_scalar = false; /*!< \brief Flag for bounded scalar problem */ + su2double lengthScale_i, lengthScale_j; + public: /*! * \brief Return type used in some "ComputeResidual" overloads to give a @@ -828,6 +830,16 @@ class CNumerics { dist_j = val_dist_j; } + /*! + * \brief Set the value of the length scale for SST. + * \param[in] val_lengthScale_i - Value of of the length scale for SST from point i. + * \param[in] val_lengthScale_j - Value of of the length scale for SST from point j. + */ + void SetLengthScale(su2double val_lengthScale_i, su2double val_lengthScale_j) { + lengthScale_i = val_lengthScale_i; + lengthScale_j = val_lengthScale_j; + } + /*! * \brief Set the value of the roughness from the nearest wall. * \param[in] val_dist_i - Value of of the roughness of the nearest wall from point i diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index af920cd34c1e..83d0ca9dfae3 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -834,6 +834,9 @@ class CSourcePieceWise_TurbSST final : public CNumerics { /*--- Dissipation ---*/ su2double dk = beta_star * Density_i * ScalarVar_i[1] * ScalarVar_i[0]; + if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES) + dk = Density_i * sqrt(ScalarVar_i[0]*ScalarVar_i[0]*ScalarVar_i[0]) / lengthScale_i; + su2double dw = beta_blended * Density_i * ScalarVar_i[1] * ScalarVar_i[1]; /*--- LM model coupling with production and dissipation term for k transport equation---*/ diff --git a/SU2_CFD/include/solvers/CTurbSSTSolver.hpp b/SU2_CFD/include/solvers/CTurbSSTSolver.hpp index 6dbed05fd9d1..aceaa94beef9 100644 --- a/SU2_CFD/include/solvers/CTurbSSTSolver.hpp +++ b/SU2_CFD/include/solvers/CTurbSSTSolver.hpp @@ -54,6 +54,16 @@ class CTurbSSTSolver final : public CTurbSolver { const CConfig *config, unsigned short val_marker); + /*! + * \brief A virtual member. + * \param[in] solver - Solver container + * \param[in] geometry - Geometrical definition. + * \param[in] config - Definition of the particular problem. + */ + void SetDES_LengthScale(CSolver** solver, + CGeometry *geometry, + CConfig *config); + public: /*! * \brief Constructor. diff --git a/SU2_CFD/include/variables/CTurbSAVariable.hpp b/SU2_CFD/include/variables/CTurbSAVariable.hpp index 569e416fa159..6a19003da020 100644 --- a/SU2_CFD/include/variables/CTurbSAVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSAVariable.hpp @@ -39,7 +39,6 @@ class CTurbSAVariable final : public CTurbVariable { private: - VectorType DES_LengthScale; VectorType Vortex_Tilting; public: @@ -60,19 +59,6 @@ class CTurbSAVariable final : public CTurbVariable { */ ~CTurbSAVariable() override = default; - /*! - * \brief Get the DES length scale - * \param[in] iPoint - Point index. - * \return Value of the DES length Scale. - */ - inline su2double GetDES_LengthScale(unsigned long iPoint) const override { return DES_LengthScale(iPoint); } - - /*! - * \brief Set the DES Length Scale. - * \param[in] iPoint - Point index. - */ - inline void SetDES_LengthScale(unsigned long iPoint, su2double val_des_lengthscale) override { DES_LengthScale(iPoint) = val_des_lengthscale; } - /*! * \brief Set the vortex tilting measure for computation of the EDDES length scale * \param[in] iPoint - Point index. diff --git a/SU2_CFD/include/variables/CTurbSSTVariable.hpp b/SU2_CFD/include/variables/CTurbSSTVariable.hpp index 0113a0ead3ad..469679eb6bd3 100644 --- a/SU2_CFD/include/variables/CTurbSSTVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSSTVariable.hpp @@ -87,4 +87,5 @@ class CTurbSSTVariable final : public CTurbVariable { * \brief Get the value of the cross diffusion of tke and omega. */ inline su2double GetCrossDiff(unsigned long iPoint) const override { return CDkw(iPoint); } + }; diff --git a/SU2_CFD/include/variables/CTurbVariable.hpp b/SU2_CFD/include/variables/CTurbVariable.hpp index 1a476fdac70e..1196030b7380 100644 --- a/SU2_CFD/include/variables/CTurbVariable.hpp +++ b/SU2_CFD/include/variables/CTurbVariable.hpp @@ -38,6 +38,7 @@ class CTurbVariable : public CScalarVariable { protected: VectorType muT; /*!< \brief Eddy viscosity. */ + VectorType DES_LengthScale; public: static constexpr size_t MAXNVAR = 2; @@ -100,5 +101,18 @@ class CTurbVariable : public CScalarVariable { */ inline void SetIntermittency(unsigned long iPoint, su2double val_intermittency) final { intermittency(iPoint) = val_intermittency; } + /*! + * \brief Get the DES length scale + * \param[in] iPoint - Point index. + * \return Value of the DES length Scale. + */ + inline su2double GetDES_LengthScale(unsigned long iPoint) const override { return DES_LengthScale(iPoint); } + + /*! + * \brief Set the DES Length Scale. + * \param[in] iPoint - Point index. + */ + inline void SetDES_LengthScale(unsigned long iPoint, su2double val_des_lengthscale) override { DES_LengthScale(iPoint) = val_des_lengthscale; } + }; diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index e1e9ef644c71..dc68a2437635 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -188,8 +188,19 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) { SU2_OMP_SAFE_GLOBAL_ACCESS(config->SetGlobalParam(config->GetKind_Solver(), RunTime_EqSystem);) + const auto kind_hybridRANSLES = config->GetKind_HybridRANSLES(); + /*--- Upwind second order reconstruction and gradients ---*/ CommonPreprocessing(geometry, config, Output); + + if (kind_hybridRANSLES != NO_HYBRIDRANSLES) { + + /*--- Compute the DES length scale ---*/ + + SetDES_LengthScale(solver_container, geometry, config); + + } + } void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_container, @@ -358,6 +369,10 @@ void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(iPoint)); } + if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES) { + numerics->SetLengthScale(nodes->GetDES_LengthScale(iPoint), 0.0); + } + /*--- Compute the source term ---*/ auto residual = numerics->ComputeResidual(config); @@ -1060,3 +1075,106 @@ void CTurbSSTSolver::SetUniformInlet(const CConfig* config, unsigned short iMark } } + + +void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CConfig *config){ + + const auto kind_hybridRANSLES = config->GetKind_HybridRANSLES(); + + + auto* flowNodes = su2staticcast_p(solver[FLOW_SOL]->GetNodes()); + + SU2_OMP_FOR_STAT(omp_chunk_size) + for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++){ + const su2double StrainMag = max(flowNodes->GetStrainMag(iPoint), 1e-12); + const su2double VortMag = max(GeometryToolbox::Norm(3, flowNodes->GetVorticity(iPoint)), 1e-12); + + const su2double KolmConst2 = 0.41*0.41; + const su2double wallDist2 = geometry->nodes->GetWall_Distance(iPoint)*geometry->nodes->GetWall_Distance(iPoint); + + const su2double eddyVisc = nodes->GetmuT(iPoint)/flowNodes->GetDensity(iPoint); + const su2double lamVisc = nodes->GetLaminarViscosity(iPoint)/flowNodes->GetDensity(iPoint); + + const su2double C_DES1 = 0.78; + const su2double C_DES2 = 0.61; + + const su2double h_max = geometry->nodes->GetMaxLength(iPoint); + const su2double C_DES = C_DES1 * nodes->GetF1blending(iPoint) + C_DES2 * (1-nodes->GetF1blending(iPoint)); + const su2double l_RANS = sqrt(nodes->GetSolution(iPoint, 0)) / (constants[6] * nodes->GetSolution(iPoint, 1)); + + su2double DES_lengthScale = 0.0; + + switch(kind_hybridRANSLES){ + case SST_DDES: { + + const su2double r_d = (eddyVisc + lamVisc) / (KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))); + const su2double C_d1 = 20.0; + const su2double C_d2 = 3.0; + + const su2double f_d = 1 - tanh(pow(C_d1 * r_d, C_d2)); + + const su2double l_LES = C_DES * h_max; + + DES_lengthScale = l_RANS - f_d * max(0.0, l_RANS - l_LES); + + break; + } + case SST_IDDES: { + + // Constants + const su2double C_w = 0.15; + const su2double C_dt1 = 20.0; + const su2double C_dt2 = 3.0; + const su2double C_l = 5.0; + const su2double C_t = 1.87; + + const su2double alpha = 0.25 - sqrt(wallDist2) / h_max; + const su2double f_b = min(2.0 * exp(-9.0 * alpha*alpha), 1.0); + const su2double r_dt = eddyVisc / (KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))); + const su2double f_dt = 1 - tanh(pow(C_dt1 * r_dt, C_dt2)); + const su2double ftilda_d = max(1.0 - f_dt, f_b); + + const su2double r_dl = lamVisc / (KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))); + const su2double f_l = tanh(pow(C_l*C_l*r_dl, 10.0)); + const su2double f_t = tanh(pow(C_t*C_t*r_dt, 3.0)); + const su2double f_e2 = 1.0 - max(f_t, f_l); + const su2double f_e1 = alpha >= 0 ? 2.0 * exp(-11.09*alpha*alpha) : 2.0 * exp(-9.0*alpha*alpha); + const su2double f_e = f_e2 * max((f_e1 - 1.0), 0.0); + + + const su2double Delta = min(C_w * max(sqrt(wallDist2), h_max), h_max); + const su2double l_LES = C_DES * Delta; + + DES_lengthScale = ftilda_d *(1.0+f_e)*l_RANS + (1.0 - ftilda_d) * l_LES; + + break; + } + case SST_SIDDES: { + + // Constants + const su2double C_w = 0.15; + const su2double C_dt1 = 20.0; + const su2double C_dt2 = 3.0; + const su2double C_l = 5.0; + const su2double C_t = 1.87; + + const su2double alpha = 0.25 - sqrt(wallDist2) / h_max; + const su2double f_b = min(2.0 * exp(-9.0 * alpha*alpha), 1.0); + const su2double r_dt = eddyVisc / (KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))); + const su2double f_dt = 1 - tanh(pow(C_dt1 * r_dt, C_dt2)); + const su2double ftilda_d = max(1.0 - f_dt, f_b); + + const su2double Delta = min(C_w * max(sqrt(wallDist2), h_max), h_max); + const su2double l_LES = C_DES * Delta; + + DES_lengthScale = ftilda_d*l_RANS + (1.0 - ftilda_d) * l_LES; + + break; + } + } + + nodes->SetDES_LengthScale(iPoint, DES_lengthScale); + + } + END_SU2_OMP_FOR +} diff --git a/SU2_CFD/src/variables/CTurbSAVariable.cpp b/SU2_CFD/src/variables/CTurbSAVariable.cpp index 454ce5734a83..b8335969ca1f 100644 --- a/SU2_CFD/src/variables/CTurbSAVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSAVariable.cpp @@ -46,7 +46,6 @@ CTurbSAVariable::CTurbSAVariable(su2double val_nu_tilde, su2double val_muT, unsi Solution_time_n1 = Solution; } - DES_LengthScale.resize(nPoint) = su2double(0.0); Vortex_Tilting.resize(nPoint); } diff --git a/SU2_CFD/src/variables/CTurbVariable.cpp b/SU2_CFD/src/variables/CTurbVariable.cpp index 54bede5033f0..e905de5205a5 100644 --- a/SU2_CFD/src/variables/CTurbVariable.cpp +++ b/SU2_CFD/src/variables/CTurbVariable.cpp @@ -35,4 +35,6 @@ CTurbVariable::CTurbVariable(unsigned long npoint, unsigned long ndim, unsigned turb_index.resize(nPoint) = su2double(1.0); intermittency.resize(nPoint) = su2double(1.0); + DES_LengthScale.resize(nPoint) = su2double(0.0); + } From 8c8e89da6f5d6a36a48e5ab967bbdf4f4d226f17 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Thu, 5 Oct 2023 22:22:13 +0200 Subject: [PATCH 07/56] - Added SST DDES in config --- Common/src/CConfig.cpp | 3 +++ SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 2e8788fbe235..ffb186d04879 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -6157,6 +6157,9 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) { case SA_DDES: cout << "Delayed Detached Eddy Simulation (DDES) with Standard SGS" << endl; break; case SA_ZDES: cout << "Delayed Detached Eddy Simulation (DDES) with Vorticity-based SGS" << endl; break; case SA_EDDES: cout << "Delayed Detached Eddy Simulation (DDES) with Shear-layer Adapted SGS" << endl; break; + case SST_DDES: cout << "Delayed Detached Eddy Simulation (DDES) with Shear-layer Adapted SGS" << endl; break; + case SST_IDDES: cout << "Delayed Detached Eddy Simulation (DDES) with Shear-layer Adapted SGS" << endl; break; + case SST_SIDDES: cout << "Delayed Detached Eddy Simulation (DDES) with Shear-layer Adapted SGS" << endl; break; } break; case MAIN_SOLVER::NEMO_EULER: diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index dc68a2437635..871dde715557 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -1081,11 +1081,11 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C const auto kind_hybridRANSLES = config->GetKind_HybridRANSLES(); - auto* flowNodes = su2staticcast_p(solver[FLOW_SOL]->GetNodes()); SU2_OMP_FOR_STAT(omp_chunk_size) for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++){ + const su2double StrainMag = max(flowNodes->GetStrainMag(iPoint), 1e-12); const su2double VortMag = max(GeometryToolbox::Norm(3, flowNodes->GetVorticity(iPoint)), 1e-12); @@ -1138,7 +1138,7 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C const su2double f_l = tanh(pow(C_l*C_l*r_dl, 10.0)); const su2double f_t = tanh(pow(C_t*C_t*r_dt, 3.0)); const su2double f_e2 = 1.0 - max(f_t, f_l); - const su2double f_e1 = alpha >= 0 ? 2.0 * exp(-11.09*alpha*alpha) : 2.0 * exp(-9.0*alpha*alpha); + const su2double f_e1 = alpha >= 0.0 ? 2.0 * exp(-11.09*alpha*alpha) : 2.0 * exp(-9.0*alpha*alpha); const su2double f_e = f_e2 * max((f_e1 - 1.0), 0.0); From 71ac9c497a1117c6e2efdae2652ef3934a968a82 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Tue, 10 Oct 2023 18:01:55 +0200 Subject: [PATCH 08/56] - Added Debug quantities --- .../include/variables/CTurbSSTVariable.hpp | 39 +++++++++++++++++++ SU2_CFD/include/variables/CVariable.hpp | 19 +++++++++ SU2_CFD/src/output/CFlowOutput.cpp | 34 ++++++++++++++++ SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 6 +++ SU2_CFD/src/variables/CTurbSSTVariable.cpp | 7 ++++ 5 files changed, 105 insertions(+) diff --git a/SU2_CFD/include/variables/CTurbSSTVariable.hpp b/SU2_CFD/include/variables/CTurbSSTVariable.hpp index 469679eb6bd3..3e958314bb8f 100644 --- a/SU2_CFD/include/variables/CTurbSSTVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSSTVariable.hpp @@ -45,6 +45,13 @@ class CTurbSSTVariable final : public CTurbVariable { VectorType F2; /*!< \brief Menter blending function for blending of k-w and k-eps. */ VectorType CDkw; /*!< \brief Cross-diffusion. */ SST_ParsedOptions sstParsedOptions; + + VectorType ftilda_d; + VectorType l_RANS; + VectorType l_LES; + VectorType r_dl; + VectorType r_dt; + VectorType r_d; public: /*! * \brief Constructor of the class. @@ -88,4 +95,36 @@ class CTurbSSTVariable final : public CTurbVariable { */ inline su2double GetCrossDiff(unsigned long iPoint) const override { return CDkw(iPoint); } + /*! + * \brief Set the DES Length Scale. + * \param[in] iPoint - Point index. + */ + inline void SetDebug_Quantities(CConfig *config, unsigned long iPoint, su2double val_ftilda_d, su2double val_l_RANS, su2double val_l_LES, su2double val_r_d) override { + ftilda_d(iPoint) = val_ftilda_d; + l_RANS(iPoint) = val_l_RANS; + l_LES(iPoint) = val_l_LES; + + if ( config->GetKind_HybridRANSLES() == SST_DDES) + r_d(iPoint) = val_r_d; + else + r_dt(iPoint) = val_r_d; + } + + inline void SetDebug_Quantities(CConfig *config, unsigned long iPoint, su2double val_ftilda_d, su2double val_l_RANS, su2double val_l_LES, su2double val_r_dl, su2double val_r_dt) override { + ftilda_d(iPoint) = val_ftilda_d; + l_RANS(iPoint) = val_l_RANS; + l_LES(iPoint) = val_l_LES; + r_dt(iPoint) = val_r_dt; + r_dl(iPoint) = val_r_dl; + } + + inline su2double Get_L_RANS(unsigned long iPoint) const override { return l_RANS(iPoint); } + inline su2double Get_L_LES(unsigned long iPoint) const override { return l_LES(iPoint); } + inline su2double Get_ftilda_d(unsigned long iPoint) const override { return ftilda_d(iPoint); } + inline su2double Get_r_dt(unsigned long iPoint) const override { return r_dt(iPoint); } + inline su2double Get_r_dl(unsigned long iPoint) const override { return r_dl(iPoint); } + inline su2double Get_r_d(unsigned long iPoint) const override { return r_d(iPoint); } + + + }; diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index 050be2b77874..3c46655030ae 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -381,6 +381,25 @@ class CVariable { */ inline virtual void SetDES_LengthScale(unsigned long iPoint, su2double val_des_lengthscale) {} + /*! + * \brief A virtual member. + * \param[in] iPoint - Point index. + */ + inline virtual void SetDebug_Quantities(CConfig *config, unsigned long iPoint, su2double val_ftilda_d, su2double val_l_RANS, su2double val_l_LES, su2double val_r_d) {} + + inline virtual su2double Get_L_RANS(unsigned long iPoint) const { return 0.0; } + inline virtual su2double Get_L_LES(unsigned long iPoint) const { return 0.0; } + inline virtual su2double Get_ftilda_d(unsigned long iPoint) const { return 0.0; } + inline virtual su2double Get_r_dt(unsigned long iPoint) const { return 0.0; } + inline virtual su2double Get_r_dl(unsigned long iPoint) const { return 0.0; } + inline virtual su2double Get_r_d(unsigned long iPoint) const { return 0.0; } + + /*! + * \brief A virtual member. + * \param[in] iPoint - Point index. + */ + inline virtual void SetDebug_Quantities(CConfig *config, unsigned long iPoint, su2double val_ftilda_d, su2double val_l_RANS, su2double val_l_LES, su2double val_r_dl, su2double val_r_dt) {} + /*! * \brief A virtual member. * \param[in] iPoint - Point index. diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 75bd80feebb2..5bfda2f68631 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1464,6 +1464,23 @@ void CFlowOutput::SetVolumeOutputFieldsScalarMisc(const CConfig* config) { if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES) { AddVolumeOutput("DES_LENGTHSCALE", "DES_LengthScale", "DDES", "DES length scale value"); AddVolumeOutput("WALL_DISTANCE", "Wall_Distance", "DDES", "Wall distance value"); + if ( config->GetKind_HybridRANSLES() == SST_DDES){ + AddVolumeOutput("F_D", "f_d", "DDES", "DES length scale value"); + AddVolumeOutput("L_RANS", "l_RANS", "DDES", "DES length scale value"); + AddVolumeOutput("L_LES", "l_LES", "DDES", "DES length scale value"); + AddVolumeOutput("R_D", "r_d", "DDES", "DES length scale value"); + } else if ( config->GetKind_HybridRANSLES() == SST_IDDES){ + AddVolumeOutput("F_D", "f_d", "DDES", "DES length scale value"); + AddVolumeOutput("L_RANS", "l_RANS", "DDES", "DES length scale value"); + AddVolumeOutput("L_LES", "l_LES", "DDES", "DES length scale value"); + AddVolumeOutput("R_DT", "r_dt", "DDES", "DES length scale value"); + AddVolumeOutput("R_DL", "r_dl", "DDES", "DES length scale value"); + } else if ( config->GetKind_HybridRANSLES() == SST_SIDDES){ + AddVolumeOutput("F_D", "f_d", "DDES", "DES length scale value"); + AddVolumeOutput("L_RANS", "l_RANS", "DDES", "DES length scale value"); + AddVolumeOutput("L_LES", "l_LES", "DDES", "DES length scale value"); + AddVolumeOutput("R_DT", "r_dt", "DDES", "DES length scale value"); + } } if (config->GetViscous()) { @@ -1563,6 +1580,23 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES) { SetVolumeOutputValue("DES_LENGTHSCALE", iPoint, Node_Flow->GetDES_LengthScale(iPoint)); SetVolumeOutputValue("WALL_DISTANCE", iPoint, Node_Geo->GetWall_Distance(iPoint)); + if ( config->GetKind_HybridRANSLES() == SST_DDES){ + SetVolumeOutputValue("F_D", iPoint, Node_Turb->Get_ftilda_d(iPoint)); + SetVolumeOutputValue("L_RANS", iPoint, Node_Turb->Get_L_RANS(iPoint)); + SetVolumeOutputValue("L_LES", iPoint, Node_Turb->Get_L_LES(iPoint)); + SetVolumeOutputValue("R_D", iPoint, Node_Turb->Get_r_d(iPoint)); + } else if ( config->GetKind_HybridRANSLES() == SST_IDDES){ + SetVolumeOutputValue("F_D", iPoint, Node_Turb->Get_ftilda_d(iPoint)); + SetVolumeOutputValue("L_RANS", iPoint, Node_Turb->Get_L_RANS(iPoint)); + SetVolumeOutputValue("L_LES", iPoint, Node_Turb->Get_L_LES(iPoint)); + SetVolumeOutputValue("R_DT", iPoint, Node_Turb->Get_r_dt(iPoint)); + SetVolumeOutputValue("R_DL", iPoint, Node_Turb->Get_r_dl(iPoint)); + } else if ( config->GetKind_HybridRANSLES() == SST_SIDDES){ + SetVolumeOutputValue("F_D", iPoint, Node_Turb->Get_ftilda_d(iPoint)); + SetVolumeOutputValue("L_RANS", iPoint, Node_Turb->Get_L_RANS(iPoint)); + SetVolumeOutputValue("L_LES", iPoint, Node_Turb->Get_L_LES(iPoint)); + SetVolumeOutputValue("R_DT", iPoint, Node_Turb->Get_r_dt(iPoint)); + } } switch (config->GetKind_Species_Model()) { diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 871dde715557..c99ebd53433b 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -1117,6 +1117,8 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C DES_lengthScale = l_RANS - f_d * max(0.0, l_RANS - l_LES); + nodes->SetDebug_Quantities(config, iPoint, f_d, l_RANS, l_LES, r_d); + break; } case SST_IDDES: { @@ -1145,6 +1147,8 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C const su2double Delta = min(C_w * max(sqrt(wallDist2), h_max), h_max); const su2double l_LES = C_DES * Delta; + nodes->SetDebug_Quantities(config, iPoint, ftilda_d, l_RANS, l_LES, r_dl, r_dt); + DES_lengthScale = ftilda_d *(1.0+f_e)*l_RANS + (1.0 - ftilda_d) * l_LES; break; @@ -1167,6 +1171,8 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C const su2double Delta = min(C_w * max(sqrt(wallDist2), h_max), h_max); const su2double l_LES = C_DES * Delta; + nodes->SetDebug_Quantities(config, iPoint, ftilda_d, l_RANS, l_LES, r_dt); + DES_lengthScale = ftilda_d*l_RANS + (1.0 - ftilda_d) * l_LES; break; diff --git a/SU2_CFD/src/variables/CTurbSSTVariable.cpp b/SU2_CFD/src/variables/CTurbSSTVariable.cpp index 9778f1e37cc7..959294d8643e 100644 --- a/SU2_CFD/src/variables/CTurbSSTVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSSTVariable.cpp @@ -50,6 +50,13 @@ CTurbSSTVariable::CTurbSSTVariable(su2double kine, su2double omega, su2double mu F2.resize(nPoint) = su2double(0.0); CDkw.resize(nPoint) = su2double(0.0); + ftilda_d.resize(nPoint) = su2double(0.0); + l_RANS.resize(nPoint) = su2double(0.0); + l_LES.resize(nPoint) = su2double(0.0); + r_dl.resize(nPoint) = su2double(0.0); + r_dt.resize(nPoint) = su2double(0.0); + r_d.resize(nPoint) = su2double(0.0); + muT.resize(nPoint) = mut; } From 5b5fc30ce150e006fcccef75bf94790f166ba682 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Tue, 17 Oct 2023 12:34:18 +0200 Subject: [PATCH 09/56] - Added division by 0 protection --- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index c99ebd53433b..ca66c09cf3a8 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -1107,7 +1107,7 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C switch(kind_hybridRANSLES){ case SST_DDES: { - const su2double r_d = (eddyVisc + lamVisc) / (KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))); + const su2double r_d = (eddyVisc + lamVisc) / max((KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))), 1e-10); const su2double C_d1 = 20.0; const su2double C_d2 = 3.0; @@ -1132,11 +1132,11 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C const su2double alpha = 0.25 - sqrt(wallDist2) / h_max; const su2double f_b = min(2.0 * exp(-9.0 * alpha*alpha), 1.0); - const su2double r_dt = eddyVisc / (KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))); + const su2double r_dt = eddyVisc / max((KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))), 1e-10); const su2double f_dt = 1 - tanh(pow(C_dt1 * r_dt, C_dt2)); const su2double ftilda_d = max(1.0 - f_dt, f_b); - const su2double r_dl = lamVisc / (KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))); + const su2double r_dl = lamVisc / max((KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))), 1e-10); const su2double f_l = tanh(pow(C_l*C_l*r_dl, 10.0)); const su2double f_t = tanh(pow(C_t*C_t*r_dt, 3.0)); const su2double f_e2 = 1.0 - max(f_t, f_l); @@ -1164,7 +1164,7 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C const su2double alpha = 0.25 - sqrt(wallDist2) / h_max; const su2double f_b = min(2.0 * exp(-9.0 * alpha*alpha), 1.0); - const su2double r_dt = eddyVisc / (KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))); + const su2double r_dt = eddyVisc / max((KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))), 1e-10); const su2double f_dt = 1 - tanh(pow(C_dt1 * r_dt, C_dt2)); const su2double ftilda_d = max(1.0 - f_dt, f_b); From ef502830caebc7eb50892ad0212986dd742125a0 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Sat, 21 Oct 2023 23:59:15 +0200 Subject: [PATCH 10/56] - Added computation of LESIQ to Output --- SU2_CFD/src/output/CFlowOutput.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 5bfda2f68631..780669ca2d82 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1481,6 +1481,7 @@ void CFlowOutput::SetVolumeOutputFieldsScalarMisc(const CConfig* config) { AddVolumeOutput("L_LES", "l_LES", "DDES", "DES length scale value"); AddVolumeOutput("R_DT", "r_dt", "DDES", "DES length scale value"); } + AddVolumeOutput("LESIQ", "LESIQ", "DDES", "LESIQ index for SRS simulations"); } if (config->GetViscous()) { @@ -1597,6 +1598,10 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con SetVolumeOutputValue("L_LES", iPoint, Node_Turb->Get_L_LES(iPoint)); SetVolumeOutputValue("R_DT", iPoint, Node_Turb->Get_r_dt(iPoint)); } + const su2double mut = Node_Flow->GetEddyViscosity(iPoint); + const su2double mu = Node_Flow->GetLaminarViscosity(iPoint); + const su2double LESIQ = 1.0/(1.0+0.05*pow((mut+mu)/mu, 0.53)); + SetVolumeOutputValue("LESIQ", iPoint, LESIQ); } switch (config->GetKind_Species_Model()) { From 48a9f3dded8b00823ce6e6bd7b4e70e68bdcb83f Mon Sep 17 00:00:00 2001 From: rois1995 Date: Mon, 23 Oct 2023 19:07:58 +0200 Subject: [PATCH 11/56] - modified codi --- externals/codi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/externals/codi b/externals/codi index eee1b5eea2de..8ee822a9b0bb 160000 --- a/externals/codi +++ b/externals/codi @@ -1 +1 @@ -Subproject commit eee1b5eea2ded8126c34c1415e3b9cf15a3e70f2 +Subproject commit 8ee822a9b0bb8235a2494467b774e27fb64ff14f From ae33b055200ea5002e52a13912c043df6a25a797 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 27 Oct 2023 18:33:22 +0200 Subject: [PATCH 12/56] - Modified Velocity Laplacian (vector -> Matrix) - Changed names of SAS models - Added descriptions of functions - Clean up of output functions - Removed SA functions or SST variables --- Common/include/option_structure.hpp | 21 +++--- Common/src/CConfig.cpp | 17 ++++- SU2_CFD/include/numerics/CNumerics.hpp | 19 ++---- .../numerics/turbulent/turb_sources.hpp | 22 ++----- SU2_CFD/include/variables/CTurbSAVariable.hpp | 22 ------- .../include/variables/CTurbSSTVariable.hpp | 64 ++++++++++--------- SU2_CFD/include/variables/CVariable.hpp | 50 ++++----------- SU2_CFD/src/output/CFlowOutput.cpp | 42 ++++++------ SU2_CFD/src/solvers/CSolver.cpp | 19 +++--- SU2_CFD/src/solvers/CTurbSASolver.cpp | 26 -------- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 21 +++--- SU2_CFD/src/variables/CTurbSSTVariable.cpp | 8 +-- 12 files changed, 121 insertions(+), 210 deletions(-) diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 4a459c947a4b..4bd401df3051 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -990,8 +990,8 @@ enum class SST_OPTIONS { V, /*!< \brief Menter k-w SST model with vorticity production terms. */ KL, /*!< \brief Menter k-w SST model with Kato-Launder production terms. */ UQ, /*!< \brief Menter k-w SST model with uncertainty quantification modifications. */ - SAS_SIMPLE, /*!< \brief Menter k-w SST model with Scale Adaptive Simulations modifications. */ - SAS_COMPLICATED, /*!< \brief Menter k-w SST model with Scale Adaptive Simulations modifications. */ + SAS_TRAVIS, /*!< \brief Menter k-w SST model with Scale Adaptive Simulations modifications. */ + SAS_BABU, /*!< \brief Menter k-w SST model with Scale Adaptive Simulations modifications. */ }; static const MapType SST_Options_Map = { MakePair("NONE", SST_OPTIONS::NONE) @@ -1004,8 +1004,8 @@ static const MapType SST_Options_Map = { MakePair("VORTICITY", SST_OPTIONS::V) MakePair("KATO-LAUNDER", SST_OPTIONS::KL) MakePair("UQ", SST_OPTIONS::UQ) - MakePair("SAS_SIMPLE", SST_OPTIONS::SAS_SIMPLE) - MakePair("SAS_COMPLICATED", SST_OPTIONS::SAS_COMPLICATED) + MakePair("SAS_TRAVIS", SST_OPTIONS::SAS_TRAVIS) + MakePair("SAS_BABU", SST_OPTIONS::SAS_BABU) }; /*! @@ -1014,10 +1014,9 @@ static const MapType SST_Options_Map = { struct SST_ParsedOptions { SST_OPTIONS version = SST_OPTIONS::V1994; /*!< \brief Enum SST base model. */ SST_OPTIONS production = SST_OPTIONS::NONE; /*!< \brief Enum for production corrections/modifiers for SST model. */ - SST_OPTIONS sasModel = SST_OPTIONS::SAS_SIMPLE; /*!< \brief Enum SST base model. */ + SST_OPTIONS sasModel = SST_OPTIONS::NONE; /*!< \brief Enum SST base model. */ bool sust = false; /*!< \brief Bool for SST model with sustaining terms. */ bool uq = false; /*!< \brief Bool for using uncertainty quantification. */ - bool sas = false; /*!< \brief Bool for using Scale Adaptive Simulations. */ bool modified = false; /*!< \brief Bool for modified (m) SST model. */ }; @@ -1054,15 +1053,14 @@ inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigne const bool sst_v = IsPresent(SST_OPTIONS::V); const bool sst_kl = IsPresent(SST_OPTIONS::KL); const bool sst_uq = IsPresent(SST_OPTIONS::UQ); - const bool sst_sas_simple = IsPresent(SST_OPTIONS::SAS_SIMPLE); - const bool sst_sas_comp = IsPresent(SST_OPTIONS::SAS_COMPLICATED); - const bool sst_sas = sst_sas_simple || sst_sas_comp; + const bool sst_sas_simple = IsPresent(SST_OPTIONS::SAS_TRAVIS); + const bool sst_sas_comp = IsPresent(SST_OPTIONS::SAS_BABU); if (sst_sas_simple && sst_sas_comp) { SU2_MPI::Error("Two versions (Simple and Complicated) selected for SAS under SST_OPTIONS. Please choose only one.", CURRENT_FUNCTION); } else if (sst_sas_simple) { - SSTParsedOptions.sasModel = SST_OPTIONS::SAS_SIMPLE; + SSTParsedOptions.sasModel = SST_OPTIONS::SAS_TRAVIS; } else { - SSTParsedOptions.sasModel = SST_OPTIONS::SAS_COMPLICATED; + SSTParsedOptions.sasModel = SST_OPTIONS::SAS_BABU; } if (sst_1994 && sst_2003) { @@ -1087,7 +1085,6 @@ inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigne SSTParsedOptions.sust = sst_sust; SSTParsedOptions.modified = sst_m; SSTParsedOptions.uq = sst_uq; - SSTParsedOptions.sas = sst_sas; return SSTParsedOptions; } diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index ffb186d04879..3b36d9997545 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -6116,6 +6116,17 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) { break; } cout << "." << endl; + if(sstParsedOptions.sasModel != SST_OPTIONS::NONE) cout << "Scale Adaptive Simulation model: "; + switch (sstParsedOptions.sasModel) { + case SST_OPTIONS::SAS_TRAVIS: + cout << "Travis et al. (2004)"; + break; + case SST_OPTIONS::SAS_BABU: + cout << "Babu et al. (2016)"; + break; + default: + break; + } break; } switch (Kind_Trans_Model) { @@ -6157,9 +6168,9 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) { case SA_DDES: cout << "Delayed Detached Eddy Simulation (DDES) with Standard SGS" << endl; break; case SA_ZDES: cout << "Delayed Detached Eddy Simulation (DDES) with Vorticity-based SGS" << endl; break; case SA_EDDES: cout << "Delayed Detached Eddy Simulation (DDES) with Shear-layer Adapted SGS" << endl; break; - case SST_DDES: cout << "Delayed Detached Eddy Simulation (DDES) with Shear-layer Adapted SGS" << endl; break; - case SST_IDDES: cout << "Delayed Detached Eddy Simulation (DDES) with Shear-layer Adapted SGS" << endl; break; - case SST_SIDDES: cout << "Delayed Detached Eddy Simulation (DDES) with Shear-layer Adapted SGS" << endl; break; + case SST_DDES: cout << "Delayed Detached Eddy Simulation (DDES) with Vorticity-based SGS" << endl; break; + case SST_IDDES: cout << "Improved Delayed Detached Eddy Simulation (IDDES) with Vorticity-based SGS" << endl; break; + case SST_SIDDES: cout << "Simplified Improved Delayed Detached Eddy Simulation (SIDDES) with Vorticity-based SGS" << endl; break; } break; case MAIN_SOLVER::NEMO_EULER: diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index e880ddfdaf08..995d81967060 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -136,6 +136,9 @@ class CNumerics { const su2double *TurbPsi_i, /*!< \brief Vector of adjoint turbulent variables at point i. */ *TurbPsi_j; /*!< \brief Vector of adjoint turbulent variables at point j. */ + su2double lengthScale_i, lengthScale_j; /*!< \brief length scale for SST */ + su2double FTrans; /*!< \brief SAS function */ + su2double *VelLapl; /*!< \brief Laplacian of the velocity */ CMatrixView ConsVar_Grad_i, /*!< \brief Gradient of conservative variables at point i. */ ConsVar_Grad_j, /*!< \brief Gradient of conservative variables at point j. */ @@ -190,10 +193,6 @@ class CNumerics { bool bounded_scalar = false; /*!< \brief Flag for bounded scalar problem */ - su2double lengthScale_i, lengthScale_j; - su2double FTrans; /*!< \brief SAS function */ - su2double VelLapl_X, VelLapl_Y, VelLapl_Z; - public: /*! * \brief Return type used in some "ComputeResidual" overloads to give a @@ -719,16 +718,8 @@ class CNumerics { /*! * \brief Get the value of the value of FTrans. */ - inline void SetVelLapl(su2double val_VelLapl_X, su2double val_VelLapl_Y) { - VelLapl_X = val_VelLapl_X; - VelLapl_Y = val_VelLapl_Y; - } - - /*! - * \brief Get the value of the value of FTrans. - */ - inline void SetVelLapl_Z(su2double val_VelLapl_Z) { - VelLapl_Z = val_VelLapl_Z; + inline void SetVelLapl(su2double* val_VelLapl) { + VelLapl = val_VelLapl; } /*! diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 584cb454574f..3fcdf28be384 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -855,7 +855,7 @@ class CSourcePieceWise_TurbSST final : public CNumerics { /*--- Compute SAS source term. ---*/ su2double Q_SAS = 0.0; - if (sstParsedOptions.sas && sstParsedOptions.sasModel == SST_OPTIONS::SAS_COMPLICATED) { + if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_BABU) { const su2double KolmConst = 0.41; const su2double csi2 = 3.51; @@ -866,23 +866,13 @@ class CSourcePieceWise_TurbSST final : public CNumerics { // Scale of the modeled turbulence const su2double L = sqrt(ScalarVar_i[0]) / (pow(beta_star, 0.25) * ScalarVar_i[1]); // Von Karman Length Scale - su2double VelLaplMag = VelLapl_X*VelLapl_X + VelLapl_Y*VelLapl_Y; - if (nDim == 3) VelLaplMag += VelLapl_Z*VelLapl_Z; + const su2double VelLaplMag = GeometryToolbox::SquaredNorm(nDim, VelLapl); const su2double L_vK_1 = KolmConst * StrainMag_i / sqrt(VelLaplMag); const su2double L_vK_2 = C_s * sqrt(KolmConst * csi2 / (beta_blended/beta_star - alfa_blended)) * gridSize; const su2double L_vK = max(L_vK_1, L_vK_2); - su2double gradOmega = 0.0; - for (unsigned short iDim = 0; iDim < nDim; iDim++) - gradOmega += ScalarVar_Grad_i[1][iDim]*ScalarVar_Grad_i[1][iDim]; - - gradOmega /= ScalarVar_i[1]; - - su2double gradTKE = 0.0; - for (unsigned short iDim = 0; iDim < nDim; iDim++) - gradTKE += ScalarVar_Grad_i[0][iDim]*ScalarVar_Grad_i[0][iDim]; - - gradTKE /= ScalarVar_i[0]; + const su2double gradTKE = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[0])/ScalarVar_i[0]; + const su2double gradOmega = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[1])/ScalarVar_i[1]; const su2double Q_SAS_1 = csi2 * KolmConst * StrainMag_i * StrainMag_i * (L/L_vK) * (L/L_vK); const su2double Q_SAS_2 = C * (2*ScalarVar_i[0] / sigma_phi) * max(gradOmega, gradTKE); @@ -895,7 +885,7 @@ class CSourcePieceWise_TurbSST final : public CNumerics { /*--- Add the dissipation terms to the residuals.---*/ FTrans = 1.0; - if (sstParsedOptions.sas && sstParsedOptions.sasModel == SST_OPTIONS::SAS_SIMPLE) { + if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_TRAVIS) { FTrans = max(1.0, pow(StrainMag_i / (cTrans * VorticityMag), 2.0)); } Residual[0] -= dk * Volume * FTrans; @@ -916,7 +906,7 @@ class CSourcePieceWise_TurbSST final : public CNumerics { Jacobian_i[1][0] = 0.0; Jacobian_i[1][1] = -2.0 * beta_blended * ScalarVar_i[1] * Volume; - if (sstParsedOptions.sas && sstParsedOptions.sasModel == SST_OPTIONS::SAS_COMPLICATED) { + if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_BABU) { Jacobian_i[0][0] += Q_SAS * Volume / ScalarVar_i[0]; } } diff --git a/SU2_CFD/include/variables/CTurbSAVariable.hpp b/SU2_CFD/include/variables/CTurbSAVariable.hpp index 953a9bb53a6f..31c6e40f970d 100644 --- a/SU2_CFD/include/variables/CTurbSAVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSAVariable.hpp @@ -75,26 +75,4 @@ class CTurbSAVariable final : public CTurbVariable { */ inline su2double GetVortex_Tilting(unsigned long iPoint) const override { return Vortex_Tilting(iPoint); } - /*! - * \brief Get the value of the turbulence kinetic energy. - * \return the value of the turbulence kinetic energy. - */ - inline su2double GetSSTVariables_k(unsigned long iPoint) const { return k(iPoint); } - - /*! - * \brief Get the value of the turbulence frequency Omega. - * \return the value of the turbulence frequency Omega. - */ - inline su2double GetSSTVariables_omega(unsigned long iPoint) const { return Omega(iPoint); } - - /*! - * \brief Set the value of the SST variables computed with SA solution. - * \param[in] val_k - * \param[in] val_Omega - */ - void SetSSTVariables(unsigned long iPoint, su2double val_k, su2double val_Omega) { - k(iPoint) = val_k; - Omega(iPoint) = val_Omega; - } - }; diff --git a/SU2_CFD/include/variables/CTurbSSTVariable.hpp b/SU2_CFD/include/variables/CTurbSSTVariable.hpp index 5fba3f8d5f15..b2d9f0a12669 100644 --- a/SU2_CFD/include/variables/CTurbSSTVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSSTVariable.hpp @@ -53,9 +53,7 @@ class CTurbSSTVariable final : public CTurbVariable { VectorType r_dt; VectorType r_d; VectorType FTrans; - VectorType VelocityLaplacian_X; - VectorType VelocityLaplacian_Y; - VectorType VelocityLaplacian_Z; + MatrixType VelocityLaplacian; public: /*! @@ -133,59 +131,65 @@ class CTurbSSTVariable final : public CTurbVariable { /*! * \brief Get the value of the FTrans. + * \param[in] iPoint - Point index. */ inline su2double GetFTrans(unsigned long iPoint) const override { return FTrans(iPoint); } /*! * \brief Set the value of the FTrans. + * \param[in] iPoint - Point index. + * \param[in] val_FTrans - Value of the FTrans variable. */ inline void SetFTrans(unsigned long iPoint, su2double val_FTrans) override { FTrans(iPoint) = val_FTrans; }; /*! - * \brief Get the value of the FTrans. - */ - inline su2double GetVelLapl_X(unsigned long iPoint) const override { return VelocityLaplacian_X(iPoint); } - - /*! - * \brief Get the value of the FTrans. + * \brief Get the value of the velocity laplacian. + * \param[in] iPoint - Point index. */ - inline su2double GetVelLapl_Y(unsigned long iPoint) const override { return VelocityLaplacian_Y(iPoint); } + inline su2double* GetVelLapl(unsigned long iPoint) final { return VelocityLaplacian[iPoint]; } /*! - * \brief Get the value of the FTrans. + * \brief Get the value of the velocity laplacian. + * \param[in] iPoint - Point index. + * \param[in] iDim - Dimension index. */ - inline su2double GetVelLapl_Z(unsigned long iPoint) const override { return VelocityLaplacian_Z(iPoint); } + inline su2double GetVelLapl(unsigned long iPoint, unsigned short iDim) const final { return VelocityLaplacian[iPoint][iDim]; } /*! - * \brief Set the value of the FTrans. - */ - inline void AddVelLapl(unsigned long iPoint, su2double val_VelLapl_X, su2double val_VelLapl_Y) override { - VelocityLaplacian_X(iPoint) += val_VelLapl_X; - VelocityLaplacian_Y(iPoint) += val_VelLapl_Y; + * \brief Incrementally add the velocity laplacian vector. + * \param[in] iPoint - Point index. + * \param[in] val_VelLapl_X - X-Component of the velocity laplacian. + * \param[in] val_VelLapl_Y - Y-Component of the velocity laplacian. + * \param[in] val_VelLapl_Z - Z-Component of the velocity laplacian. + */ + inline void AddVelLapl(unsigned long iPoint, su2double val_VelLapl_X, su2double val_VelLapl_Y, su2double val_VelLapl_Z) override { + VelocityLaplacian(iPoint, 0) += val_VelLapl_X; + VelocityLaplacian(iPoint, 1) += val_VelLapl_Y; + if(nDim == 3) VelocityLaplacian(iPoint, 2) += val_VelLapl_Z; }; /*! - * \brief Set the value of the FTrans. + * \brief Set the value of the velocity laplacian. + * \param[in] iPoint - Point index. + * \param[in] val_VelLapl - Vector of velocity laplacian. */ - inline void AddVelLapl_Z(unsigned long iPoint, su2double val_VelLapl_Z) override { - VelocityLaplacian_Z(iPoint) += val_VelLapl_Z; + inline void SetVelLapl(unsigned long iPoint, su2double* val_VelLapl) override { + VelocityLaplacian(iPoint, 0) = val_VelLapl[0]; + VelocityLaplacian(iPoint, 1) = val_VelLapl[1]; + if(nDim == 3) VelocityLaplacian(iPoint, 2) = val_VelLapl[2]; }; /*! - * \brief Set the value of the FTrans. + * \brief Set the value of the velocity laplacian. + * \param[in] iPoint - Point index. + * \param[in] iDim - Dimension index. + * \param[in] val_VelLapl - value of the velocity laplacian. */ - inline void SetVelLapl(unsigned long iPoint, su2double val_VelLapl_X, su2double val_VelLapl_Y) override { - VelocityLaplacian_X(iPoint) = val_VelLapl_X; - VelocityLaplacian_Y(iPoint) = val_VelLapl_Y; + inline void SetVelLapl(unsigned long iPoint, unsigned short iDim, su2double val_VelLapl) override { + VelocityLaplacian(iPoint, iDim) = val_VelLapl; }; - /*! - * \brief Set the value of the FTrans. - */ - inline void SetVelLapl_Z(unsigned long iPoint, su2double val_VelLapl_Z) override { - VelocityLaplacian_Z(iPoint) = val_VelLapl_Z; - }; }; diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index 6f784652d406..17e373f105ee 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -1677,34 +1677,29 @@ class CVariable { inline virtual void SetFTrans(unsigned long iPoint, su2double val_FTrans) {} /*! - * \brief Get the value of the value of FTrans. - */ - inline virtual su2double GetVelLapl_X(unsigned long iPoint) const { return 0.0; } - /*! - * \brief Get the value of the value of FTrans. - */ - inline virtual su2double GetVelLapl_Y(unsigned long iPoint) const { return 0.0; } - /*! - * \brief Get the value of the value of FTrans. + * \brief Get the value of the velocity laplacian. */ - inline virtual su2double GetVelLapl_Z(unsigned long iPoint) const { return 0.0; } + inline virtual su2double* GetVelLapl(unsigned long iPoint) { return nullptr; } /*! - * \brief Set the value of the value of FTrans. + * \brief Get the value of the velocity laplacian. */ - inline virtual void AddVelLapl(unsigned long iPoint, su2double val_VelLapl_X, su2double val_VelLapl_Y) {} + inline virtual su2double GetVelLapl(unsigned long iPoint, unsigned short iDim) const { return 0.0; } + /*! - * \brief Set the value of the value of FTrans. + * \brief Incrementally add the velocity laplacian vector. */ - inline virtual void AddVelLapl_Z(unsigned long iPoint, su2double val_VelLapl_Z) {} + inline virtual void AddVelLapl(unsigned long iPoint, su2double val_VelLapl_X, su2double val_VelLapl_Y, su2double val_VelLapl_Z) {} + /*! - * \brief Set the value of the value of FTrans. + * \brief Set the value of the velocity laplacian. */ - inline virtual void SetVelLapl(unsigned long iPoint, su2double val_VelLapl_X, su2double val_VelLapl_Y) {} + inline virtual void SetVelLapl(unsigned long iPoint, su2double* val_VelLapl) {} + /*! - * \brief Set the value of the value of FTrans. + * \brief Set the value of the velocity laplacian. */ - inline virtual void SetVelLapl_Z(unsigned long iPoint, su2double val_VelLapl_Z) {} + inline virtual void SetVelLapl(unsigned long iPoint, unsigned short iDim, su2double val_VelLapl) {} /*! * \brief Get the value of the eddy viscosity. @@ -1754,25 +1749,6 @@ class CVariable { */ inline virtual void SetmuT(unsigned long iPoint, su2double val_muT) {} - /*! - * \brief Get the value of the turbulence kinetic energy. - * \return the value of the turbulence kinetic energy. - */ - inline virtual su2double GetSSTVariables_k(unsigned long iPoint) const { return 0.0; } - - /*! - * \brief Get the value of the Rate of dissipation Omega. - * \return the value of the Rate of dissipation Omega. - */ - inline virtual su2double GetSSTVariables_omega(unsigned long iPoint) const { return 0.0; } - - /*! - * \brief Set the value of the SST variables computed with SA solution. - * \param[in] val_k - * \param[in] val_Omega - */ - inline virtual void SetSSTVariables(unsigned long iPoint, su2double val_k, su2double val_Omega) {} - /*! * \brief Get the value of the desired grid size for Scale Resolving Simulations. * \return the value of the desired grid size for Scale Resolving Simulations. diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 5ca132765067..5b07264dbf75 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1250,11 +1250,11 @@ void CFlowOutput::SetVolumeOutputFieldsScalarSolution(const CConfig* config){ AddVolumeOutput("TKE", "Turb_Kin_Energy", "SOLUTION", "Turbulent kinetic energy"); AddVolumeOutput("DISSIPATION", "Omega", "SOLUTION", "Rate of dissipation"); AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "SOLUTION", "desired grid size for Scale Resolving Simulations"); - if (config->GetSSTParsedOptions().sas && config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_SIMPLE) AddVolumeOutput("FTRANS", "FTrans", "SOLUTION", "value of FTrans for SAS simulation"); - if (config->GetSSTParsedOptions().sas && config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_COMPLICATED){ - AddVolumeOutput("VEL_LAPLACIAN_X", "Vel Laplacian x", "SOLUTION", "value of laplacian of velocity for SAS simulation"); - AddVolumeOutput("VEL_LAPLACIAN_Y", "Vel Laplacian y", "SOLUTION", "value of laplacian of velocity for SAS simulation"); - if (nDim == 3) AddVolumeOutput("VEL_LAPLACIAN_Z", "Vel Laplacian z", "SOLUTION", "value of laplacian of velocity for SAS simulation"); + if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_TRAVIS) AddVolumeOutput("FTRANS", "FTrans", "SOLUTION", "value of FTrans for SAS simulation"); + if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_BABU){ + AddVolumeOutput("VEL-LAPLACIAN_X", "Vel Laplacian x", "SOLUTION", "value of laplacian of x-velocity for SAS simulation"); + AddVolumeOutput("VEL-LAPLACIAN_Y", "Vel Laplacian y", "SOLUTION", "value of laplacian of y-velocity for SAS simulation"); + if (nDim == 3) AddVolumeOutput("VEL-LAPLACIAN_Z", "Vel Laplacian z", "SOLUTION", "value of laplacian of z-velocity for SAS simulation"); } break; @@ -1472,22 +1472,18 @@ void CFlowOutput::SetVolumeOutputFieldsScalarMisc(const CConfig* config) { if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES) { AddVolumeOutput("DES_LENGTHSCALE", "DES_LengthScale", "DDES", "DES length scale value"); AddVolumeOutput("WALL_DISTANCE", "Wall_Distance", "DDES", "Wall distance value"); + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) { + AddVolumeOutput("F_D", "f_d", "DDES", "Empiric blending function"); + AddVolumeOutput("L_RANS", "l_RANS", "DDES", "RANS length scale value"); + AddVolumeOutput("L_LES", "l_LES", "DDES", "LES length scale value"); + } if ( config->GetKind_HybridRANSLES() == SST_DDES){ - AddVolumeOutput("F_D", "f_d", "DDES", "DES length scale value"); - AddVolumeOutput("L_RANS", "l_RANS", "DDES", "DES length scale value"); - AddVolumeOutput("L_LES", "l_LES", "DDES", "DES length scale value"); - AddVolumeOutput("R_D", "r_d", "DDES", "DES length scale value"); + AddVolumeOutput("R_D", "r_d", "DDES", "r_d"); } else if ( config->GetKind_HybridRANSLES() == SST_IDDES){ - AddVolumeOutput("F_D", "f_d", "DDES", "DES length scale value"); - AddVolumeOutput("L_RANS", "l_RANS", "DDES", "DES length scale value"); - AddVolumeOutput("L_LES", "l_LES", "DDES", "DES length scale value"); - AddVolumeOutput("R_DT", "r_dt", "DDES", "DES length scale value"); - AddVolumeOutput("R_DL", "r_dl", "DDES", "DES length scale value"); + AddVolumeOutput("R_DT", "r_dt", "DDES", "turbulent r_d"); + AddVolumeOutput("R_DL", "r_dl", "DDES", "laminar r_d"); } else if ( config->GetKind_HybridRANSLES() == SST_SIDDES){ - AddVolumeOutput("F_D", "f_d", "DDES", "DES length scale value"); - AddVolumeOutput("L_RANS", "l_RANS", "DDES", "DES length scale value"); - AddVolumeOutput("L_LES", "l_LES", "DDES", "DES length scale value"); - AddVolumeOutput("R_DT", "r_dt", "DDES", "DES length scale value"); + AddVolumeOutput("R_DT", "r_dt", "DDES", "turbulent r_d"); } AddVolumeOutput("LESIQ", "LESIQ", "DDES", "LESIQ index for SRS simulations"); } @@ -1554,11 +1550,11 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con SetVolumeOutputValue("RES_TKE", iPoint, turb_solver->LinSysRes(iPoint, 0)); SetVolumeOutputValue("RES_DISSIPATION", iPoint, turb_solver->LinSysRes(iPoint, 1)); SetVolumeOutputValue("SRS_GRID_SIZE", iPoint, Node_Turb->GetSRSGridSize(iPoint)); - if (config->GetSSTParsedOptions().sas && config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_SIMPLE) SetVolumeOutputValue("FTRANS", iPoint, Node_Turb->GetFTrans(iPoint)); - if (config->GetSSTParsedOptions().sas && config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_COMPLICATED){ - SetVolumeOutputValue("VEL_LAPLACIAN_X", iPoint, Node_Turb->GetVelLapl_X(iPoint)); - SetVolumeOutputValue("VEL_LAPLACIAN_Y", iPoint, Node_Turb->GetVelLapl_Y(iPoint)); - if (nDim == 3) SetVolumeOutputValue("VEL_LAPLACIAN_Z", iPoint, Node_Turb->GetVelLapl_Z(iPoint)); + if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_TRAVIS) SetVolumeOutputValue("FTRANS", iPoint, Node_Turb->GetFTrans(iPoint)); + if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_BABU){ + SetVolumeOutputValue("VEL-LAPLACIAN_X", iPoint, Node_Turb->GetVelLapl(iPoint, 0)); + SetVolumeOutputValue("VEL-LAPLACIAN_Y", iPoint, Node_Turb->GetVelLapl(iPoint, 1)); + if (nDim == 3) SetVolumeOutputValue("VEL-LAPLACIAN_Z", iPoint, Node_Turb->GetVelLapl(iPoint, 2)); } if (limiter) { SetVolumeOutputValue("LIMITER_TKE", iPoint, Node_Turb->GetLimiter(iPoint, 0)); diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index dae8335567bc..b1c10838a409 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -1350,15 +1350,15 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, break; case PERIODIC_VEL_LAPLACIAN: - + { /*--- Adjust the undivided Laplacian. The accumulation was with a subtraction before communicating, so now just add. ---*/ - - base_nodes->AddVelLapl(iPoint, bufDRecv[buf_offset+0], bufDRecv[buf_offset+1]); - if(nDim == 3) base_nodes->AddVelLapl_Z(iPoint, bufDRecv[buf_offset+2]); + su2double bufDRecv_Z = 0.0; + if(nDim == 3) bufDRecv_Z = bufDRecv[buf_offset+2]; + base_nodes->AddVelLapl(iPoint, bufDRecv[buf_offset+0], bufDRecv[buf_offset+1], bufDRecv_Z); break; - + } default: SU2_MPI::Error("Unrecognized quantity for periodic communication.", @@ -1601,9 +1601,8 @@ void CSolver::InitiateComms(CGeometry *geometry, bufDSend[buf_offset+iVar] = base_nodes->GetSolution_time_n1(iPoint, iVar); break; case VELOCITY_LAPLACIAN: - bufDSend[buf_offset+0] = base_nodes->GetVelLapl_X(iPoint); - bufDSend[buf_offset+1] = base_nodes->GetVelLapl_Y(iPoint); - if(nDim == 3) bufDSend[buf_offset+2] = base_nodes->GetVelLapl_Z(iPoint); + for(iDim = 0; iDim < nDim; iDim++) + bufDSend[buf_offset+iDim] = base_nodes->GetVelLapl(iPoint, iDim); break; default: SU2_MPI::Error("Unrecognized quantity for point-to-point MPI comms.", @@ -1754,8 +1753,8 @@ void CSolver::CompleteComms(CGeometry *geometry, base_nodes->Set_Solution_time_n1(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; case VELOCITY_LAPLACIAN: - base_nodes->SetVelLapl(iPoint, bufDRecv[buf_offset+0], bufDRecv[buf_offset+1]); - if(nDim == 3) base_nodes->SetVelLapl_Z(iPoint, bufDRecv[buf_offset+2]); + for (iDim = 0; iDim < nDim; iDim++) + base_nodes->SetVelLapl(iPoint, iDim, bufDRecv[buf_offset+iDim]); break; default: SU2_MPI::Error("Unrecognized quantity for point-to-point MPI comms.", diff --git a/SU2_CFD/src/solvers/CTurbSASolver.cpp b/SU2_CFD/src/solvers/CTurbSASolver.cpp index a81f75a5e09f..65b56ab5d3db 100644 --- a/SU2_CFD/src/solvers/CTurbSASolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSASolver.cpp @@ -240,32 +240,6 @@ void CTurbSASolver::Postprocessing(CGeometry *geometry, CSolver **solver_contain nodes->SetmuT(iPoint,muT); - // Now compute k and w - auto* flowNodes = su2staticcast_p(solver_container[FLOW_SOL]->GetNodes()); - - const su2double BetaStar = 0.09; - const su2double a1 = 0.31; - - const su2double Omega = GeometryToolbox::Norm(nDim, flowNodes->GetVorticity(iPoint))/sqrt(BetaStar); - - const su2double nut = muT / rho; - const su2double arg2_1 = 2.0 * sqrt(nut / Omega) / (BetaStar * wallDistance); - const su2double arg2_2 = 500.0 * flowNodes->GetLaminarViscosity(iPoint) / (wallDistance*wallDistance * Omega); - - const su2double arg2 = max(arg2_1, arg2_2); - const su2double F2 = tanh(arg2*arg2); - - const su2double k = nut * max(Omega, flowNodes->GetStrainMag(iPoint) * F2 / a1); - - nodes->SetSSTVariables(iPoint, k, Omega); - - // Now compute desired cell size for Scale Resolving Simulations - const su2double Cmu = 0.09; - const su2double RANSLength = sqrt(k) / max(1e-20, (Cmu * Omega)); - const su2double RatioL = 0.1; // it should be less or equal than 0.2 - 0.1. Should be taken as input from config? - const su2double SRSGridSize = RANSLength * RatioL; - nodes->SetSRSGridSize(iPoint, SRSGridSize); - } END_SU2_OMP_FOR diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index ca33f730f22e..c1a146f65f63 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -202,7 +202,7 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain } - if (sstParsedOptions.sas && sstParsedOptions.sasModel == SST_OPTIONS::SAS_COMPLICATED){ + if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_BABU){ auto* flowNodes = su2staticcast_p(solver_container[FLOW_SOL]->GetNodes()); SU2_OMP_FOR_DYN(256) @@ -211,10 +211,8 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain const bool boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint); /*--- Initialize. ---*/ - nodes->SetVelLapl(iPoint, 0.0, 0.0); - if (nDim == 3) { - nodes->SetVelLapl_Z(iPoint, 0.0); - } + for (unsigned short iDim = 0; iDim < nDim; iDim++) + nodes->SetVelLapl(iPoint, iDim, 0.0); /*--- Loop over the neighbors of point i. ---*/ for (auto jPoint : geometry->nodes->GetPoints(iPoint)) { @@ -229,12 +227,12 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain const su2double delta_x = (flowNodes->GetVelocity(jPoint,0)-flowNodes->GetVelocity(iPoint,0))/distance; const su2double delta_y = (flowNodes->GetVelocity(jPoint,1)-flowNodes->GetVelocity(iPoint,1))/distance; + su2double delta_z = 0.0; - nodes->AddVelLapl(iPoint, delta_x, delta_y); if (nDim == 3) { - const su2double delta_z = (flowNodes->GetVelocity(jPoint,2)-flowNodes->GetVelocity(iPoint,2))/distance; - nodes->AddVelLapl_Z(iPoint, delta_z); + delta_z = (flowNodes->GetVelocity(jPoint,2)-flowNodes->GetVelocity(iPoint,2))/distance; } + nodes->AddVelLapl(iPoint, delta_x, delta_y, delta_z); } @@ -434,9 +432,8 @@ void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta numerics->SetLengthScale(nodes->GetDES_LengthScale(iPoint), 0.0); } - if (sstParsedOptions.sas && sstParsedOptions.sasModel == SST_OPTIONS::SAS_COMPLICATED){ - numerics->SetVelLapl(nodes->GetVelLapl_X(iPoint), nodes->GetVelLapl_Y(iPoint)); - if (nDim == 3) numerics->SetVelLapl_Z(nodes->GetVelLapl_Z(iPoint)); + if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_BABU){ + numerics->SetVelLapl(nodes->GetVelLapl(iPoint)); } /*--- Compute the source term ---*/ @@ -444,7 +441,7 @@ void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta auto residual = numerics->ComputeResidual(config); /*--- Store the SAS function ---*/ - if (sstParsedOptions.sas && sstParsedOptions.sasModel == SST_OPTIONS::SAS_SIMPLE) { + if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_TRAVIS) { nodes->SetFTrans(iPoint, numerics->GetFTrans()); } diff --git a/SU2_CFD/src/variables/CTurbSSTVariable.cpp b/SU2_CFD/src/variables/CTurbSSTVariable.cpp index f3455e4f1aa0..e3b38e14e619 100644 --- a/SU2_CFD/src/variables/CTurbSSTVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSSTVariable.cpp @@ -59,11 +59,9 @@ CTurbSSTVariable::CTurbSSTVariable(su2double kine, su2double omega, su2double mu muT.resize(nPoint) = mut; - if(sstParsedOptions.sas && sstParsedOptions.sasModel == SST_OPTIONS::SAS_SIMPLE) FTrans.resize(nPoint) = su2double(1.0); - if(sstParsedOptions.sas && sstParsedOptions.sasModel == SST_OPTIONS::SAS_COMPLICATED) { - VelocityLaplacian_X.resize(nPoint) = su2double(0.0); - VelocityLaplacian_Y.resize(nPoint) = su2double(0.0); - if (nDim == 3) VelocityLaplacian_Z.resize(nPoint) = su2double(0.0); + if(sstParsedOptions.sasModel == SST_OPTIONS::SAS_TRAVIS) FTrans.resize(nPoint) = su2double(1.0); + if(sstParsedOptions.sasModel == SST_OPTIONS::SAS_BABU) { + VelocityLaplacian.resize(nPoint, nDim) = su2double(0.0); } } From 6443070d2f31f6e3a976204f2c54c6edb4971c98 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 20 Sep 2024 09:37:59 +0200 Subject: [PATCH 13/56] - Added outputs log for SST-DDES --- Common/src/CConfig.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 3b36d9997545..e7f4500b41d1 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -6168,9 +6168,9 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) { case SA_DDES: cout << "Delayed Detached Eddy Simulation (DDES) with Standard SGS" << endl; break; case SA_ZDES: cout << "Delayed Detached Eddy Simulation (DDES) with Vorticity-based SGS" << endl; break; case SA_EDDES: cout << "Delayed Detached Eddy Simulation (DDES) with Shear-layer Adapted SGS" << endl; break; - case SST_DDES: cout << "Delayed Detached Eddy Simulation (DDES) with Vorticity-based SGS" << endl; break; - case SST_IDDES: cout << "Improved Delayed Detached Eddy Simulation (IDDES) with Vorticity-based SGS" << endl; break; - case SST_SIDDES: cout << "Simplified Improved Delayed Detached Eddy Simulation (SIDDES) with Vorticity-based SGS" << endl; break; + case SST_DDES: cout << "Delayed Detached Eddy Simulation (DDES)" << endl; break; + case SST_IDDES: cout << "Improved Delayed Detached Eddy Simulation (IDDES)" << endl; break; + case SST_SIDDES: cout << "Simplified Improved Delayed Detached Eddy Simulation (SIDDES)" << endl; break; } break; case MAIN_SOLVER::NEMO_EULER: From a58452681184e589853b4a0086de5a6cd948e991 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 20 Sep 2024 14:46:57 +0200 Subject: [PATCH 14/56] - update externals --- externals/medi | 2 +- externals/opdi | 2 +- subprojects/MLPCpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/externals/medi b/externals/medi index ab3a7688f6d5..aafc2d1966ba 160000 --- a/externals/medi +++ b/externals/medi @@ -1 +1 @@ -Subproject commit ab3a7688f6d518f8d940eb61a341d89f51922ba4 +Subproject commit aafc2d1966ba1233640af737e71c77c1a86183fd diff --git a/externals/opdi b/externals/opdi index 8c8979881725..c42cca71a3d0 160000 --- a/externals/opdi +++ b/externals/opdi @@ -1 +1 @@ -Subproject commit 8c89798817253abb017d857a0ae7f0520187645c +Subproject commit c42cca71a3d0b44fb482e268ecd40b623e71776b diff --git a/subprojects/MLPCpp b/subprojects/MLPCpp index c19c53ea2b85..665c45b7d353 160000 --- a/subprojects/MLPCpp +++ b/subprojects/MLPCpp @@ -1 +1 @@ -Subproject commit c19c53ea2b85ccfb185f1c6c87044dc0b5bc7ae0 +Subproject commit 665c45b7d3533c977eb1f637918d5b8b75c07d3b From 710e1dc5c1ec58128368db805b7348c3d12fdee2 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Wed, 30 Oct 2024 14:59:26 +0100 Subject: [PATCH 15/56] Fix SAS Babu implementation --- SU2_CFD/include/numerics/turbulent/turb_sources.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 0204ad3b7740..8b2bca6bcbd4 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -940,8 +940,8 @@ class CSourcePieceWise_TurbSST final : public CNumerics { const su2double L_vK_2 = C_s * sqrt(KolmConst * csi2 / (beta_blended/beta_star - alfa_blended)) * gridSize; const su2double L_vK = max(L_vK_1, L_vK_2); - const su2double gradTKE = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[0])/ScalarVar_i[0]; - const su2double gradOmega = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[1])/ScalarVar_i[1]; + const su2double gradTKE = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[0])/(ScalarVar_i[0]*ScalarVar_i[0]); + const su2double gradOmega = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[1])/(ScalarVar_i[1]*ScalarVar_i[1]); const su2double Q_SAS_1 = csi2 * KolmConst * StrainMag_i * StrainMag_i * (L/L_vK) * (L/L_vK); const su2double Q_SAS_2 = C * (2*ScalarVar_i[0] / sigma_phi) * max(gradOmega, gradTKE); From e4f28d4615f39f300da4e4672bedadfd545c9146 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Wed, 30 Oct 2024 15:38:20 +0100 Subject: [PATCH 16/56] - Fixed compilation error --- SU2_CFD/src/solvers/CSolver.cpp | 6 +++--- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index c3550371a454..d19df52ab702 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -1446,7 +1446,7 @@ void CSolver::GetCommCountAndType(const CConfig* config, COUNT_PER_POINT = nVar; MPI_TYPE = COMM_TYPE_DOUBLE; break; - case VELOCITY_LAPLACIAN: + case MPI_QUANTITIES::VELOCITY_LAPLACIAN: COUNT_PER_POINT = nDim; MPI_TYPE = COMM_TYPE_DOUBLE; break; @@ -1599,7 +1599,7 @@ void CSolver::InitiateComms(CGeometry *geometry, for (iVar = 0; iVar < nVar; iVar++) bufDSend[buf_offset+iVar] = base_nodes->GetSolution_time_n1(iPoint, iVar); break; - case VELOCITY_LAPLACIAN: + case MPI_QUANTITIES::VELOCITY_LAPLACIAN: for(iDim = 0; iDim < nDim; iDim++) bufDSend[buf_offset+iDim] = base_nodes->GetVelLapl(iPoint, iDim); break; @@ -1751,7 +1751,7 @@ void CSolver::CompleteComms(CGeometry *geometry, for (iVar = 0; iVar < nVar; iVar++) base_nodes->Set_Solution_time_n1(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; - case VELOCITY_LAPLACIAN: + case MPI_QUANTITIES::VELOCITY_LAPLACIAN: for (iDim = 0; iDim < nDim; iDim++) base_nodes->SetVelLapl(iPoint, iDim, bufDRecv[buf_offset+iDim]); break; diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index ac6c82a184cb..20f5f5602e2a 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -258,8 +258,8 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain /*--- MPI parallelization ---*/ - InitiateComms(geometry, config, VELOCITY_LAPLACIAN); - CompleteComms(geometry, config, VELOCITY_LAPLACIAN); + InitiateComms(geometry, config, MPI_QUANTITIES::VELOCITY_LAPLACIAN); + CompleteComms(geometry, config, MPI_QUANTITIES::VELOCITY_LAPLACIAN); } From 068ac21599c4e829a1f8083c307f680f82a29c54 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 7 Feb 2025 00:08:06 +0100 Subject: [PATCH 17/56] - Moved output functions not to brake the restart --- SU2_CFD/src/output/CFlowOutput.cpp | 31 ++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 40ea7e0fd236..08789fc30c1a 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1501,6 +1501,18 @@ void CFlowOutput::SetVolumeOutputFieldsScalarMisc(const CConfig* config) { AddVolumeOutput("VORTICITY", "Vorticity", "VORTEX_IDENTIFICATION", "Value of the vorticity"); } AddVolumeOutput("Q_CRITERION", "Q_Criterion", "VORTEX_IDENTIFICATION", "Value of the Q-Criterion"); + + AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "SOLUTION", "desired grid size for Scale Resolving Simulations"); + + if (TurbModelFamily(config->GetKind_Turb_Model()) == TURB_FAMILY::KW) { + if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_TRAVIS) AddVolumeOutput("FTRANS", "FTrans", "SOLUTION", "value of FTrans for SAS simulation"); + if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_BABU){ + AddVolumeOutput("VEL-LAPLACIAN_X", "Vel Laplacian x", "SOLUTION", "value of laplacian of x-velocity for SAS simulation"); + AddVolumeOutput("VEL-LAPLACIAN_Y", "Vel Laplacian y", "SOLUTION", "value of laplacian of y-velocity for SAS simulation"); + if (nDim == 3) AddVolumeOutput("VEL-LAPLACIAN_Z", "Vel Laplacian z", "SOLUTION", "value of laplacian of z-velocity for SAS simulation"); + } + } + } // Timestep info @@ -1534,6 +1546,17 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con SetVolumeOutputValue("VORTICITY", iPoint, Node_Flow->GetVorticity(iPoint)[2]); } SetVolumeOutputValue("Q_CRITERION", iPoint, GetQCriterion(Node_Flow->GetVelocityGradient(iPoint))); + + SetVolumeOutputValue("SRS_GRID_SIZE", iPoint, Node_Turb->GetSRSGridSize(iPoint)); + if (TurbModelFamily(config->GetKind_Turb_Model()) == TURB_FAMILY::KW) { + if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_TRAVIS) SetVolumeOutputValue("FTRANS", iPoint, Node_Turb->GetFTrans(iPoint)); + if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_BABU){ + SetVolumeOutputValue("VEL-LAPLACIAN_X", iPoint, Node_Turb->GetVelLapl(iPoint, 0)); + SetVolumeOutputValue("VEL-LAPLACIAN_Y", iPoint, Node_Turb->GetVelLapl(iPoint, 1)); + if (nDim == 3) SetVolumeOutputValue("VEL-LAPLACIAN_Z", iPoint, Node_Turb->GetVelLapl(iPoint, 2)); + } + + } } const bool limiter = (config->GetKind_SlopeLimit_Turb() != LIMITER::NONE); @@ -1542,7 +1565,6 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con case TURB_FAMILY::SA: SetVolumeOutputValue("NU_TILDE", iPoint, Node_Turb->GetSolution(iPoint, 0)); SetVolumeOutputValue("RES_NU_TILDE", iPoint, turb_solver->LinSysRes(iPoint, 0)); - SetVolumeOutputValue("SRS_GRID_SIZE", iPoint, Node_Turb->GetSRSGridSize(iPoint)); if (limiter) { SetVolumeOutputValue("LIMITER_NU_TILDE", iPoint, Node_Turb->GetLimiter(iPoint, 0)); } @@ -1553,13 +1575,6 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con SetVolumeOutputValue("DISSIPATION", iPoint, Node_Turb->GetSolution(iPoint, 1)); SetVolumeOutputValue("RES_TKE", iPoint, turb_solver->LinSysRes(iPoint, 0)); SetVolumeOutputValue("RES_DISSIPATION", iPoint, turb_solver->LinSysRes(iPoint, 1)); - SetVolumeOutputValue("SRS_GRID_SIZE", iPoint, Node_Turb->GetSRSGridSize(iPoint)); - if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_TRAVIS) SetVolumeOutputValue("FTRANS", iPoint, Node_Turb->GetFTrans(iPoint)); - if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_BABU){ - SetVolumeOutputValue("VEL-LAPLACIAN_X", iPoint, Node_Turb->GetVelLapl(iPoint, 0)); - SetVolumeOutputValue("VEL-LAPLACIAN_Y", iPoint, Node_Turb->GetVelLapl(iPoint, 1)); - if (nDim == 3) SetVolumeOutputValue("VEL-LAPLACIAN_Z", iPoint, Node_Turb->GetVelLapl(iPoint, 2)); - } if (limiter) { SetVolumeOutputValue("LIMITER_TKE", iPoint, Node_Turb->GetLimiter(iPoint, 0)); SetVolumeOutputValue("LIMITER_DISSIPATION", iPoint, Node_Turb->GetLimiter(iPoint, 1)); From cbe79f783f61c36a6ebf9cb1fd9d76bd44f0d1f9 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 7 Feb 2025 08:36:00 +0100 Subject: [PATCH 18/56] - Added limiting to eddy viscosity (needed?) - Removed boundary dependence on laplacian computation --- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 20f5f5602e2a..43d983383949 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -217,8 +217,6 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain SU2_OMP_FOR_DYN(256) for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) { - const bool boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint); - /*--- Initialize. ---*/ for (unsigned short iDim = 0; iDim < nDim; iDim++) nodes->SetVelLapl(iPoint, iDim, 0.0); @@ -226,12 +224,6 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain /*--- Loop over the neighbors of point i. ---*/ for (auto jPoint : geometry->nodes->GetPoints(iPoint)) { - bool boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint); - - /*--- If iPoint is boundary it only takes contributions from other boundary points. ---*/ - if (boundary_i && !boundary_j) continue; - - /*--- Add solution differences, with correction for compressible flows which use the enthalpy. ---*/ const su2double distance = GeometryToolbox::Distance(nDim, geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(jPoint)); const su2double delta_x = (flowNodes->GetVelocity(jPoint,0)-flowNodes->GetVelocity(iPoint,0))/distance; @@ -305,7 +297,16 @@ void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai const su2double omega = nodes->GetSolution(iPoint,1); const auto& eddy_visc_var = sstParsedOptions.version == SST_OPTIONS::V1994 ? VorticityMag : StrainMag; - const su2double muT = max(0.0, rho * a1 * kine / max(a1 * omega, eddy_visc_var * F2)); + su2double muT = max(0.0, rho * a1 * kine / max(a1 * omega, eddy_visc_var * F2)); + + // In the paper by Babu it says that the limiter on the von Karman length scale must prevent + // the SAS eddy viscosity from decreasing below the LES subgrid-scale eddy viscosity. The limiter has been imposed + // in the turb_sources, should I also limit the eddy viscosity here? + // If yes then this is how + const su2double gridSize = pow(geometry->nodes->GetVolume(iPoint), 1.0/3.0); + const su2double Cs = 0.5; // taken from turb_sources + const su2double muT_LES = rho * pow(Cs*gridSize, 2.0) * StrainMag; + muT = max(muT, muT_LES); nodes->SetmuT(iPoint, muT); From d770fa1a57d8e7b26ed822898015b93979d4756c Mon Sep 17 00:00:00 2001 From: rois1995 <43813346+rois1995@users.noreply.github.com> Date: Fri, 7 Feb 2025 08:37:11 +0100 Subject: [PATCH 19/56] Update SU2_CFD/include/numerics/CNumerics.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/include/numerics/CNumerics.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index c6297f6427ee..95462789828f 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -138,7 +138,7 @@ class CNumerics { *TurbPsi_j; /*!< \brief Vector of adjoint turbulent variables at point j. */ su2double lengthScale_i, lengthScale_j; /*!< \brief length scale for SST */ su2double FTrans; /*!< \brief SAS function */ - su2double *VelLapl; /*!< \brief Laplacian of the velocity */ + const su2double *VelLapl; /*!< \brief Laplacian of the velocity */ CMatrixView ConsVar_Grad_i, /*!< \brief Gradient of conservative variables at point i. */ ConsVar_Grad_j, /*!< \brief Gradient of conservative variables at point j. */ From 4dda1419c895fc08a5d8151d03e434d470839366 Mon Sep 17 00:00:00 2001 From: rois1995 <43813346+rois1995@users.noreply.github.com> Date: Fri, 7 Feb 2025 08:37:26 +0100 Subject: [PATCH 20/56] Update SU2_CFD/include/numerics/CNumerics.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/include/numerics/CNumerics.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index 95462789828f..037be9081fa8 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -718,7 +718,7 @@ class CNumerics { /*! * \brief Get the value of the value of FTrans. */ - inline void SetVelLapl(su2double* val_VelLapl) { + inline void SetVelLapl(const su2double* val_VelLapl) { VelLapl = val_VelLapl; } From 84d65bf8ab559d2156cff0cf31977f5382508a9d Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 7 Feb 2025 08:46:15 +0100 Subject: [PATCH 21/56] - change grid size computation to account for 2D --- SU2_CFD/include/numerics/turbulent/turb_sources.hpp | 2 +- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 8b2bca6bcbd4..76c5f617aaa5 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -931,7 +931,7 @@ class CSourcePieceWise_TurbSST final : public CNumerics { const su2double sigma_phi = 2.0/3.0; const su2double C = 2.0; const su2double C_s = 0.5; // Honestly I do not know if it is the right one. - const su2double gridSize = pow(Volume, 1.0/3.0); + const su2double gridSize = pow(Volume, 1.0/nDim); // Scale of the modeled turbulence const su2double L = sqrt(ScalarVar_i[0]) / (pow(beta_star, 0.25) * ScalarVar_i[1]); // Von Karman Length Scale diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 43d983383949..100e032aa85e 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -303,7 +303,7 @@ void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai // the SAS eddy viscosity from decreasing below the LES subgrid-scale eddy viscosity. The limiter has been imposed // in the turb_sources, should I also limit the eddy viscosity here? // If yes then this is how - const su2double gridSize = pow(geometry->nodes->GetVolume(iPoint), 1.0/3.0); + const su2double gridSize = pow(geometry->nodes->GetVolume(iPoint), 1.0/nDim); const su2double Cs = 0.5; // taken from turb_sources const su2double muT_LES = rho * pow(Cs*gridSize, 2.0) * StrainMag; muT = max(muT, muT_LES); From 53372298d1975d9a7883d8ca928e87cb9d93629e Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 7 Feb 2025 12:02:44 +0100 Subject: [PATCH 22/56] - Added output of debug variables to SAS - Removed SAS contribution to jacobian - Added an output field called SAS --- SU2_CFD/include/numerics/CNumerics.hpp | 30 +++++++ .../numerics/turbulent/turb_sources.hpp | 39 ++++++++-- .../include/variables/CTurbSSTVariable.hpp | 78 +++++++++++++++++++ SU2_CFD/include/variables/CVariable.hpp | 52 +++++++++++++ SU2_CFD/src/output/CFlowOutput.cpp | 20 ++++- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 27 +++++-- SU2_CFD/src/variables/CTurbSSTVariable.cpp | 5 ++ 7 files changed, 231 insertions(+), 20 deletions(-) diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index 037be9081fa8..0ff0bc952026 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -138,6 +138,11 @@ class CNumerics { *TurbPsi_j; /*!< \brief Vector of adjoint turbulent variables at point j. */ su2double lengthScale_i, lengthScale_j; /*!< \brief length scale for SST */ su2double FTrans; /*!< \brief SAS function */ + su2double Q_SAS_1; /*!< \brief SAS function */ + su2double Q_SAS_2; /*!< \brief SAS function */ + su2double L; /*!< \brief SAS function */ + su2double L_vK_1; /*!< \brief SAS function */ + su2double L_vK_2; /*!< \brief SAS function */ const su2double *VelLapl; /*!< \brief Laplacian of the velocity */ CMatrixView ConsVar_Grad_i, /*!< \brief Gradient of conservative variables at point i. */ @@ -715,6 +720,31 @@ class CNumerics { */ inline virtual su2double GetFTrans() const { return 0.0; } + /*! + * \brief Get the value of the value of Q_SAS1. + */ + inline virtual su2double GetQ_SAS1() const { return 0.0; } + + /*! + * \brief Get the value of the value of Q_SAS2. + */ + inline virtual su2double GetQ_SAS2() const { return 0.0; } + + /*! + * \brief Get the value of the value of L. + */ + inline virtual su2double GetL() const { return 0.0; } + + /*! + * \brief Get the value of the value of L_vK1. + */ + inline virtual su2double GetL_vK1() const { return 0.0; } + + /*! + * \brief Get the value of the value of L_vK2. + */ + inline virtual su2double GetL_vK2() const { return 0.0; } + /*! * \brief Get the value of the value of FTrans. */ diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 76c5f617aaa5..61aca5382d64 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -933,18 +933,18 @@ class CSourcePieceWise_TurbSST final : public CNumerics { const su2double C_s = 0.5; // Honestly I do not know if it is the right one. const su2double gridSize = pow(Volume, 1.0/nDim); // Scale of the modeled turbulence - const su2double L = sqrt(ScalarVar_i[0]) / (pow(beta_star, 0.25) * ScalarVar_i[1]); + L = sqrt(ScalarVar_i[0]) / (pow(beta_star, 0.25) * ScalarVar_i[1]); // Von Karman Length Scale const su2double VelLaplMag = GeometryToolbox::SquaredNorm(nDim, VelLapl); - const su2double L_vK_1 = KolmConst * StrainMag_i / sqrt(VelLaplMag); - const su2double L_vK_2 = C_s * sqrt(KolmConst * csi2 / (beta_blended/beta_star - alfa_blended)) * gridSize; + L_vK_1 = KolmConst * StrainMag_i / sqrt(VelLaplMag); + L_vK_2 = C_s * sqrt(KolmConst * csi2 / (beta_blended/beta_star - alfa_blended)) * gridSize; const su2double L_vK = max(L_vK_1, L_vK_2); const su2double gradTKE = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[0])/(ScalarVar_i[0]*ScalarVar_i[0]); const su2double gradOmega = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[1])/(ScalarVar_i[1]*ScalarVar_i[1]); - const su2double Q_SAS_1 = csi2 * KolmConst * StrainMag_i * StrainMag_i * (L/L_vK) * (L/L_vK); - const su2double Q_SAS_2 = C * (2*ScalarVar_i[0] / sigma_phi) * max(gradOmega, gradTKE); + Q_SAS_1 = csi2 * KolmConst * StrainMag_i * StrainMag_i * (L/L_vK) * (L/L_vK); + Q_SAS_2 = C * (2*ScalarVar_i[0] / sigma_phi) * max(gradOmega, gradTKE); Q_SAS = max(Q_SAS_1 - Q_SAS_2, 0.0); @@ -975,9 +975,9 @@ class CSourcePieceWise_TurbSST final : public CNumerics { Jacobian_i[1][0] = 0.0; Jacobian_i[1][1] = -2.0 * beta_blended * ScalarVar_i[1] * Volume * (1.0 - 0.09/beta_blended * zetaFMt); - if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_BABU) { - Jacobian_i[0][0] += Q_SAS * Volume / ScalarVar_i[0]; - } + // if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_BABU) { + // Jacobian_i[0][0] += Q_SAS * Volume / ScalarVar_i[0]; + // } } AD::SetPreaccOut(Residual, nVar); @@ -991,5 +991,28 @@ class CSourcePieceWise_TurbSST final : public CNumerics { */ inline su2double GetFTrans() const override { return FTrans; } + /*! + * \brief Get the value of the Q_SAS1. + */ + inline su2double GetQ_SAS1() const override { return Q_SAS_1; } + + /*! + * \brief Get the value of the Q_SAS2. + */ + inline su2double GetQ_SAS2() const override { return Q_SAS_2; } + /*! + * \brief Get the value of the L. + */ + inline su2double GetL() const override { return L; } + + /*! + * \brief Get the value of the L_vK1. + */ + inline su2double GetL_vK1() const override { return L_vK_1; } + + /*! + * \brief Get the value of the L_vK2. + */ + inline su2double GetL_vK2() const override { return L_vK_2; } }; diff --git a/SU2_CFD/include/variables/CTurbSSTVariable.hpp b/SU2_CFD/include/variables/CTurbSSTVariable.hpp index 42f938566d5d..4c11ff99e505 100644 --- a/SU2_CFD/include/variables/CTurbSSTVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSSTVariable.hpp @@ -54,6 +54,11 @@ class CTurbSSTVariable final : public CTurbVariable { VectorType r_d; VectorType FTrans; MatrixType VelocityLaplacian; + VectorType Q_SAS1; + VectorType Q_SAS2; + VectorType L; + VectorType L_vK1; + VectorType L_vK2; public: /*! @@ -191,5 +196,78 @@ class CTurbSSTVariable final : public CTurbVariable { VelocityLaplacian(iPoint, iDim) = val_VelLapl; }; + /*! + * \brief Set the value of the Q_SAS1. + * \param[in] iPoint - Point index. + * \param[in] val_FTrans - Value of the FTrans variable. + */ + inline void SetQ_SAS1(unsigned long iPoint, su2double val_Q_SAS1) override { + Q_SAS1(iPoint) = val_Q_SAS1; + }; + + /*! + * \brief Set the value of the Q_SAS2. + * \param[in] iPoint - Point index. + * \param[in] val_FTrans - Value of the FTrans variable. + */ + inline void SetQ_SAS2(unsigned long iPoint, su2double val_Q_SAS2) override { + Q_SAS2(iPoint) = val_Q_SAS2; + }; + + /*! + * \brief Set the value of the FTrans. + * \param[in] iPoint - Point index. + * \param[in] val_FTrans - Value of the FTrans variable. + */ + inline void SetL(unsigned long iPoint, su2double val_L) override { + L(iPoint) = val_L; + }; + + /*! + * \brief Set the value of the FTrans. + * \param[in] iPoint - Point index. + * \param[in] val_FTrans - Value of the FTrans variable. + */ + inline void SetL_vK1(unsigned long iPoint, su2double val_L_vK1) override { + L_vK1(iPoint) = val_L_vK1; + }; + + /*! + * \brief Set the value of the FTrans. + * \param[in] iPoint - Point index. + * \param[in] val_FTrans - Value of the FTrans variable. + */ + inline void SetL_vK2(unsigned long iPoint, su2double val_L_vK2) override { + L_vK2(iPoint) = val_L_vK2; + }; + + + /*! + * \brief Get the value of the Q_SAS1. + * \param[in] iPoint - Point index. + */ + inline su2double GetQ_SAS1(unsigned long iPoint) const override { return Q_SAS1(iPoint); } + /*! + * \brief Get the value of the Q_SAS2. + * \param[in] iPoint - Point index. + */ + inline su2double GetQ_SAS2(unsigned long iPoint) const override { return Q_SAS2(iPoint); } + /*! + * \brief Get the value of the FTrans. + * \param[in] iPoint - Point index. + */ + inline su2double GetL(unsigned long iPoint) const override { return L(iPoint); } + /*! + * \brief Get the value of the FTrans. + * \param[in] iPoint - Point index. + */ + inline su2double GetL_vK1(unsigned long iPoint) const override { return L_vK1(iPoint); } + /*! + * \brief Get the value of the FTrans. + * \param[in] iPoint - Point index. + */ + inline su2double GetL_vK2(unsigned long iPoint) const override { return L_vK2(iPoint); } + + }; diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index d01c93633268..84182225907d 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -1686,6 +1686,58 @@ class CVariable { */ inline virtual void SetFTrans(unsigned long iPoint, su2double val_FTrans) {} + /*! + * \brief Get the value of the value of Q_SAS1. + */ + inline virtual su2double GetQ_SAS1(unsigned long iPoint) const { return 0.0; } + + /*! + * \brief Set the value of the value of Q_SAS1. + */ + inline virtual void SetQ_SAS1(unsigned long iPoint, su2double val_Q_SAS1) {} + + /*! + * \brief Get the value of the value of Q_SAS2. + */ + inline virtual su2double GetQ_SAS2(unsigned long iPoint) const { return 0.0; } + + /*! + * \brief Set the value of the value of Q_SAS2. + */ + inline virtual void SetQ_SAS2(unsigned long iPoint, su2double val_Q_SAS2) {} + + /*! + * \brief Get the value of the value of L. + */ + inline virtual su2double GetL(unsigned long iPoint) const { return 0.0; } + + /*! + * \brief Set the value of the value of L. + */ + inline virtual void SetL(unsigned long iPoint, su2double val_L) {} + + /*! + * \brief Get the value of the value of L_vK1. + */ + inline virtual su2double GetL_vK1(unsigned long iPoint) const { return 0.0; } + + /*! + * \brief Set the value of the value of L_vK1. + */ + inline virtual void SetL_vK1(unsigned long iPoint, su2double val_L_vK1) {} + + /*! + * \brief Get the value of the value of L_vK2. + */ + inline virtual su2double GetL_vK2(unsigned long iPoint) const { return 0.0; } + + /*! + * \brief Set the value of the value of L_vK2. + */ + inline virtual void SetL_vK2(unsigned long iPoint, su2double val_L_vK2) {} + + + /*! * \brief Get the value of the velocity laplacian. */ diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 08789fc30c1a..759336648d01 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1502,14 +1502,19 @@ void CFlowOutput::SetVolumeOutputFieldsScalarMisc(const CConfig* config) { } AddVolumeOutput("Q_CRITERION", "Q_Criterion", "VORTEX_IDENTIFICATION", "Value of the Q-Criterion"); - AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "SOLUTION", "desired grid size for Scale Resolving Simulations"); + AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "SAS", "desired grid size for Scale Resolving Simulations"); if (TurbModelFamily(config->GetKind_Turb_Model()) == TURB_FAMILY::KW) { if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_TRAVIS) AddVolumeOutput("FTRANS", "FTrans", "SOLUTION", "value of FTrans for SAS simulation"); if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_BABU){ - AddVolumeOutput("VEL-LAPLACIAN_X", "Vel Laplacian x", "SOLUTION", "value of laplacian of x-velocity for SAS simulation"); - AddVolumeOutput("VEL-LAPLACIAN_Y", "Vel Laplacian y", "SOLUTION", "value of laplacian of y-velocity for SAS simulation"); - if (nDim == 3) AddVolumeOutput("VEL-LAPLACIAN_Z", "Vel Laplacian z", "SOLUTION", "value of laplacian of z-velocity for SAS simulation"); + AddVolumeOutput("Q_SAS_1", "Q_SAS 1", "SAS", "value of first term of Q_SAS for SAS simulation"); + AddVolumeOutput("Q_SAS_2", "Q_SAS 2", "SAS", "value of second term of Q_SAS for SAS simulation"); + AddVolumeOutput("L", "L", "SAS", "value of turbulence length scale for SAS simulation"); + AddVolumeOutput("L_VK_1", "L_vK 1", "SAS", "value of first term of von Karman length scale for SAS simulation"); + AddVolumeOutput("L_VK_2", "L_vK 2", "SAS", "value of second term of von Karman length scale for SAS simulation"); + AddVolumeOutput("VEL-LAPLACIAN_X", "Vel Laplacian x", "SAS", "value of laplacian of x-velocity for SAS simulation"); + AddVolumeOutput("VEL-LAPLACIAN_Y", "Vel Laplacian y", "SAS", "value of laplacian of y-velocity for SAS simulation"); + if (nDim == 3) AddVolumeOutput("VEL-LAPLACIAN_Z", "Vel Laplacian z", "SAS", "value of laplacian of z-velocity for SAS simulation"); } } @@ -1551,6 +1556,13 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con if (TurbModelFamily(config->GetKind_Turb_Model()) == TURB_FAMILY::KW) { if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_TRAVIS) SetVolumeOutputValue("FTRANS", iPoint, Node_Turb->GetFTrans(iPoint)); if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_BABU){ + + SetVolumeOutputValue("Q_SAS_1", iPoint, Node_Turb->GetQ_SAS1(iPoint)); + SetVolumeOutputValue("Q_SAS_2", iPoint, Node_Turb->GetQ_SAS2(iPoint)); + SetVolumeOutputValue("L", iPoint, Node_Turb->GetL(iPoint)); + SetVolumeOutputValue("L_VK_1", iPoint, Node_Turb->GetL_vK1(iPoint)); + SetVolumeOutputValue("L_VK_2", iPoint, Node_Turb->GetL_vK2(iPoint)); + SetVolumeOutputValue("VEL-LAPLACIAN_X", iPoint, Node_Turb->GetVelLapl(iPoint, 0)); SetVolumeOutputValue("VEL-LAPLACIAN_Y", iPoint, Node_Turb->GetVelLapl(iPoint, 1)); if (nDim == 3) SetVolumeOutputValue("VEL-LAPLACIAN_Z", iPoint, Node_Turb->GetVelLapl(iPoint, 2)); diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 100e032aa85e..8bccbf8b784b 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -299,14 +299,16 @@ void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai const auto& eddy_visc_var = sstParsedOptions.version == SST_OPTIONS::V1994 ? VorticityMag : StrainMag; su2double muT = max(0.0, rho * a1 * kine / max(a1 * omega, eddy_visc_var * F2)); - // In the paper by Babu it says that the limiter on the von Karman length scale must prevent - // the SAS eddy viscosity from decreasing below the LES subgrid-scale eddy viscosity. The limiter has been imposed - // in the turb_sources, should I also limit the eddy viscosity here? - // If yes then this is how - const su2double gridSize = pow(geometry->nodes->GetVolume(iPoint), 1.0/nDim); - const su2double Cs = 0.5; // taken from turb_sources - const su2double muT_LES = rho * pow(Cs*gridSize, 2.0) * StrainMag; - muT = max(muT, muT_LES); + if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_BABU) { + // In the paper by Babu it says that the limiter on the von Karman length scale must prevent + // the SAS eddy viscosity from decreasing below the LES subgrid-scale eddy viscosity. The limiter has been imposed + // in the turb_sources, should I also limit the eddy viscosity here? + // If yes then this is how + const su2double gridSize = pow(geometry->nodes->GetVolume(iPoint), 1.0/nDim); + const su2double Cs = 0.5; // taken from turb_sources + const su2double muT_LES = rho * pow(Cs*gridSize, 2.0) * StrainMag; + muT = max(muT, muT_LES); + } nodes->SetmuT(iPoint, muT); @@ -455,6 +457,15 @@ void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta nodes->SetFTrans(iPoint, numerics->GetFTrans()); } + /*--- Store the SAS function ---*/ + if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_BABU) { + nodes->SetQ_SAS1(iPoint, numerics->GetQ_SAS1()); + nodes->SetQ_SAS2(iPoint, numerics->GetQ_SAS2()); + nodes->SetL(iPoint, numerics->GetL()); + nodes->SetL_vK1(iPoint, numerics->GetL_vK1()); + nodes->SetL_vK2(iPoint, numerics->GetL_vK2()); + } + /*--- Store the intermittency ---*/ if (config->GetKind_Trans_Model() != TURB_TRANS_MODEL::NONE) { diff --git a/SU2_CFD/src/variables/CTurbSSTVariable.cpp b/SU2_CFD/src/variables/CTurbSSTVariable.cpp index 2d24b5c41326..76af25987f5b 100644 --- a/SU2_CFD/src/variables/CTurbSSTVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSSTVariable.cpp @@ -62,6 +62,11 @@ CTurbSSTVariable::CTurbSSTVariable(su2double kine, su2double omega, su2double mu if(sstParsedOptions.sasModel == SST_OPTIONS::SAS_TRAVIS) FTrans.resize(nPoint) = su2double(1.0); if(sstParsedOptions.sasModel == SST_OPTIONS::SAS_BABU) { VelocityLaplacian.resize(nPoint, nDim) = su2double(0.0); + Q_SAS1.resize(nPoint) = su2double(0.0); + Q_SAS2.resize(nPoint) = su2double(0.0); + L.resize(nPoint) = su2double(0.0); + L_vK1.resize(nPoint) = su2double(0.0); + L_vK2.resize(nPoint) = su2double(0.0); } } From 0806d2145588e41eb83ea73957f0c495f9e99c66 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Mon, 10 Feb 2025 09:40:55 +0100 Subject: [PATCH 23/56] - Fixed bug that always activates SAS Babu --- Common/include/option_structure.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 8fca4a72895c..01fe6c35979e 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -1066,13 +1066,13 @@ inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigne const bool sst_compWilcox = IsPresent(SST_OPTIONS::COMP_Wilcox); const bool sst_compSarkar = IsPresent(SST_OPTIONS::COMP_Sarkar); const bool sst_dll = IsPresent(SST_OPTIONS::DLL); - const bool sst_sas_simple = IsPresent(SST_OPTIONS::SAS_TRAVIS); - const bool sst_sas_comp = IsPresent(SST_OPTIONS::SAS_BABU); - if (sst_sas_simple && sst_sas_comp) { + const bool sst_sas_travis = IsPresent(SST_OPTIONS::SAS_TRAVIS); + const bool sst_sas_babu = IsPresent(SST_OPTIONS::SAS_BABU); + if (sst_sas_travis && sst_sas_babu) { SU2_MPI::Error("Two versions (Simple and Complicated) selected for SAS under SST_OPTIONS. Please choose only one.", CURRENT_FUNCTION); - } else if (sst_sas_simple) { + } else if (sst_sas_travis) { SSTParsedOptions.sasModel = SST_OPTIONS::SAS_TRAVIS; - } else { + } else if (sst_sas_babu) { SSTParsedOptions.sasModel = SST_OPTIONS::SAS_BABU; } From 0cab1ef39f26667704d8bb4c0514f81b0689cd5c Mon Sep 17 00:00:00 2001 From: rois1995 Date: Wed, 12 Feb 2025 11:00:20 +0100 Subject: [PATCH 24/56] - Modified the C_S constant in Lvk limiter --- SU2_CFD/include/numerics/turbulent/turb_sources.hpp | 7 +++++-- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 61aca5382d64..1dbad19c313a 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -930,14 +930,17 @@ class CSourcePieceWise_TurbSST final : public CNumerics { const su2double csi2 = 3.51; const su2double sigma_phi = 2.0/3.0; const su2double C = 2.0; - const su2double C_s = 0.5; // Honestly I do not know if it is the right one. + // const su2double C_DES = 0.5; // Honestly I do not know if it is the right one. + const su2double C_DES1 = 0.78; + const su2double C_DES2 = 0.61; + const su2double C_DES = C_DES1 * F1_i + C_DES2 * (1-F1_i); // taken this from the SST-DDES part const su2double gridSize = pow(Volume, 1.0/nDim); // Scale of the modeled turbulence L = sqrt(ScalarVar_i[0]) / (pow(beta_star, 0.25) * ScalarVar_i[1]); // Von Karman Length Scale const su2double VelLaplMag = GeometryToolbox::SquaredNorm(nDim, VelLapl); L_vK_1 = KolmConst * StrainMag_i / sqrt(VelLaplMag); - L_vK_2 = C_s * sqrt(KolmConst * csi2 / (beta_blended/beta_star - alfa_blended)) * gridSize; + L_vK_2 = C_DES * sqrt(KolmConst * csi2 / (beta_blended/beta_star - alfa_blended)) * gridSize; const su2double L_vK = max(L_vK_1, L_vK_2); const su2double gradTKE = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[0])/(ScalarVar_i[0]*ScalarVar_i[0]); diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 8bccbf8b784b..c7882581c66b 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -305,8 +305,11 @@ void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai // in the turb_sources, should I also limit the eddy viscosity here? // If yes then this is how const su2double gridSize = pow(geometry->nodes->GetVolume(iPoint), 1.0/nDim); - const su2double Cs = 0.5; // taken from turb_sources - const su2double muT_LES = rho * pow(Cs*gridSize, 2.0) * StrainMag; + const su2double C_DES1 = 0.78; + const su2double C_DES2 = 0.61; + const su2double C_DES = C_DES1 * nodes->GetF1blending(iPoint) + C_DES2 * (1-nodes->GetF1blending(iPoint)); // taken this from the SST-DDES part + // const su2double Cs = 0.5; // taken from turb_sources + const su2double muT_LES = rho * pow(C_DES*gridSize, 2.0) * StrainMag; muT = max(muT, muT_LES); } From ad8619251cdadbee1143eba65267105fb53aa7f4 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Wed, 26 Feb 2025 15:14:43 +0100 Subject: [PATCH 25/56] Changed computation of Laplacian --- SU2_CFD/src/solvers/CSolver.cpp | 38 +++++++++++++++++++------- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 37 ++++++++++++++++++++++--- 2 files changed, 61 insertions(+), 14 deletions(-) diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index d19df52ab702..8362798494cf 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -974,7 +974,7 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, } break; - case PERIODIC_VEL_LAPLACIAN: + case PERIODIC_VEL_LAPLACIAN: { /*--- For JST, the undivided Laplacian must be computed consistently by using the complete control volume info @@ -983,21 +983,40 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, for (iDim = 0; iDim < nDim; iDim++) Vel_Lapl[iDim] = 0.0; - for (auto jPoint : geometry->nodes->GetPoints(iPoint)) { + su2double halfOnVol = 1.0 / (geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint)); + const auto coordsIPoint = geometry->nodes->GetCoord(iPoint); + + for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) { /*--- Avoid periodic boundary points so that we do not duplicate edges on both sides of the periodic BC. ---*/ + size_t jPoint = geometry->nodes->GetPoint(iPoint, iNeigh); + if (!geometry->nodes->GetPeriodicBoundary(jPoint)) { - /*--- Solution differences ---*/ - const su2double distance = GeometryToolbox::Distance(nDim, geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(jPoint)); + size_t iEdge = geometry->nodes->GetEdge(iPoint, iNeigh); + su2double weight = halfOnVol; - for (iDim = 0; iDim < nDim; iDim++) - Diff[iDim] = (base_nodes->GetVelocity(iPoint, iDim) - - base_nodes->GetVelocity(jPoint, iDim))/distance; + const auto area = geometry->edges->GetNormal(iEdge); + AD::SetPreaccIn(area, nDim); + + const auto coordsJPoint = geometry->nodes->GetCoord(jPoint); + su2double I2JVec[nDim] = {0.0}; + for (size_t iDim = 0; iDim < nDim; ++iDim) I2JVec[iDim] = coordsJPoint[iDim] - coordsIPoint[iDim]; + const su2double I2JVecnorm = GeometryToolbox::SquaredNorm(nDim, I2JVec); + const su2double AreaNorm = GeometryToolbox::Norm(nDim, area); + su2double edgeNormal = 0.0; + for (size_t iDim = 0; iDim < nDim; ++iDim) + edgeNormal += area[iDim] * I2JVec[iDim]/AreaNorm; + + const su2double distance = GeometryToolbox::Distance(nDim, geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(jPoint)); + + for (iDim = 0; iDimGetVelocity(jPoint,iDim)-base_nodes->GetVelocity(iPoint,iDim))* edgeNormal * AreaNorm / I2JVecnorm; + boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint); boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint); @@ -1007,7 +1026,7 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, if (!boundary_i || boundary_j) { if (geometry->nodes->GetDomain(iPoint)){ for (iDim = 0; iDim< nDim; iDim++) - Vel_Lapl[iDim] -= Diff[iDim]; + Vel_Lapl[iDim] -= Diff[iDim]; } } } @@ -1025,8 +1044,7 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, } break; - - + } default: SU2_MPI::Error("Unrecognized quantity for periodic communication.", CURRENT_FUNCTION); diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index c7882581c66b..0b577e3681b0 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -212,6 +212,7 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain } if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_BABU){ + auto* flowNodes = su2staticcast_p(solver_container[FLOW_SOL]->GetNodes()); SU2_OMP_FOR_DYN(256) @@ -221,17 +222,45 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain for (unsigned short iDim = 0; iDim < nDim; iDim++) nodes->SetVelLapl(iPoint, iDim, 0.0); + su2double halfOnVol = 1.0 / (geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint)); + + const auto coordsIPoint = geometry->nodes->GetCoord(iPoint); + /*--- Loop over the neighbors of point i. ---*/ - for (auto jPoint : geometry->nodes->GetPoints(iPoint)) { + for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) { + + size_t iEdge = geometry->nodes->GetEdge(iPoint, iNeigh); + size_t jPoint = geometry->nodes->GetPoint(iPoint, iNeigh); + + /*--- Determine if edge points inwards or outwards of iPoint. + * If inwards we need to flip the area vector. ---*/ + + su2double dir = (iPoint < jPoint) ? 1.0 : -1.0; + // su2double weight = dir * halfOnVol; + su2double weight = halfOnVol; + + const auto area = geometry->edges->GetNormal(iEdge); + AD::SetPreaccIn(area, nDim); + + const auto coordsJPoint = geometry->nodes->GetCoord(jPoint); + + su2double I2JVec[nDim] = {0.0}; + for (size_t iDim = 0; iDim < nDim; ++iDim) I2JVec[iDim] = coordsJPoint[iDim] - coordsIPoint[iDim]; + + const su2double I2JVecnorm = GeometryToolbox::SquaredNorm(nDim, I2JVec); + const su2double AreaNorm = GeometryToolbox::Norm(nDim, area); + su2double edgeNormal = 0.0; + for (size_t iDim = 0; iDim < nDim; ++iDim) + edgeNormal += area[iDim] * I2JVec[iDim]/AreaNorm; const su2double distance = GeometryToolbox::Distance(nDim, geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(jPoint)); - const su2double delta_x = (flowNodes->GetVelocity(jPoint,0)-flowNodes->GetVelocity(iPoint,0))/distance; - const su2double delta_y = (flowNodes->GetVelocity(jPoint,1)-flowNodes->GetVelocity(iPoint,1))/distance; + const su2double delta_x = weight *(flowNodes->GetVelocity(jPoint,0)-flowNodes->GetVelocity(iPoint,0))* edgeNormal * AreaNorm / I2JVecnorm; + const su2double delta_y = weight *(flowNodes->GetVelocity(jPoint,1)-flowNodes->GetVelocity(iPoint,1))* edgeNormal * AreaNorm / I2JVecnorm; su2double delta_z = 0.0; if (nDim == 3) { - delta_z = (flowNodes->GetVelocity(jPoint,2)-flowNodes->GetVelocity(iPoint,2))/distance; + delta_z = weight *(flowNodes->GetVelocity(jPoint,2)-flowNodes->GetVelocity(iPoint,2))* edgeNormal * AreaNorm / I2JVecnorm; } nodes->AddVelLapl(iPoint, delta_x, delta_y, delta_z); From dcbacc893ae31f98d174857db39691f7c7f3277f Mon Sep 17 00:00:00 2001 From: rois1995 Date: Tue, 4 Mar 2025 11:48:50 +0100 Subject: [PATCH 26/56] - slight changes to functions calls --- SU2_CFD/include/numerics/turbulent/turb_sources.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 1dbad19c313a..22c05122eb90 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -938,8 +938,8 @@ class CSourcePieceWise_TurbSST final : public CNumerics { // Scale of the modeled turbulence L = sqrt(ScalarVar_i[0]) / (pow(beta_star, 0.25) * ScalarVar_i[1]); // Von Karman Length Scale - const su2double VelLaplMag = GeometryToolbox::SquaredNorm(nDim, VelLapl); - L_vK_1 = KolmConst * StrainMag_i / sqrt(VelLaplMag); + const su2double VelLaplMag = GeometryToolbox::Norm(nDim, VelLapl); + L_vK_1 = KolmConst * StrainMag_i / VelLaplMag; L_vK_2 = C_DES * sqrt(KolmConst * csi2 / (beta_blended/beta_star - alfa_blended)) * gridSize; const su2double L_vK = max(L_vK_1, L_vK_2); From a5702d8ef5f68a159644ef73eb178bd02b6a5def Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 7 Mar 2025 15:08:25 +0100 Subject: [PATCH 27/56] - align externals and submodules to develop --- externals/codi | 2 +- externals/medi | 2 +- externals/opdi | 2 +- subprojects/MLPCpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/externals/codi b/externals/codi index 8ee822a9b0bb..762ba7698e3c 160000 --- a/externals/codi +++ b/externals/codi @@ -1 +1 @@ -Subproject commit 8ee822a9b0bb8235a2494467b774e27fb64ff14f +Subproject commit 762ba7698e3ceaa1b17aa299421ddd418f00b823 diff --git a/externals/medi b/externals/medi index aafc2d1966ba..7d550831e0e2 160000 --- a/externals/medi +++ b/externals/medi @@ -1 +1 @@ -Subproject commit aafc2d1966ba1233640af737e71c77c1a86183fd +Subproject commit 7d550831e0e233a85b9d9af9c181d7ecb2929946 diff --git a/externals/opdi b/externals/opdi index c42cca71a3d0..a6b9655c240a 160000 --- a/externals/opdi +++ b/externals/opdi @@ -1 +1 @@ -Subproject commit c42cca71a3d0b44fb482e268ecd40b623e71776b +Subproject commit a6b9655c240af2a35454a61727e5bbbbaa3a425f diff --git a/subprojects/MLPCpp b/subprojects/MLPCpp index 665c45b7d353..6865a58b22f2 160000 --- a/subprojects/MLPCpp +++ b/subprojects/MLPCpp @@ -1 +1 @@ -Subproject commit 665c45b7d3533c977eb1f637918d5b8b75c07d3b +Subproject commit 6865a58b22f21a92977839d9c93eae9522402f55 From ab6bedb3f88a3e047a3ee55a52763d392ca30a00 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 7 Mar 2025 15:32:16 +0100 Subject: [PATCH 28/56] -fixed compilation errors --- SU2_CFD/src/solvers/CSolver.cpp | 8 +++----- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 12 +++--------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index f2c231d2dbc5..ae236c2116e3 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -983,7 +983,7 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, for (iDim = 0; iDim < nDim; iDim++) Vel_Lapl[iDim] = 0.0; - su2double halfOnVol = 1.0 / (geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint)); + const su2double halfOnVol = 1.0 / (geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint)); const auto coordsIPoint = geometry->nodes->GetCoord(iPoint); for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) { @@ -996,14 +996,14 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, if (!geometry->nodes->GetPeriodicBoundary(jPoint)) { size_t iEdge = geometry->nodes->GetEdge(iPoint, iNeigh); - su2double weight = halfOnVol; + const su2double weight = halfOnVol; const auto area = geometry->edges->GetNormal(iEdge); AD::SetPreaccIn(area, nDim); const auto coordsJPoint = geometry->nodes->GetCoord(jPoint); - su2double I2JVec[nDim] = {0.0}; + su2double I2JVec[3] = {0.0}; for (size_t iDim = 0; iDim < nDim; ++iDim) I2JVec[iDim] = coordsJPoint[iDim] - coordsIPoint[iDim]; const su2double I2JVecnorm = GeometryToolbox::SquaredNorm(nDim, I2JVec); @@ -1012,8 +1012,6 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, for (size_t iDim = 0; iDim < nDim; ++iDim) edgeNormal += area[iDim] * I2JVec[iDim]/AreaNorm; - const su2double distance = GeometryToolbox::Distance(nDim, geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(jPoint)); - for (iDim = 0; iDimGetVelocity(jPoint,iDim)-base_nodes->GetVelocity(iPoint,iDim))* edgeNormal * AreaNorm / I2JVecnorm; diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 7d95a1e8fc67..2c37ca5cb8f9 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -222,7 +222,7 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain for (unsigned short iDim = 0; iDim < nDim; iDim++) nodes->SetVelLapl(iPoint, iDim, 0.0); - su2double halfOnVol = 1.0 / (geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint)); + const su2double halfOnVol = 1.0 / (geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint)); const auto coordsIPoint = geometry->nodes->GetCoord(iPoint); @@ -235,16 +235,14 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain /*--- Determine if edge points inwards or outwards of iPoint. * If inwards we need to flip the area vector. ---*/ - su2double dir = (iPoint < jPoint) ? 1.0 : -1.0; - // su2double weight = dir * halfOnVol; - su2double weight = halfOnVol; + const su2double weight = halfOnVol; const auto area = geometry->edges->GetNormal(iEdge); AD::SetPreaccIn(area, nDim); const auto coordsJPoint = geometry->nodes->GetCoord(jPoint); - su2double I2JVec[nDim] = {0.0}; + su2double I2JVec[MAXNDIM] = {0.0}; for (size_t iDim = 0; iDim < nDim; ++iDim) I2JVec[iDim] = coordsJPoint[iDim] - coordsIPoint[iDim]; const su2double I2JVecnorm = GeometryToolbox::SquaredNorm(nDim, I2JVec); @@ -253,8 +251,6 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain for (size_t iDim = 0; iDim < nDim; ++iDim) edgeNormal += area[iDim] * I2JVec[iDim]/AreaNorm; - const su2double distance = GeometryToolbox::Distance(nDim, geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(jPoint)); - const su2double delta_x = weight *(flowNodes->GetVelocity(jPoint,0)-flowNodes->GetVelocity(iPoint,0))* edgeNormal * AreaNorm / I2JVecnorm; const su2double delta_y = weight *(flowNodes->GetVelocity(jPoint,1)-flowNodes->GetVelocity(iPoint,1))* edgeNormal * AreaNorm / I2JVecnorm; su2double delta_z = 0.0; @@ -1230,8 +1226,6 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C const su2double C_w = 0.15; const su2double C_dt1 = 20.0; const su2double C_dt2 = 3.0; - const su2double C_l = 5.0; - const su2double C_t = 1.87; const su2double alpha = 0.25 - sqrt(wallDist2) / h_max; const su2double f_b = min(2.0 * exp(-9.0 * alpha*alpha), 1.0); From e5080a14a526a5d99efb2f6ae23546023cdf644c Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 7 Mar 2025 16:00:49 +0100 Subject: [PATCH 29/56] - Solve declaration hids variable --- SU2_CFD/src/solvers/CSolver.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index ae236c2116e3..24d5e8d4b9bf 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -996,7 +996,7 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, if (!geometry->nodes->GetPeriodicBoundary(jPoint)) { size_t iEdge = geometry->nodes->GetEdge(iPoint, iNeigh); - const su2double weight = halfOnVol; + weight = halfOnVol; const auto area = geometry->edges->GetNormal(iEdge); AD::SetPreaccIn(area, nDim); @@ -1004,12 +1004,12 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, const auto coordsJPoint = geometry->nodes->GetCoord(jPoint); su2double I2JVec[3] = {0.0}; - for (size_t iDim = 0; iDim < nDim; ++iDim) I2JVec[iDim] = coordsJPoint[iDim] - coordsIPoint[iDim]; + for (iDim = 0; iDim < nDim; ++iDim) I2JVec[iDim] = coordsJPoint[iDim] - coordsIPoint[iDim]; const su2double I2JVecnorm = GeometryToolbox::SquaredNorm(nDim, I2JVec); const su2double AreaNorm = GeometryToolbox::Norm(nDim, area); su2double edgeNormal = 0.0; - for (size_t iDim = 0; iDim < nDim; ++iDim) + for (iDim = 0; iDim < nDim; ++iDim) edgeNormal += area[iDim] * I2JVec[iDim]/AreaNorm; for (iDim = 0; iDim Date: Fri, 7 Mar 2025 17:57:33 +0100 Subject: [PATCH 30/56] - SRS Grid size output (fix?) --- SU2_CFD/include/numerics/turbulent/turb_sources.hpp | 4 ---- SU2_CFD/src/output/CFlowOutput.cpp | 7 +++++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 18605e18c4fb..26391bd43172 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -978,10 +978,6 @@ class CSourcePieceWise_TurbSST final : public CNumerics { Jacobian_i[0][1] = -beta_star * ScalarVar_i[0] * Volume * (1.0 + zetaFMt) * FTrans; Jacobian_i[1][0] = 0.0; Jacobian_i[1][1] = -2.0 * beta_blended * ScalarVar_i[1] * Volume * (1.0 - 0.09/beta_blended * zetaFMt); - - // if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_BABU) { - // Jacobian_i[0][0] += Q_SAS * Volume / ScalarVar_i[0]; - // } } AD::SetPreaccOut(Residual, nVar); diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 759336648d01..4c70730e08ba 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1502,7 +1502,8 @@ void CFlowOutput::SetVolumeOutputFieldsScalarMisc(const CConfig* config) { } AddVolumeOutput("Q_CRITERION", "Q_Criterion", "VORTEX_IDENTIFICATION", "Value of the Q-Criterion"); - AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "SAS", "desired grid size for Scale Resolving Simulations"); + if (config->GetKind_Turb_Model() != TURB_MODEL::NONE) + AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "SAS", "desired grid size for Scale Resolving Simulations"); if (TurbModelFamily(config->GetKind_Turb_Model()) == TURB_FAMILY::KW) { if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_TRAVIS) AddVolumeOutput("FTRANS", "FTrans", "SOLUTION", "value of FTrans for SAS simulation"); @@ -1552,7 +1553,9 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con } SetVolumeOutputValue("Q_CRITERION", iPoint, GetQCriterion(Node_Flow->GetVelocityGradient(iPoint))); - SetVolumeOutputValue("SRS_GRID_SIZE", iPoint, Node_Turb->GetSRSGridSize(iPoint)); + if (config->GetKind_Turb_Model() != TURB_MODEL::NONE) + SetVolumeOutputValue("SRS_GRID_SIZE", iPoint, Node_Turb->GetSRSGridSize(iPoint)); + if (TurbModelFamily(config->GetKind_Turb_Model()) == TURB_FAMILY::KW) { if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_TRAVIS) SetVolumeOutputValue("FTRANS", iPoint, Node_Turb->GetFTrans(iPoint)); if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_BABU){ From d037e596f16024fb12745df3b35cba975bb8be55 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Tue, 18 Mar 2025 16:15:24 +0100 Subject: [PATCH 31/56] - Added SLA DDES formulation to SST --- Common/include/option_structure.hpp | 4 +- SU2_CFD/include/variables/CTurbSAVariable.hpp | 15 ---- SU2_CFD/include/variables/CTurbVariable.hpp | 14 ++++ SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 77 ++++++++++++++++++- SU2_CFD/src/variables/CTurbSAVariable.cpp | 50 +----------- SU2_CFD/src/variables/CTurbVariable.cpp | 50 ++++++++++++ 6 files changed, 144 insertions(+), 66 deletions(-) diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 01fe6c35979e..3f54a3388872 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -1450,7 +1450,8 @@ enum ENUM_HYBRIDRANSLES { SA_EDDES = 4, /*!< \brief Kind of Hybrid RANS/LES (SA - Delayed DES (DDES) with Shear Layer Adapted SGS: Enhanced DDES). */ SST_DDES = 5, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): DDES). */ SST_IDDES = 6, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Improved DDES). */ - SST_SIDDES = 7 /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Simplified Improved DDES). */ + SST_SIDDES = 7, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Simplified Improved DDES). */ + SST_EDDES = 8 /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Enhanced (SLA) DDES). */ }; static const MapType HybridRANSLES_Map = { MakePair("NONE", NO_HYBRIDRANSLES) @@ -1461,6 +1462,7 @@ static const MapType HybridRANSLES_Map = { MakePair("SST_DDES", SST_DDES) MakePair("SST_IDDES", SST_IDDES) MakePair("SST_SIDDES", SST_SIDDES) + MakePair("SST_EDDES", SST_EDDES) }; /*! diff --git a/SU2_CFD/include/variables/CTurbSAVariable.hpp b/SU2_CFD/include/variables/CTurbSAVariable.hpp index 5919face0566..c70b4c892b98 100644 --- a/SU2_CFD/include/variables/CTurbSAVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSAVariable.hpp @@ -39,7 +39,6 @@ class CTurbSAVariable final : public CTurbVariable { private: - VectorType Vortex_Tilting; VectorType k, Omega; /*!< \brief SST variables as computed through SA solution. */ @@ -61,18 +60,4 @@ class CTurbSAVariable final : public CTurbVariable { */ ~CTurbSAVariable() override = default; - /*! - * \brief Set the vortex tilting measure for computation of the EDDES length scale - * \param[in] iPoint - Point index. - */ - void SetVortex_Tilting(unsigned long iPoint, CMatrixView, - const su2double* Vorticity, su2double LaminarViscosity) override; - - /*! - * \brief Get the vortex tilting measure for computation of the EDDES length scale - * \param[in] iPoint - Point index. - * \return Value of the DES length Scale - */ - inline su2double GetVortex_Tilting(unsigned long iPoint) const override { return Vortex_Tilting(iPoint); } - }; diff --git a/SU2_CFD/include/variables/CTurbVariable.hpp b/SU2_CFD/include/variables/CTurbVariable.hpp index 794c8b030659..58ea523067fc 100644 --- a/SU2_CFD/include/variables/CTurbVariable.hpp +++ b/SU2_CFD/include/variables/CTurbVariable.hpp @@ -45,6 +45,7 @@ class CTurbVariable : public CScalarVariable { VectorType turb_index; /*!< \brief Value of the turbulence index for transition simulations. */ VectorType intermittency; /*!< \brief Value of the intermittency for the transition model. */ VectorType SRSGridSize; /*!< \brief alue of the desired grid size for Scale Resolving Simulations. */ + VectorType Vortex_Tilting; /*! * \brief Constructor of the class. @@ -129,5 +130,18 @@ class CTurbVariable : public CScalarVariable { */ inline void SetDES_LengthScale(unsigned long iPoint, su2double val_des_lengthscale) override { DES_LengthScale(iPoint) = val_des_lengthscale; } + /*! + * \brief Set the vortex tilting measure for computation of the EDDES length scale + * \param[in] iPoint - Point index. + */ + void SetVortex_Tilting(unsigned long iPoint, CMatrixView, + const su2double* Vorticity, su2double LaminarViscosity) override; + + /*! + * \brief Get the vortex tilting measure for computation of the EDDES length scale + * \param[in] iPoint - Point index. + * \return Value of the DES length Scale + */ + inline su2double GetVortex_Tilting(unsigned long iPoint) const override { return Vortex_Tilting(iPoint); } }; diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 2c37ca5cb8f9..713fa86db869 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -205,6 +205,21 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain if (kind_hybridRANSLES != NO_HYBRIDRANSLES) { + /*--- Set the vortex tilting coefficient at every node if required ---*/ + + if (kind_hybridRANSLES == SST_EDDES){ + auto* flowNodes = su2staticcast_p(solver_container[FLOW_SOL]->GetNodes()); + + SU2_OMP_FOR_STAT(omp_chunk_size) + for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++){ + auto Vorticity = flowNodes->GetVorticity(iPoint); + auto PrimGrad_Flow = flowNodes->GetGradient_Primitive(iPoint); + auto Laminar_Viscosity = flowNodes->GetLaminarViscosity(iPoint); + nodes->SetVortex_Tilting(iPoint, PrimGrad_Flow, Vorticity, Laminar_Viscosity); + } + END_SU2_OMP_FOR + } + /*--- Compute the DES length scale ---*/ SetDES_LengthScale(solver_container, geometry, config); @@ -1154,7 +1169,8 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++){ const su2double StrainMag = max(flowNodes->GetStrainMag(iPoint), 1e-12); - const su2double VortMag = max(GeometryToolbox::Norm(3, flowNodes->GetVorticity(iPoint)), 1e-12); + const auto Vorticity = flowNodes->GetVorticity(iPoint); + const su2double VortMag = max(GeometryToolbox::Norm(3, Vorticity), 1e-12); const su2double KolmConst2 = 0.41*0.41; const su2double wallDist2 = geometry->nodes->GetWall_Distance(iPoint)*geometry->nodes->GetWall_Distance(iPoint); @@ -1242,6 +1258,65 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C break; } + case SST_EDDES: { + + // Improved DDES version with the Shear-Layer-Adapted augmentation + // found in Detached Eddy Simulation: Recent Development and Application to Compressor Tip Leakage Flow, Xiao He, Fanzhou Zhao, Mehdi Vahdati + // originally from Application of SST-Based SLA-DDES Formulation to Turbomachinery Flows, Guoping Xia, Zifei Yin and Gorazd Medic + // I could be naming it either as SST_EDDES to follow the same notation as for the SA model or as SST_SLA_DDES to follow the paper notation + + const su2double f_max = 1.0, f_min = 0.1, a1 = 0.15, a2 = 0.3; + + const auto nNeigh = geometry->nodes->GetnPoint(iPoint); + + su2double vortexTiltingMeasure = nodes->GetVortex_Tilting(iPoint); + + su2double deltaOmega = -1; + su2double vorticityDir[MAXNDIM] = {}; + + for (auto iDim = 0; iDim < 3; iDim++){ + vorticityDir[iDim] = Vorticity[iDim]/VortMag; + } + + for (const auto jPoint : geometry->nodes->GetPoints(iPoint)){ + const auto coord_j = geometry->nodes->GetCoord(jPoint); + + for (const auto kPoint : geometry->nodes->GetPoints(iPoint)){ + const auto coord_k = geometry->nodes->GetCoord(kPoint); + + su2double delta[3]; + for (auto iDim = 0u; iDim < nDim; iDim++){ + delta[iDim] = (coord_j[iDim] - coord_k[iDim])/2.0; // Should I divide by 2 as I am interested in the dual volume? + } + su2double l_n_minus_m[3]; + GeometryToolbox::CrossProduct(delta, vorticityDir, l_n_minus_m); + deltaOmega = max(deltaOmega, GeometryToolbox::Norm(nDim, l_n_minus_m)); + } + + // Add to VTM(iPoint) to perform the average + vortexTiltingMeasure += nodes->GetVortex_Tilting(jPoint); + } + deltaOmega /= (1/sqrt(3)); + vortexTiltingMeasure /= (nNeigh+1); + + const su2double f_kh = max(f_min, + min(f_max, + f_min + ((f_max - f_min)/(a2 - a1)) * (vortexTiltingMeasure - a1))); + + const su2double r_d = (eddyVisc + lamVisc) / max((KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))), 1e-10); + const su2double C_d1 = 20.0; + const su2double C_d2 = 3.0; + + const su2double f_d = 1 - tanh(pow(C_d1 * r_d, C_d2)); + + su2double delta = deltaOmega * f_kh; + if (f_d < 0.99){ + delta = h_max; + } + + const su2double l_LES = C_DES * delta; + DES_lengthScale = l_RANS - f_d * max(0.0, l_RANS - l_LES); + } } nodes->SetDES_LengthScale(iPoint, DES_lengthScale); diff --git a/SU2_CFD/src/variables/CTurbSAVariable.cpp b/SU2_CFD/src/variables/CTurbSAVariable.cpp index d0466c83d6b9..7066027c09db 100644 --- a/SU2_CFD/src/variables/CTurbSAVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSAVariable.cpp @@ -46,55 +46,7 @@ CTurbSAVariable::CTurbSAVariable(su2double val_nu_tilde, su2double val_muT, unsi Solution_time_n1 = Solution; } - Vortex_Tilting.resize(nPoint); k.resize(nPoint) = su2double(0.0); Omega.resize(nPoint) = su2double(0.0); -} - -void CTurbSAVariable::SetVortex_Tilting(unsigned long iPoint, CMatrixView PrimGrad_Flow, - const su2double* Vorticity, su2double LaminarViscosity) { - - su2double Strain[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}}, Omega, StrainDotVort[3], numVecVort[3]; - su2double numerator, trace0, trace1, denominator; - - AD::StartPreacc(); - AD::SetPreaccIn(PrimGrad_Flow, nDim+1, nDim); - AD::SetPreaccIn(Vorticity, 3); - /*--- Eddy viscosity ---*/ - AD::SetPreaccIn(muT(iPoint)); - /*--- Laminar viscosity --- */ - AD::SetPreaccIn(LaminarViscosity); - - Strain[0][0] = PrimGrad_Flow[1][0]; - Strain[1][0] = 0.5*(PrimGrad_Flow[2][0] + PrimGrad_Flow[1][1]); - Strain[0][1] = 0.5*(PrimGrad_Flow[1][1] + PrimGrad_Flow[2][0]); - Strain[1][1] = PrimGrad_Flow[2][1]; - if (nDim == 3){ - Strain[0][2] = 0.5*(PrimGrad_Flow[3][0] + PrimGrad_Flow[1][2]); - Strain[1][2] = 0.5*(PrimGrad_Flow[3][1] + PrimGrad_Flow[2][2]); - Strain[2][0] = 0.5*(PrimGrad_Flow[1][2] + PrimGrad_Flow[3][0]); - Strain[2][1] = 0.5*(PrimGrad_Flow[2][2] + PrimGrad_Flow[3][1]); - Strain[2][2] = PrimGrad_Flow[3][2]; - } - - Omega = sqrt(Vorticity[0]*Vorticity[0] + Vorticity[1]*Vorticity[1]+ Vorticity[2]*Vorticity[2]); - - StrainDotVort[0] = Strain[0][0]*Vorticity[0]+Strain[0][1]*Vorticity[1]+Strain[0][2]*Vorticity[2]; - StrainDotVort[1] = Strain[1][0]*Vorticity[0]+Strain[1][1]*Vorticity[1]+Strain[1][2]*Vorticity[2]; - StrainDotVort[2] = Strain[2][0]*Vorticity[0]+Strain[2][1]*Vorticity[1]+Strain[2][2]*Vorticity[2]; - - numVecVort[0] = StrainDotVort[1]*Vorticity[2] - StrainDotVort[2]*Vorticity[1]; - numVecVort[1] = StrainDotVort[2]*Vorticity[0] - StrainDotVort[0]*Vorticity[2]; - numVecVort[2] = StrainDotVort[0]*Vorticity[1] - StrainDotVort[1]*Vorticity[0]; - - numerator = sqrt(6.0) * sqrt(numVecVort[0]*numVecVort[0] + numVecVort[1]*numVecVort[1] + numVecVort[2]*numVecVort[2]); - trace0 = 3.0*(pow(Strain[0][0],2.0) + pow(Strain[1][1],2.0) + pow(Strain[2][2],2.0)); - trace1 = pow(Strain[0][0] + Strain[1][1] + Strain[2][2],2.0); - denominator = pow(Omega, 2.0) * sqrt(trace0-trace1); - - Vortex_Tilting(iPoint) = (numerator/denominator) * max(1.0,0.2*LaminarViscosity/muT(iPoint)); - - AD::SetPreaccOut(Vortex_Tilting(iPoint)); - AD::EndPreacc(); -} +} \ No newline at end of file diff --git a/SU2_CFD/src/variables/CTurbVariable.cpp b/SU2_CFD/src/variables/CTurbVariable.cpp index ef2bafed1c97..a3b1f66d5345 100644 --- a/SU2_CFD/src/variables/CTurbVariable.cpp +++ b/SU2_CFD/src/variables/CTurbVariable.cpp @@ -37,5 +37,55 @@ CTurbVariable::CTurbVariable(unsigned long npoint, unsigned long ndim, unsigned DES_LengthScale.resize(nPoint) = su2double(0.0); SRSGridSize.resize(nPoint) = su2double(0.0); + + Vortex_Tilting.resize(nPoint); } + + +void CTurbVariable::SetVortex_Tilting(unsigned long iPoint, CMatrixView PrimGrad_Flow, + const su2double* Vorticity, su2double LaminarViscosity) { + + su2double Strain[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}}, Omega, StrainDotVort[3], numVecVort[3]; + su2double numerator, trace0, trace1, denominator; + + AD::StartPreacc(); + AD::SetPreaccIn(PrimGrad_Flow, nDim+1, nDim); + AD::SetPreaccIn(Vorticity, 3); + /*--- Eddy viscosity ---*/ + AD::SetPreaccIn(muT(iPoint)); + /*--- Laminar viscosity --- */ + AD::SetPreaccIn(LaminarViscosity); + + Strain[0][0] = PrimGrad_Flow[1][0]; + Strain[1][0] = 0.5*(PrimGrad_Flow[2][0] + PrimGrad_Flow[1][1]); + Strain[0][1] = 0.5*(PrimGrad_Flow[1][1] + PrimGrad_Flow[2][0]); + Strain[1][1] = PrimGrad_Flow[2][1]; + if (nDim == 3){ + Strain[0][2] = 0.5*(PrimGrad_Flow[3][0] + PrimGrad_Flow[1][2]); + Strain[1][2] = 0.5*(PrimGrad_Flow[3][1] + PrimGrad_Flow[2][2]); + Strain[2][0] = 0.5*(PrimGrad_Flow[1][2] + PrimGrad_Flow[3][0]); + Strain[2][1] = 0.5*(PrimGrad_Flow[2][2] + PrimGrad_Flow[3][1]); + Strain[2][2] = PrimGrad_Flow[3][2]; + } + + Omega = sqrt(Vorticity[0]*Vorticity[0] + Vorticity[1]*Vorticity[1]+ Vorticity[2]*Vorticity[2]); + + StrainDotVort[0] = Strain[0][0]*Vorticity[0]+Strain[0][1]*Vorticity[1]+Strain[0][2]*Vorticity[2]; + StrainDotVort[1] = Strain[1][0]*Vorticity[0]+Strain[1][1]*Vorticity[1]+Strain[1][2]*Vorticity[2]; + StrainDotVort[2] = Strain[2][0]*Vorticity[0]+Strain[2][1]*Vorticity[1]+Strain[2][2]*Vorticity[2]; + + numVecVort[0] = StrainDotVort[1]*Vorticity[2] - StrainDotVort[2]*Vorticity[1]; + numVecVort[1] = StrainDotVort[2]*Vorticity[0] - StrainDotVort[0]*Vorticity[2]; + numVecVort[2] = StrainDotVort[0]*Vorticity[1] - StrainDotVort[1]*Vorticity[0]; + + numerator = sqrt(6.0) * sqrt(numVecVort[0]*numVecVort[0] + numVecVort[1]*numVecVort[1] + numVecVort[2]*numVecVort[2]); + trace0 = 3.0*(pow(Strain[0][0],2.0) + pow(Strain[1][1],2.0) + pow(Strain[2][2],2.0)); + trace1 = pow(Strain[0][0] + Strain[1][1] + Strain[2][2],2.0); + denominator = pow(Omega, 2.0) * sqrt(trace0-trace1); + + Vortex_Tilting(iPoint) = (numerator/denominator) * max(1.0,0.2*LaminarViscosity/muT(iPoint)); + + AD::SetPreaccOut(Vortex_Tilting(iPoint)); + AD::EndPreacc(); +} \ No newline at end of file From 0adcb7e1bf8250fe5585614dfa69607028abbabb Mon Sep 17 00:00:00 2001 From: rois1995 Date: Wed, 19 Mar 2025 09:47:55 +0100 Subject: [PATCH 32/56] - compilation erorr --- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 713fa86db869..e870f7cc403a 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -1284,8 +1284,9 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C for (const auto kPoint : geometry->nodes->GetPoints(iPoint)){ const auto coord_k = geometry->nodes->GetCoord(kPoint); - su2double delta[3]; - for (auto iDim = 0u; iDim < nDim; iDim++){ + su2double delta[MAXNDIM] = {}; + // This should only be performed on 3D cases anyway + for (auto iDim = 0u; iDim < 3; iDim++){ delta[iDim] = (coord_j[iDim] - coord_k[iDim])/2.0; // Should I divide by 2 as I am interested in the dual volume? } su2double l_n_minus_m[3]; From d50b1234eaa057e119b867f72c75d57dbb01c460 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Wed, 19 Mar 2025 11:02:32 +0100 Subject: [PATCH 33/56] - Fix memory leak --- SU2_CFD/src/solvers/CSolver.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index 24d5e8d4b9bf..4dc8b166e53e 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -1060,6 +1060,7 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, delete [] Diff; delete [] Und_Lapl; + delete [] Vel_Lapl; delete [] Sol_Min; delete [] Sol_Max; delete [] rotPrim_i; From 34a02719647e7b7a1c0a68653dc7d35b3dca7065 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Wed, 19 Mar 2025 18:10:53 +0100 Subject: [PATCH 34/56] - fixed formatting error --- Common/include/option_structure.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 3f54a3388872..5bc55e80b4a2 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -1074,7 +1074,7 @@ inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigne SSTParsedOptions.sasModel = SST_OPTIONS::SAS_TRAVIS; } else if (sst_sas_babu) { SSTParsedOptions.sasModel = SST_OPTIONS::SAS_BABU; - } + } if (sst_1994 && sst_2003) { SU2_MPI::Error("Two versions (1994 and 2003) selected for SST_OPTIONS. Please choose only one.", CURRENT_FUNCTION); From 95ccc7370670ad731a3c76d04abf4322bcd1ce77 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 28 Mar 2025 19:17:30 +0100 Subject: [PATCH 35/56] - update externals --- externals/codi | 2 +- externals/medi | 2 +- externals/opdi | 2 +- subprojects/MLPCpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/externals/codi b/externals/codi index a0725b2bfd17..762ba7698e3c 160000 --- a/externals/codi +++ b/externals/codi @@ -1 +1 @@ -Subproject commit a0725b2bfd172e741a07f96b041a5ddf88d441d7 +Subproject commit 762ba7698e3ceaa1b17aa299421ddd418f00b823 diff --git a/externals/medi b/externals/medi index 0cfaf96e7a31..7d550831e0e2 160000 --- a/externals/medi +++ b/externals/medi @@ -1 +1 @@ -Subproject commit 0cfaf96e7a31a5a8941b97f84198da03a8f8bd7a +Subproject commit 7d550831e0e233a85b9d9af9c181d7ecb2929946 diff --git a/externals/opdi b/externals/opdi index a5e2ac47035b..a6b9655c240a 160000 --- a/externals/opdi +++ b/externals/opdi @@ -1 +1 @@ -Subproject commit a5e2ac47035b6b3663f60d5f80b7a9fe62084867 +Subproject commit a6b9655c240af2a35454a61727e5bbbbaa3a425f diff --git a/subprojects/MLPCpp b/subprojects/MLPCpp index e19ca0cafb28..6865a58b22f2 160000 --- a/subprojects/MLPCpp +++ b/subprojects/MLPCpp @@ -1 +1 @@ -Subproject commit e19ca0cafb28c4b7ba5b8cffef42883259b00dc0 +Subproject commit 6865a58b22f21a92977839d9c93eae9522402f55 From de45d5f0b9061b237169372a935796ccc4354734 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 28 Mar 2025 19:22:00 +0100 Subject: [PATCH 36/56] - update externals and subprojects --- externals/codi | 2 +- externals/medi | 2 +- externals/opdi | 2 +- subprojects/MLPCpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/externals/codi b/externals/codi index 762ba7698e3c..a0725b2bfd17 160000 --- a/externals/codi +++ b/externals/codi @@ -1 +1 @@ -Subproject commit 762ba7698e3ceaa1b17aa299421ddd418f00b823 +Subproject commit a0725b2bfd172e741a07f96b041a5ddf88d441d7 diff --git a/externals/medi b/externals/medi index 7d550831e0e2..0cfaf96e7a31 160000 --- a/externals/medi +++ b/externals/medi @@ -1 +1 @@ -Subproject commit 7d550831e0e233a85b9d9af9c181d7ecb2929946 +Subproject commit 0cfaf96e7a31a5a8941b97f84198da03a8f8bd7a diff --git a/externals/opdi b/externals/opdi index a6b9655c240a..a5e2ac47035b 160000 --- a/externals/opdi +++ b/externals/opdi @@ -1 +1 @@ -Subproject commit a6b9655c240af2a35454a61727e5bbbbaa3a425f +Subproject commit a5e2ac47035b6b3663f60d5f80b7a9fe62084867 diff --git a/subprojects/MLPCpp b/subprojects/MLPCpp index 6865a58b22f2..e19ca0cafb28 160000 --- a/subprojects/MLPCpp +++ b/subprojects/MLPCpp @@ -1 +1 @@ -Subproject commit 6865a58b22f21a92977839d9c93eae9522402f55 +Subproject commit e19ca0cafb28c4b7ba5b8cffef42883259b00dc0 From d1726079d9a4f361d23cc3940f5fc481387fd878 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Mon, 31 Mar 2025 17:13:41 +0200 Subject: [PATCH 37/56] - Try changes to SA-EDDES --- Common/include/option_structure.hpp | 4 +- SU2_CFD/src/solvers/CTurbSASolver.cpp | 58 ++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 1dada06c412c..9c6e09088d30 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -1494,7 +1494,8 @@ enum ENUM_HYBRIDRANSLES { SST_DDES = 5, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): DDES). */ SST_IDDES = 6, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Improved DDES). */ SST_SIDDES = 7, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Simplified Improved DDES). */ - SST_EDDES = 8 /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Enhanced (SLA) DDES). */ + SST_EDDES = 8, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Enhanced (SLA) DDES). */ + SA_EDDES_MOD = 9 /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Enhanced (SLA) DDES). */ }; static const MapType HybridRANSLES_Map = { MakePair("NONE", NO_HYBRIDRANSLES) @@ -1502,6 +1503,7 @@ static const MapType HybridRANSLES_Map = { MakePair("SA_DDES", SA_DDES) MakePair("SA_ZDES", SA_ZDES) MakePair("SA_EDDES", SA_EDDES) + MakePair("SA_EDDES_MOD", SA_EDDES_MOD) MakePair("SST_DDES", SST_DDES) MakePair("SST_IDDES", SST_IDDES) MakePair("SST_SIDDES", SST_SIDDES) diff --git a/SU2_CFD/src/solvers/CTurbSASolver.cpp b/SU2_CFD/src/solvers/CTurbSASolver.cpp index f2e19581fb4a..2bd9a47ea5a9 100644 --- a/SU2_CFD/src/solvers/CTurbSASolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSASolver.cpp @@ -184,7 +184,7 @@ void CTurbSASolver::Preprocessing(CGeometry *geometry, CSolver **solver_containe /*--- Set the vortex tilting coefficient at every node if required ---*/ - if (kind_hybridRANSLES == SA_EDDES){ + if (kind_hybridRANSLES == SA_EDDES || kind_hybridRANSLES == SA_EDDES_MOD){ auto* flowNodes = su2staticcast_p(solver_container[FLOW_SOL]->GetNodes()); SU2_OMP_FOR_STAT(omp_chunk_size) @@ -1511,6 +1511,62 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC const su2double distDES = constDES * maxDelta; lengthScale = wallDistance-f_d*max(0.0,(wallDistance-distDES)); + break; + } + case SA_EDDES_MOD: { + /*--- An Enhanced Version of DES with Rapid Transition from RANS to LES in Separated Flows. + Shur et al. + Flow Turbulence Combust - 2015 + ---*/ + + su2double vortexTiltingMeasure = nodes->GetVortex_Tilting(iPoint); + + const su2double omega = GeometryToolbox::Norm(3, vorticity); + + su2double ratioOmega[MAXNDIM] = {}; + + for (auto iDim = 0; iDim < 3; iDim++){ + ratioOmega[iDim] = vorticity[iDim]/omega; + } + + const su2double deltaDDES = geometry->nodes->GetMaxLength(iPoint); + + su2double ln_max = -1; + for (const auto jPoint : geometry->nodes->GetPoints(iPoint)){ + const auto coord_j = geometry->nodes->GetCoord(jPoint); + + for (const auto kPoint : geometry->nodes->GetPoints(iPoint)){ + const auto coord_k = geometry->nodes->GetCoord(kPoint); + + su2double delta[MAXNDIM] = {}; + // This should only be performed on 3D cases anyway + for (auto iDim = 0u; iDim < 3; iDim++){ + delta[iDim] = (coord_j[iDim] - coord_k[iDim])/2.0; // Should I divide by 2 as I am interested in the dual volume? + } + su2double l_n_minus_m[3]; + GeometryToolbox::CrossProduct(delta, ratioOmega, l_n_minus_m); + ln_max = max(ln_max, GeometryToolbox::Norm(nDim, l_n_minus_m)); + } + vortexTiltingMeasure += nodes->GetVortex_Tilting(jPoint); + } + + vortexTiltingMeasure /= (nNeigh + 1); + + const su2double f_kh = max(f_min, + min(f_max, + f_min + ((f_max - f_min)/(a2 - a1)) * (vortexTiltingMeasure - a1))); + + const su2double r_d = (kinematicViscosityTurb+kinematicViscosity)/(uijuij*k2*pow(wallDistance, 2.0)); + const su2double f_d = 1.0-tanh(pow(8.0*r_d,3.0)); + + su2double maxDelta = (ln_max/sqrt(3.0)) * f_kh; + if (f_d < 0.999){ + maxDelta = deltaDDES; + } + + const su2double distDES = constDES * maxDelta; + lengthScale = wallDistance-f_d*max(0.0,(wallDistance-distDES)); + break; } } From e5a916c20ad7ee5c7226375452e191cae72f50be Mon Sep 17 00:00:00 2001 From: rois1995 Date: Tue, 1 Apr 2025 12:34:22 +0200 Subject: [PATCH 38/56] - Fix bug in SST-EDDES --- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index e870f7cc403a..2aba6ffb27d6 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -1297,7 +1297,7 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C // Add to VTM(iPoint) to perform the average vortexTiltingMeasure += nodes->GetVortex_Tilting(jPoint); } - deltaOmega /= (1/sqrt(3)); + deltaOmega /= sqrt(3); vortexTiltingMeasure /= (nNeigh+1); const su2double f_kh = max(f_min, From c723a131db53b992bce2ce0f2e16c924ad5847d2 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Tue, 1 Apr 2025 12:54:24 +0200 Subject: [PATCH 39/56] - Set debug quantities --- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 2aba6ffb27d6..86995f7903dd 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -1317,6 +1317,7 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C const su2double l_LES = C_DES * delta; DES_lengthScale = l_RANS - f_d * max(0.0, l_RANS - l_LES); + nodes->SetDebug_Quantities(config, iPoint, f_d, l_RANS, l_LES, r_d); } } From d051f0bb615a48222cebe7809553b296f5d4fb54 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Tue, 1 Apr 2025 13:58:54 +0200 Subject: [PATCH 40/56] - try fix --- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 86995f7903dd..ff06b261dcc0 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -1271,7 +1271,7 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C su2double vortexTiltingMeasure = nodes->GetVortex_Tilting(iPoint); - su2double deltaOmega = -1; + su2double deltaOmega = -1.0; su2double vorticityDir[MAXNDIM] = {}; for (auto iDim = 0; iDim < 3; iDim++){ @@ -1297,7 +1297,7 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C // Add to VTM(iPoint) to perform the average vortexTiltingMeasure += nodes->GetVortex_Tilting(jPoint); } - deltaOmega /= sqrt(3); + deltaOmega /= sqrt(3.0); vortexTiltingMeasure /= (nNeigh+1); const su2double f_kh = max(f_min, From c84025624e59a41b968b2e3948d4763372445e0b Mon Sep 17 00:00:00 2001 From: rois1995 Date: Tue, 1 Apr 2025 14:04:30 +0200 Subject: [PATCH 41/56] - Fix output --- SU2_CFD/include/variables/CTurbSSTVariable.hpp | 2 +- SU2_CFD/src/output/CFlowOutput.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/SU2_CFD/include/variables/CTurbSSTVariable.hpp b/SU2_CFD/include/variables/CTurbSSTVariable.hpp index 4c11ff99e505..4b21f6082588 100644 --- a/SU2_CFD/include/variables/CTurbSSTVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSSTVariable.hpp @@ -112,7 +112,7 @@ class CTurbSSTVariable final : public CTurbVariable { l_RANS(iPoint) = val_l_RANS; l_LES(iPoint) = val_l_LES; - if ( config->GetKind_HybridRANSLES() == SST_DDES) + if ( config->GetKind_HybridRANSLES() == SST_DDES || config->GetKind_HybridRANSLES() == SST_EDDES) r_d(iPoint) = val_r_d; else r_dt(iPoint) = val_r_d; diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 95b5c5e0dd29..2e03a5998f3e 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1651,6 +1651,11 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con SetVolumeOutputValue("L_RANS", iPoint, Node_Turb->Get_L_RANS(iPoint)); SetVolumeOutputValue("L_LES", iPoint, Node_Turb->Get_L_LES(iPoint)); SetVolumeOutputValue("R_DT", iPoint, Node_Turb->Get_r_dt(iPoint)); + } else if ( config->GetKind_HybridRANSLES() == SST_EDDES){ + SetVolumeOutputValue("F_D", iPoint, Node_Turb->Get_ftilda_d(iPoint)); + SetVolumeOutputValue("L_RANS", iPoint, Node_Turb->Get_L_RANS(iPoint)); + SetVolumeOutputValue("L_LES", iPoint, Node_Turb->Get_L_LES(iPoint)); + SetVolumeOutputValue("R_D", iPoint, Node_Turb->Get_r_d(iPoint)); } const su2double mut = Node_Flow->GetEddyViscosity(iPoint); const su2double mu = Node_Flow->GetLaminarViscosity(iPoint); From 9b997d73a23d191948e411be3d7903fa4cd9424a Mon Sep 17 00:00:00 2001 From: rois1995 Date: Mon, 7 Apr 2025 14:39:59 +0200 Subject: [PATCH 42/56] - Fix output --- SU2_CFD/src/output/CFlowOutput.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 2e03a5998f3e..e040eb5cc76a 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1489,7 +1489,7 @@ void CFlowOutput::SetVolumeOutputFieldsScalarMisc(const CConfig* config) { AddVolumeOutput("L_RANS", "l_RANS", "DDES", "RANS length scale value"); AddVolumeOutput("L_LES", "l_LES", "DDES", "LES length scale value"); } - if ( config->GetKind_HybridRANSLES() == SST_DDES){ + if ( config->GetKind_HybridRANSLES() == SST_DDES || config->GetKind_HybridRANSLES() == SST_EDDES){ AddVolumeOutput("R_D", "r_d", "DDES", "r_d"); } else if ( config->GetKind_HybridRANSLES() == SST_IDDES){ AddVolumeOutput("R_DT", "r_dt", "DDES", "turbulent r_d"); @@ -1635,7 +1635,7 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES) { SetVolumeOutputValue("DES_LENGTHSCALE", iPoint, Node_Flow->GetDES_LengthScale(iPoint)); SetVolumeOutputValue("WALL_DISTANCE", iPoint, Node_Geo->GetWall_Distance(iPoint)); - if ( config->GetKind_HybridRANSLES() == SST_DDES){ + if ( config->GetKind_HybridRANSLES() == SST_DDES || config->GetKind_HybridRANSLES() == SST_EDDES){ SetVolumeOutputValue("F_D", iPoint, Node_Turb->Get_ftilda_d(iPoint)); SetVolumeOutputValue("L_RANS", iPoint, Node_Turb->Get_L_RANS(iPoint)); SetVolumeOutputValue("L_LES", iPoint, Node_Turb->Get_L_LES(iPoint)); @@ -1651,11 +1651,6 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con SetVolumeOutputValue("L_RANS", iPoint, Node_Turb->Get_L_RANS(iPoint)); SetVolumeOutputValue("L_LES", iPoint, Node_Turb->Get_L_LES(iPoint)); SetVolumeOutputValue("R_DT", iPoint, Node_Turb->Get_r_dt(iPoint)); - } else if ( config->GetKind_HybridRANSLES() == SST_EDDES){ - SetVolumeOutputValue("F_D", iPoint, Node_Turb->Get_ftilda_d(iPoint)); - SetVolumeOutputValue("L_RANS", iPoint, Node_Turb->Get_L_RANS(iPoint)); - SetVolumeOutputValue("L_LES", iPoint, Node_Turb->Get_L_LES(iPoint)); - SetVolumeOutputValue("R_D", iPoint, Node_Turb->Get_r_d(iPoint)); } const su2double mut = Node_Flow->GetEddyViscosity(iPoint); const su2double mu = Node_Flow->GetLaminarViscosity(iPoint); From 8f3efaed6dfd8ae735901412c5a5cc59bf5052eb Mon Sep 17 00:00:00 2001 From: rois1995 Date: Tue, 10 Jun 2025 19:50:43 +0200 Subject: [PATCH 43/56] - Added come outputs --- SU2_CFD/src/output/CFlowOutput.cpp | 36 +++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index e040eb5cc76a..4c80cafd9306 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1509,6 +1509,23 @@ void CFlowOutput::SetVolumeOutputFieldsScalarMisc(const CConfig* config) { AddVolumeOutput("VORTICITY", "Vorticity", "VORTEX_IDENTIFICATION", "Value of the vorticity"); } AddVolumeOutput("Q_CRITERION", "Q_Criterion", "VORTEX_IDENTIFICATION", "Value of the Q-Criterion"); + if (config->GetKind_HybridRANSLES() == NO_HYBRIDRANSLES) { + AddVolumeOutput("WALL_DISTANCE", "Wall_Distance", "DEBUG", "Wall distance value"); + } + AddVolumeOutput("GRAD_VEL_XX", "Grad_Vel_xx", "DEBUG", "Strain magnitude value"); + AddVolumeOutput("GRAD_VEL_XY", "Grad_Vel_xy", "DEBUG", "Strain magnitude value"); + AddVolumeOutput("GRAD_VEL_YX", "Grad_Vel_yx", "DEBUG", "Strain magnitude value"); + AddVolumeOutput("GRAD_VEL_YY", "Grad_Vel_yy", "DEBUG", "Strain magnitude value"); + if (nDim == 3) { + AddVolumeOutput("GRAD_VEL_XZ", "Grad_Vel_xz", "DEBUG", "Strain magnitude value"); + AddVolumeOutput("GRAD_VEL_YZ", "Grad_Vel_yz", "DEBUG", "Strain magnitude value"); + AddVolumeOutput("GRAD_VEL_ZX", "Grad_Vel_zx", "DEBUG", "Strain magnitude value"); + AddVolumeOutput("GRAD_VEL_ZY", "Grad_Vel_zy", "DEBUG", "Strain magnitude value"); + AddVolumeOutput("GRAD_VEL_ZZ", "Grad_Vel_zz", "DEBUG", "Strain magnitude value"); + } + AddVolumeOutput("CDkw", "CDkw", "DEBUG", "Cross-Diffusion term"); + AddVolumeOutput("F1", "F1", "DEBUG", "F1 blending function"); + AddVolumeOutput("F2", "F2", "DEBUG", "F2 blending function"); if (config->GetKind_Turb_Model() != TURB_MODEL::NONE) AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "SAS", "desired grid size for Scale Resolving Simulations"); @@ -1552,6 +1569,7 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con SetVolumeOutputValue("CFL", iPoint, Node_Flow->GetLocalCFL(iPoint)); if (config->GetViscous()) { + const auto VelGrad = Node_Flow->GetVelocityGradient(iPoint); if (nDim == 3){ SetVolumeOutputValue("VORTICITY_X", iPoint, Node_Flow->GetVorticity(iPoint)[0]); SetVolumeOutputValue("VORTICITY_Y", iPoint, Node_Flow->GetVorticity(iPoint)[1]); @@ -1559,7 +1577,23 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con } else { SetVolumeOutputValue("VORTICITY", iPoint, Node_Flow->GetVorticity(iPoint)[2]); } - SetVolumeOutputValue("Q_CRITERION", iPoint, GetQCriterion(Node_Flow->GetVelocityGradient(iPoint))); + SetVolumeOutputValue("Q_CRITERION", iPoint, GetQCriterion(VelGrad)); + SetVolumeOutputValue("WALL_DISTANCE", iPoint, Node_Geo->GetWall_Distance(iPoint)); + SetVolumeOutputValue("GRAD_VEL_XX", iPoint, VelGrad(0,0)); + SetVolumeOutputValue("GRAD_VEL_XY", iPoint, VelGrad(0,1)); + SetVolumeOutputValue("GRAD_VEL_YX", iPoint, VelGrad(1,0)); + SetVolumeOutputValue("GRAD_VEL_YY", iPoint, VelGrad(1,1)); + if (nDim == 3) { + SetVolumeOutputValue("GRAD_VEL_XZ", iPoint, VelGrad(0,2)); + SetVolumeOutputValue("GRAD_VEL_YZ", iPoint, VelGrad(1,2)); + SetVolumeOutputValue("GRAD_VEL_ZX", iPoint, VelGrad(2,0)); + SetVolumeOutputValue("GRAD_VEL_ZY", iPoint, VelGrad(2,1)); + SetVolumeOutputValue("GRAD_VEL_ZZ", iPoint, VelGrad(2,2)); + } + + SetVolumeOutputValue("CDkw", iPoint, Node_Turb->GetCrossDiff(iPoint)); + SetVolumeOutputValue("F1", iPoint, Node_Turb->GetF1blending(iPoint)); + SetVolumeOutputValue("F2", iPoint, Node_Turb->GetF2blending(iPoint)); if (config->GetKind_Turb_Model() != TURB_MODEL::NONE) SetVolumeOutputValue("SRS_GRID_SIZE", iPoint, Node_Turb->GetSRSGridSize(iPoint)); From f7162182476c7650eadc2762a2fd381e371b6964 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Tue, 10 Jun 2025 20:11:03 +0200 Subject: [PATCH 44/56] - minor fix --- SU2_CFD/include/variables/CTurbVariable.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/variables/CTurbVariable.hpp b/SU2_CFD/include/variables/CTurbVariable.hpp index 58ea523067fc..c4373d59e9c5 100644 --- a/SU2_CFD/include/variables/CTurbVariable.hpp +++ b/SU2_CFD/include/variables/CTurbVariable.hpp @@ -134,7 +134,7 @@ class CTurbVariable : public CScalarVariable { * \brief Set the vortex tilting measure for computation of the EDDES length scale * \param[in] iPoint - Point index. */ - void SetVortex_Tilting(unsigned long iPoint, CMatrixView, + void SetVortex_Tilting(unsigned long iPoint, CMatrixView PrimGrad_Flow, const su2double* Vorticity, su2double LaminarViscosity) override; /*! From 707afa4282e03c98aad5e1be4b8ae84e14fa4df7 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Thu, 18 Sep 2025 12:47:46 +0200 Subject: [PATCH 45/56] update meson and ninja --- externals/meson | 2 +- externals/ninja | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/externals/meson b/externals/meson index 5a82ea050173..41c650a040d5 160000 --- a/externals/meson +++ b/externals/meson @@ -1 +1 @@ -Subproject commit 5a82ea0501736a666ca9cc003ea0774f8219fd65 +Subproject commit 41c650a040d50e0912d268af7a903a9ce1456dfa diff --git a/externals/ninja b/externals/ninja index b4d51f6ed5be..52649de2c56b 160000 --- a/externals/ninja +++ b/externals/ninja @@ -1 +1 @@ -Subproject commit b4d51f6ed5bed09dd2b70324df0d9cb4ecad2638 +Subproject commit 52649de2c56b63f42bc59513d51286531c595b44 From f10c465b473c378401c74220a00c5c6ef95fcded Mon Sep 17 00:00:00 2001 From: rois1995 Date: Thu, 2 Oct 2025 10:53:28 +0200 Subject: [PATCH 46/56] Removed SAS implementation (not working) --- Common/include/option_structure.hpp | 17 -- Common/src/CConfig.cpp | 11 - SU2_CFD/include/numerics/CNumerics.hpp | 44 --- .../numerics/turbulent/turb_sources.hpp | 75 +---- .../include/variables/CTurbSSTVariable.hpp | 144 ---------- SU2_CFD/include/variables/CVariable.hpp | 87 ------ SU2_CFD/src/output/CFlowOutput.cpp | 38 +-- SU2_CFD/src/solvers/CSolver.cpp | 96 ------- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 272 ------------------ SU2_CFD/src/variables/CTurbSSTVariable.cpp | 9 - externals/meson | 2 +- 11 files changed, 5 insertions(+), 790 deletions(-) diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 6ef02c56070b..c1d61884c6b8 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -995,8 +995,6 @@ enum class SST_OPTIONS { COMP_Wilcox, /*!< \brief Menter k-w SST model with Compressibility correction of Wilcox. */ COMP_Sarkar, /*!< \brief Menter k-w SST model with Compressibility correction of Sarkar. */ DLL, /*!< \brief Menter k-w SST model with dimensionless lower limit clipping of turbulence variables. */ - SAS_TRAVIS, /*!< \brief Menter k-w SST model with Scale Adaptive Simulations modifications. */ - SAS_BABU, /*!< \brief Menter k-w SST model with Scale Adaptive Simulations modifications. */ }; static const MapType SST_Options_Map = { MakePair("NONE", SST_OPTIONS::NONE) @@ -1012,8 +1010,6 @@ static const MapType SST_Options_Map = { MakePair("COMPRESSIBILITY-WILCOX", SST_OPTIONS::COMP_Wilcox) MakePair("COMPRESSIBILITY-SARKAR", SST_OPTIONS::COMP_Sarkar) MakePair("DIMENSIONLESS_LIMIT", SST_OPTIONS::DLL) - MakePair("SAS_TRAVIS", SST_OPTIONS::SAS_TRAVIS) - MakePair("SAS_BABU", SST_OPTIONS::SAS_BABU) }; /*! @@ -1022,7 +1018,6 @@ static const MapType SST_Options_Map = { struct SST_ParsedOptions { SST_OPTIONS version = SST_OPTIONS::V1994; /*!< \brief Enum SST base model. */ SST_OPTIONS production = SST_OPTIONS::NONE; /*!< \brief Enum for production corrections/modifiers for SST model. */ - SST_OPTIONS sasModel = SST_OPTIONS::NONE; /*!< \brief Enum SST base model. */ bool sust = false; /*!< \brief Bool for SST model with sustaining terms. */ bool uq = false; /*!< \brief Bool for using uncertainty quantification. */ bool modified = false; /*!< \brief Bool for modified (m) SST model. */ @@ -1067,16 +1062,6 @@ inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigne const bool sst_compWilcox = IsPresent(SST_OPTIONS::COMP_Wilcox); const bool sst_compSarkar = IsPresent(SST_OPTIONS::COMP_Sarkar); const bool sst_dll = IsPresent(SST_OPTIONS::DLL); - const bool sst_sas_travis = IsPresent(SST_OPTIONS::SAS_TRAVIS); - const bool sst_sas_babu = IsPresent(SST_OPTIONS::SAS_BABU); - if (sst_sas_travis && sst_sas_babu) { - SU2_MPI::Error("Two versions (Simple and Complicated) selected for SAS under SST_OPTIONS. Please choose only one.", CURRENT_FUNCTION); - } else if (sst_sas_travis) { - SSTParsedOptions.sasModel = SST_OPTIONS::SAS_TRAVIS; - } else if (sst_sas_babu) { - SSTParsedOptions.sasModel = SST_OPTIONS::SAS_BABU; - } - if (sst_1994 && sst_2003) { SU2_MPI::Error("Two versions (1994 and 2003) selected for SST_OPTIONS. Please choose only one.", CURRENT_FUNCTION); } else if (sst_2003) { @@ -2645,7 +2630,6 @@ enum PERIODIC_QUANTITIES { PERIODIC_LIM_PRIM_1 , /*!< \brief Primitive limiter communication phase 1 of 2 (periodic only). */ PERIODIC_LIM_PRIM_2 , /*!< \brief Primitive limiter communication phase 2 of 2 (periodic only). */ PERIODIC_IMPLICIT , /*!< \brief Implicit update communication to ensure consistency across periodic boundaries. */ - PERIODIC_VEL_LAPLACIAN , /*!< \brief Velocity Laplacian communication for SAS (periodic only). */ }; /*! @@ -2677,7 +2661,6 @@ enum class MPI_QUANTITIES { MESH_DISPLACEMENTS , /*!< \brief Mesh displacements at the interface. */ SOLUTION_TIME_N , /*!< \brief Solution at time n. */ SOLUTION_TIME_N1 , /*!< \brief Solution at time n-1. */ - VELOCITY_LAPLACIAN , /*!< \brief Velocity Laplacian communication. */ }; /*! diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 8df9d6f0940e..8c242f78824a 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -6405,17 +6405,6 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) { else cout << "\nusing default hard coded lower limit clipping"; cout << "." << endl; - if(sstParsedOptions.sasModel != SST_OPTIONS::NONE) cout << "Scale Adaptive Simulation model: "; - switch (sstParsedOptions.sasModel) { - case SST_OPTIONS::SAS_TRAVIS: - cout << "Travis et al. (2004)"; - break; - case SST_OPTIONS::SAS_BABU: - cout << "Babu et al. (2016)"; - break; - default: - break; - } break; } switch (Kind_Trans_Model) { diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index ee040bdcd82a..ba2ad7ec751f 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -136,13 +136,6 @@ class CNumerics { *TurbPsi_i, /*!< \brief Vector of adjoint turbulent variables at point i. */ *TurbPsi_j; /*!< \brief Vector of adjoint turbulent variables at point j. */ su2double lengthScale_i, lengthScale_j; /*!< \brief length scale for SST */ - su2double FTrans; /*!< \brief SAS function */ - su2double Q_SAS_1; /*!< \brief SAS function */ - su2double Q_SAS_2; /*!< \brief SAS function */ - su2double L; /*!< \brief SAS function */ - su2double L_vK_1; /*!< \brief SAS function */ - su2double L_vK_2; /*!< \brief SAS function */ - const su2double *VelLapl; /*!< \brief Laplacian of the velocity */ CMatrixView ConsVar_Grad_i, /*!< \brief Gradient of conservative variables at point i. */ ConsVar_Grad_j, /*!< \brief Gradient of conservative variables at point j. */ @@ -714,43 +707,6 @@ class CNumerics { */ virtual void SetCrossDiff(su2double val_CDkw_i) {/* empty */}; - /*! - * \brief Get the value of the value of FTrans. - */ - inline virtual su2double GetFTrans() const { return 0.0; } - - /*! - * \brief Get the value of the value of Q_SAS1. - */ - inline virtual su2double GetQ_SAS1() const { return 0.0; } - - /*! - * \brief Get the value of the value of Q_SAS2. - */ - inline virtual su2double GetQ_SAS2() const { return 0.0; } - - /*! - * \brief Get the value of the value of L. - */ - inline virtual su2double GetL() const { return 0.0; } - - /*! - * \brief Get the value of the value of L_vK1. - */ - inline virtual su2double GetL_vK1() const { return 0.0; } - - /*! - * \brief Get the value of the value of L_vK2. - */ - inline virtual su2double GetL_vK2() const { return 0.0; } - - /*! - * \brief Get the value of the value of FTrans. - */ - inline void SetVelLapl(const su2double* val_VelLapl) { - VelLapl = val_VelLapl; - } - /*! * \brief Set the value of the effective intermittency for the LM model. * \param[in] intermittency_eff_i - Value of the effective intermittency at point i. diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 86735b24e5f5..c4e2dd247c30 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -909,47 +909,7 @@ class CSourcePieceWise_TurbSST final : public CNumerics { Residual[0] += pk * Volume; Residual[1] += pw * Volume; - - /*--- Compute SAS source term. ---*/ - su2double Q_SAS = 0.0; - - if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_BABU) { - - const su2double KolmConst = 0.41; - const su2double csi2 = 3.51; - const su2double sigma_phi = 2.0/3.0; - const su2double C = 2.0; - // const su2double C_DES = 0.5; // Honestly I do not know if it is the right one. - const su2double C_DES1 = 0.78; - const su2double C_DES2 = 0.61; - const su2double C_DES = C_DES1 * F1_i + C_DES2 * (1-F1_i); // taken this from the SST-DDES part - const su2double gridSize = pow(Volume, 1.0/nDim); - // Scale of the modeled turbulence - L = sqrt(ScalarVar_i[0]) / (pow(beta_star, 0.25) * ScalarVar_i[1]); - // Von Karman Length Scale - const su2double VelLaplMag = GeometryToolbox::Norm(nDim, VelLapl); - L_vK_1 = KolmConst * StrainMag_i / VelLaplMag; - L_vK_2 = C_DES * sqrt(KolmConst * csi2 / (beta_blended/beta_star - alfa_blended)) * gridSize; - const su2double L_vK = max(L_vK_1, L_vK_2); - - const su2double gradTKE = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[0])/(ScalarVar_i[0]*ScalarVar_i[0]); - const su2double gradOmega = GeometryToolbox::SquaredNorm(nDim, ScalarVar_Grad_i[1])/(ScalarVar_i[1]*ScalarVar_i[1]); - - Q_SAS_1 = csi2 * KolmConst * StrainMag_i * StrainMag_i * (L/L_vK) * (L/L_vK); - Q_SAS_2 = C * (2*ScalarVar_i[0] / sigma_phi) * max(gradOmega, gradTKE); - - Q_SAS = max(Q_SAS_1 - Q_SAS_2, 0.0); - - Residual[1] += Density_i * Q_SAS * Volume; - - } - - /*--- Add the dissipation terms to the residuals.---*/ - FTrans = 1.0; - if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_TRAVIS) { - FTrans = max(1.0, pow(StrainMag_i / (cTrans * VorticityMag), 2.0)); - } - Residual[0] -= dk * Volume * FTrans; + Residual[0] -= dk * Volume; Residual[1] -= dw * Volume; /*--- Cross diffusion is included in the viscous fluxes, discretisation in turb_diffusion.hpp ---*/ @@ -960,8 +920,8 @@ class CSourcePieceWise_TurbSST final : public CNumerics { /*--- Implicit part ---*/ - Jacobian_i[0][0] = -beta_star * ScalarVar_i[1] * Volume * (1.0 + zetaFMt) * FTrans; - Jacobian_i[0][1] = -beta_star * ScalarVar_i[0] * Volume * (1.0 + zetaFMt) * FTrans; + Jacobian_i[0][0] = -beta_star * ScalarVar_i[1] * Volume * (1.0 + zetaFMt); + Jacobian_i[0][1] = -beta_star * ScalarVar_i[0] * Volume * (1.0 + zetaFMt); Jacobian_i[1][0] = 0.0; Jacobian_i[1][1] = -2.0 * beta_blended * ScalarVar_i[1] * Volume * (1.0 - 0.09/beta_blended * zetaFMt); } @@ -972,33 +932,4 @@ class CSourcePieceWise_TurbSST final : public CNumerics { return ResidualType<>(Residual, Jacobian_i, nullptr); } - /*! - * \brief Get the value of the FTrans. - */ - inline su2double GetFTrans() const override { return FTrans; } - - /*! - * \brief Get the value of the Q_SAS1. - */ - inline su2double GetQ_SAS1() const override { return Q_SAS_1; } - - /*! - * \brief Get the value of the Q_SAS2. - */ - inline su2double GetQ_SAS2() const override { return Q_SAS_2; } - - /*! - * \brief Get the value of the L. - */ - inline su2double GetL() const override { return L; } - - /*! - * \brief Get the value of the L_vK1. - */ - inline su2double GetL_vK1() const override { return L_vK_1; } - - /*! - * \brief Get the value of the L_vK2. - */ - inline su2double GetL_vK2() const override { return L_vK_2; } }; diff --git a/SU2_CFD/include/variables/CTurbSSTVariable.hpp b/SU2_CFD/include/variables/CTurbSSTVariable.hpp index 791b09f4bd09..35c68ce7c98c 100644 --- a/SU2_CFD/include/variables/CTurbSSTVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSSTVariable.hpp @@ -52,13 +52,6 @@ class CTurbSSTVariable final : public CTurbVariable { VectorType r_dl; VectorType r_dt; VectorType r_d; - VectorType FTrans; - MatrixType VelocityLaplacian; - VectorType Q_SAS1; - VectorType Q_SAS2; - VectorType L; - VectorType L_vK1; - VectorType L_vK2; public: /*! @@ -133,141 +126,4 @@ class CTurbSSTVariable final : public CTurbVariable { inline su2double Get_r_dl(unsigned long iPoint) const override { return r_dl(iPoint); } inline su2double Get_r_d(unsigned long iPoint) const override { return r_d(iPoint); } - - /*! - * \brief Get the value of the FTrans. - * \param[in] iPoint - Point index. - */ - inline su2double GetFTrans(unsigned long iPoint) const override { return FTrans(iPoint); } - - /*! - * \brief Set the value of the FTrans. - * \param[in] iPoint - Point index. - * \param[in] val_FTrans - Value of the FTrans variable. - */ - inline void SetFTrans(unsigned long iPoint, su2double val_FTrans) override { - FTrans(iPoint) = val_FTrans; - }; - - /*! - * \brief Get the value of the velocity laplacian. - * \param[in] iPoint - Point index. - */ - inline su2double* GetVelLapl(unsigned long iPoint) final { return VelocityLaplacian[iPoint]; } - - /*! - * \brief Get the value of the velocity laplacian. - * \param[in] iPoint - Point index. - * \param[in] iDim - Dimension index. - */ - inline su2double GetVelLapl(unsigned long iPoint, unsigned short iDim) const final { return VelocityLaplacian[iPoint][iDim]; } - - /*! - * \brief Incrementally add the velocity laplacian vector. - * \param[in] iPoint - Point index. - * \param[in] val_VelLapl_X - X-Component of the velocity laplacian. - * \param[in] val_VelLapl_Y - Y-Component of the velocity laplacian. - * \param[in] val_VelLapl_Z - Z-Component of the velocity laplacian. - */ - inline void AddVelLapl(unsigned long iPoint, su2double val_VelLapl_X, su2double val_VelLapl_Y, su2double val_VelLapl_Z) override { - VelocityLaplacian(iPoint, 0) += val_VelLapl_X; - VelocityLaplacian(iPoint, 1) += val_VelLapl_Y; - if(nDim == 3) VelocityLaplacian(iPoint, 2) += val_VelLapl_Z; - }; - - /*! - * \brief Set the value of the velocity laplacian. - * \param[in] iPoint - Point index. - * \param[in] val_VelLapl - Vector of velocity laplacian. - */ - inline void SetVelLapl(unsigned long iPoint, su2double* val_VelLapl) override { - VelocityLaplacian(iPoint, 0) = val_VelLapl[0]; - VelocityLaplacian(iPoint, 1) = val_VelLapl[1]; - if(nDim == 3) VelocityLaplacian(iPoint, 2) = val_VelLapl[2]; - }; - - /*! - * \brief Set the value of the velocity laplacian. - * \param[in] iPoint - Point index. - * \param[in] iDim - Dimension index. - * \param[in] val_VelLapl - value of the velocity laplacian. - */ - inline void SetVelLapl(unsigned long iPoint, unsigned short iDim, su2double val_VelLapl) override { - VelocityLaplacian(iPoint, iDim) = val_VelLapl; - }; - - /*! - * \brief Set the value of the Q_SAS1. - * \param[in] iPoint - Point index. - * \param[in] val_FTrans - Value of the FTrans variable. - */ - inline void SetQ_SAS1(unsigned long iPoint, su2double val_Q_SAS1) override { - Q_SAS1(iPoint) = val_Q_SAS1; - }; - - /*! - * \brief Set the value of the Q_SAS2. - * \param[in] iPoint - Point index. - * \param[in] val_FTrans - Value of the FTrans variable. - */ - inline void SetQ_SAS2(unsigned long iPoint, su2double val_Q_SAS2) override { - Q_SAS2(iPoint) = val_Q_SAS2; - }; - - /*! - * \brief Set the value of the FTrans. - * \param[in] iPoint - Point index. - * \param[in] val_FTrans - Value of the FTrans variable. - */ - inline void SetL(unsigned long iPoint, su2double val_L) override { - L(iPoint) = val_L; - }; - - /*! - * \brief Set the value of the FTrans. - * \param[in] iPoint - Point index. - * \param[in] val_FTrans - Value of the FTrans variable. - */ - inline void SetL_vK1(unsigned long iPoint, su2double val_L_vK1) override { - L_vK1(iPoint) = val_L_vK1; - }; - - /*! - * \brief Set the value of the FTrans. - * \param[in] iPoint - Point index. - * \param[in] val_FTrans - Value of the FTrans variable. - */ - inline void SetL_vK2(unsigned long iPoint, su2double val_L_vK2) override { - L_vK2(iPoint) = val_L_vK2; - }; - - - /*! - * \brief Get the value of the Q_SAS1. - * \param[in] iPoint - Point index. - */ - inline su2double GetQ_SAS1(unsigned long iPoint) const override { return Q_SAS1(iPoint); } - /*! - * \brief Get the value of the Q_SAS2. - * \param[in] iPoint - Point index. - */ - inline su2double GetQ_SAS2(unsigned long iPoint) const override { return Q_SAS2(iPoint); } - /*! - * \brief Get the value of the FTrans. - * \param[in] iPoint - Point index. - */ - inline su2double GetL(unsigned long iPoint) const override { return L(iPoint); } - /*! - * \brief Get the value of the FTrans. - * \param[in] iPoint - Point index. - */ - inline su2double GetL_vK1(unsigned long iPoint) const override { return L_vK1(iPoint); } - /*! - * \brief Get the value of the FTrans. - * \param[in] iPoint - Point index. - */ - inline su2double GetL_vK2(unsigned long iPoint) const override { return L_vK2(iPoint); } - - - }; diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index 883947ffeae3..76e1415892dc 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -1692,93 +1692,6 @@ class CVariable { */ inline virtual su2double GetCrossDiff(unsigned long iPoint) const { return 0.0; } - /*! - * \brief Get the value of the value of FTrans. - */ - inline virtual su2double GetFTrans(unsigned long iPoint) const { return 0.0; } - - /*! - * \brief Set the value of the value of FTrans. - */ - inline virtual void SetFTrans(unsigned long iPoint, su2double val_FTrans) {} - - /*! - * \brief Get the value of the value of Q_SAS1. - */ - inline virtual su2double GetQ_SAS1(unsigned long iPoint) const { return 0.0; } - - /*! - * \brief Set the value of the value of Q_SAS1. - */ - inline virtual void SetQ_SAS1(unsigned long iPoint, su2double val_Q_SAS1) {} - - /*! - * \brief Get the value of the value of Q_SAS2. - */ - inline virtual su2double GetQ_SAS2(unsigned long iPoint) const { return 0.0; } - - /*! - * \brief Set the value of the value of Q_SAS2. - */ - inline virtual void SetQ_SAS2(unsigned long iPoint, su2double val_Q_SAS2) {} - - /*! - * \brief Get the value of the value of L. - */ - inline virtual su2double GetL(unsigned long iPoint) const { return 0.0; } - - /*! - * \brief Set the value of the value of L. - */ - inline virtual void SetL(unsigned long iPoint, su2double val_L) {} - - /*! - * \brief Get the value of the value of L_vK1. - */ - inline virtual su2double GetL_vK1(unsigned long iPoint) const { return 0.0; } - - /*! - * \brief Set the value of the value of L_vK1. - */ - inline virtual void SetL_vK1(unsigned long iPoint, su2double val_L_vK1) {} - - /*! - * \brief Get the value of the value of L_vK2. - */ - inline virtual su2double GetL_vK2(unsigned long iPoint) const { return 0.0; } - - /*! - * \brief Set the value of the value of L_vK2. - */ - inline virtual void SetL_vK2(unsigned long iPoint, su2double val_L_vK2) {} - - - - /*! - * \brief Get the value of the velocity laplacian. - */ - inline virtual su2double* GetVelLapl(unsigned long iPoint) { return nullptr; } - - /*! - * \brief Get the value of the velocity laplacian. - */ - inline virtual su2double GetVelLapl(unsigned long iPoint, unsigned short iDim) const { return 0.0; } - - /*! - * \brief Incrementally add the velocity laplacian vector. - */ - inline virtual void AddVelLapl(unsigned long iPoint, su2double val_VelLapl_X, su2double val_VelLapl_Y, su2double val_VelLapl_Z) {} - - /*! - * \brief Set the value of the velocity laplacian. - */ - inline virtual void SetVelLapl(unsigned long iPoint, su2double* val_VelLapl) {} - - /*! - * \brief Set the value of the velocity laplacian. - */ - inline virtual void SetVelLapl(unsigned long iPoint, unsigned short iDim, su2double val_VelLapl) {} - /*! * \brief Get the value of the eddy viscosity. * \return the value of the eddy viscosity. diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 0d857be95eaa..a8269bca61ed 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1258,12 +1258,6 @@ void CFlowOutput::SetVolumeOutputFieldsScalarSolution(const CConfig* config){ AddVolumeOutput("TKE", "Turb_Kin_Energy", "SOLUTION", "Turbulent kinetic energy"); AddVolumeOutput("DISSIPATION", "Omega", "SOLUTION", "Rate of dissipation"); AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "SOLUTION", "desired grid size for Scale Resolving Simulations"); - if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_TRAVIS) AddVolumeOutput("FTRANS", "FTrans", "SOLUTION", "value of FTrans for SAS simulation"); - if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_BABU){ - AddVolumeOutput("VEL-LAPLACIAN_X", "Vel Laplacian x", "SOLUTION", "value of laplacian of x-velocity for SAS simulation"); - AddVolumeOutput("VEL-LAPLACIAN_Y", "Vel Laplacian y", "SOLUTION", "value of laplacian of y-velocity for SAS simulation"); - if (nDim == 3) AddVolumeOutput("VEL-LAPLACIAN_Z", "Vel Laplacian z", "SOLUTION", "value of laplacian of z-velocity for SAS simulation"); - } break; case TURB_FAMILY::NONE: @@ -1535,21 +1529,7 @@ void CFlowOutput::SetVolumeOutputFieldsScalarMisc(const CConfig* config) { AddVolumeOutput("F2", "F2", "DEBUG", "F2 blending function"); if (config->GetKind_Turb_Model() != TURB_MODEL::NONE) - AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "SAS", "desired grid size for Scale Resolving Simulations"); - - if (TurbModelFamily(config->GetKind_Turb_Model()) == TURB_FAMILY::KW) { - if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_TRAVIS) AddVolumeOutput("FTRANS", "FTrans", "SOLUTION", "value of FTrans for SAS simulation"); - if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_BABU){ - AddVolumeOutput("Q_SAS_1", "Q_SAS 1", "SAS", "value of first term of Q_SAS for SAS simulation"); - AddVolumeOutput("Q_SAS_2", "Q_SAS 2", "SAS", "value of second term of Q_SAS for SAS simulation"); - AddVolumeOutput("L", "L", "SAS", "value of turbulence length scale for SAS simulation"); - AddVolumeOutput("L_VK_1", "L_vK 1", "SAS", "value of first term of von Karman length scale for SAS simulation"); - AddVolumeOutput("L_VK_2", "L_vK 2", "SAS", "value of second term of von Karman length scale for SAS simulation"); - AddVolumeOutput("VEL-LAPLACIAN_X", "Vel Laplacian x", "SAS", "value of laplacian of x-velocity for SAS simulation"); - AddVolumeOutput("VEL-LAPLACIAN_Y", "Vel Laplacian y", "SAS", "value of laplacian of y-velocity for SAS simulation"); - if (nDim == 3) AddVolumeOutput("VEL-LAPLACIAN_Z", "Vel Laplacian z", "SAS", "value of laplacian of z-velocity for SAS simulation"); - } - } + AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "DDES", "desired grid size for Scale Resolving Simulations"); } @@ -1605,22 +1585,6 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con if (config->GetKind_Turb_Model() != TURB_MODEL::NONE) SetVolumeOutputValue("SRS_GRID_SIZE", iPoint, Node_Turb->GetSRSGridSize(iPoint)); - if (TurbModelFamily(config->GetKind_Turb_Model()) == TURB_FAMILY::KW) { - if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_TRAVIS) SetVolumeOutputValue("FTRANS", iPoint, Node_Turb->GetFTrans(iPoint)); - if (config->GetSSTParsedOptions().sasModel == SST_OPTIONS::SAS_BABU){ - - SetVolumeOutputValue("Q_SAS_1", iPoint, Node_Turb->GetQ_SAS1(iPoint)); - SetVolumeOutputValue("Q_SAS_2", iPoint, Node_Turb->GetQ_SAS2(iPoint)); - SetVolumeOutputValue("L", iPoint, Node_Turb->GetL(iPoint)); - SetVolumeOutputValue("L_VK_1", iPoint, Node_Turb->GetL_vK1(iPoint)); - SetVolumeOutputValue("L_VK_2", iPoint, Node_Turb->GetL_vK2(iPoint)); - - SetVolumeOutputValue("VEL-LAPLACIAN_X", iPoint, Node_Turb->GetVelLapl(iPoint, 0)); - SetVolumeOutputValue("VEL-LAPLACIAN_Y", iPoint, Node_Turb->GetVelLapl(iPoint, 1)); - if (nDim == 3) SetVolumeOutputValue("VEL-LAPLACIAN_Z", iPoint, Node_Turb->GetVelLapl(iPoint, 2)); - } - - } } const bool limiter = (config->GetKind_SlopeLimit_Turb() != LIMITER::NONE); diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index c28af595bb2a..56ea623fc4b0 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -275,11 +275,6 @@ void CSolver::GetPeriodicCommCountAndType(const CConfig* config, MPI_TYPE = COMM_TYPE_DOUBLE; ICOUNT = nVar; break; - case PERIODIC_VEL_LAPLACIAN: - COUNT_PER_POINT = nDim; - MPI_TYPE = COMM_TYPE_DOUBLE; - ICOUNT = nDim; - break; default: SU2_MPI::Error("Unrecognized quantity for periodic communication.", CURRENT_FUNCTION); @@ -974,75 +969,6 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, } break; - case PERIODIC_VEL_LAPLACIAN: { - - /*--- For JST, the undivided Laplacian must be computed - consistently by using the complete control volume info - from both sides of the periodic face. ---*/ - - for (iDim = 0; iDim < nDim; iDim++) - Vel_Lapl[iDim] = 0.0; - - const su2double halfOnVol = 1.0 / (geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint)); - const auto coordsIPoint = geometry->nodes->GetCoord(iPoint); - - for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) { - - /*--- Avoid periodic boundary points so that we do not - duplicate edges on both sides of the periodic BC. ---*/ - - size_t jPoint = geometry->nodes->GetPoint(iPoint, iNeigh); - - if (!geometry->nodes->GetPeriodicBoundary(jPoint)) { - - size_t iEdge = geometry->nodes->GetEdge(iPoint, iNeigh); - weight = halfOnVol; - - const auto area = geometry->edges->GetNormal(iEdge); - AD::SetPreaccIn(area, nDim); - - const auto coordsJPoint = geometry->nodes->GetCoord(jPoint); - - su2double I2JVec[3] = {0.0}; - for (iDim = 0; iDim < nDim; ++iDim) I2JVec[iDim] = coordsJPoint[iDim] - coordsIPoint[iDim]; - - const su2double I2JVecnorm = GeometryToolbox::SquaredNorm(nDim, I2JVec); - const su2double AreaNorm = GeometryToolbox::Norm(nDim, area); - su2double edgeNormal = 0.0; - for (iDim = 0; iDim < nDim; ++iDim) - edgeNormal += area[iDim] * I2JVec[iDim]/AreaNorm; - - for (iDim = 0; iDimGetVelocity(jPoint,iDim)-base_nodes->GetVelocity(iPoint,iDim))* edgeNormal * AreaNorm / I2JVecnorm; - - boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint); - boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint); - - /*--- Both points inside the domain, or both in the boundary ---*/ - /*--- iPoint inside the domain, jPoint on the boundary ---*/ - - if (!boundary_i || boundary_j) { - if (geometry->nodes->GetDomain(iPoint)){ - for (iDim = 0; iDim< nDim; iDim++) - Vel_Lapl[iDim] -= Diff[iDim]; - } - } - } - } - - /*--- Store the components to be communicated in the buffer. ---*/ - - for (iDim = 0; iDim < nDim; iDim++) - bufDSend[buf_offset+iDim] = Vel_Lapl[iDim]; - - /*--- Rotate the momentum components of the Laplacian. ---*/ - - if (rotate_periodic) { - Rotate(zeros, &Vel_Lapl[0], &bufDSend[buf_offset+0]); - } - - break; - } default: SU2_MPI::Error("Unrecognized quantity for periodic communication.", CURRENT_FUNCTION); @@ -1365,16 +1291,6 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, limiter(iPoint, iVar) = min(limiter(iPoint, iVar), bufDRecv[buf_offset+iVar]); break; - case PERIODIC_VEL_LAPLACIAN: - { - /*--- Adjust the undivided Laplacian. The accumulation was - with a subtraction before communicating, so now just add. ---*/ - su2double bufDRecv_Z = 0.0; - if(nDim == 3) bufDRecv_Z = bufDRecv[buf_offset+2]; - base_nodes->AddVelLapl(iPoint, bufDRecv[buf_offset+0], bufDRecv[buf_offset+1], bufDRecv_Z); - - break; - } default: SU2_MPI::Error("Unrecognized quantity for periodic communication.", @@ -1463,10 +1379,6 @@ void CSolver::GetCommCountAndType(const CConfig* config, COUNT_PER_POINT = nVar; MPI_TYPE = COMM_TYPE_DOUBLE; break; - case MPI_QUANTITIES::VELOCITY_LAPLACIAN: - COUNT_PER_POINT = nDim; - MPI_TYPE = COMM_TYPE_DOUBLE; - break; default: SU2_MPI::Error("Unrecognized quantity for point-to-point MPI comms.", CURRENT_FUNCTION); @@ -1616,10 +1528,6 @@ void CSolver::InitiateComms(CGeometry *geometry, for (iVar = 0; iVar < nVar; iVar++) bufDSend[buf_offset+iVar] = base_nodes->GetSolution_time_n1(iPoint, iVar); break; - case MPI_QUANTITIES::VELOCITY_LAPLACIAN: - for(iDim = 0; iDim < nDim; iDim++) - bufDSend[buf_offset+iDim] = base_nodes->GetVelLapl(iPoint, iDim); - break; default: SU2_MPI::Error("Unrecognized quantity for point-to-point MPI comms.", CURRENT_FUNCTION); @@ -1768,10 +1676,6 @@ void CSolver::CompleteComms(CGeometry *geometry, for (iVar = 0; iVar < nVar; iVar++) base_nodes->Set_Solution_time_n1(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; - case MPI_QUANTITIES::VELOCITY_LAPLACIAN: - for (iDim = 0; iDim < nDim; iDim++) - base_nodes->SetVelLapl(iPoint, iDim, bufDRecv[buf_offset+iDim]); - break; default: SU2_MPI::Error("Unrecognized quantity for point-to-point MPI comms.", CURRENT_FUNCTION); diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index c072d6e7a2a7..bccc722f08a5 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -228,75 +228,6 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain } - if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_BABU){ - - auto* flowNodes = su2staticcast_p(solver_container[FLOW_SOL]->GetNodes()); - - SU2_OMP_FOR_DYN(256) - for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) { - - /*--- Initialize. ---*/ - for (unsigned short iDim = 0; iDim < nDim; iDim++) - nodes->SetVelLapl(iPoint, iDim, 0.0); - - const su2double halfOnVol = 1.0 / (geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint)); - - const auto coordsIPoint = geometry->nodes->GetCoord(iPoint); - - /*--- Loop over the neighbors of point i. ---*/ - for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) { - - size_t iEdge = geometry->nodes->GetEdge(iPoint, iNeigh); - size_t jPoint = geometry->nodes->GetPoint(iPoint, iNeigh); - - /*--- Determine if edge points inwards or outwards of iPoint. - * If inwards we need to flip the area vector. ---*/ - - const su2double weight = halfOnVol; - - const auto area = geometry->edges->GetNormal(iEdge); - AD::SetPreaccIn(area, nDim); - - const auto coordsJPoint = geometry->nodes->GetCoord(jPoint); - - su2double I2JVec[MAXNDIM] = {0.0}; - for (size_t iDim = 0; iDim < nDim; ++iDim) I2JVec[iDim] = coordsJPoint[iDim] - coordsIPoint[iDim]; - - const su2double I2JVecnorm = GeometryToolbox::SquaredNorm(nDim, I2JVec); - const su2double AreaNorm = GeometryToolbox::Norm(nDim, area); - su2double edgeNormal = 0.0; - for (size_t iDim = 0; iDim < nDim; ++iDim) - edgeNormal += area[iDim] * I2JVec[iDim]/AreaNorm; - - const su2double delta_x = weight *(flowNodes->GetVelocity(jPoint,0)-flowNodes->GetVelocity(iPoint,0))* edgeNormal * AreaNorm / I2JVecnorm; - const su2double delta_y = weight *(flowNodes->GetVelocity(jPoint,1)-flowNodes->GetVelocity(iPoint,1))* edgeNormal * AreaNorm / I2JVecnorm; - su2double delta_z = 0.0; - - if (nDim == 3) { - delta_z = weight *(flowNodes->GetVelocity(jPoint,2)-flowNodes->GetVelocity(iPoint,2))* edgeNormal * AreaNorm / I2JVecnorm; - } - nodes->AddVelLapl(iPoint, delta_x, delta_y, delta_z); - - } - - - } - END_SU2_OMP_FOR - - /*--- Correct the Laplacian across any periodic boundaries. ---*/ - - for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { - InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_VEL_LAPLACIAN); - CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_VEL_LAPLACIAN); - } - - /*--- MPI parallelization ---*/ - - InitiateComms(geometry, config, MPI_QUANTITIES::VELOCITY_LAPLACIAN); - CompleteComms(geometry, config, MPI_QUANTITIES::VELOCITY_LAPLACIAN); - - } - } void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_container, @@ -341,20 +272,6 @@ void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai const auto& eddy_visc_var = sstParsedOptions.version == SST_OPTIONS::V1994 ? VorticityMag : StrainMag; su2double muT = max(0.0, rho * a1 * kine / max(a1 * omega, eddy_visc_var * F2)); - if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_BABU) { - // In the paper by Babu it says that the limiter on the von Karman length scale must prevent - // the SAS eddy viscosity from decreasing below the LES subgrid-scale eddy viscosity. The limiter has been imposed - // in the turb_sources, should I also limit the eddy viscosity here? - // If yes then this is how - const su2double gridSize = pow(geometry->nodes->GetVolume(iPoint), 1.0/nDim); - const su2double C_DES1 = 0.78; - const su2double C_DES2 = 0.61; - const su2double C_DES = C_DES1 * nodes->GetF1blending(iPoint) + C_DES2 * (1-nodes->GetF1blending(iPoint)); // taken this from the SST-DDES part - // const su2double Cs = 0.5; // taken from turb_sources - const su2double muT_LES = rho * pow(C_DES*gridSize, 2.0) * StrainMag; - muT = max(muT, muT_LES); - } - nodes->SetmuT(iPoint, muT); // Now compute desired cell size for Scale Resolving Simulations @@ -489,30 +406,10 @@ void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta numerics->SetLengthScale(nodes->GetDES_LengthScale(iPoint), 0.0); } - if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_BABU){ - numerics->SetVelLapl(nodes->GetVelLapl(iPoint)); - } - /*--- Compute the source term ---*/ - auto residual = numerics->ComputeResidual(config); - /*--- Store the SAS function ---*/ - if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_TRAVIS) { - nodes->SetFTrans(iPoint, numerics->GetFTrans()); - } - - /*--- Store the SAS function ---*/ - if (sstParsedOptions.sasModel == SST_OPTIONS::SAS_BABU) { - nodes->SetQ_SAS1(iPoint, numerics->GetQ_SAS1()); - nodes->SetQ_SAS2(iPoint, numerics->GetQ_SAS2()); - nodes->SetL(iPoint, numerics->GetL()); - nodes->SetL_vK1(iPoint, numerics->GetL_vK1()); - nodes->SetL_vK2(iPoint, numerics->GetL_vK2()); - } - /*--- Store the intermittency ---*/ - if (config->GetKind_Trans_Model() != TURB_TRANS_MODEL::NONE) { nodes->SetIntermittency(iPoint, numerics->GetIntermittencyEff()); } @@ -1334,175 +1231,6 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C END_SU2_OMP_FOR } - -void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CConfig *config){ - - const auto kind_hybridRANSLES = config->GetKind_HybridRANSLES(); - - auto* flowNodes = su2staticcast_p(solver[FLOW_SOL]->GetNodes()); - - SU2_OMP_FOR_STAT(omp_chunk_size) - for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++){ - - const su2double StrainMag = max(flowNodes->GetStrainMag(iPoint), 1e-12); - const auto Vorticity = flowNodes->GetVorticity(iPoint); - const su2double VortMag = max(GeometryToolbox::Norm(3, Vorticity), 1e-12); - - const su2double KolmConst2 = 0.41*0.41; - const su2double wallDist2 = geometry->nodes->GetWall_Distance(iPoint)*geometry->nodes->GetWall_Distance(iPoint); - - const su2double eddyVisc = nodes->GetmuT(iPoint)/flowNodes->GetDensity(iPoint); - const su2double lamVisc = nodes->GetLaminarViscosity(iPoint)/flowNodes->GetDensity(iPoint); - - const su2double C_DES1 = 0.78; - const su2double C_DES2 = 0.61; - - const su2double h_max = geometry->nodes->GetMaxLength(iPoint); - const su2double C_DES = C_DES1 * nodes->GetF1blending(iPoint) + C_DES2 * (1-nodes->GetF1blending(iPoint)); - const su2double l_RANS = sqrt(nodes->GetSolution(iPoint, 0)) / (constants[6] * nodes->GetSolution(iPoint, 1)); - - su2double DES_lengthScale = 0.0; - - switch(kind_hybridRANSLES){ - case SST_DDES: { - - const su2double r_d = (eddyVisc + lamVisc) / max((KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))), 1e-10); - const su2double C_d1 = 20.0; - const su2double C_d2 = 3.0; - - const su2double f_d = 1 - tanh(pow(C_d1 * r_d, C_d2)); - - const su2double l_LES = C_DES * h_max; - - DES_lengthScale = l_RANS - f_d * max(0.0, l_RANS - l_LES); - - nodes->SetDebug_Quantities(config, iPoint, f_d, l_RANS, l_LES, r_d); - - break; - } - case SST_IDDES: { - - // Constants - const su2double C_w = 0.15; - const su2double C_dt1 = 20.0; - const su2double C_dt2 = 3.0; - const su2double C_l = 5.0; - const su2double C_t = 1.87; - - const su2double alpha = 0.25 - sqrt(wallDist2) / h_max; - const su2double f_b = min(2.0 * exp(-9.0 * alpha*alpha), 1.0); - const su2double r_dt = eddyVisc / max((KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))), 1e-10); - const su2double f_dt = 1 - tanh(pow(C_dt1 * r_dt, C_dt2)); - const su2double ftilda_d = max(1.0 - f_dt, f_b); - - const su2double r_dl = lamVisc / max((KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))), 1e-10); - const su2double f_l = tanh(pow(C_l*C_l*r_dl, 10.0)); - const su2double f_t = tanh(pow(C_t*C_t*r_dt, 3.0)); - const su2double f_e2 = 1.0 - max(f_t, f_l); - const su2double f_e1 = alpha >= 0.0 ? 2.0 * exp(-11.09*alpha*alpha) : 2.0 * exp(-9.0*alpha*alpha); - const su2double f_e = f_e2 * max((f_e1 - 1.0), 0.0); - - - const su2double Delta = min(C_w * max(sqrt(wallDist2), h_max), h_max); - const su2double l_LES = C_DES * Delta; - - nodes->SetDebug_Quantities(config, iPoint, ftilda_d, l_RANS, l_LES, r_dl, r_dt); - - DES_lengthScale = ftilda_d *(1.0+f_e)*l_RANS + (1.0 - ftilda_d) * l_LES; - - break; - } - case SST_SIDDES: { - - // Constants - const su2double C_w = 0.15; - const su2double C_dt1 = 20.0; - const su2double C_dt2 = 3.0; - - const su2double alpha = 0.25 - sqrt(wallDist2) / h_max; - const su2double f_b = min(2.0 * exp(-9.0 * alpha*alpha), 1.0); - const su2double r_dt = eddyVisc / max((KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))), 1e-10); - const su2double f_dt = 1 - tanh(pow(C_dt1 * r_dt, C_dt2)); - const su2double ftilda_d = max(1.0 - f_dt, f_b); - - const su2double Delta = min(C_w * max(sqrt(wallDist2), h_max), h_max); - const su2double l_LES = C_DES * Delta; - - nodes->SetDebug_Quantities(config, iPoint, ftilda_d, l_RANS, l_LES, r_dt); - - DES_lengthScale = ftilda_d*l_RANS + (1.0 - ftilda_d) * l_LES; - - break; - } - case SST_EDDES: { - - // Improved DDES version with the Shear-Layer-Adapted augmentation - // found in Detached Eddy Simulation: Recent Development and Application to Compressor Tip Leakage Flow, Xiao He, Fanzhou Zhao, Mehdi Vahdati - // originally from Application of SST-Based SLA-DDES Formulation to Turbomachinery Flows, Guoping Xia, Zifei Yin and Gorazd Medic - // I could be naming it either as SST_EDDES to follow the same notation as for the SA model or as SST_SLA_DDES to follow the paper notation - - const su2double f_max = 1.0, f_min = 0.1, a1 = 0.15, a2 = 0.3; - - const auto nNeigh = geometry->nodes->GetnPoint(iPoint); - - su2double vortexTiltingMeasure = nodes->GetVortex_Tilting(iPoint); - - su2double deltaOmega = -1.0; - su2double vorticityDir[MAXNDIM] = {}; - - for (auto iDim = 0; iDim < 3; iDim++){ - vorticityDir[iDim] = Vorticity[iDim]/VortMag; - } - - for (const auto jPoint : geometry->nodes->GetPoints(iPoint)){ - const auto coord_j = geometry->nodes->GetCoord(jPoint); - - for (const auto kPoint : geometry->nodes->GetPoints(iPoint)){ - const auto coord_k = geometry->nodes->GetCoord(kPoint); - - su2double delta[MAXNDIM] = {}; - // This should only be performed on 3D cases anyway - for (auto iDim = 0u; iDim < 3; iDim++){ - delta[iDim] = (coord_j[iDim] - coord_k[iDim])/2.0; // Should I divide by 2 as I am interested in the dual volume? - } - su2double l_n_minus_m[3]; - GeometryToolbox::CrossProduct(delta, vorticityDir, l_n_minus_m); - deltaOmega = max(deltaOmega, GeometryToolbox::Norm(nDim, l_n_minus_m)); - } - - // Add to VTM(iPoint) to perform the average - vortexTiltingMeasure += nodes->GetVortex_Tilting(jPoint); - } - deltaOmega /= sqrt(3.0); - vortexTiltingMeasure /= (nNeigh+1); - - const su2double f_kh = max(f_min, - min(f_max, - f_min + ((f_max - f_min)/(a2 - a1)) * (vortexTiltingMeasure - a1))); - - const su2double r_d = (eddyVisc + lamVisc) / max((KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))), 1e-10); - const su2double C_d1 = 20.0; - const su2double C_d2 = 3.0; - - const su2double f_d = 1 - tanh(pow(C_d1 * r_d, C_d2)); - - su2double delta = deltaOmega * f_kh; - if (f_d < 0.99){ - delta = h_max; - } - - const su2double l_LES = C_DES * delta; - DES_lengthScale = l_RANS - f_d * max(0.0, l_RANS - l_LES); - nodes->SetDebug_Quantities(config, iPoint, f_d, l_RANS, l_LES, r_d); - } - } - - nodes->SetDES_LengthScale(iPoint, DES_lengthScale); - - } - END_SU2_OMP_FOR -} - void CTurbSSTSolver::ComputeUnderRelaxationFactor(const CConfig *config) { const su2double allowableRatio = config->GetMaxUpdateFractionSST(); diff --git a/SU2_CFD/src/variables/CTurbSSTVariable.cpp b/SU2_CFD/src/variables/CTurbSSTVariable.cpp index 161dfa4c79e5..4bc410acf14b 100644 --- a/SU2_CFD/src/variables/CTurbSSTVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSSTVariable.cpp @@ -59,15 +59,6 @@ CTurbSSTVariable::CTurbSSTVariable(su2double kine, su2double omega, su2double mu muT.resize(nPoint) = mut; - if(sstParsedOptions.sasModel == SST_OPTIONS::SAS_TRAVIS) FTrans.resize(nPoint) = su2double(1.0); - if(sstParsedOptions.sasModel == SST_OPTIONS::SAS_BABU) { - VelocityLaplacian.resize(nPoint, nDim) = su2double(0.0); - Q_SAS1.resize(nPoint) = su2double(0.0); - Q_SAS2.resize(nPoint) = su2double(0.0); - L.resize(nPoint) = su2double(0.0); - L_vK1.resize(nPoint) = su2double(0.0); - L_vK2.resize(nPoint) = su2double(0.0); - } } void CTurbSSTVariable::SetBlendingFunc(unsigned long iPoint, su2double val_viscosity, diff --git a/externals/meson b/externals/meson index 41c650a040d5..5a82ea050173 160000 --- a/externals/meson +++ b/externals/meson @@ -1 +1 @@ -Subproject commit 41c650a040d50e0912d268af7a903a9ce1456dfa +Subproject commit 5a82ea0501736a666ca9cc003ea0774f8219fd65 From 37a866f0606f7dde5999ddb04d1f0c8a41a99ab0 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Thu, 2 Oct 2025 11:11:27 +0200 Subject: [PATCH 47/56] - Removed debug quantities - Made Get/SetSRSGridSize non virtual --- .../include/variables/CTurbSSTVariable.hpp | 37 ------------------- SU2_CFD/include/variables/CTurbVariable.hpp | 4 +- SU2_CFD/include/variables/CVariable.hpp | 31 ---------------- SU2_CFD/src/output/CFlowOutput.cpp | 32 ---------------- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 7 ---- SU2_CFD/src/variables/CTurbSSTVariable.cpp | 7 ---- 6 files changed, 2 insertions(+), 116 deletions(-) diff --git a/SU2_CFD/include/variables/CTurbSSTVariable.hpp b/SU2_CFD/include/variables/CTurbSSTVariable.hpp index 35c68ce7c98c..aeb288bcef88 100644 --- a/SU2_CFD/include/variables/CTurbSSTVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSSTVariable.hpp @@ -46,13 +46,6 @@ class CTurbSSTVariable final : public CTurbVariable { VectorType CDkw; /*!< \brief Cross-diffusion. */ SST_ParsedOptions sstParsedOptions; - VectorType ftilda_d; - VectorType l_RANS; - VectorType l_LES; - VectorType r_dl; - VectorType r_dt; - VectorType r_d; - public: /*! * \brief Constructor of the class. @@ -96,34 +89,4 @@ class CTurbSSTVariable final : public CTurbVariable { */ inline su2double GetCrossDiff(unsigned long iPoint) const override { return CDkw(iPoint); } - /*! - * \brief Set the DES Length Scale. - * \param[in] iPoint - Point index. - */ - inline void SetDebug_Quantities(CConfig *config, unsigned long iPoint, su2double val_ftilda_d, su2double val_l_RANS, su2double val_l_LES, su2double val_r_d) override { - ftilda_d(iPoint) = val_ftilda_d; - l_RANS(iPoint) = val_l_RANS; - l_LES(iPoint) = val_l_LES; - - if ( config->GetKind_HybridRANSLES() == SST_DDES || config->GetKind_HybridRANSLES() == SST_EDDES) - r_d(iPoint) = val_r_d; - else - r_dt(iPoint) = val_r_d; - } - - inline void SetDebug_Quantities(CConfig *config, unsigned long iPoint, su2double val_ftilda_d, su2double val_l_RANS, su2double val_l_LES, su2double val_r_dl, su2double val_r_dt) override { - ftilda_d(iPoint) = val_ftilda_d; - l_RANS(iPoint) = val_l_RANS; - l_LES(iPoint) = val_l_LES; - r_dt(iPoint) = val_r_dt; - r_dl(iPoint) = val_r_dl; - } - - inline su2double Get_L_RANS(unsigned long iPoint) const override { return l_RANS(iPoint); } - inline su2double Get_L_LES(unsigned long iPoint) const override { return l_LES(iPoint); } - inline su2double Get_ftilda_d(unsigned long iPoint) const override { return ftilda_d(iPoint); } - inline su2double Get_r_dt(unsigned long iPoint) const override { return r_dt(iPoint); } - inline su2double Get_r_dl(unsigned long iPoint) const override { return r_dl(iPoint); } - inline su2double Get_r_d(unsigned long iPoint) const override { return r_d(iPoint); } - }; diff --git a/SU2_CFD/include/variables/CTurbVariable.hpp b/SU2_CFD/include/variables/CTurbVariable.hpp index 89aa2e80b095..e26e4fd0ed0d 100644 --- a/SU2_CFD/include/variables/CTurbVariable.hpp +++ b/SU2_CFD/include/variables/CTurbVariable.hpp @@ -108,14 +108,14 @@ class CTurbVariable : public CScalarVariable { * \param[in] iPoint - Point index. * \return the value of the desired grid size for Scale Resolving Simulations. */ - inline su2double GetSRSGridSize(unsigned long iPoint) const final { return SRSGridSize(iPoint); } + inline su2double GetSRSGridSize(unsigned long iPoint) const { return SRSGridSize(iPoint); } /*! * \brief Set the value of the desired grid size for Scale Resolving Simulations. * \param[in] iPoint - Point index. * \param[in] val_muT - Value of the desired grid size for Scale Resolving Simulations. */ - inline void SetSRSGridSize(unsigned long iPoint, su2double val_gridSize) final { SRSGridSize(iPoint) = val_gridSize; } + inline void SetSRSGridSize(unsigned long iPoint, su2double val_gridSize) { SRSGridSize(iPoint) = val_gridSize; } /*! * \brief Get the DES length scale diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index 76e1415892dc..dc905d79fcb4 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -397,25 +397,6 @@ class CVariable { */ inline virtual void SetDES_LengthScale(unsigned long iPoint, su2double val_des_lengthscale) {} - /*! - * \brief A virtual member. - * \param[in] iPoint - Point index. - */ - inline virtual void SetDebug_Quantities(CConfig *config, unsigned long iPoint, su2double val_ftilda_d, su2double val_l_RANS, su2double val_l_LES, su2double val_r_d) {} - - inline virtual su2double Get_L_RANS(unsigned long iPoint) const { return 0.0; } - inline virtual su2double Get_L_LES(unsigned long iPoint) const { return 0.0; } - inline virtual su2double Get_ftilda_d(unsigned long iPoint) const { return 0.0; } - inline virtual su2double Get_r_dt(unsigned long iPoint) const { return 0.0; } - inline virtual su2double Get_r_dl(unsigned long iPoint) const { return 0.0; } - inline virtual su2double Get_r_d(unsigned long iPoint) const { return 0.0; } - - /*! - * \brief A virtual member. - * \param[in] iPoint - Point index. - */ - inline virtual void SetDebug_Quantities(CConfig *config, unsigned long iPoint, su2double val_ftilda_d, su2double val_l_RANS, su2double val_l_LES, su2double val_r_dl, su2double val_r_dt) {} - /*! * \brief A virtual member. * \param[in] iPoint - Point index. @@ -1740,18 +1721,6 @@ class CVariable { */ inline virtual void SetmuT(unsigned long iPoint, su2double val_muT) {} - /*! - * \brief Get the value of the desired grid size for Scale Resolving Simulations. - * \return the value of the desired grid size for Scale Resolving Simulations. - */ - inline virtual su2double GetSRSGridSize(unsigned long iPoint) const { return 0.0; } - - /*! - * \brief Set the value of the desired grid size for Scale Resolving Simulations. - * \param[in] val_gridSize - */ - inline virtual void SetSRSGridSize(unsigned long iPoint, su2double val_gridSize) {} - /*! * \brief Set the value of the turbulence index. * \param[in] val_turb_index - turbulence index diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index a8269bca61ed..7877ee542734 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1251,13 +1251,11 @@ void CFlowOutput::SetVolumeOutputFieldsScalarSolution(const CConfig* config){ switch (TurbModelFamily(config->GetKind_Turb_Model())) { case TURB_FAMILY::SA: AddVolumeOutput("NU_TILDE", "Nu_Tilde", "SOLUTION", "Spalart-Allmaras variable"); - AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "SOLUTION", "desired grid size for Scale Resolving Simulations"); break; case TURB_FAMILY::KW: AddVolumeOutput("TKE", "Turb_Kin_Energy", "SOLUTION", "Turbulent kinetic energy"); AddVolumeOutput("DISSIPATION", "Omega", "SOLUTION", "Rate of dissipation"); - AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "SOLUTION", "desired grid size for Scale Resolving Simulations"); break; case TURB_FAMILY::NONE: @@ -1485,19 +1483,6 @@ void CFlowOutput::SetVolumeOutputFieldsScalarMisc(const CConfig* config) { if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES) { AddVolumeOutput("DES_LENGTHSCALE", "DES_LengthScale", "DDES", "DES length scale value"); AddVolumeOutput("WALL_DISTANCE", "Wall_Distance", "DDES", "Wall distance value"); - if (config->GetKind_Turb_Model() == TURB_MODEL::SST) { - AddVolumeOutput("F_D", "f_d", "DDES", "Empiric blending function"); - AddVolumeOutput("L_RANS", "l_RANS", "DDES", "RANS length scale value"); - AddVolumeOutput("L_LES", "l_LES", "DDES", "LES length scale value"); - } - if ( config->GetKind_HybridRANSLES() == SST_DDES || config->GetKind_HybridRANSLES() == SST_EDDES){ - AddVolumeOutput("R_D", "r_d", "DDES", "r_d"); - } else if ( config->GetKind_HybridRANSLES() == SST_IDDES){ - AddVolumeOutput("R_DT", "r_dt", "DDES", "turbulent r_d"); - AddVolumeOutput("R_DL", "r_dl", "DDES", "laminar r_d"); - } else if ( config->GetKind_HybridRANSLES() == SST_SIDDES){ - AddVolumeOutput("R_DT", "r_dt", "DDES", "turbulent r_d"); - } AddVolumeOutput("LESIQ", "LESIQ", "DDES", "LESIQ index for SRS simulations"); } @@ -1640,23 +1625,6 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES) { SetVolumeOutputValue("DES_LENGTHSCALE", iPoint, Node_Flow->GetDES_LengthScale(iPoint)); SetVolumeOutputValue("WALL_DISTANCE", iPoint, Node_Geo->GetWall_Distance(iPoint)); - if ( config->GetKind_HybridRANSLES() == SST_DDES || config->GetKind_HybridRANSLES() == SST_EDDES){ - SetVolumeOutputValue("F_D", iPoint, Node_Turb->Get_ftilda_d(iPoint)); - SetVolumeOutputValue("L_RANS", iPoint, Node_Turb->Get_L_RANS(iPoint)); - SetVolumeOutputValue("L_LES", iPoint, Node_Turb->Get_L_LES(iPoint)); - SetVolumeOutputValue("R_D", iPoint, Node_Turb->Get_r_d(iPoint)); - } else if ( config->GetKind_HybridRANSLES() == SST_IDDES){ - SetVolumeOutputValue("F_D", iPoint, Node_Turb->Get_ftilda_d(iPoint)); - SetVolumeOutputValue("L_RANS", iPoint, Node_Turb->Get_L_RANS(iPoint)); - SetVolumeOutputValue("L_LES", iPoint, Node_Turb->Get_L_LES(iPoint)); - SetVolumeOutputValue("R_DT", iPoint, Node_Turb->Get_r_dt(iPoint)); - SetVolumeOutputValue("R_DL", iPoint, Node_Turb->Get_r_dl(iPoint)); - } else if ( config->GetKind_HybridRANSLES() == SST_SIDDES){ - SetVolumeOutputValue("F_D", iPoint, Node_Turb->Get_ftilda_d(iPoint)); - SetVolumeOutputValue("L_RANS", iPoint, Node_Turb->Get_L_RANS(iPoint)); - SetVolumeOutputValue("L_LES", iPoint, Node_Turb->Get_L_LES(iPoint)); - SetVolumeOutputValue("R_DT", iPoint, Node_Turb->Get_r_dt(iPoint)); - } const su2double mut = Node_Flow->GetEddyViscosity(iPoint); const su2double mu = Node_Flow->GetLaminarViscosity(iPoint); const su2double LESIQ = 1.0/(1.0+0.05*pow((mut+mu)/mu, 0.53)); diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index bccc722f08a5..71fd4b5d320d 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -1104,8 +1104,6 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C DES_lengthScale = l_RANS - f_d * max(0.0, l_RANS - l_LES); - nodes->SetDebug_Quantities(config, iPoint, f_d, l_RANS, l_LES, r_d); - break; } case SST_IDDES: { @@ -1134,8 +1132,6 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C const su2double Delta = min(C_w * max(sqrt(wallDist2), h_max), h_max); const su2double l_LES = C_DES * Delta; - nodes->SetDebug_Quantities(config, iPoint, ftilda_d, l_RANS, l_LES, r_dl, r_dt); - DES_lengthScale = ftilda_d *(1.0+f_e)*l_RANS + (1.0 - ftilda_d) * l_LES; break; @@ -1156,8 +1152,6 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C const su2double Delta = min(C_w * max(sqrt(wallDist2), h_max), h_max); const su2double l_LES = C_DES * Delta; - nodes->SetDebug_Quantities(config, iPoint, ftilda_d, l_RANS, l_LES, r_dt); - DES_lengthScale = ftilda_d*l_RANS + (1.0 - ftilda_d) * l_LES; break; @@ -1221,7 +1215,6 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C const su2double l_LES = C_DES * delta; DES_lengthScale = l_RANS - f_d * max(0.0, l_RANS - l_LES); - nodes->SetDebug_Quantities(config, iPoint, f_d, l_RANS, l_LES, r_d); } } diff --git a/SU2_CFD/src/variables/CTurbSSTVariable.cpp b/SU2_CFD/src/variables/CTurbSSTVariable.cpp index 4bc410acf14b..f503ee72f8d8 100644 --- a/SU2_CFD/src/variables/CTurbSSTVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSSTVariable.cpp @@ -50,13 +50,6 @@ CTurbSSTVariable::CTurbSSTVariable(su2double kine, su2double omega, su2double mu F2.resize(nPoint) = su2double(0.0); CDkw.resize(nPoint) = su2double(0.0); - ftilda_d.resize(nPoint) = su2double(0.0); - l_RANS.resize(nPoint) = su2double(0.0); - l_LES.resize(nPoint) = su2double(0.0); - r_dl.resize(nPoint) = su2double(0.0); - r_dt.resize(nPoint) = su2double(0.0); - r_d.resize(nPoint) = su2double(0.0); - muT.resize(nPoint) = mut; } From ac2078cc7b72e7471717aa613bb9e49050e4cbe7 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Thu, 2 Oct 2025 11:17:46 +0200 Subject: [PATCH 48/56] - Re-introduced the virtual function --- SU2_CFD/include/variables/CTurbVariable.hpp | 4 ++-- SU2_CFD/include/variables/CVariable.hpp | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/include/variables/CTurbVariable.hpp b/SU2_CFD/include/variables/CTurbVariable.hpp index e26e4fd0ed0d..89aa2e80b095 100644 --- a/SU2_CFD/include/variables/CTurbVariable.hpp +++ b/SU2_CFD/include/variables/CTurbVariable.hpp @@ -108,14 +108,14 @@ class CTurbVariable : public CScalarVariable { * \param[in] iPoint - Point index. * \return the value of the desired grid size for Scale Resolving Simulations. */ - inline su2double GetSRSGridSize(unsigned long iPoint) const { return SRSGridSize(iPoint); } + inline su2double GetSRSGridSize(unsigned long iPoint) const final { return SRSGridSize(iPoint); } /*! * \brief Set the value of the desired grid size for Scale Resolving Simulations. * \param[in] iPoint - Point index. * \param[in] val_muT - Value of the desired grid size for Scale Resolving Simulations. */ - inline void SetSRSGridSize(unsigned long iPoint, su2double val_gridSize) { SRSGridSize(iPoint) = val_gridSize; } + inline void SetSRSGridSize(unsigned long iPoint, su2double val_gridSize) final { SRSGridSize(iPoint) = val_gridSize; } /*! * \brief Get the DES length scale diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index dc905d79fcb4..e94b9d132ad9 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -1721,6 +1721,18 @@ class CVariable { */ inline virtual void SetmuT(unsigned long iPoint, su2double val_muT) {} + /*! + * \brief Get the value of the desired grid size for Scale Resolving Simulations. + * \return the value of the desired grid size for Scale Resolving Simulations. + */ + inline virtual su2double GetSRSGridSize(unsigned long iPoint) const { return 0.0; } + + /*! + * \brief Set the value of the desired grid size for Scale Resolving Simulations. + * \param[in] val_gridSize + */ + inline virtual void SetSRSGridSize(unsigned long iPoint, su2double val_gridSize) {} + /*! * \brief Set the value of the turbulence index. * \param[in] val_turb_index - turbulence index From 0c8d49ab609aeacebebd4e0368968c770e3f4986 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Thu, 2 Oct 2025 16:34:52 +0200 Subject: [PATCH 49/56] - Fixed some notation - Used GeometryToolbox when possible --- Common/include/option_structure.hpp | 4 +- Common/src/CConfig.cpp | 15 +++---- .../numerics/turbulent/turb_sources.hpp | 6 +-- SU2_CFD/include/variables/CTurbVariable.hpp | 2 +- SU2_CFD/include/variables/CVariable.hpp | 2 +- SU2_CFD/src/solvers/CTurbSASolver.cpp | 38 +++++++++-------- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 26 ++++++++---- SU2_CFD/src/variables/CTurbVariable.cpp | 41 +++++++------------ 8 files changed, 68 insertions(+), 66 deletions(-) diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index c1d61884c6b8..0f9566ff21f2 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -1480,7 +1480,7 @@ enum ENUM_HYBRIDRANSLES { SST_IDDES = 6, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Improved DDES). */ SST_SIDDES = 7, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Simplified Improved DDES). */ SST_EDDES = 8, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Enhanced (SLA) DDES). */ - SA_EDDES_MOD = 9 /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Enhanced (SLA) DDES). */ + SA_EDDES_UNSTR = 9 /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Enhanced (SLA) DDES). */ }; static const MapType HybridRANSLES_Map = { MakePair("NONE", NO_HYBRIDRANSLES) @@ -1488,7 +1488,7 @@ static const MapType HybridRANSLES_Map = { MakePair("SA_DDES", SA_DDES) MakePair("SA_ZDES", SA_ZDES) MakePair("SA_EDDES", SA_EDDES) - MakePair("SA_EDDES_MOD", SA_EDDES_MOD) + MakePair("SA_EDDES_UNSTR", SA_EDDES_UNSTR) MakePair("SST_DDES", SST_DDES) MakePair("SST_IDDES", SST_IDDES) MakePair("SST_SIDDES", SST_SIDDES) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 8c242f78824a..b756e9252ae1 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -6442,13 +6442,14 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) { cout << "Hybrid RANS/LES: "; switch (Kind_HybridRANSLES) { case NO_HYBRIDRANSLES: cout << "No Hybrid RANS/LES" << endl; break; - case SA_DES: cout << "Detached Eddy Simulation (DES97) " << endl; break; - case SA_DDES: cout << "Delayed Detached Eddy Simulation (DDES) with Standard SGS" << endl; break; - case SA_ZDES: cout << "Delayed Detached Eddy Simulation (DDES) with Vorticity-based SGS" << endl; break; - case SA_EDDES: cout << "Delayed Detached Eddy Simulation (DDES) with Shear-layer Adapted SGS" << endl; break; - case SST_DDES: cout << "Delayed Detached Eddy Simulation (DDES)" << endl; break; - case SST_IDDES: cout << "Improved Delayed Detached Eddy Simulation (IDDES)" << endl; break; - case SST_SIDDES: cout << "Simplified Improved Delayed Detached Eddy Simulation (SIDDES)" << endl; break; + case SA_DES: cout << "Detached Eddy Simulation (DES97) " << endl; break; + case SA_DDES: cout << "Delayed Detached Eddy Simulation (DDES) with Standard SGS" << endl; break; + case SA_ZDES: cout << "Delayed Detached Eddy Simulation (DDES) with Vorticity-based SGS" << endl; break; + case SA_EDDES: cout << "Delayed Detached Eddy Simulation (DDES) with Shear-layer Adapted SGS" << endl; break; + case SA_EDDES_UNSTR: cout << "Delayed Detached Eddy Simulation (DDES) with Shear-layer Adapted SGS (modified for Unstructured grids)" << endl; break; + case SST_DDES: cout << "Delayed Detached Eddy Simulation (DDES)" << endl; break; + case SST_IDDES: cout << "Improved Delayed Detached Eddy Simulation (IDDES)" << endl; break; + case SST_SIDDES: cout << "Simplified Improved Delayed Detached Eddy Simulation (SIDDES)" << endl; break; } break; case MAIN_SOLVER::NEMO_EULER: diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index c4e2dd247c30..33556a81482f 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -887,7 +887,7 @@ class CSourcePieceWise_TurbSST final : public CNumerics { } if (sstParsedOptions.production == SST_OPTIONS::COMP_Sarkar) { - const su2double Dilatation_Sarkar = -0.15 * pk * Mt + 0.2 * beta_star * (1.0 +zetaFMt) * Density_i * ScalarVar_i[1] * ScalarVar_i[0] * Mt * Mt; + const su2double Dilatation_Sarkar = -0.15 * pk * Mt + 0.2 * beta_star * (1.0 +zetaFMt) * Density_i * ScalarVar_i[1] * ScalarVar_i[0] * pow(Mt, 2); pk += Dilatation_Sarkar; } @@ -895,9 +895,9 @@ class CSourcePieceWise_TurbSST final : public CNumerics { su2double dk = beta_star * Density_i * ScalarVar_i[1] * ScalarVar_i[0] * (1.0 + zetaFMt); if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES) - dk = Density_i * sqrt(ScalarVar_i[0]*ScalarVar_i[0]*ScalarVar_i[0]) / lengthScale_i; + dk = Density_i * sqrt(pow(ScalarVar_i[0], 3)) / lengthScale_i; - su2double dw = beta_blended * Density_i * ScalarVar_i[1] * ScalarVar_i[1] * (1.0 - 0.09/beta_blended * zetaFMt); + su2double dw = beta_blended * Density_i * pow(ScalarVar_i[1], 2) * (1.0 - 0.09/beta_blended * zetaFMt); /*--- LM model coupling with production and dissipation term for k transport equation---*/ if (config->GetKind_Trans_Model() == TURB_TRANS_MODEL::LM) { diff --git a/SU2_CFD/include/variables/CTurbVariable.hpp b/SU2_CFD/include/variables/CTurbVariable.hpp index 89aa2e80b095..2fffa11314b3 100644 --- a/SU2_CFD/include/variables/CTurbVariable.hpp +++ b/SU2_CFD/include/variables/CTurbVariable.hpp @@ -134,7 +134,7 @@ class CTurbVariable : public CScalarVariable { * \brief Set the vortex tilting measure for computation of the EDDES length scale * \param[in] iPoint - Point index. */ - void SetVortex_Tilting(unsigned long iPoint, CMatrixView PrimGrad_Flow, + void SetVortex_Tilting(unsigned long iPoint, const su2double Strain[3][3], const su2double* Vorticity, su2double LaminarViscosity) override; /*! diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index e94b9d132ad9..8283f124ede3 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -2247,7 +2247,7 @@ class CVariable { inline virtual su2double GetTau_Wall(unsigned long iPoint) const { return 0.0; } - inline virtual void SetVortex_Tilting(unsigned long iPoint, CMatrixView PrimGrad_Flow, + inline virtual void SetVortex_Tilting(unsigned long iPoint, const su2double Strain[3][3], const su2double* Vorticity, su2double LaminarViscosity) {} inline virtual su2double GetVortex_Tilting(unsigned long iPoint) const { return 0.0; } diff --git a/SU2_CFD/src/solvers/CTurbSASolver.cpp b/SU2_CFD/src/solvers/CTurbSASolver.cpp index 348cf8b1efe8..2a71528f2848 100644 --- a/SU2_CFD/src/solvers/CTurbSASolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSASolver.cpp @@ -186,15 +186,21 @@ void CTurbSASolver::Preprocessing(CGeometry *geometry, CSolver **solver_containe /*--- Set the vortex tilting coefficient at every node if required ---*/ - if (kind_hybridRANSLES == SA_EDDES || kind_hybridRANSLES == SA_EDDES_MOD){ + if (kind_hybridRANSLES == SA_EDDES || kind_hybridRANSLES == SA_EDDES_UNSTR){ auto* flowNodes = su2staticcast_p(solver_container[FLOW_SOL]->GetNodes()); SU2_OMP_FOR_STAT(omp_chunk_size) for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++){ + su2double Grad_Vel[3][3] = {{0.0}}, StrainMat[3][3] = {{0.0}}; auto Vorticity = flowNodes->GetVorticity(iPoint); - auto PrimGrad_Flow = flowNodes->GetGradient_Primitive(iPoint); + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + for (unsigned short jDim = 0; jDim < nDim; jDim++) { + Grad_Vel[iDim][jDim] = nodes->GetGradient_Primitive(iPoint, prim_idx.Velocity() + iDim, jDim); + } + } auto Laminar_Viscosity = flowNodes->GetLaminarViscosity(iPoint); - nodes->SetVortex_Tilting(iPoint, PrimGrad_Flow, Vorticity, Laminar_Viscosity); + CNumerics::ComputeMeanRateOfStrainMatrix(3, StrainMat, Grad_Vel); + nodes->SetVortex_Tilting(iPoint, StrainMat, Vorticity, Laminar_Viscosity); } END_SU2_OMP_FOR } @@ -1456,8 +1462,8 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC pow(ratioOmega[1], 2)*delta[0]*delta[2] + pow(ratioOmega[2], 2)*delta[0]*delta[1]); - const su2double r_d = (kinematicViscosityTurb+kinematicViscosity)/(uijuij*k2*pow(wallDistance, 2.0)); - const su2double f_d = 1.0-tanh(pow(8.0*r_d,3.0)); + const su2double r_d = (kinematicViscosityTurb+kinematicViscosity)/(uijuij*k2*pow(wallDistance, 2)); + const su2double f_d = 1.0-tanh(pow(8.0*r_d,3)); if (f_d < 0.99){ maxDelta = deltaDDES; @@ -1507,8 +1513,8 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC min(f_max, f_min + ((f_max - f_min)/(a2 - a1)) * (vortexTiltingMeasure - a1))); - const su2double r_d = (kinematicViscosityTurb+kinematicViscosity)/(uijuij*k2*pow(wallDistance, 2.0)); - const su2double f_d = 1.0-tanh(pow(8.0*r_d,3.0)); + const su2double r_d = (kinematicViscosityTurb+kinematicViscosity)/(uijuij*k2*pow(wallDistance, 2)); + const su2double f_d = 1.0-tanh(pow(8.0*r_d,3)); su2double maxDelta = (ln_max/sqrt(3.0)) * f_kh; if (f_d < 0.999){ @@ -1520,7 +1526,7 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC break; } - case SA_EDDES_MOD: { + case SA_EDDES_UNSTR: { /*--- An Enhanced Version of DES with Rapid Transition from RANS to LES in Separated Flows. Shur et al. Flow Turbulence Combust - 2015 @@ -1531,13 +1537,13 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC const su2double omega = GeometryToolbox::Norm(3, vorticity); su2double ratioOmega[MAXNDIM] = {}; - - for (auto iDim = 0; iDim < 3; iDim++){ + for (auto iDim = 0; iDim < MAXNDIM; iDim++){ ratioOmega[iDim] = vorticity[iDim]/omega; } const su2double deltaDDES = geometry->nodes->GetMaxLength(iPoint); - + + // Introduced correction for unstructured grids su2double ln_max = -1; for (const auto jPoint : geometry->nodes->GetPoints(iPoint)){ const auto coord_j = geometry->nodes->GetCoord(jPoint); @@ -1546,13 +1552,13 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC const auto coord_k = geometry->nodes->GetCoord(kPoint); su2double delta[MAXNDIM] = {}; - // This should only be performed on 3D cases anyway - for (auto iDim = 0u; iDim < 3; iDim++){ - delta[iDim] = (coord_j[iDim] - coord_k[iDim])/2.0; // Should I divide by 2 as I am interested in the dual volume? + for (auto iDim = 0u; iDim < MAXNDIM; iDim++){ + // TODO: Should I divide by 2 as I am interested in the dual volume (the edge is split at midpoint)? + delta[iDim] = (coord_j[iDim] - coord_k[iDim])/2.0; } - su2double l_n_minus_m[3]; + su2double l_n_minus_m[MAXNDIM]; GeometryToolbox::CrossProduct(delta, ratioOmega, l_n_minus_m); - ln_max = max(ln_max, GeometryToolbox::Norm(nDim, l_n_minus_m)); + ln_max = max(ln_max, GeometryToolbox::Norm(3, l_n_minus_m)); } vortexTiltingMeasure += nodes->GetVortex_Tilting(jPoint); } diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 71fd4b5d320d..09e42f72ba4a 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -28,7 +28,6 @@ #include "../../include/solvers/CTurbSSTSolver.hpp" #include "../../include/variables/CTurbSSTVariable.hpp" #include "../../include/variables/CFlowVariable.hpp" -#include "../../include/variables/CMeshVariable.hpp" #include "../../../Common/include/parallelization/omp_structure.hpp" #include "../../../Common/include/toolboxes/geometry_toolbox.hpp" @@ -214,10 +213,16 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain SU2_OMP_FOR_STAT(omp_chunk_size) for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++){ + su2double Grad_Vel[3][3] = {{0.0}}, StrainMat[3][3] = {{0.0}}; auto Vorticity = flowNodes->GetVorticity(iPoint); - auto PrimGrad_Flow = flowNodes->GetGradient_Primitive(iPoint); + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + for (unsigned short jDim = 0; jDim < nDim; jDim++) { + Grad_Vel[iDim][jDim] = nodes->GetGradient_Primitive(iPoint, prim_idx.Velocity() + iDim, jDim); + } + } auto Laminar_Viscosity = flowNodes->GetLaminarViscosity(iPoint); - nodes->SetVortex_Tilting(iPoint, PrimGrad_Flow, Vorticity, Laminar_Viscosity); + CNumerics::ComputeMeanRateOfStrainMatrix(3, StrainMat, Grad_Vel); + nodes->SetVortex_Tilting(iPoint, StrainMat, Vorticity, Laminar_Viscosity); } END_SU2_OMP_FOR } @@ -1092,6 +1097,9 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C su2double DES_lengthScale = 0.0; switch(kind_hybridRANSLES){ + /*--- Every model is taken from "Development of DDES and IDDES Formulations for the k-ω Shear Stress Transport Model" + Mikhail S. Gritskevich et al. (DOI:10.1007/s10494-011-9378-4) + ---*/ case SST_DDES: { const su2double r_d = (eddyVisc + lamVisc) / max((KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))), 1e-10); @@ -1172,7 +1180,7 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C su2double deltaOmega = -1.0; su2double vorticityDir[MAXNDIM] = {}; - for (auto iDim = 0; iDim < 3; iDim++){ + for (auto iDim = 0; iDim < MAXNDIM; iDim++){ vorticityDir[iDim] = Vorticity[iDim]/VortMag; } @@ -1183,13 +1191,13 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C const auto coord_k = geometry->nodes->GetCoord(kPoint); su2double delta[MAXNDIM] = {}; - // This should only be performed on 3D cases anyway - for (auto iDim = 0u; iDim < 3; iDim++){ - delta[iDim] = (coord_j[iDim] - coord_k[iDim])/2.0; // Should I divide by 2 as I am interested in the dual volume? + for (auto iDim = 0u; iDim < MAXNDIM; iDim++){ + // TODO: Should I divide by 2 as I am interested in the dual volume (the edge is split at midpoint)? + delta[iDim] = (coord_j[iDim] - coord_k[iDim])/2.0; } - su2double l_n_minus_m[3]; + su2double l_n_minus_m[MAXNDIM]; GeometryToolbox::CrossProduct(delta, vorticityDir, l_n_minus_m); - deltaOmega = max(deltaOmega, GeometryToolbox::Norm(nDim, l_n_minus_m)); + deltaOmega = max(deltaOmega, GeometryToolbox::Norm(3, l_n_minus_m)); } // Add to VTM(iPoint) to perform the average diff --git a/SU2_CFD/src/variables/CTurbVariable.cpp b/SU2_CFD/src/variables/CTurbVariable.cpp index 2b3c2acd0ac9..d5a56cb27a96 100644 --- a/SU2_CFD/src/variables/CTurbVariable.cpp +++ b/SU2_CFD/src/variables/CTurbVariable.cpp @@ -27,6 +27,7 @@ #include "../../include/variables/CTurbVariable.hpp" +#include "../../../Common/include/toolboxes/geometry_toolbox.hpp" CTurbVariable::CTurbVariable(unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config) @@ -43,43 +44,29 @@ CTurbVariable::CTurbVariable(unsigned long npoint, unsigned long ndim, unsigned } -void CTurbVariable::SetVortex_Tilting(unsigned long iPoint, CMatrixView PrimGrad_Flow, - const su2double* Vorticity, su2double LaminarViscosity) { +void CTurbVariable::SetVortex_Tilting(unsigned long iPoint, const su2double Strain[3][3], + const su2double* Vorticity, su2double LaminarViscosity) { - su2double Strain[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}}, Omega, StrainDotVort[3], numVecVort[3]; + su2double Omega, StrainDotVort[3], numVecVort[3]; su2double numerator, trace0, trace1, denominator; AD::StartPreacc(); - AD::SetPreaccIn(PrimGrad_Flow, nDim+1, nDim); + AD::SetPreaccIn(Strain, nDim, nDim); AD::SetPreaccIn(Vorticity, 3); /*--- Eddy viscosity ---*/ AD::SetPreaccIn(muT(iPoint)); /*--- Laminar viscosity --- */ AD::SetPreaccIn(LaminarViscosity); - Strain[0][0] = PrimGrad_Flow[1][0]; - Strain[1][0] = 0.5*(PrimGrad_Flow[2][0] + PrimGrad_Flow[1][1]); - Strain[0][1] = 0.5*(PrimGrad_Flow[1][1] + PrimGrad_Flow[2][0]); - Strain[1][1] = PrimGrad_Flow[2][1]; - if (nDim == 3){ - Strain[0][2] = 0.5*(PrimGrad_Flow[3][0] + PrimGrad_Flow[1][2]); - Strain[1][2] = 0.5*(PrimGrad_Flow[3][1] + PrimGrad_Flow[2][2]); - Strain[2][0] = 0.5*(PrimGrad_Flow[1][2] + PrimGrad_Flow[3][0]); - Strain[2][1] = 0.5*(PrimGrad_Flow[2][2] + PrimGrad_Flow[3][1]); - Strain[2][2] = PrimGrad_Flow[3][2]; - } - - Omega = sqrt(Vorticity[0]*Vorticity[0] + Vorticity[1]*Vorticity[1]+ Vorticity[2]*Vorticity[2]); - - StrainDotVort[0] = Strain[0][0]*Vorticity[0]+Strain[0][1]*Vorticity[1]+Strain[0][2]*Vorticity[2]; - StrainDotVort[1] = Strain[1][0]*Vorticity[0]+Strain[1][1]*Vorticity[1]+Strain[1][2]*Vorticity[2]; - StrainDotVort[2] = Strain[2][0]*Vorticity[0]+Strain[2][1]*Vorticity[1]+Strain[2][2]*Vorticity[2]; - - numVecVort[0] = StrainDotVort[1]*Vorticity[2] - StrainDotVort[2]*Vorticity[1]; - numVecVort[1] = StrainDotVort[2]*Vorticity[0] - StrainDotVort[0]*Vorticity[2]; - numVecVort[2] = StrainDotVort[0]*Vorticity[1] - StrainDotVort[1]*Vorticity[0]; - - numerator = sqrt(6.0) * sqrt(numVecVort[0]*numVecVort[0] + numVecVort[1]*numVecVort[1] + numVecVort[2]*numVecVort[2]); + Omega = GeometryToolbox::Norm(3, Vorticity); + + StrainDotVort[0] = GeometryToolbox::DotProduct(3, Strain[0], Vorticity); + StrainDotVort[1] = GeometryToolbox::DotProduct(3, Strain[1], Vorticity); + StrainDotVort[2] = GeometryToolbox::DotProduct(3, Strain[2], Vorticity); + + GeometryToolbox::CrossProduct(StrainDotVort, Vorticity, numVecVort); + + numerator = sqrt(6.0) * GeometryToolbox::Norm(3, numVecVort); trace0 = 3.0*(pow(Strain[0][0],2.0) + pow(Strain[1][1],2.0) + pow(Strain[2][2],2.0)); trace1 = pow(Strain[0][0] + Strain[1][1] + Strain[2][2],2.0); denominator = pow(Omega, 2.0) * sqrt(trace0-trace1); From 86db90b81de2c8a1595a73b31135e4f76b820ad2 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Thu, 2 Oct 2025 18:37:35 +0200 Subject: [PATCH 50/56] - Fix compilation issues --- SU2_CFD/src/solvers/CTurbSASolver.cpp | 4 ++-- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SU2_CFD/src/solvers/CTurbSASolver.cpp b/SU2_CFD/src/solvers/CTurbSASolver.cpp index 2a71528f2848..75fbbe2a0ad4 100644 --- a/SU2_CFD/src/solvers/CTurbSASolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSASolver.cpp @@ -1486,7 +1486,7 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC su2double ratioOmega[MAXNDIM] = {}; - for (auto iDim = 0; iDim < 3; iDim++){ + for (auto iDim = 0u; iDim < MAXNDIM; iDim++){ ratioOmega[iDim] = vorticity[iDim]/omega; } @@ -1537,7 +1537,7 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC const su2double omega = GeometryToolbox::Norm(3, vorticity); su2double ratioOmega[MAXNDIM] = {}; - for (auto iDim = 0; iDim < MAXNDIM; iDim++){ + for (auto iDim = 0u; iDim < MAXNDIM; iDim++){ ratioOmega[iDim] = vorticity[iDim]/omega; } diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 09e42f72ba4a..a5eefc2f45ca 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -1180,7 +1180,7 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C su2double deltaOmega = -1.0; su2double vorticityDir[MAXNDIM] = {}; - for (auto iDim = 0; iDim < MAXNDIM; iDim++){ + for (auto iDim = 0u; iDim < MAXNDIM; iDim++){ vorticityDir[iDim] = Vorticity[iDim]/VortMag; } From d4564da3c534638d9cde10154b34c04a9b4cc28c Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 3 Oct 2025 09:02:17 +0200 Subject: [PATCH 51/56] - Fixed variable inputs --- Common/include/option_structure.hpp | 18 +++++++++--------- SU2_CFD/include/variables/CTurbVariable.hpp | 2 +- SU2_CFD/include/variables/CVariable.hpp | 2 +- SU2_CFD/src/solvers/CTurbSASolver.cpp | 13 ++++++++----- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 5 ++++- SU2_CFD/src/variables/CTurbVariable.cpp | 2 +- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 0f9566ff21f2..b7cbd85161ff 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -1472,15 +1472,15 @@ static const MapType Window_Map = { */ enum ENUM_HYBRIDRANSLES { NO_HYBRIDRANSLES = 0, /*!< \brief No turbulence model. */ - SA_DES = 1, /*!< \brief Kind of Hybrid RANS/LES (SA - Detached Eddy Simulation (DES)). */ - SA_DDES = 2, /*!< \brief Kind of Hybrid RANS/LES (SA - Delayed DES (DDES) with Delta_max SGS ). */ - SA_ZDES = 3, /*!< \brief Kind of Hybrid RANS/LES (SA - Delayed DES (DDES) with Vorticity based SGS like Zonal DES). */ - SA_EDDES = 4, /*!< \brief Kind of Hybrid RANS/LES (SA - Delayed DES (DDES) with Shear Layer Adapted SGS: Enhanced DDES). */ - SST_DDES = 5, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): DDES). */ - SST_IDDES = 6, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Improved DDES). */ - SST_SIDDES = 7, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Simplified Improved DDES). */ - SST_EDDES = 8, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Enhanced (SLA) DDES). */ - SA_EDDES_UNSTR = 9 /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Enhanced (SLA) DDES). */ + SA_DES = 1, /*!< \brief Kind of Hybrid RANS/LES (SA - Detached Eddy Simulation (DES)). */ + SA_DDES = 2, /*!< \brief Kind of Hybrid RANS/LES (SA - Delayed DES (DDES) with Delta_max SGS ). */ + SA_ZDES = 3, /*!< \brief Kind of Hybrid RANS/LES (SA - Delayed DES (DDES) with Vorticity based SGS like Zonal DES). */ + SA_EDDES = 4, /*!< \brief Kind of Hybrid RANS/LES (SA - Delayed DES (DDES) with Shear Layer Adapted SGS: Enhanced DDES). */ + SA_EDDES_UNSTR = 5, /*!< \brief Kind of Hybrid RANS/LES (SA - Delayed DES (DDES) with Shear Layer Adapted SGS: Enhanced DDES and for Unstructured grids). */ + SST_DDES = 6, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): DDES). */ + SST_IDDES = 7, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Improved DDES). */ + SST_SIDDES = 8, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Simplified Improved DDES). */ + SST_EDDES = 9 /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Enhanced (SLA) DDES). */ }; static const MapType HybridRANSLES_Map = { MakePair("NONE", NO_HYBRIDRANSLES) diff --git a/SU2_CFD/include/variables/CTurbVariable.hpp b/SU2_CFD/include/variables/CTurbVariable.hpp index 2fffa11314b3..31ccf5709ed7 100644 --- a/SU2_CFD/include/variables/CTurbVariable.hpp +++ b/SU2_CFD/include/variables/CTurbVariable.hpp @@ -134,7 +134,7 @@ class CTurbVariable : public CScalarVariable { * \brief Set the vortex tilting measure for computation of the EDDES length scale * \param[in] iPoint - Point index. */ - void SetVortex_Tilting(unsigned long iPoint, const su2double Strain[3][3], + void SetVortex_Tilting(unsigned long iPoint, su2double **Strain, const su2double* Vorticity, su2double LaminarViscosity) override; /*! diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index 8283f124ede3..e1ffffa2b504 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -2247,7 +2247,7 @@ class CVariable { inline virtual su2double GetTau_Wall(unsigned long iPoint) const { return 0.0; } - inline virtual void SetVortex_Tilting(unsigned long iPoint, const su2double Strain[3][3], + inline virtual void SetVortex_Tilting(unsigned long iPoint, su2double **Strain, const su2double* Vorticity, su2double LaminarViscosity) {} inline virtual su2double GetVortex_Tilting(unsigned long iPoint) const { return 0.0; } diff --git a/SU2_CFD/src/solvers/CTurbSASolver.cpp b/SU2_CFD/src/solvers/CTurbSASolver.cpp index 75fbbe2a0ad4..1164d793f992 100644 --- a/SU2_CFD/src/solvers/CTurbSASolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSASolver.cpp @@ -191,9 +191,12 @@ void CTurbSASolver::Preprocessing(CGeometry *geometry, CSolver **solver_containe SU2_OMP_FOR_STAT(omp_chunk_size) for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++){ - su2double Grad_Vel[3][3] = {{0.0}}, StrainMat[3][3] = {{0.0}}; + su2double **Grad_Vel = new su2double* [nDim]; + su2double **StrainMat = new su2double* [nDim]; auto Vorticity = flowNodes->GetVorticity(iPoint); for (unsigned short iDim = 0; iDim < nDim; iDim++) { + Grad_Vel[iDim] = new su2double [nDim]; + StrainMat[iDim] = new su2double [nDim]; for (unsigned short jDim = 0; jDim < nDim; jDim++) { Grad_Vel[iDim][jDim] = nodes->GetGradient_Primitive(iPoint, prim_idx.Velocity() + iDim, jDim); } @@ -1426,8 +1429,8 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC const su2double maxDelta = geometry->nodes->GetMaxLength(iPoint); - const su2double r_d = (kinematicViscosityTurb+kinematicViscosity)/(uijuij*k2*pow(wallDistance, 2.0)); - const su2double f_d = 1.0-tanh(pow(8.0*r_d,3.0)); + const su2double r_d = (kinematicViscosityTurb+kinematicViscosity)/(uijuij*k2*pow(wallDistance, 2)); + const su2double f_d = 1.0-tanh(pow(8.0*r_d,3)); const su2double distDES = constDES * maxDelta; lengthScale = wallDistance-f_d*max(0.0,(wallDistance-distDES)); @@ -1569,8 +1572,8 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC min(f_max, f_min + ((f_max - f_min)/(a2 - a1)) * (vortexTiltingMeasure - a1))); - const su2double r_d = (kinematicViscosityTurb+kinematicViscosity)/(uijuij*k2*pow(wallDistance, 2.0)); - const su2double f_d = 1.0-tanh(pow(8.0*r_d,3.0)); + const su2double r_d = (kinematicViscosityTurb+kinematicViscosity)/(uijuij*k2*pow(wallDistance, 2)); + const su2double f_d = 1.0-tanh(pow(8.0*r_d,3)); su2double maxDelta = (ln_max/sqrt(3.0)) * f_kh; if (f_d < 0.999){ diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index a5eefc2f45ca..531ab8578fda 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -213,9 +213,12 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain SU2_OMP_FOR_STAT(omp_chunk_size) for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++){ - su2double Grad_Vel[3][3] = {{0.0}}, StrainMat[3][3] = {{0.0}}; + su2double **Grad_Vel = new su2double* [nDim]; + su2double **StrainMat = new su2double* [nDim]; auto Vorticity = flowNodes->GetVorticity(iPoint); for (unsigned short iDim = 0; iDim < nDim; iDim++) { + Grad_Vel[iDim] = new su2double [nDim]; + StrainMat[iDim] = new su2double [nDim]; for (unsigned short jDim = 0; jDim < nDim; jDim++) { Grad_Vel[iDim][jDim] = nodes->GetGradient_Primitive(iPoint, prim_idx.Velocity() + iDim, jDim); } diff --git a/SU2_CFD/src/variables/CTurbVariable.cpp b/SU2_CFD/src/variables/CTurbVariable.cpp index d5a56cb27a96..014948a05443 100644 --- a/SU2_CFD/src/variables/CTurbVariable.cpp +++ b/SU2_CFD/src/variables/CTurbVariable.cpp @@ -44,7 +44,7 @@ CTurbVariable::CTurbVariable(unsigned long npoint, unsigned long ndim, unsigned } -void CTurbVariable::SetVortex_Tilting(unsigned long iPoint, const su2double Strain[3][3], +void CTurbVariable::SetVortex_Tilting(unsigned long iPoint, su2double **Strain, const su2double* Vorticity, su2double LaminarViscosity) { su2double Omega, StrainDotVort[3], numVecVort[3]; From 177276a441ee9eef2a991d0b74fe35c604040cb8 Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 3 Oct 2025 10:23:49 +0200 Subject: [PATCH 52/56] - Fixed some thread sanitizer problems --- SU2_CFD/src/output/CFlowOutput.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 7877ee542734..e8df72315a86 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1509,9 +1509,12 @@ void CFlowOutput::SetVolumeOutputFieldsScalarMisc(const CConfig* config) { AddVolumeOutput("GRAD_VEL_ZY", "Grad_Vel_zy", "DEBUG", "Strain magnitude value"); AddVolumeOutput("GRAD_VEL_ZZ", "Grad_Vel_zz", "DEBUG", "Strain magnitude value"); } - AddVolumeOutput("CDkw", "CDkw", "DEBUG", "Cross-Diffusion term"); - AddVolumeOutput("F1", "F1", "DEBUG", "F1 blending function"); - AddVolumeOutput("F2", "F2", "DEBUG", "F2 blending function"); + + if (config->GetKind_Turb_Model() == TURB_MODEL::SST){ + AddVolumeOutput("CDkw", "CDkw", "DEBUG", "Cross-Diffusion term"); + AddVolumeOutput("F1", "F1", "DEBUG", "F1 blending function"); + AddVolumeOutput("F2", "F2", "DEBUG", "F2 blending function"); + } if (config->GetKind_Turb_Model() != TURB_MODEL::NONE) AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "DDES", "desired grid size for Scale Resolving Simulations"); @@ -1562,10 +1565,12 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con SetVolumeOutputValue("GRAD_VEL_ZY", iPoint, VelGrad(2,1)); SetVolumeOutputValue("GRAD_VEL_ZZ", iPoint, VelGrad(2,2)); } - - SetVolumeOutputValue("CDkw", iPoint, Node_Turb->GetCrossDiff(iPoint)); - SetVolumeOutputValue("F1", iPoint, Node_Turb->GetF1blending(iPoint)); - SetVolumeOutputValue("F2", iPoint, Node_Turb->GetF2blending(iPoint)); + + if (config->GetKind_Turb_Model() == TURB_MODEL::SST){ + SetVolumeOutputValue("CDkw", iPoint, Node_Turb->GetCrossDiff(iPoint)); + SetVolumeOutputValue("F1", iPoint, Node_Turb->GetF1blending(iPoint)); + SetVolumeOutputValue("F2", iPoint, Node_Turb->GetF2blending(iPoint)); + } if (config->GetKind_Turb_Model() != TURB_MODEL::NONE) SetVolumeOutputValue("SRS_GRID_SIZE", iPoint, Node_Turb->GetSRSGridSize(iPoint)); From e260cc4948bf39898efe0faf8cc6761e1728adcb Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 3 Oct 2025 10:44:56 +0200 Subject: [PATCH 53/56] - Removed unused functions - Rearrenged and renamed outputs --- SU2_CFD/include/variables/CTurbVariable.hpp | 15 -------- SU2_CFD/include/variables/CVariable.hpp | 12 ------- SU2_CFD/src/output/CFlowOutput.cpp | 40 +++++++++++---------- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 6 ---- SU2_CFD/src/variables/CTurbVariable.cpp | 1 - 5 files changed, 22 insertions(+), 52 deletions(-) diff --git a/SU2_CFD/include/variables/CTurbVariable.hpp b/SU2_CFD/include/variables/CTurbVariable.hpp index 31ccf5709ed7..742405941e06 100644 --- a/SU2_CFD/include/variables/CTurbVariable.hpp +++ b/SU2_CFD/include/variables/CTurbVariable.hpp @@ -44,7 +44,6 @@ class CTurbVariable : public CScalarVariable { static constexpr size_t MAXNVAR = 2; VectorType turb_index; /*!< \brief Value of the turbulence index for transition simulations. */ VectorType intermittency; /*!< \brief Value of the intermittency for the transition model. */ - VectorType SRSGridSize; /*!< \brief alue of the desired grid size for Scale Resolving Simulations. */ VectorType Vortex_Tilting; /*! @@ -102,20 +101,6 @@ class CTurbVariable : public CScalarVariable { * \param[in] val_intermittency - New value of the intermittency. */ inline void SetIntermittency(unsigned long iPoint, su2double val_intermittency) final { intermittency(iPoint) = val_intermittency; } - - /*! - * \brief Get the desired grid size for Scale Resolving Simulations. - * \param[in] iPoint - Point index. - * \return the value of the desired grid size for Scale Resolving Simulations. - */ - inline su2double GetSRSGridSize(unsigned long iPoint) const final { return SRSGridSize(iPoint); } - - /*! - * \brief Set the value of the desired grid size for Scale Resolving Simulations. - * \param[in] iPoint - Point index. - * \param[in] val_muT - Value of the desired grid size for Scale Resolving Simulations. - */ - inline void SetSRSGridSize(unsigned long iPoint, su2double val_gridSize) final { SRSGridSize(iPoint) = val_gridSize; } /*! * \brief Get the DES length scale diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index e1ffffa2b504..a19453754bf7 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -1721,18 +1721,6 @@ class CVariable { */ inline virtual void SetmuT(unsigned long iPoint, su2double val_muT) {} - /*! - * \brief Get the value of the desired grid size for Scale Resolving Simulations. - * \return the value of the desired grid size for Scale Resolving Simulations. - */ - inline virtual su2double GetSRSGridSize(unsigned long iPoint) const { return 0.0; } - - /*! - * \brief Set the value of the desired grid size for Scale Resolving Simulations. - * \param[in] val_gridSize - */ - inline virtual void SetSRSGridSize(unsigned long iPoint, su2double val_gridSize) {} - /*! * \brief Set the value of the turbulence index. * \param[in] val_turb_index - turbulence index diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index e8df72315a86..e087a1fd61a1 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1484,6 +1484,8 @@ void CFlowOutput::SetVolumeOutputFieldsScalarMisc(const CConfig* config) { AddVolumeOutput("DES_LENGTHSCALE", "DES_LengthScale", "DDES", "DES length scale value"); AddVolumeOutput("WALL_DISTANCE", "Wall_Distance", "DDES", "Wall distance value"); AddVolumeOutput("LESIQ", "LESIQ", "DDES", "LESIQ index for SRS simulations"); + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) + AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "DDES", "desired grid size for Scale Resolving Simulations"); } if (config->GetViscous()) { @@ -1498,27 +1500,24 @@ void CFlowOutput::SetVolumeOutputFieldsScalarMisc(const CConfig* config) { if (config->GetKind_HybridRANSLES() == NO_HYBRIDRANSLES) { AddVolumeOutput("WALL_DISTANCE", "Wall_Distance", "DEBUG", "Wall distance value"); } - AddVolumeOutput("GRAD_VEL_XX", "Grad_Vel_xx", "DEBUG", "Strain magnitude value"); - AddVolumeOutput("GRAD_VEL_XY", "Grad_Vel_xy", "DEBUG", "Strain magnitude value"); - AddVolumeOutput("GRAD_VEL_YX", "Grad_Vel_yx", "DEBUG", "Strain magnitude value"); - AddVolumeOutput("GRAD_VEL_YY", "Grad_Vel_yy", "DEBUG", "Strain magnitude value"); + AddVolumeOutput("GRAD_VEL_XX", "Grad_Vel_xx", "VELOCITY_GRADIENT", "X-Gradient of U"); + AddVolumeOutput("GRAD_VEL_XY", "Grad_Vel_xy", "VELOCITY_GRADIENT", "Y-Gradient of U"); + AddVolumeOutput("GRAD_VEL_YX", "Grad_Vel_yx", "VELOCITY_GRADIENT", "X-Gradient of U"); + AddVolumeOutput("GRAD_VEL_YY", "Grad_Vel_yy", "VELOCITY_GRADIENT", "Y-Gradient of V"); if (nDim == 3) { - AddVolumeOutput("GRAD_VEL_XZ", "Grad_Vel_xz", "DEBUG", "Strain magnitude value"); - AddVolumeOutput("GRAD_VEL_YZ", "Grad_Vel_yz", "DEBUG", "Strain magnitude value"); - AddVolumeOutput("GRAD_VEL_ZX", "Grad_Vel_zx", "DEBUG", "Strain magnitude value"); - AddVolumeOutput("GRAD_VEL_ZY", "Grad_Vel_zy", "DEBUG", "Strain magnitude value"); - AddVolumeOutput("GRAD_VEL_ZZ", "Grad_Vel_zz", "DEBUG", "Strain magnitude value"); + AddVolumeOutput("GRAD_VEL_XZ", "Grad_Vel_xz", "VELOCITY_GRADIENT", "Z-Gradient of U"); + AddVolumeOutput("GRAD_VEL_YZ", "Grad_Vel_yz", "VELOCITY_GRADIENT", "Z-Gradient of V"); + AddVolumeOutput("GRAD_VEL_ZX", "Grad_Vel_zx", "VELOCITY_GRADIENT", "X-Gradient of W"); + AddVolumeOutput("GRAD_VEL_ZY", "Grad_Vel_zy", "VELOCITY_GRADIENT", "Y-Gradient of W"); + AddVolumeOutput("GRAD_VEL_ZZ", "Grad_Vel_zz", "VELOCITY_GRADIENT", "Z-Gradient of W"); } if (config->GetKind_Turb_Model() == TURB_MODEL::SST){ - AddVolumeOutput("CDkw", "CDkw", "DEBUG", "Cross-Diffusion term"); - AddVolumeOutput("F1", "F1", "DEBUG", "F1 blending function"); - AddVolumeOutput("F2", "F2", "DEBUG", "F2 blending function"); + AddVolumeOutput("CDkw", "CDkw", "SST_QUANTITIES", "Cross-Diffusion term"); + AddVolumeOutput("F1", "F1", "SST_QUANTITIES", "F1 blending function"); + AddVolumeOutput("F2", "F2", "SST_QUANTITIES", "F2 blending function"); } - if (config->GetKind_Turb_Model() != TURB_MODEL::NONE) - AddVolumeOutput("SRS_GRID_SIZE", "Srs_grid_size", "DDES", "desired grid size for Scale Resolving Simulations"); - } // Timestep info @@ -1554,6 +1553,7 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con } SetVolumeOutputValue("Q_CRITERION", iPoint, GetQCriterion(VelGrad)); SetVolumeOutputValue("WALL_DISTANCE", iPoint, Node_Geo->GetWall_Distance(iPoint)); + SetVolumeOutputValue("GRAD_VEL_XX", iPoint, VelGrad(0,0)); SetVolumeOutputValue("GRAD_VEL_XY", iPoint, VelGrad(0,1)); SetVolumeOutputValue("GRAD_VEL_YX", iPoint, VelGrad(1,0)); @@ -1572,9 +1572,6 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con SetVolumeOutputValue("F2", iPoint, Node_Turb->GetF2blending(iPoint)); } - if (config->GetKind_Turb_Model() != TURB_MODEL::NONE) - SetVolumeOutputValue("SRS_GRID_SIZE", iPoint, Node_Turb->GetSRSGridSize(iPoint)); - } const bool limiter = (config->GetKind_SlopeLimit_Turb() != LIMITER::NONE); @@ -1634,6 +1631,13 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con const su2double mu = Node_Flow->GetLaminarViscosity(iPoint); const su2double LESIQ = 1.0/(1.0+0.05*pow((mut+mu)/mu, 0.53)); SetVolumeOutputValue("LESIQ", iPoint, LESIQ); + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) { + const su2double betaStar = 0.09; // constants[6] + const su2double RANSLength = sqrt(Node_Flow->GetSolution(iPoint, 0)) / max(1e-20, (betaStar * Node_Flow->GetSolution(iPoint, 1))); + const su2double RatioL = 0.1; // TODO:: it should be less or equal than 0.2 - 0.1. Should be taken as input from config? + const su2double SRSGridSize = RANSLength * RatioL; + SetVolumeOutputValue("SRS_GRID_SIZE", iPoint, SRSGridSize); + } } switch (config->GetKind_Species_Model()) { diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 531ab8578fda..4173c53c96ab 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -282,12 +282,6 @@ void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai nodes->SetmuT(iPoint, muT); - // Now compute desired cell size for Scale Resolving Simulations - const su2double RANSLength = sqrt(nodes->GetSolution(iPoint, 0)) / max(1e-20, (constants[6] * nodes->GetSolution(iPoint, 1))); - const su2double RatioL = 0.1; // it should be less or equal than 0.2 - 0.1. Should be taken as input from config? - const su2double SRSGridSize = RANSLength * RatioL; - nodes->SetSRSGridSize(iPoint, SRSGridSize); - } END_SU2_OMP_FOR diff --git a/SU2_CFD/src/variables/CTurbVariable.cpp b/SU2_CFD/src/variables/CTurbVariable.cpp index 014948a05443..171ec8a7ec35 100644 --- a/SU2_CFD/src/variables/CTurbVariable.cpp +++ b/SU2_CFD/src/variables/CTurbVariable.cpp @@ -37,7 +37,6 @@ CTurbVariable::CTurbVariable(unsigned long npoint, unsigned long ndim, unsigned intermittency.resize(nPoint) = su2double(1.0); DES_LengthScale.resize(nPoint) = su2double(0.0); - SRSGridSize.resize(nPoint) = su2double(0.0); Vortex_Tilting.resize(nPoint); From 7e57afe773c22d2a6b6b5bf38edc5fcc039da32b Mon Sep 17 00:00:00 2001 From: rois1995 Date: Fri, 3 Oct 2025 11:24:23 +0200 Subject: [PATCH 54/56] - Fixed some notation - Remove unused variables --- SU2_CFD/include/numerics/turbulent/turb_sources.hpp | 6 +++--- SU2_CFD/include/variables/CTurbSAVariable.hpp | 2 -- SU2_CFD/include/variables/CTurbSSTVariable.hpp | 2 -- SU2_CFD/include/variables/CTurbVariable.hpp | 6 +++--- SU2_CFD/src/solvers/CSolver.cpp | 4 ++-- SU2_CFD/src/solvers/CTurbSASolver.cpp | 3 +-- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 4 +++- SU2_CFD/src/variables/CTurbSAVariable.cpp | 4 ---- SU2_CFD/src/variables/CTurbSSTVariable.cpp | 1 - 9 files changed, 12 insertions(+), 20 deletions(-) diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index 33556a81482f..afadc4bd1282 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -642,7 +642,6 @@ class CSourcePieceWise_TurbSST final : public CNumerics { /*--- 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; const su2double prod_lim_const; - const su2double cTrans; /*--- Ambient values for SST-SUST. ---*/ const su2double kAmb, omegaAmb; @@ -727,7 +726,6 @@ class CSourcePieceWise_TurbSST final : public CNumerics { alfa_1(constants[8]), alfa_2(constants[9]), prod_lim_const(constants[10]), - cTrans(1.25), kAmb(val_kine_Inf), omegaAmb(val_omega_Inf) { /*--- "Allocate" the Jacobian using the static buffer. ---*/ @@ -909,6 +907,9 @@ class CSourcePieceWise_TurbSST final : public CNumerics { Residual[0] += pk * Volume; Residual[1] += pw * Volume; + + /*--- Add the dissipation terms to the residuals.---*/ + Residual[0] -= dk * Volume; Residual[1] -= dw * Volume; @@ -931,5 +932,4 @@ class CSourcePieceWise_TurbSST final : public CNumerics { return ResidualType<>(Residual, Jacobian_i, nullptr); } - }; diff --git a/SU2_CFD/include/variables/CTurbSAVariable.hpp b/SU2_CFD/include/variables/CTurbSAVariable.hpp index b4b6ab554237..6a533d4fb28b 100644 --- a/SU2_CFD/include/variables/CTurbSAVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSAVariable.hpp @@ -40,8 +40,6 @@ class CTurbSAVariable final : public CTurbVariable { private: - VectorType k, Omega; /*!< \brief SST variables as computed through SA solution. */ - public: /*! * \brief Constructor of the class. diff --git a/SU2_CFD/include/variables/CTurbSSTVariable.hpp b/SU2_CFD/include/variables/CTurbSSTVariable.hpp index aeb288bcef88..214cfbd06a13 100644 --- a/SU2_CFD/include/variables/CTurbSSTVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSSTVariable.hpp @@ -45,7 +45,6 @@ class CTurbSSTVariable final : public CTurbVariable { VectorType F2; /*!< \brief Menter blending function for blending of k-w and k-eps. */ VectorType CDkw; /*!< \brief Cross-diffusion. */ SST_ParsedOptions sstParsedOptions; - public: /*! * \brief Constructor of the class. @@ -88,5 +87,4 @@ class CTurbSSTVariable final : public CTurbVariable { * \brief Get the value of the cross diffusion of tke and omega. */ inline su2double GetCrossDiff(unsigned long iPoint) const override { return CDkw(iPoint); } - }; diff --git a/SU2_CFD/include/variables/CTurbVariable.hpp b/SU2_CFD/include/variables/CTurbVariable.hpp index 742405941e06..2bb514786223 100644 --- a/SU2_CFD/include/variables/CTurbVariable.hpp +++ b/SU2_CFD/include/variables/CTurbVariable.hpp @@ -37,14 +37,14 @@ */ class CTurbVariable : public CScalarVariable { protected: - VectorType muT; /*!< \brief Eddy viscosity. */ - VectorType DES_LengthScale; + VectorType muT; /*!< \brief Eddy viscosity. */ + VectorType DES_LengthScale; /*!< \brief DES Length scale. */ public: static constexpr size_t MAXNVAR = 2; VectorType turb_index; /*!< \brief Value of the turbulence index for transition simulations. */ VectorType intermittency; /*!< \brief Value of the intermittency for the transition model. */ - VectorType Vortex_Tilting; + VectorType Vortex_Tilting; /*!< \brief Value of the vortex tilting measure for EDDES models. */ /*! * \brief Constructor of the class. diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index 56ea623fc4b0..1490b1ebb042 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -363,7 +363,6 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, auto *Diff = new su2double[nVar]; auto *Und_Lapl = new su2double[nVar]; - auto *Vel_Lapl = new su2double[nDim]; auto *Sol_Min = new su2double[nPrimVarGrad]; auto *Sol_Max = new su2double[nPrimVarGrad]; auto *rotPrim_i = new su2double[nPrimVar]; @@ -969,6 +968,7 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, } break; + default: SU2_MPI::Error("Unrecognized quantity for periodic communication.", CURRENT_FUNCTION); @@ -986,7 +986,6 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, delete [] Diff; delete [] Und_Lapl; - delete [] Vel_Lapl; delete [] Sol_Min; delete [] Sol_Max; delete [] rotPrim_i; @@ -1291,6 +1290,7 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, limiter(iPoint, iVar) = min(limiter(iPoint, iVar), bufDRecv[buf_offset+iVar]); break; + default: SU2_MPI::Error("Unrecognized quantity for periodic communication.", diff --git a/SU2_CFD/src/solvers/CTurbSASolver.cpp b/SU2_CFD/src/solvers/CTurbSASolver.cpp index 1164d793f992..689675422beb 100644 --- a/SU2_CFD/src/solvers/CTurbSASolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSASolver.cpp @@ -235,8 +235,7 @@ void CTurbSASolver::Postprocessing(CGeometry *geometry, CSolver **solver_contain const su2double nu = mu/rho; const su2double nu_hat = nodes->GetSolution(iPoint,0); const su2double roughness = geometry->nodes->GetRoughnessHeight(iPoint); - const su2double wallDistance = geometry->nodes->GetWall_Distance(iPoint); - const su2double dist = wallDistance + rough_const * roughness; + const su2double dist = geometry->nodes->GetWall_Distance(iPoint) + rough_const * roughness; su2double Ji = nu_hat/nu; if (roughness > 1.0e-10) diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 4173c53c96ab..89f3b4936919 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -278,7 +278,7 @@ void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai const su2double omega = nodes->GetSolution(iPoint,1); const auto& eddy_visc_var = sstParsedOptions.version == SST_OPTIONS::V1994 ? VorticityMag : StrainMag; - su2double muT = max(0.0, rho * a1 * kine / max(a1 * omega, eddy_visc_var * F2)); + const su2double muT = max(0.0, rho * a1 * kine / max(a1 * omega, eddy_visc_var * F2)); nodes->SetmuT(iPoint, muT); @@ -409,9 +409,11 @@ void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta } /*--- Compute the source term ---*/ + auto residual = numerics->ComputeResidual(config); /*--- Store the intermittency ---*/ + if (config->GetKind_Trans_Model() != TURB_TRANS_MODEL::NONE) { nodes->SetIntermittency(iPoint, numerics->GetIntermittencyEff()); } diff --git a/SU2_CFD/src/variables/CTurbSAVariable.cpp b/SU2_CFD/src/variables/CTurbSAVariable.cpp index bba34f6c2926..a9227af91400 100644 --- a/SU2_CFD/src/variables/CTurbSAVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSAVariable.cpp @@ -45,8 +45,4 @@ CTurbSAVariable::CTurbSAVariable(su2double val_nu_tilde, su2double val_muT, unsi Solution_time_n = Solution; Solution_time_n1 = Solution; } - - - k.resize(nPoint) = su2double(0.0); - Omega.resize(nPoint) = su2double(0.0); } \ No newline at end of file diff --git a/SU2_CFD/src/variables/CTurbSSTVariable.cpp b/SU2_CFD/src/variables/CTurbSSTVariable.cpp index f503ee72f8d8..e416ae75618f 100644 --- a/SU2_CFD/src/variables/CTurbSSTVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSSTVariable.cpp @@ -51,7 +51,6 @@ CTurbSSTVariable::CTurbSSTVariable(su2double kine, su2double omega, su2double mu CDkw.resize(nPoint) = su2double(0.0); muT.resize(nPoint) = mut; - } void CTurbSSTVariable::SetBlendingFunc(unsigned long iPoint, su2double val_viscosity, From f193796cf32d430a54d7a0e5bcfc105daa0a9a7e Mon Sep 17 00:00:00 2001 From: rois1995 Date: Thu, 30 Oct 2025 10:58:44 +0100 Subject: [PATCH 55/56] - Added SST-EDDES formulation for unstructured grids --- Common/include/option_structure.hpp | 4 +- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 65 +++++++++++++++++++++++++- 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index b7cbd85161ff..9124405da691 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -1480,7 +1480,8 @@ enum ENUM_HYBRIDRANSLES { SST_DDES = 6, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): DDES). */ SST_IDDES = 7, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Improved DDES). */ SST_SIDDES = 8, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Simplified Improved DDES). */ - SST_EDDES = 9 /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Enhanced (SLA) DDES). */ + SST_EDDES = 9, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Enhanced (SLA) DDES). */ + SST_EDDES_UNSTR = 10 /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Enhanced (SLA) DDES). */ }; static const MapType HybridRANSLES_Map = { MakePair("NONE", NO_HYBRIDRANSLES) @@ -1493,6 +1494,7 @@ static const MapType HybridRANSLES_Map = { MakePair("SST_IDDES", SST_IDDES) MakePair("SST_SIDDES", SST_SIDDES) MakePair("SST_EDDES", SST_EDDES) + MakePair("SST_EDDES_UNSTR", SST_EDDES_UNSTR) }; /*! diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 89f3b4936919..ac44bf84e6ed 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -208,7 +208,7 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain /*--- Set the vortex tilting coefficient at every node if required ---*/ - if (kind_hybridRANSLES == SST_EDDES){ + if (kind_hybridRANSLES == SST_EDDES || kind_hybridRANSLES == SST_EDDES_UNSTR){ auto* flowNodes = su2staticcast_p(solver_container[FLOW_SOL]->GetNodes()); SU2_OMP_FOR_STAT(omp_chunk_size) @@ -1076,6 +1076,9 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C SU2_OMP_FOR_STAT(omp_chunk_size) for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++){ + const auto coord_i = geometry->nodes->GetCoord(iPoint); + const auto nNeigh = geometry->nodes->GetnPoint(iPoint); + const su2double StrainMag = max(flowNodes->GetStrainMag(iPoint), 1e-12); const auto Vorticity = flowNodes->GetVorticity(iPoint); const su2double VortMag = max(GeometryToolbox::Norm(3, Vorticity), 1e-12); @@ -1176,6 +1179,66 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C su2double vortexTiltingMeasure = nodes->GetVortex_Tilting(iPoint); + const su2double omega = GeometryToolbox::Norm(3, Vorticity); + + su2double ratioOmega[MAXNDIM] = {}; + + for (auto iDim = 0u; iDim < MAXNDIM; iDim++){ + ratioOmega[iDim] = Vorticity[iDim]/omega; + } + + const su2double deltaDDES = geometry->nodes->GetMaxLength(iPoint); + + su2double ln_max = 0.0; + for (const auto jPoint : geometry->nodes->GetPoints(iPoint)) { + const auto coord_j = geometry->nodes->GetCoord(jPoint); + su2double delta[MAXNDIM] = {}; + for (auto iDim = 0u; iDim < nDim; iDim++){ + delta[iDim] = fabs(coord_j[iDim] - coord_i[iDim]); + } + su2double ln[3]; + ln[0] = delta[1]*ratioOmega[2] - delta[2]*ratioOmega[1]; + ln[1] = delta[2]*ratioOmega[0] - delta[0]*ratioOmega[2]; + ln[2] = delta[0]*ratioOmega[1] - delta[1]*ratioOmega[0]; + const su2double aux_ln = sqrt(ln[0]*ln[0] + ln[1]*ln[1] + ln[2]*ln[2]); + ln_max = max(ln_max, aux_ln); + vortexTiltingMeasure += nodes->GetVortex_Tilting(jPoint); + } + vortexTiltingMeasure /= (nNeigh + 1); + + + + const su2double f_kh = max(f_min, + min(f_max, + f_min + ((f_max - f_min)/(a2 - a1)) * (vortexTiltingMeasure - a1))); + + const su2double r_d = (eddyVisc + lamVisc) / max((KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))), 1e-10); + const su2double C_d1 = 20.0; + const su2double C_d2 = 3.0; + + const su2double f_d = 1 - tanh(pow(C_d1 * r_d, C_d2)); + + su2double delta = (ln_max/sqrt(3.0)) * f_kh; + if (f_d < 0.99){ + delta = h_max; + } + + const su2double l_LES = C_DES * delta; + DES_lengthScale = l_RANS - f_d * max(0.0, l_RANS - l_LES); + } + case SST_EDDES_UNSTR: { + + // Improved DDES version with the Shear-Layer-Adapted augmentation + // found in Detached Eddy Simulation: Recent Development and Application to Compressor Tip Leakage Flow, Xiao He, Fanzhou Zhao, Mehdi Vahdati + // originally from Application of SST-Based SLA-DDES Formulation to Turbomachinery Flows, Guoping Xia, Zifei Yin and Gorazd Medic + // I could be naming it either as SST_EDDES to follow the same notation as for the SA model or as SST_SLA_DDES to follow the paper notation + + const su2double f_max = 1.0, f_min = 0.1, a1 = 0.15, a2 = 0.3; + + const auto nNeigh = geometry->nodes->GetnPoint(iPoint); + + su2double vortexTiltingMeasure = nodes->GetVortex_Tilting(iPoint); + su2double deltaOmega = -1.0; su2double vorticityDir[MAXNDIM] = {}; From 3460d509b2c657e84d80ba7e503b495e4f276feb Mon Sep 17 00:00:00 2001 From: rois1995 Date: Thu, 13 Nov 2025 12:08:09 +0100 Subject: [PATCH 56/56] - Removed unused variables --- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index ac44bf84e6ed..03e2e012d3ca 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -1175,8 +1175,6 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C const su2double f_max = 1.0, f_min = 0.1, a1 = 0.15, a2 = 0.3; - const auto nNeigh = geometry->nodes->GetnPoint(iPoint); - su2double vortexTiltingMeasure = nodes->GetVortex_Tilting(iPoint); const su2double omega = GeometryToolbox::Norm(3, Vorticity); @@ -1234,9 +1232,7 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C // I could be naming it either as SST_EDDES to follow the same notation as for the SA model or as SST_SLA_DDES to follow the paper notation const su2double f_max = 1.0, f_min = 0.1, a1 = 0.15, a2 = 0.3; - - const auto nNeigh = geometry->nodes->GetnPoint(iPoint); - + su2double vortexTiltingMeasure = nodes->GetVortex_Tilting(iPoint); su2double deltaOmega = -1.0;