diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index 852e1ce04d73..e74e70da0c08 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -9846,6 +9846,11 @@ class CConfig { */ unsigned short GetKind_HybridRANSLES(void) const { return Kind_HybridRANSLES; } + bool IsHybridSST() const { + return Kind_HybridRANSLES == SST_DDES || Kind_HybridRANSLES == SST_IDDES || + Kind_HybridRANSLES == SST_SIDDES || Kind_HybridRANSLES == SST_EDDES; + } + /*! * \brief Get if the LES mode must be enforced. * \return TRUE if LES is enforced. diff --git a/Common/include/geometry/dual_grid/CPoint.hpp b/Common/include/geometry/dual_grid/CPoint.hpp index 4b96b1d4cec3..c836d0d555f1 100644 --- a/Common/include/geometry/dual_grid/CPoint.hpp +++ b/Common/include/geometry/dual_grid/CPoint.hpp @@ -99,6 +99,7 @@ class CPoint { su2vector nNeighbor; /*!< \brief Number of neighbors, needed by some numerical methods. */ /*--- Closest element on a viscous wall, and distance to it. ---*/ + su2activematrix WallNormal; /*!< \brief Unit normal of the nearest wall element. */ su2activevector Wall_Distance; /*!< \brief Distance to the nearest wall. */ su2vector ClosestWall_Rank; /*!< \brief Rank of process holding the closest wall element. */ su2vector ClosestWall_Zone; /*!< \brief Zone index of closest wall element. */ @@ -887,6 +888,23 @@ class CPoint { } } + /*! \brief Gather the nearest wall-element normal for each point. */ + template + void SetWallNormals(const NormalsType& normals) { + WallNormal.resize(GlobalIndex.size(), nDim) = su2double(0.0); + for (unsigned long iPoint = 0; iPoint < GlobalIndex.size(); ++iPoint) { + const auto rank = ClosestWall_Rank[iPoint]; + if (rank < 0) continue; + const auto& normal = + normals[rank][ClosestWall_Zone[iPoint]][ClosestWall_Marker[iPoint]][ClosestWall_Elem[iPoint]]; + for (auto iDim = 0u; iDim < nDim; ++iDim) WallNormal(iPoint, iDim) = normal[iDim]; + } + } + + inline const su2double* GetWallNormal(unsigned long iPoint) const { + return WallNormal.empty() ? nullptr : WallNormal[iPoint]; + } + /*! * \brief Set wall roughnesses according to stored closest wall information. * \param[in] roughness - Mapping [rank][zone][marker] -> roughness diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 3d548ae6a583..e6d3ecfdce12 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -1702,10 +1702,14 @@ 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). */ + 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). */ }; static const MapType HybridRANSLES_Map = { MakePair("NONE", NO_HYBRIDRANSLES) @@ -1713,6 +1717,10 @@ 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) + MakePair("SST_EDDES", SST_EDDES) }; /*! diff --git a/Common/include/toolboxes/geometry_toolbox.hpp b/Common/include/toolboxes/geometry_toolbox.hpp index fb31b4a99bea..b296f5300480 100644 --- a/Common/include/toolboxes/geometry_toolbox.hpp +++ b/Common/include/toolboxes/geometry_toolbox.hpp @@ -60,6 +60,51 @@ inline void PointPointReflect(Int nDim, const T* a, const T* b, T* d) { for (Int i = 0; i < nDim; i++) d[i] = 2 * b[i] - a[i]; } +/*! + * \brief Compute the mean rate of strain matrix. + * \details The parameter primvargrad can be e.g. PrimVar_Grad_i or Mean_GradPrimVar. + * \param[in] nDim - 2 or 3 + * \param[out] rateofstrain - Rate of strain matrix + * \param[in] velgrad - A velocity gradient matrix. + * \tparam Mat1 - any type that supports the [][] interface + * \tparam Mat2 - any type that supports the [][] interface + */ +template +inline void ComputeMeanRateOfStrainMatrix(size_t nDim, Mat1& rateofstrain, const Mat2& velgrad) { + /* --- Calculate the rate of strain tensor, using mean velocity gradients --- */ + + if (nDim == 3) { + rateofstrain[0][0] = velgrad[0][0]; + rateofstrain[1][1] = velgrad[1][1]; + rateofstrain[2][2] = velgrad[2][2]; + rateofstrain[0][1] = 0.5 * (velgrad[0][1] + velgrad[1][0]); + rateofstrain[0][2] = 0.5 * (velgrad[0][2] + velgrad[2][0]); + rateofstrain[1][2] = 0.5 * (velgrad[1][2] + velgrad[2][1]); + rateofstrain[1][0] = rateofstrain[0][1]; + rateofstrain[2][1] = rateofstrain[1][2]; + rateofstrain[2][0] = rateofstrain[0][2]; + } else { // nDim==2 + rateofstrain[0][0] = velgrad[0][0]; + rateofstrain[1][1] = velgrad[1][1]; + rateofstrain[2][2] = 0.0; + rateofstrain[0][1] = 0.5 * (velgrad[0][1] + velgrad[1][0]); + rateofstrain[0][2] = 0.0; + rateofstrain[1][2] = 0.0; + rateofstrain[1][0] = rateofstrain[0][1]; + rateofstrain[2][1] = rateofstrain[1][2]; + rateofstrain[2][0] = rateofstrain[0][2]; + } +} + +/*! \brief Magnitude of an edge projected onto a unit wall normal. */ +template +inline T WallNormalEdgeLength(Int nDim, const T* a, const T* b, const T* normal) { + T projection(0); + for (Int i = 0; i < nDim; ++i) projection += (b[i] - a[i]) * normal[i]; + using std::abs; + return abs(projection); +} + /*! \return a.b */ template inline T DotProduct(Int nDim, const T* a, const T* b) { diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 690e8d809f59..ef9d7296bcc4 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -3127,7 +3127,7 @@ void CConfig::SetConfig_Options() { /* DESCRIPTION: Window (weight) function for the cost-functional in the reverse sweep */ addEnumOption("WINDOW_FUNCTION", Kind_WindowFct, Window_Map, WINDOW_FUNCTION::SQUARE); - /* DESCRIPTION: DES Constant */ + /* DESCRIPTION: DES Constant of the SA hybrid models. The SST hybrid models blend their own constants with F1. */ addDoubleOption("DES_CONST", Const_DES, 0.65); /* DESCRIPTION: SBS lengthscale coefficient */ @@ -3148,7 +3148,7 @@ void CConfig::SetConfig_Options() { /* DESCRIPTION: Specify if the Stochastic Backscatter Model must be activated */ addBoolOption("STOCHASTIC_BACKSCATTER", SBSParam.StochasticBackscatter, false); - /* DESCRIPTION: Specify if the LES mode must be enforced */ + /* DESCRIPTION: Specify if the LES mode must be enforced (SA hybrid models only) */ addBoolOption("ENFORCE_LES", enforceLES, false); /* DESCRIPTION: Specify if the stochastic source term must be included in the turbulence model equation */ @@ -3169,7 +3169,7 @@ void CConfig::SetConfig_Options() { /* DESCRIPTION: Shielding function lower threshold for application of Stochastic Backscatter Model */ addDoubleOption("SBS_FD_LOWER_THRESHOLD", SBSParam.stochFdThreshold, 0.9); - /* DESCRIPTION: Filter width for LES (if negative, it is computed based on the local cell size) */ + /* DESCRIPTION: Filter width for LES (if negative, it is computed based on the local cell size, SA hybrid models only) */ addDoubleOption("LES_FILTER_WIDTH", LES_FilterWidth, -1.0); /* DESCRIPTION: Roe with low dissipation for unsteady flows */ @@ -4173,6 +4173,59 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i "TIME_STEPPING, DUAL_TIME_STEPPING-1ST_ORDER or DUAL_TIME_STEPPING-2ND_ORDER", CURRENT_FUNCTION); } + if (Kind_SU2 == SU2_COMPONENT::SU2_CFD && Kind_HybridRANSLES != NO_HYBRIDRANSLES && !Time_Domain) { + SU2_MPI::Error("Hybrid RANS/LES models (HYBRID_RANSLES) require an unsteady simulation, set TIME_DOMAIN= YES.", + CURRENT_FUNCTION); + } + + /*--- The SA_* hybrid models are built on the SA model and the SST_* ones on the SST model. ---*/ + const bool hybridSA = Kind_HybridRANSLES == SA_DES || Kind_HybridRANSLES == SA_DDES || + Kind_HybridRANSLES == SA_ZDES || Kind_HybridRANSLES == SA_EDDES; + const bool hybridSST = IsHybridSST(); + if ((hybridSA && Kind_Turb_Model != TURB_MODEL::SA) || (hybridSST && Kind_Turb_Model != TURB_MODEL::SST)) { + SU2_MPI::Error(string("The hybrid RANS/LES model (HYBRID_RANSLES) must match the turbulence model (KIND_TURB_MODEL): ") + + "SA_* options require SA, SST_* options require SST.", CURRENT_FUNCTION); + } + + /*--- The stochastic backscatter model adds the Langevin equations to the SA model (turbulence variables 1 to 3). ---*/ + if (SBSParam.StochasticBackscatter && hybridSST) { + SU2_MPI::Error(string("The stochastic backscatter model (STOCHASTIC_BACKSCATTER= YES) is only available with the SA ") + + "hybrid RANS/LES models (HYBRID_RANSLES= SA_DES, SA_DDES, SA_ZDES or SA_EDDES).", CURRENT_FUNCTION); + } + + /*--- How the SST compressibility corrections should act in the LES region of the hybrid models is not validated yet + (e.g. Forsythe et al. 2002 keep them only in the RANS length scale). Stop rather than give unvalidated results. ---*/ + if (hybridSST && (sstParsedOptions.compWilcox || sstParsedOptions.compSarkar)) { + SU2_MPI::Error(string("The SST compressibility corrections (COMPRESSIBILITY-WILCOX, COMPRESSIBILITY-SARKAR) are not ") + + "supported yet with the SST hybrid RANS/LES models (HYBRID_RANSLES= SST_*).", CURRENT_FUNCTION); + } + + /*--- The transition models were calibrated for RANS. With a hybrid model the intermittency also scales the + turbulence destruction in the LES region, which is not validated. ---*/ + if (Kind_HybridRANSLES != NO_HYBRIDRANSLES && Kind_Trans_Model != TURB_TRANS_MODEL::NONE && rank == MASTER_NODE) { + cout << "WARNING: The transition model (KIND_TRANS_MODEL) is not validated with hybrid RANS/LES models\n" + "(HYBRID_RANSLES). The intermittency also scales the turbulence destruction in the LES region." << endl; + } + + /*--- The SST hybrid models compute their length scale from the grid with the constant C_DES = 0.78 F1 + 0.61 (1 - F1) + (Gritskevich et al. 2012), they do not use these options of the SA hybrid models. ---*/ + if (hybridSST) { + if (enforceLES) { + SU2_MPI::Error("ENFORCE_LES= YES is only available with the SA hybrid RANS/LES models (HYBRID_RANSLES= SA_*).", + CURRENT_FUNCTION); + } + if (LES_FilterWidth > 0.0) { + SU2_MPI::Error(string("A user-specified LES_FILTER_WIDTH is only available with the SA hybrid RANS/LES models ") + + "(HYBRID_RANSLES= SA_*). The SST hybrid models compute the filter width from the grid.", CURRENT_FUNCTION); + } + if (OptionIsSet("DES_CONST")) { + if (rank == MASTER_NODE) { + cout << "WARNING: DES_CONST is ignored by SST hybrid RANS/LES models, which use " + "C_DES = 0.78 F1 + 0.61 (1 - F1)." << endl; + } + } + } + if (Time_Domain){ Delta_UnstTime = Time_Step; @@ -6918,13 +6971,21 @@ 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 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 SST_EDDES: cout << "Delayed Detached Eddy Simulation (DDES) with Shear-layer Adapted SGS" << endl; break; } if (Kind_HybridRANSLES != NO_HYBRIDRANSLES) { if (LES_FilterWidth > 0.0) cout << "User-specified LES filter width: " << LES_FilterWidth << endl; + if (IsHybridSST()) + cout << "DES constant blended with F1: C_DES = 0.78 F1 + 0.61 (1 - F1)." << endl; + else + cout << "DES constant: " << Const_DES << endl; cout << "Stochastic Backscatter: "; if (SBSParam.StochasticBackscatter) { cout << "ON" << endl; diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp index 65ccbbc5d11a..64a44728c75f 100644 --- a/Common/src/geometry/CGeometry.cpp +++ b/Common/src/geometry/CGeometry.cpp @@ -4542,6 +4542,56 @@ su2double NearestNeighborDistance(CGeometry* geometry, const CConfig* config, co const su2double Vol = geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint); return 2 * Vol / GeometryToolbox::Norm(3, Normal); } +/*! \brief Average the vertex normals of a wall element and normalize the result. + * With active = false the vertex normals are read as passive values. */ +std::array WallElementNormal(const CGeometry* geometry, unsigned short iMarker, unsigned long iElem, + bool active) { + std::array normal = {}; + const auto* element = geometry->bound[iMarker][iElem]; + for (auto iNode = 0u; iNode < element->GetnNodes(); ++iNode) { + const auto iPoint = element->GetNode(iNode); + const auto iVertex = geometry->nodes->GetVertex(iPoint, iMarker); + for (auto iDim = 0u; iDim < geometry->GetnDim(); ++iDim) { + const su2double component = geometry->vertex[iMarker][iVertex]->GetNormal(iDim); + normal[iDim] += active ? component : su2double(SU2_TYPE::GetValue(component)); + } + } + for (auto& component : normal) component /= element->GetnNodes(); + const auto magnitude = GeometryToolbox::Norm(3, normal.data()); + if (magnitude > 0.0) + for (auto& component : normal) component /= magnitude; + return normal; +} + +/*! \brief Collect unit wall-element normals for each marker of one zone. */ +su2vector> CollectWallNormals(const CGeometry* geometry, const CConfig* config, bool active) { + su2vector> normals; + normals.resize(geometry->GetnMarker()); + for (auto iMarker = 0u; iMarker < geometry->GetnMarker(); ++iMarker) { + if (!config->GetViscous_Wall(iMarker)) { + normals[iMarker].resize(1, 3) = su2double(0.0); + continue; + } + normals[iMarker].resize(geometry->GetnElem_Bound(iMarker), 3); + for (auto iElem = 0ul; iElem < geometry->GetnElem_Bound(iMarker); ++iElem) { + const auto normal = WallElementNormal(geometry, iMarker, iElem, active); + for (auto iDim = 0u; iDim < 3; ++iDim) normals[iMarker](iElem, iDim) = normal[iDim]; + } + } + return normals; +} + +/*! \brief Adapt one marker's normal matrix to the recursive NdFlattener interface. */ +auto WallNormalMatrix(const su2matrix& normals) { + return make_pair(normals.rows(), [&normals](auto iElem) { + return make_pair(normals.cols(), [&normals, iElem](auto iDim) { return normals(iElem, iDim); }); + }); +} + +/*! \brief Adapt a zone's marker normals without copying the matrices. */ +auto WallNormalMarkers(const su2vector>& normals) { + return make_pair(normals.size(), [&normals](auto iMarker) { return WallNormalMatrix(normals[iMarker]); }); +} /*--- Whether any equation system of a zone uses the WALL_DISTANCE slope limiter. ---*/ bool UsesWallDistanceLimiter(const CConfig* config) { @@ -4642,6 +4692,33 @@ void CGeometry::ComputeWallDistance(const CConfig* const* config_container, CGeo } } + /*--- IDDES needs the normal of the nearest wall, including walls on other ranks and zones. ---*/ + bool needWallNormals = false; + for (int iZone = 0; iZone < nZone; ++iZone) { + const auto hybrid = config_container[iZone]->GetKind_HybridRANSLES(); + needWallNormals = needWallNormals || hybrid == SST_IDDES || hybrid == SST_SIDDES; + } + if (needWallNormals) { + /*--- When recording for a specific zone, the normals of other zones are passive (all zones are still + * gathered to keep the indexing) and only that zone is updated, to avoid cross-zone AD dependencies. ---*/ + su2vector>> wallNormals; + wallNormals.resize(nZone); + for (int iZone = 0; iZone < nZone; ++iZone) { + const bool active = record_zone < 0 || iZone == record_zone; + wallNormals[iZone] = + CollectWallNormals(geometry_container[iZone][iInst][MESH_0], config_container[iZone], active); + } + auto normal_i = make_pair(nZone, [&wallNormals](auto iZone) { return WallNormalMarkers(wallNormals[iZone]); }); + NdFlattener<4> localNormals(normal_i); + NdFlattener<5> globalNormals(Nd_MPI_Environment(), localNormals); + for (int iZone = 0; iZone < nZone; ++iZone) { + if (record_zone >= 0 && iZone != record_zone) continue; + const auto hybrid = config_container[iZone]->GetKind_HybridRANSLES(); + if (hybrid == SST_IDDES || hybrid == SST_SIDDES) + geometry_container[iZone][iInst][MESH_0]->nodes->SetWallNormals(globalNormals); + } + } + for (int iZone = 0; iZone < nZone; iZone++) { /*--- When recording for a specific zone, only compute nearest-neighbor distances (which read vertex * normals) for that zone. Reading normals from other zones at this tape position would create diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index 1b22ed12a63d..8e6cb803ebab 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -142,6 +142,7 @@ 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 hybridLengthScale = 0.0; /*!< \brief Hybrid RANS/LES length scale. */ CMatrixView ConsVar_Grad_i, /*!< \brief Gradient of conservative variables at point i. */ ConsVar_Grad_j, /*!< \brief Gradient of conservative variables at point j. */ @@ -435,44 +436,6 @@ class CNumerics { TurbPsi_Grad_j = val_turbpsivar_grad_j; } - /*! - * \brief Compute the mean rate of strain matrix. - * \details The parameter primvargrad can be e.g. PrimVar_Grad_i or Mean_GradPrimVar. - * \param[in] nDim - 2 or 3 - * \param[out] rateofstrain - Rate of strain matrix - * \param[in] velgrad - A velocity gradient matrix. - * \tparam Mat1 - any type that supports the [][] interface - * \tparam Mat2 - any type that supports the [][] interface - */ - template - FORCEINLINE static void ComputeMeanRateOfStrainMatrix(size_t nDim, Mat1& rateofstrain, const Mat2& velgrad){ - - /* --- Calculate the rate of strain tensor, using mean velocity gradients --- */ - - if (nDim == 3) { - rateofstrain[0][0] = velgrad[0][0]; - rateofstrain[1][1] = velgrad[1][1]; - rateofstrain[2][2] = velgrad[2][2]; - rateofstrain[0][1] = 0.5 * (velgrad[0][1] + velgrad[1][0]); - rateofstrain[0][2] = 0.5 * (velgrad[0][2] + velgrad[2][0]); - rateofstrain[1][2] = 0.5 * (velgrad[1][2] + velgrad[2][1]); - rateofstrain[1][0] = rateofstrain[0][1]; - rateofstrain[2][1] = rateofstrain[1][2]; - rateofstrain[2][0] = rateofstrain[0][2]; - } - else { // nDim==2 - rateofstrain[0][0] = velgrad[0][0]; - rateofstrain[1][1] = velgrad[1][1]; - rateofstrain[2][2] = 0.0; - rateofstrain[0][1] = 0.5 * (velgrad[0][1] + velgrad[1][0]); - rateofstrain[0][2] = 0.0; - rateofstrain[1][2] = 0.0; - rateofstrain[1][0] = rateofstrain[0][1]; - rateofstrain[2][1] = rateofstrain[1][2]; - rateofstrain[2][0] = rateofstrain[0][2]; - } - } - /*! * \brief Compute the stress tensor from the velocity gradients. * \details To obtain the Reynolds stress tensor +(u_i' u_j')~, divide the result @@ -964,6 +927,9 @@ class CNumerics { dist_j = val_dist_j; } + /*! \brief Set the hybrid RANS/LES length scale for the source term. */ + void SetHybridLengthScale(su2double value) { hybridLengthScale = value; } + /*! * \brief Set the stochastic source term for the Langevin equations (Backscatter Model). * \param[in] val_stoch_source - Value of stochastic source term. diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index c6140d922ad9..893be502a788 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -883,6 +883,11 @@ class CSourcePieceWise_TurbSST final : public CNumerics { AD::SetPreaccIn(V_i[idx.Velocity() + 1]); AD::SetPreaccIn(V_i[idx.SoundSpeed()]); + /*--- The hybrid RANS/LES length scale depends on the flow and turbulence solution, it must be a preaccumulation + input or its sensitivities are lost in the discrete adjoint. ---*/ + const bool hybridRANSLES = config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES; + if (hybridRANSLES) AD::SetPreaccIn(hybridLengthScale); + Density_i = V_i[idx.Density()]; Laminar_Viscosity_i = V_i[idx.LaminarViscosity()]; Eddy_Viscosity_i = V_i[idx.EddyViscosity()]; @@ -997,6 +1002,9 @@ class CSourcePieceWise_TurbSST final : public CNumerics { /*--- Dissipation ---*/ su2double dk = beta_star * Density_i * ScalarVar_i[1] * ScalarVar_i[0] * (1.0 + zetaFMt); + if (hybridRANSLES) + dk = Density_i * ScalarVar_i[0] * sqrt(ScalarVar_i[0]) / hybridLengthScale; + su2double dw = beta_blended * Density_i * ScalarVar_i[1] * ScalarVar_i[1] * (1.0 - 0.09/beta_blended * zetaFMt); /*--- LM model coupling with production and dissipation term for k transport equation---*/ @@ -1021,6 +1029,16 @@ class CSourcePieceWise_TurbSST final : public CNumerics { 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); + if (hybridRANSLES) { + /*--- Hybrid k destruction dk = rho k^(3/2) / l_hyb, with the length scale l_hyb frozen (it is computed in the + preprocessing and treated as a constant here): d(dk)/d(rho k) = 1.5 dk / (rho k) and it does not depend on omega. + The RANS form above would use the wrong derivative where l_hyb differs from l_RANS = sqrt(k) / (beta* omega). ---*/ + Jacobian_i[0][0] = -1.5 * sqrt(ScalarVar_i[0]) / hybridLengthScale * Volume; + Jacobian_i[0][1] = 0.0; + /*--- Same LM scaling of dk as in the residual. ---*/ + if (config->GetKind_Trans_Model() == TURB_TRANS_MODEL::LM) + Jacobian_i[0][0] *= min(max(eff_intermittency, 0.1), 1.0); + } 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); diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index bb426fb321cd..70fe5ba5a989 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -307,7 +307,7 @@ class CEulerSolver : public CFVMFlowSolverBase { vector Inlet_TurbVars; /*!< \brief Turbulence variables at inlet profiles */ + /*! + * \brief Work space of ShearLayerAdaptedLengthScale. Declare one per thread outside the loop over points, so that + * its capacity is reused and no memory is allocated per point. + */ + struct ShearLayerWorkspace { + vector> projected; /*!< \brief Projected control volume vertices. */ + vector> faces; /*!< \brief Sorted nodes of the visited faces. */ + }; + + /*! + * \brief Shear-layer-adapted subgrid length-scale of the EDDES models, Delta_SLA = Delta_omega * F_KH(). + * \note Shur et al., An Enhanced Version of DES with Rapid Transition from RANS to LES in Separated Flows, + * Flow Turbulence Combust 95, 2015, Eqs. (1)-(6). Delta_omega is computed on the vertices of the median-dual + * control volume of the point, so it applies to any type of grid. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] iPoint - Point index. + * \param[in] vorticity - Vorticity vector at the point. + * \param[in] shielded - True in the RANS region (f_d < 0.99), where F_KH is set to 1 (Eq. 6). + * \param[in,out] workspace - Reusable work space of the calling thread. + * \return Delta_SLA, or the maximum edge length where the vorticity vanishes. + */ + su2double ShearLayerAdaptedLengthScale(const CGeometry* geometry, unsigned long iPoint, const su2double* vorticity, + bool shielded, ShearLayerWorkspace& workspace) const; + public: /*! * \brief Destructor of the class. diff --git a/SU2_CFD/include/variables/CTurbSAVariable.hpp b/SU2_CFD/include/variables/CTurbSAVariable.hpp index fcfe75ced82d..14bc63c311bd 100644 --- a/SU2_CFD/include/variables/CTurbSAVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSAVariable.hpp @@ -39,12 +39,9 @@ class CTurbSAVariable final : public CTurbVariable { private: - VectorType DES_LengthScale; - VectorType lesMode; su2vector sbsInBox; MatrixType stochSource; MatrixType stochSourceOld; - VectorType Vortex_Tilting; VectorType besselIntegral; public: @@ -65,19 +62,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 Get the source terms for the stochastic equations. * \param[in] iPoint - Point index. @@ -124,31 +108,6 @@ class CTurbSAVariable final : public CTurbVariable { */ inline void SetSbsInBox(unsigned long iPoint, int8_t val_sbsInBox) override { sbsInBox(iPoint) = val_sbsInBox; } - /*! - * \brief Set the LES sensor. - */ - inline void SetLES_Mode(unsigned long iPoint, su2double val_les_mode) override { lesMode(iPoint) = val_les_mode; } - - /*! - * \brief Get the LES sensor. - * \return Value of the LES sensor. - */ - inline su2double GetLES_Mode(unsigned long iPoint) const override { return lesMode(iPoint); } - - /*! - * \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); } - /*! * \brief Set the integral of the product of three Bessel functions appearing in Laplacian smoothing. * \param[in] iPoint - Point index. diff --git a/SU2_CFD/include/variables/CTurbVariable.hpp b/SU2_CFD/include/variables/CTurbVariable.hpp index 54caa199feec..f29a36e627fb 100644 --- a/SU2_CFD/include/variables/CTurbVariable.hpp +++ b/SU2_CFD/include/variables/CTurbVariable.hpp @@ -37,12 +37,15 @@ */ class CTurbVariable : public CScalarVariable { protected: - VectorType muT; /*!< \brief Eddy viscosity. */ + VectorType muT; /*!< \brief Eddy viscosity. */ + VectorType DES_LengthScale; /*!< \brief DES Length scale. */ + VectorType lesMode; /*!< \brief LES sensor of the hybrid RANS/LES models (only allocated for them). */ + VectorType Vortex_Tilting; /*!< \brief Vortex tilting measure for EDDES models. */ public: static constexpr size_t MAXNVAR = 4; - 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. */ /*! * \brief Constructor of the class. @@ -100,6 +103,47 @@ 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; } + + /*! + * \brief Set the LES sensor of the hybrid RANS/LES models. + * \param[in] iPoint - Point index. + * \param[in] val_les_mode - Value of the LES sensor. + */ + inline void SetLES_Mode(unsigned long iPoint, su2double val_les_mode) override { lesMode(iPoint) = val_les_mode; } + + /*! + * \brief Get the LES sensor of the hybrid RANS/LES models. + * \param[in] iPoint - Point index. + * \return Value of the LES sensor. + */ + inline su2double GetLES_Mode(unsigned long iPoint) const override { return lesMode(iPoint); } + + /*! + * \brief Set the vortex tilting measure for computation of the EDDES length scale + * \param[in] iPoint - Point index. + * \param[in] VelGrad - Velocity gradient, starting at the first velocity component. + */ + void SetVortex_Tilting(unsigned long iPoint, CMatrixView VelGrad, + 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); } /*! * \brief Set the Diffusion Coefficients of TKE and omega equations. * \param[in] iPoint - Point index. diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index 377a0c818881..a96c04f91582 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -2301,7 +2301,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, CMatrixView VelGrad, const su2double* Vorticity, su2double LaminarViscosity) {} inline virtual su2double GetVortex_Tilting(unsigned long iPoint) const { return 0.0; } diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index a391b8662581..cee936dfe4da 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1614,7 +1614,8 @@ 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"); - AddVolumeOutput("LES_SENSOR","LES_Sensor","DDES","LES sensor value"); + AddVolumeOutput("LESIQ", "LESIQ", "DDES", "Viscosity-based LES quality index"); + AddVolumeOutput("LES_SENSOR", "LES_Sensor", "DDES", "LES length-scale weight: 0 RANS, 1 LES, between 0 and 1 blended"); if (config->GetSBSParam().StochasticBackscatter) { AddVolumeOutput("STOCHSOURCE_X", "StochSource_x", "BACKSCATTER", "x-component of the stochastic source vector"); AddVolumeOutput("STOCHSOURCE_Y", "StochSource_y", "BACKSCATTER", "y-component of the stochastic source vector"); @@ -1657,6 +1658,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]); @@ -1664,7 +1666,7 @@ 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)); } const bool limiter = ((config->GetKind_SlopeLimit_Turb() != LIMITER::NONE && config->GetKind_SlopeLimit_Turb() != LIMITER::VAN_ALBADA_EDGE)); @@ -1720,6 +1722,9 @@ 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)); + const su2double mu = max(Node_Flow->GetLaminarViscosity(iPoint), 1e-20); + const su2double mut = Node_Flow->GetEddyViscosity(iPoint); + SetVolumeOutputValue("LESIQ", iPoint, 1.0 / (1.0 + 0.05 * pow((mut + mu) / mu, 0.53))); SetVolumeOutputValue("LES_SENSOR", iPoint, Node_Flow->GetLES_Mode(iPoint)); if (config->GetSBSParam().StochasticBackscatter) { if (config->GetSBSParam().SBS_Ctau > 0.0) { diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index 580b6f970b99..2abe4c17e6f6 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -1619,7 +1619,7 @@ void CEulerSolver::CommonPreprocessing(CGeometry *geometry, CSolver **solver_con /*--- Roe Low Dissipation Sensor ---*/ if (roe_low_dissipation) { - SetRoe_Dissipation(geometry, config); + SetRoe_Dissipation(geometry, config, solver_container); if (kind_row_dissipation == FD_DUCROS || kind_row_dissipation == NTS_DUCROS){ SetUpwind_Ducros_Sensor(geometry, config); } diff --git a/SU2_CFD/src/solvers/CNSSolver.cpp b/SU2_CFD/src/solvers/CNSSolver.cpp index 4cac41af8f00..d25f050064f8 100644 --- a/SU2_CFD/src/solvers/CNSSolver.cpp +++ b/SU2_CFD/src/solvers/CNSSolver.cpp @@ -301,7 +301,7 @@ void CNSSolver::Evaluate_ObjFunc(const CConfig *config, CSolver**) { } -void CNSSolver::SetRoe_Dissipation(CGeometry *geometry, CConfig *config){ +void CNSSolver::SetRoe_Dissipation(CGeometry *geometry, CConfig *config, CSolver** solver_container){ SU2_ZONE_SCOPED const unsigned short kind_roe_dissipation = config->GetKind_RoeLowDiss(); @@ -319,7 +319,12 @@ void CNSSolver::SetRoe_Dissipation(CGeometry *geometry, CConfig *config){ const su2double delta = geometry->nodes->GetMaxLength(iPoint); assert(delta > 0 && "Delta must be initialized and non-negative"); - nodes->SetRoe_Dissipation_NTS(iPoint, delta, config->GetConst_DES()); + su2double cDES = config->GetConst_DES(); + if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES && config->GetKind_Turb_Model() == TURB_MODEL::SST) { + const auto f1 = solver_container[TURB_SOL]->GetNodes()->GetF1blending(iPoint); + cDES = 0.78 * f1 + 0.61 * (1.0 - f1); + } + nodes->SetRoe_Dissipation_NTS(iPoint, delta, cDES); } } END_SU2_OMP_FOR diff --git a/SU2_CFD/src/solvers/CTurbSASolver.cpp b/SU2_CFD/src/solvers/CTurbSASolver.cpp index 4951589737f1..e9804d0c73b0 100644 --- a/SU2_CFD/src/solvers/CTurbSASolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSASolver.cpp @@ -224,9 +224,9 @@ void CTurbSASolver::Preprocessing(CGeometry *geometry, CSolver **solver_containe 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 VelGrad = flowNodes->GetGradient_Primitive(iPoint) + prim_idx.Velocity(); auto Laminar_Viscosity = flowNodes->GetLaminarViscosity(iPoint); - nodes->SetVortex_Tilting(iPoint, PrimGrad_Flow, Vorticity, Laminar_Viscosity); + nodes->SetVortex_Tilting(iPoint, VelGrad, Vorticity, Laminar_Viscosity); } END_SU2_OMP_FOR } @@ -1026,15 +1026,17 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC const su2double fw_star = 0.424, cv1_3 = pow(7.1, 3), k2 = pow(0.41, 2); const su2double cb1 = 0.1355, ct3 = 1.2, ct4 = 0.5; - const su2double sigma = 2./3., cb2 = 0.622, f_max = 1.0, f_min = 0.1, a1 = 0.15, a2 = 0.3; + const su2double sigma = 2./3., cb2 = 0.622; auto* flowNodes = su2staticcast_p(solver[FLOW_SOL]->GetNodes()); + /*--- Work space of the EDDES length scale, private to each thread and reused for all its points. ---*/ + ShearLayerWorkspace slaWorkspace; + SU2_OMP_FOR_DYN(omp_chunk_size) for (auto iPoint = 0ul; iPoint < nPointDomain; iPoint++){ const auto coord_i = geometry->nodes->GetCoord(iPoint); - const auto nNeigh = geometry->nodes->GetnPoint(iPoint); const auto wallDistance = geometry->nodes->GetWall_Distance(iPoint); const auto velocityGrad = flowNodes->GetVelocityGradient(iPoint); const auto vorticity = flowNodes->GetVorticity(iPoint); @@ -1104,8 +1106,8 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC maxDelta = LES_FilterWidth; } - 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)); @@ -1146,8 +1148,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; @@ -1173,46 +1175,10 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC 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 r_d = (kinematicViscosityTurb+kinematicViscosity)/(uijuij*k2*pow(wallDistance, 2)); + const su2double f_d = 1.0-tanh(pow(8.0*r_d,3)); - 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 = (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; - } + su2double maxDelta = ShearLayerAdaptedLengthScale(geometry, iPoint, vorticity, f_d < 0.99, slaWorkspace); if (LES_FilterWidth > 0.0){ maxDelta = LES_FilterWidth; diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 89a7b8579b07..8ffe82010b99 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -207,8 +207,38 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain SU2_ZONE_SCOPED 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) { + + /*--- 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 VelGrad = flowNodes->GetGradient_Primitive(iPoint) + prim_idx.Velocity(); + auto Laminar_Viscosity = flowNodes->GetLaminarViscosity(iPoint); + nodes->SetVortex_Tilting(iPoint, VelGrad, Vorticity, Laminar_Viscosity); + } + END_SU2_OMP_FOR + } + + /*--- Compute the DES length scale on the domain points and send it to the halo points, as for SA. + The EDDES length scale needs the full neighbourhood of the point, which halo points do not have. ---*/ + + SetDES_LengthScale(solver_container, geometry, config); + + InitiateComms(geometry, config, MPI_QUANTITIES::DES_LENGTHSCALE); + CompleteComms(geometry, config, MPI_QUANTITIES::DES_LENGTHSCALE); + + } + } void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_container, @@ -384,6 +414,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->SetHybridLengthScale(nodes->GetDES_LengthScale(iPoint)); + } + /*--- Compute the source term ---*/ auto residual = numerics->ComputeResidual(config); @@ -875,6 +909,152 @@ 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()); + + /*--- Work space of the EDDES length scale, private to each thread and reused for all its points. ---*/ + ShearLayerWorkspace slaWorkspace; + + SU2_OMP_FOR_STAT(omp_chunk_size) + for (unsigned long iPoint = 0; iPoint < nPointDomain; 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 kappa2 = 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 = flowNodes->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); + su2double h_wn = 0.0; + if (kind_hybridRANSLES == SST_IDDES || kind_hybridRANSLES == SST_SIDDES) { + const auto normal = geometry->nodes->GetWallNormal(iPoint); + if (normal != nullptr) { + const auto coord = geometry->nodes->GetCoord(iPoint); + for (const auto neighbor : geometry->nodes->GetPoints(iPoint)) { + const auto neighborCoord = geometry->nodes->GetCoord(neighbor); + h_wn = max(h_wn, GeometryToolbox::WallNormalEdgeLength(nDim, coord, neighborCoord, normal)); + } + } + } + const su2double C_DES = C_DES1 * nodes->GetF1blending(iPoint) + C_DES2 * (1-nodes->GetF1blending(iPoint)); + const su2double l_RANS = max(sqrt(max(nodes->GetSolution(iPoint, 0), 0.0)) / + max(constants[6] * nodes->GetSolution(iPoint, 1), 1e-10), 1e-10); + + su2double DES_lengthScale = 0.0; + + /*--- DDES uses f_d only when the LES length is shorter. IDDES always blends the two lengths, so its + LES weight is 1-ftilda_d even when the LES length exceeds the RANS length. ---*/ + su2double lesSensor = 0.0; + + switch(kind_hybridRANSLES){ + /*--- SST DDES and IDDES follow Gritskevich et al. (DOI:10.1007/s10494-011-9378-4). ---*/ + case SST_DDES: { + + const su2double r_d = (eddyVisc + lamVisc) / max((kappa2*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); + if (l_RANS > l_LES) lesSensor = f_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((kappa2*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((kappa2*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(max(C_w * max(sqrt(wallDist2), h_max), h_wn), 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; + lesSensor = 1.0 - ftilda_d; + + break; + } + case SST_SIDDES: { + /*--- Simplified IDDES of Gritskevich et al. (Section 5 and Eq. 12): IDDES without the elevating + function f_e. ---*/ + + // 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((kappa2*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(max(C_w * max(sqrt(wallDist2), h_max), h_wn), h_max); + const su2double l_LES = C_DES * Delta; + + DES_lengthScale = ftilda_d*l_RANS + (1.0 - ftilda_d) * l_LES; + lesSensor = 1.0 - ftilda_d; + + break; + } + case SST_EDDES: { + /*--- DDES with the shear-layer-adapted subgrid length-scale of Shur et al. (An Enhanced Version of DES with + Rapid Transition from RANS to LES in Separated Flows, Flow Turbulence Combust 95, 2015), applied to the SST model + as in Guseva et al. (Flow Turbulence Combust 98, 2017) and Xiao et al. (Int. J. Heat Fluid Flow 85, 2020). ---*/ + + const su2double r_d = (eddyVisc + lamVisc) / max((kappa2*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 delta = ShearLayerAdaptedLengthScale(geometry, iPoint, Vorticity, f_d < 0.99, slaWorkspace); + + const su2double l_LES = C_DES * delta; + DES_lengthScale = l_RANS - f_d * max(0.0, l_RANS - l_LES); + if (l_RANS > l_LES) lesSensor = f_d; + + break; + } + } + + nodes->SetDES_LengthScale(iPoint, max(DES_lengthScale, 1e-10)); + nodes->SetLES_Mode(iPoint, lesSensor); + + } + END_SU2_OMP_FOR +} + void CTurbSSTSolver::ComputeUnderRelaxationFactor(CSolver** solver_container, const CConfig *config) { SU2_ZONE_SCOPED diff --git a/SU2_CFD/src/solvers/CTurbSolver.cpp b/SU2_CFD/src/solvers/CTurbSolver.cpp index 162fb955028e..4e85299c0f7b 100644 --- a/SU2_CFD/src/solvers/CTurbSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSolver.cpp @@ -316,3 +316,109 @@ void CTurbSolver::ComputeUnderRelaxationFactorHelper(CSolver** solver_container, } END_SU2_OMP_FOR } + +su2double CTurbSolver::ShearLayerAdaptedLengthScale(const CGeometry* geometry, unsigned long iPoint, + const su2double* vorticity, bool shielded, + ShearLayerWorkspace& workspace) const { + const su2double omega = GeometryToolbox::Norm(int(MAXNDIM), vorticity); + + /*--- Without vorticity its direction is undefined and Delta_omega vanishes, use the standard DES length-scale. ---*/ + if (omega < 1e-12) return geometry->nodes->GetMaxLength(iPoint); + + su2double direction[MAXNDIM]; + for (auto iDim = 0u; iDim < MAXNDIM; iDim++) direction[iDim] = vorticity[iDim] / omega; + + /*--- Delta_omega = max_{n,m} |l_n - l_m| / sqrt(3), with l_n = n_omega x r_n and r_n the vertices of the control + volume (Eq. 1). The control volume of a point is its median-dual cell, whose vertices are the midpoints of the edges + of the point and the centroids of the faces and of the elements that contain it (and the point itself where the + cell is cut by a boundary). On hexahedral grids the extreme vertices are the 8 element centroids. ---*/ + auto& projected = workspace.projected; + auto& visitedFaces = workspace.faces; + projected.clear(); + visitedFaces.clear(); + + const auto coord_i = geometry->nodes->GetCoord(iPoint); + auto addVertex = [&](const su2double* vertex) { + su2double relative[MAXNDIM] = {0.0, 0.0, 0.0}; + for (auto iDim = 0u; iDim < nDim; iDim++) relative[iDim] = vertex[iDim] - coord_i[iDim]; + array cross; + GeometryToolbox::CrossProduct(direction, relative, cross.data()); + projected.push_back(cross); + }; + + addVertex(coord_i); + + for (const auto jPoint : geometry->nodes->GetPoints(iPoint)) { + const auto coord_j = geometry->nodes->GetCoord(jPoint); + su2double midpoint[MAXNDIM] = {0.0, 0.0, 0.0}; + for (auto iDim = 0u; iDim < nDim; iDim++) midpoint[iDim] = 0.5 * (coord_i[iDim] + coord_j[iDim]); + addVertex(midpoint); + } + + for (const auto iElem : geometry->nodes->GetElems(iPoint)) { + const auto* elem = geometry->elem[iElem]; + addVertex(elem->GetCG()); + + for (auto iFace = 0u; iFace < elem->GetnFaces(); iFace++) { + const auto nNodesFace = elem->GetnNodesFace(iFace); + bool containsPoint = false; + array faceNodes; + faceNodes.fill(numeric_limits::max()); + su2double centroid[MAXNDIM] = {0.0, 0.0, 0.0}; + for (auto iNode = 0u; iNode < nNodesFace; iNode++) { + const auto jPoint = elem->GetNode(elem->GetFaces(iFace, iNode)); + containsPoint = containsPoint || (jPoint == iPoint); + faceNodes[iNode] = jPoint; + const auto coord_j = geometry->nodes->GetCoord(jPoint); + for (auto iDim = 0u; iDim < nDim; iDim++) centroid[iDim] += coord_j[iDim] / nNodesFace; + } + /*--- Faces shared by two elements are added once, identified by their sorted (padded) nodes. ---*/ + if (containsPoint) { + sort(faceNodes.begin(), faceNodes.end()); + if (find(visitedFaces.begin(), visitedFaces.end(), faceNodes) == visitedFaces.end()) { + visitedFaces.push_back(faceNodes); + addVertex(centroid); + } + } + } + } + + /*--- Select the farthest pair without taping every candidate, then differentiate the selected distance. ---*/ + const bool wasActive = AD::BeginPassive(); + su2double diameter2 = 0.0; + size_t farthestN = 0, farthestM = 0; + for (auto n = 0ul; n < projected.size(); n++) { + for (auto m = n + 1; m < projected.size(); m++) { + su2double dist2 = 0.0; + for (auto iDim = 0u; iDim < MAXNDIM; iDim++) dist2 += pow(projected[n][iDim] - projected[m][iDim], 2); + if (dist2 > diameter2) { + diameter2 = dist2; + farthestN = n; + farthestM = m; + } + } + } + AD::EndPassive(wasActive); + + /*--- Without a pair at positive distance Delta_omega is 0, skip the sqrt whose derivative is infinite there. ---*/ + su2double deltaOmega = 0.0; + if (farthestN != farthestM) { + diameter2 = 0.0; + for (auto iDim = 0u; iDim < MAXNDIM; iDim++) + diameter2 += pow(projected[farthestN][iDim] - projected[farthestM][iDim], 2); + deltaOmega = sqrt(diameter2 / 3.0); + } + + /*--- In the RANS region F_KH is set to 1 to shield the boundary layer (Eq. 6, epsilon = 0.01). ---*/ + if (shielded) return deltaOmega; + + /*--- F_KH of the vortex tilting measure averaged over the point and its neighbors (Eq. 4). ---*/ + su2double vortexTilting = nodes->GetVortex_Tilting(iPoint); + for (const auto jPoint : geometry->nodes->GetPoints(iPoint)) vortexTilting += nodes->GetVortex_Tilting(jPoint); + vortexTilting /= geometry->nodes->GetnPoint(iPoint) + 1; + + const su2double fMax = 1.0, fMin = 0.1, a1 = 0.15, a2 = 0.3; + const su2double fKH = max(fMin, min(fMax, fMin + (fMax - fMin) / (a2 - a1) * (vortexTilting - a1))); + + return deltaOmega * fKH; +} diff --git a/SU2_CFD/src/variables/CTurbSAVariable.cpp b/SU2_CFD/src/variables/CTurbSAVariable.cpp index 861fc7331ac0..68ea6b21793f 100644 --- a/SU2_CFD/src/variables/CTurbSAVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSAVariable.cpp @@ -56,11 +56,8 @@ 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); if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES) { - lesMode.resize(nPoint) = su2double(0.0); if (backscatter) { sbsInBox.resize(nPoint) = 1; stochSource.resize(nPoint, nDim) = su2double(0.0); @@ -70,50 +67,3 @@ CTurbSAVariable::CTurbSAVariable(su2double val_nu_tilde, su2double val_muT, unsi } } - -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(); -} diff --git a/SU2_CFD/src/variables/CTurbVariable.cpp b/SU2_CFD/src/variables/CTurbVariable.cpp index c09fbd9e3717..7ceab816d190 100644 --- a/SU2_CFD/src/variables/CTurbVariable.cpp +++ b/SU2_CFD/src/variables/CTurbVariable.cpp @@ -27,15 +27,65 @@ #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) : CScalarVariable(npoint, ndim, nvar, config, config->GetMUSCL_Turb()) { - turb_index.resize(nPoint) = su2double(1.0); - intermittency.resize(nPoint) = su2double(1.0); + turb_index.resize(nPoint) = su2double(1.0); + intermittency.resize(nPoint) = su2double(1.0); - } + const auto hybrid = config->GetKind_HybridRANSLES(); + if (hybrid != NO_HYBRIDRANSLES) { + DES_LengthScale.resize(nPoint) = su2double(0.0); + lesMode.resize(nPoint) = su2double(0.0); + } + if (hybrid == SA_EDDES || hybrid == SST_EDDES) Vortex_Tilting.resize(nPoint); +} + + +void CTurbVariable::SetVortex_Tilting(unsigned long iPoint, CMatrixView VelGrad, + 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(VelGrad, nDim, nDim); + AD::SetPreaccIn(Vorticity, 3); + /*--- Eddy viscosity ---*/ + AD::SetPreaccIn(muT(iPoint)); + /*--- Laminar viscosity --- */ + AD::SetPreaccIn(LaminarViscosity); + + GeometryToolbox::ComputeMeanRateOfStrainMatrix(nDim, Strain, VelGrad); + + Omega = GeometryToolbox::Norm(3, Vorticity); + + 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]; + + GeometryToolbox::CrossProduct(StrainDotVort, Vorticity, numVecVort); + numerator = sqrt(6.0) * GeometryToolbox::Norm(3, numVecVort); + /*--- 3 tr(S^2) - tr(S)^2, where tr(S^2) is the sum of the squares of all the components of S. ---*/ + trace0 = 0.0; + for (auto iDim = 0u; iDim < 3; iDim++) + for (auto jDim = 0u; jDim < 3; jDim++) trace0 += 3.0 * pow(Strain[iDim][jDim], 2); + trace1 = pow(Strain[0][0] + Strain[1][1] + Strain[2][2],2.0); + denominator = pow(Omega, 2.0) * sqrt(max(trace0-trace1, 0.0)); + + /*--- Without vorticity or strain anisotropy the measure is undefined, make it neutral (F_KH = 1). ---*/ + if (denominator < 1e-20) { + Vortex_Tilting(iPoint) = 1.0; + } else { + Vortex_Tilting(iPoint) = (numerator/denominator) * max(1.0,0.2*LaminarViscosity/max(muT(iPoint), 1e-20)); + } + + AD::SetPreaccOut(Vortex_Tilting(iPoint)); + AD::EndPreacc(); +} void CTurbVariable::RegisterEddyViscosity(bool input) { RegisterContainer(input, muT); diff --git a/TestCases/ddes/oneram6/ddes_oneram6_sa_eddes.cfg b/TestCases/ddes/oneram6/ddes_oneram6_sa_eddes.cfg new file mode 100644 index 000000000000..4724a4b34e3e --- /dev/null +++ b/TestCases/ddes/oneram6/ddes_oneram6_sa_eddes.cfg @@ -0,0 +1,70 @@ +% Hybrid RANS/LES model SA_EDDES, ONERA M6 wing on a hexahedral grid. +% The simulation restarts from a partially converged SA RANS solution (solution_flow_sa_00000.dat), +% so that the LES branch of the length scale is active in the turbulent regions. +% +% ------------------------------ PROBLEM DEFINITION ------------------------------% +SOLVER= RANS +KIND_TURB_MODEL= SA +HYBRID_RANSLES= SA_EDDES +MATH_PROBLEM= DIRECT +RESTART_SOL= YES +RESTART_ITER= 1 +% +% ------------------------------ TIME INTEGRATION --------------------------------% +TIME_DOMAIN= YES +TIME_MARCHING= DUAL_TIME_STEPPING-1ST_ORDER +TIME_STEP= 1e-4 +TIME_ITER= 6 +INNER_ITER= 2 +% +% ------------------------------ FREE-STREAM -------------------------------------% +MACH_NUMBER= 0.8395 +AOA= 3.06 +SIDESLIP_ANGLE= 0.0 +FREESTREAM_TEMPERATURE= 288.15 +REYNOLDS_NUMBER= 11.72E6 +REYNOLDS_LENGTH= 0.64607 +FLUID_MODEL= STANDARD_AIR +VISCOSITY_MODEL= SUTHERLAND +% +% ------------------------------ REFERENCE VALUES --------------------------------% +REF_ORIGIN_MOMENT_X= 0.25 +REF_ORIGIN_MOMENT_Y= 0.00 +REF_ORIGIN_MOMENT_Z= 0.00 +REF_LENGTH= 0.64607 +REF_AREA= 0 +% +% ------------------------------ BOUNDARY CONDITIONS -----------------------------% +MARKER_HEATFLUX= ( WING, 0.0 ) +MARKER_FAR= ( FARFIELD ) +MARKER_SYM= ( SYMMETRY ) +MARKER_PLOTTING= ( WING ) +MARKER_MONITORING= ( WING ) +% +% ------------------------------ NUMERICS ----------------------------------------% +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 4.0 +CFL_ADAPT= NO +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= LU_SGS +LINEAR_SOLVER_ERROR= 1E-4 +LINEAR_SOLVER_ITER= 5 +CONV_NUM_METHOD_FLOW= ROE +MUSCL_FLOW= YES +SLOPE_LIMITER_FLOW= VENKATAKRISHNAN +VENKAT_LIMITER_COEFF= 1.0 +TIME_DISCRE_FLOW= EULER_IMPLICIT +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +MUSCL_TURB= NO +TIME_DISCRE_TURB= EULER_IMPLICIT +CONV_RESIDUAL_MINVAL= -10 +CONV_STARTITER= 10 +% +% ------------------------------ INPUT/OUTPUT ------------------------------------% +MESH_FILENAME= ../../rans/oneram6/mesh_ONERAM6_turb_hexa_43008.su2 +MESH_FORMAT= SU2 +SOLUTION_FILENAME= solution_flow_sa +OUTPUT_FILES= (RESTART) +OUTPUT_WRT_FREQ= 250 +SCREEN_OUTPUT= (TIME_ITER, INNER_ITER, RMS_DENSITY, RMS_NU_TILDE, LIFT, DRAG) +HISTORY_OUTPUT= (ITER, RMS_RES, AERO_COEFF) diff --git a/TestCases/ddes/oneram6/ddes_oneram6_sst_ddes.cfg b/TestCases/ddes/oneram6/ddes_oneram6_sst_ddes.cfg new file mode 100644 index 000000000000..a027cbae243d --- /dev/null +++ b/TestCases/ddes/oneram6/ddes_oneram6_sst_ddes.cfg @@ -0,0 +1,70 @@ +% Hybrid RANS/LES model SST_DDES, ONERA M6 wing on a hexahedral grid. +% The simulation restarts from a partially converged SST RANS solution (solution_flow_sst_00000.dat), +% so that the LES branch of the length scale is active in the turbulent regions. +% +% ------------------------------ PROBLEM DEFINITION ------------------------------% +SOLVER= RANS +KIND_TURB_MODEL= SST +HYBRID_RANSLES= SST_DDES +MATH_PROBLEM= DIRECT +RESTART_SOL= YES +RESTART_ITER= 1 +% +% ------------------------------ TIME INTEGRATION --------------------------------% +TIME_DOMAIN= YES +TIME_MARCHING= DUAL_TIME_STEPPING-1ST_ORDER +TIME_STEP= 1e-4 +TIME_ITER= 6 +INNER_ITER= 2 +% +% ------------------------------ FREE-STREAM -------------------------------------% +MACH_NUMBER= 0.8395 +AOA= 3.06 +SIDESLIP_ANGLE= 0.0 +FREESTREAM_TEMPERATURE= 288.15 +REYNOLDS_NUMBER= 11.72E6 +REYNOLDS_LENGTH= 0.64607 +FLUID_MODEL= STANDARD_AIR +VISCOSITY_MODEL= SUTHERLAND +% +% ------------------------------ REFERENCE VALUES --------------------------------% +REF_ORIGIN_MOMENT_X= 0.25 +REF_ORIGIN_MOMENT_Y= 0.00 +REF_ORIGIN_MOMENT_Z= 0.00 +REF_LENGTH= 0.64607 +REF_AREA= 0 +% +% ------------------------------ BOUNDARY CONDITIONS -----------------------------% +MARKER_HEATFLUX= ( WING, 0.0 ) +MARKER_FAR= ( FARFIELD ) +MARKER_SYM= ( SYMMETRY ) +MARKER_PLOTTING= ( WING ) +MARKER_MONITORING= ( WING ) +% +% ------------------------------ NUMERICS ----------------------------------------% +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 4.0 +CFL_ADAPT= NO +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= LU_SGS +LINEAR_SOLVER_ERROR= 1E-4 +LINEAR_SOLVER_ITER= 5 +CONV_NUM_METHOD_FLOW= ROE +MUSCL_FLOW= YES +SLOPE_LIMITER_FLOW= VENKATAKRISHNAN +VENKAT_LIMITER_COEFF= 1.0 +TIME_DISCRE_FLOW= EULER_IMPLICIT +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +MUSCL_TURB= NO +TIME_DISCRE_TURB= EULER_IMPLICIT +CONV_RESIDUAL_MINVAL= -10 +CONV_STARTITER= 10 +% +% ------------------------------ INPUT/OUTPUT ------------------------------------% +MESH_FILENAME= ../../rans/oneram6/mesh_ONERAM6_turb_hexa_43008.su2 +MESH_FORMAT= SU2 +SOLUTION_FILENAME= solution_flow_sst +OUTPUT_FILES= (RESTART) +OUTPUT_WRT_FREQ= 250 +SCREEN_OUTPUT= (TIME_ITER, INNER_ITER, RMS_DENSITY, RMS_TKE, RMS_DISSIPATION, LIFT, DRAG) +HISTORY_OUTPUT= (ITER, RMS_RES, AERO_COEFF) diff --git a/TestCases/ddes/oneram6/ddes_oneram6_sst_eddes.cfg b/TestCases/ddes/oneram6/ddes_oneram6_sst_eddes.cfg new file mode 100644 index 000000000000..7de571ae72d2 --- /dev/null +++ b/TestCases/ddes/oneram6/ddes_oneram6_sst_eddes.cfg @@ -0,0 +1,70 @@ +% Hybrid RANS/LES model SST_EDDES, ONERA M6 wing on a hexahedral grid. +% The simulation restarts from a partially converged SST RANS solution (solution_flow_sst_00000.dat), +% so that the LES branch of the length scale is active in the turbulent regions. +% +% ------------------------------ PROBLEM DEFINITION ------------------------------% +SOLVER= RANS +KIND_TURB_MODEL= SST +HYBRID_RANSLES= SST_EDDES +MATH_PROBLEM= DIRECT +RESTART_SOL= YES +RESTART_ITER= 1 +% +% ------------------------------ TIME INTEGRATION --------------------------------% +TIME_DOMAIN= YES +TIME_MARCHING= DUAL_TIME_STEPPING-1ST_ORDER +TIME_STEP= 1e-4 +TIME_ITER= 6 +INNER_ITER= 2 +% +% ------------------------------ FREE-STREAM -------------------------------------% +MACH_NUMBER= 0.8395 +AOA= 3.06 +SIDESLIP_ANGLE= 0.0 +FREESTREAM_TEMPERATURE= 288.15 +REYNOLDS_NUMBER= 11.72E6 +REYNOLDS_LENGTH= 0.64607 +FLUID_MODEL= STANDARD_AIR +VISCOSITY_MODEL= SUTHERLAND +% +% ------------------------------ REFERENCE VALUES --------------------------------% +REF_ORIGIN_MOMENT_X= 0.25 +REF_ORIGIN_MOMENT_Y= 0.00 +REF_ORIGIN_MOMENT_Z= 0.00 +REF_LENGTH= 0.64607 +REF_AREA= 0 +% +% ------------------------------ BOUNDARY CONDITIONS -----------------------------% +MARKER_HEATFLUX= ( WING, 0.0 ) +MARKER_FAR= ( FARFIELD ) +MARKER_SYM= ( SYMMETRY ) +MARKER_PLOTTING= ( WING ) +MARKER_MONITORING= ( WING ) +% +% ------------------------------ NUMERICS ----------------------------------------% +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 4.0 +CFL_ADAPT= NO +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= LU_SGS +LINEAR_SOLVER_ERROR= 1E-4 +LINEAR_SOLVER_ITER= 5 +CONV_NUM_METHOD_FLOW= ROE +MUSCL_FLOW= YES +SLOPE_LIMITER_FLOW= VENKATAKRISHNAN +VENKAT_LIMITER_COEFF= 1.0 +TIME_DISCRE_FLOW= EULER_IMPLICIT +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +MUSCL_TURB= NO +TIME_DISCRE_TURB= EULER_IMPLICIT +CONV_RESIDUAL_MINVAL= -10 +CONV_STARTITER= 10 +% +% ------------------------------ INPUT/OUTPUT ------------------------------------% +MESH_FILENAME= ../../rans/oneram6/mesh_ONERAM6_turb_hexa_43008.su2 +MESH_FORMAT= SU2 +SOLUTION_FILENAME= solution_flow_sst +OUTPUT_FILES= (RESTART) +OUTPUT_WRT_FREQ= 250 +SCREEN_OUTPUT= (TIME_ITER, INNER_ITER, RMS_DENSITY, RMS_TKE, RMS_DISSIPATION, LIFT, DRAG) +HISTORY_OUTPUT= (ITER, RMS_RES, AERO_COEFF) diff --git a/TestCases/ddes/oneram6/ddes_oneram6_sst_iddes.cfg b/TestCases/ddes/oneram6/ddes_oneram6_sst_iddes.cfg new file mode 100644 index 000000000000..b8a26e8a6e7d --- /dev/null +++ b/TestCases/ddes/oneram6/ddes_oneram6_sst_iddes.cfg @@ -0,0 +1,70 @@ +% Hybrid RANS/LES model SST_IDDES, ONERA M6 wing on a hexahedral grid. +% The simulation restarts from a partially converged SST RANS solution (solution_flow_sst_00000.dat), +% so that the LES branch of the length scale is active in the turbulent regions. +% +% ------------------------------ PROBLEM DEFINITION ------------------------------% +SOLVER= RANS +KIND_TURB_MODEL= SST +HYBRID_RANSLES= SST_IDDES +MATH_PROBLEM= DIRECT +RESTART_SOL= YES +RESTART_ITER= 1 +% +% ------------------------------ TIME INTEGRATION --------------------------------% +TIME_DOMAIN= YES +TIME_MARCHING= DUAL_TIME_STEPPING-1ST_ORDER +TIME_STEP= 1e-4 +TIME_ITER= 6 +INNER_ITER= 2 +% +% ------------------------------ FREE-STREAM -------------------------------------% +MACH_NUMBER= 0.8395 +AOA= 3.06 +SIDESLIP_ANGLE= 0.0 +FREESTREAM_TEMPERATURE= 288.15 +REYNOLDS_NUMBER= 11.72E6 +REYNOLDS_LENGTH= 0.64607 +FLUID_MODEL= STANDARD_AIR +VISCOSITY_MODEL= SUTHERLAND +% +% ------------------------------ REFERENCE VALUES --------------------------------% +REF_ORIGIN_MOMENT_X= 0.25 +REF_ORIGIN_MOMENT_Y= 0.00 +REF_ORIGIN_MOMENT_Z= 0.00 +REF_LENGTH= 0.64607 +REF_AREA= 0 +% +% ------------------------------ BOUNDARY CONDITIONS -----------------------------% +MARKER_HEATFLUX= ( WING, 0.0 ) +MARKER_FAR= ( FARFIELD ) +MARKER_SYM= ( SYMMETRY ) +MARKER_PLOTTING= ( WING ) +MARKER_MONITORING= ( WING ) +% +% ------------------------------ NUMERICS ----------------------------------------% +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 4.0 +CFL_ADAPT= NO +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= LU_SGS +LINEAR_SOLVER_ERROR= 1E-4 +LINEAR_SOLVER_ITER= 5 +CONV_NUM_METHOD_FLOW= ROE +MUSCL_FLOW= YES +SLOPE_LIMITER_FLOW= VENKATAKRISHNAN +VENKAT_LIMITER_COEFF= 1.0 +TIME_DISCRE_FLOW= EULER_IMPLICIT +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +MUSCL_TURB= NO +TIME_DISCRE_TURB= EULER_IMPLICIT +CONV_RESIDUAL_MINVAL= -10 +CONV_STARTITER= 10 +% +% ------------------------------ INPUT/OUTPUT ------------------------------------% +MESH_FILENAME= ../../rans/oneram6/mesh_ONERAM6_turb_hexa_43008.su2 +MESH_FORMAT= SU2 +SOLUTION_FILENAME= solution_flow_sst +OUTPUT_FILES= (RESTART) +OUTPUT_WRT_FREQ= 250 +SCREEN_OUTPUT= (TIME_ITER, INNER_ITER, RMS_DENSITY, RMS_TKE, RMS_DISSIPATION, LIFT, DRAG) +HISTORY_OUTPUT= (ITER, RMS_RES, AERO_COEFF) diff --git a/TestCases/ddes/oneram6/ddes_oneram6_sst_siddes.cfg b/TestCases/ddes/oneram6/ddes_oneram6_sst_siddes.cfg new file mode 100644 index 000000000000..c7c7ad44a1b8 --- /dev/null +++ b/TestCases/ddes/oneram6/ddes_oneram6_sst_siddes.cfg @@ -0,0 +1,70 @@ +% Hybrid RANS/LES model SST_SIDDES, ONERA M6 wing on a hexahedral grid. +% The simulation restarts from a partially converged SST RANS solution (solution_flow_sst_00000.dat), +% so that the LES branch of the length scale is active in the turbulent regions. +% +% ------------------------------ PROBLEM DEFINITION ------------------------------% +SOLVER= RANS +KIND_TURB_MODEL= SST +HYBRID_RANSLES= SST_SIDDES +MATH_PROBLEM= DIRECT +RESTART_SOL= YES +RESTART_ITER= 1 +% +% ------------------------------ TIME INTEGRATION --------------------------------% +TIME_DOMAIN= YES +TIME_MARCHING= DUAL_TIME_STEPPING-1ST_ORDER +TIME_STEP= 1e-4 +TIME_ITER= 6 +INNER_ITER= 2 +% +% ------------------------------ FREE-STREAM -------------------------------------% +MACH_NUMBER= 0.8395 +AOA= 3.06 +SIDESLIP_ANGLE= 0.0 +FREESTREAM_TEMPERATURE= 288.15 +REYNOLDS_NUMBER= 11.72E6 +REYNOLDS_LENGTH= 0.64607 +FLUID_MODEL= STANDARD_AIR +VISCOSITY_MODEL= SUTHERLAND +% +% ------------------------------ REFERENCE VALUES --------------------------------% +REF_ORIGIN_MOMENT_X= 0.25 +REF_ORIGIN_MOMENT_Y= 0.00 +REF_ORIGIN_MOMENT_Z= 0.00 +REF_LENGTH= 0.64607 +REF_AREA= 0 +% +% ------------------------------ BOUNDARY CONDITIONS -----------------------------% +MARKER_HEATFLUX= ( WING, 0.0 ) +MARKER_FAR= ( FARFIELD ) +MARKER_SYM= ( SYMMETRY ) +MARKER_PLOTTING= ( WING ) +MARKER_MONITORING= ( WING ) +% +% ------------------------------ NUMERICS ----------------------------------------% +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 4.0 +CFL_ADAPT= NO +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= LU_SGS +LINEAR_SOLVER_ERROR= 1E-4 +LINEAR_SOLVER_ITER= 5 +CONV_NUM_METHOD_FLOW= ROE +MUSCL_FLOW= YES +SLOPE_LIMITER_FLOW= VENKATAKRISHNAN +VENKAT_LIMITER_COEFF= 1.0 +TIME_DISCRE_FLOW= EULER_IMPLICIT +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +MUSCL_TURB= NO +TIME_DISCRE_TURB= EULER_IMPLICIT +CONV_RESIDUAL_MINVAL= -10 +CONV_STARTITER= 10 +% +% ------------------------------ INPUT/OUTPUT ------------------------------------% +MESH_FILENAME= ../../rans/oneram6/mesh_ONERAM6_turb_hexa_43008.su2 +MESH_FORMAT= SU2 +SOLUTION_FILENAME= solution_flow_sst +OUTPUT_FILES= (RESTART) +OUTPUT_WRT_FREQ= 250 +SCREEN_OUTPUT= (TIME_ITER, INNER_ITER, RMS_DENSITY, RMS_TKE, RMS_DISSIPATION, LIFT, DRAG) +HISTORY_OUTPUT= (ITER, RMS_RES, AERO_COEFF) diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index e50abcb98ccb..6f3f868151d4 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -557,10 +557,25 @@ def main(): ddes_flatplate.cfg_dir = "ddes/flatplate" ddes_flatplate.cfg_file = "ddes_flatplate.cfg" ddes_flatplate.test_iter = 10 - ddes_flatplate.test_vals = [-2.714713, -5.763299, -0.214960, 0.023758, 0.000000] + ddes_flatplate.test_vals = [-2.714713, -5.938404, -0.214960, 0.023758, 0.000000] ddes_flatplate.unsteady = True test_list.append(ddes_flatplate) + # Hybrid RANS/LES models on the ONERA M6 wing, restarting from a RANS solution + ddes_oneram6_vals = {"sst_ddes": [-3.562792, -0.782249, 1.862156, 0.262000, 0.023186], + "sst_iddes": [-3.543730, 3.063407, 2.101699, 0.262015, 0.023189], + "sst_siddes": [-3.543749, 3.063407, 2.101710, 0.262000, 0.023186], + "sst_eddes": [-3.562408, 0.258673, 1.861874, 0.262000, 0.023186], + "sa_eddes": [-3.510006, -3.683557, 0.266420, 0.023471]} + for model, vals in ddes_oneram6_vals.items(): + ddes_oneram6 = TestCase('ddes_oneram6_' + model) + ddes_oneram6.cfg_dir = "ddes/oneram6" + ddes_oneram6.cfg_file = "ddes_oneram6_" + model + ".cfg" + ddes_oneram6.test_iter = 5 + ddes_oneram6.test_vals = vals + ddes_oneram6.unsteady = True + test_list.append(ddes_oneram6) + # unsteady pitching NACA0015, SA unst_inc_turb_naca0015_sa = TestCase('unst_inc_turb_naca0015_sa') unst_inc_turb_naca0015_sa.cfg_dir = "unsteady/pitching_naca0015_rans_inc" diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index dd064b1af6bb..df2c532f3162 100755 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1317,10 +1317,25 @@ def main(): ddes_flatplate.cfg_dir = "ddes/flatplate" ddes_flatplate.cfg_file = "ddes_flatplate.cfg" ddes_flatplate.test_iter = 10 - ddes_flatplate.test_vals = [-2.714713, -5.763284, -0.214960, 0.023758, 0.000000] + ddes_flatplate.test_vals = [-2.714713, -5.938404, -0.214960, 0.023758, 0.000000] ddes_flatplate.unsteady = True test_list.append(ddes_flatplate) + # Hybrid RANS/LES models on the ONERA M6 wing, restarting from a RANS solution + ddes_oneram6_vals = {"sst_ddes": [-3.562793, -0.782251, 1.862156, 0.262000, 0.023186], + "sst_iddes": [-3.543730, 3.063407, 2.101695, 0.262015, 0.023189], + "sst_siddes": [-3.543749, 3.063407, 2.101707, 0.262000, 0.023186], + "sst_eddes": [-3.562409, 0.258674, 1.861874, 0.262000, 0.023186], + "sa_eddes": [-3.510007, -3.683557, 0.266420, 0.023471]} + for model, vals in ddes_oneram6_vals.items(): + ddes_oneram6 = TestCase('ddes_oneram6_' + model) + ddes_oneram6.cfg_dir = "ddes/oneram6" + ddes_oneram6.cfg_file = "ddes_oneram6_" + model + ".cfg" + ddes_oneram6.test_iter = 5 + ddes_oneram6.test_vals = vals + ddes_oneram6.unsteady = True + test_list.append(ddes_oneram6) + # Stochastic BackScatter (SBS) model sbs_backward_step = TestCase('sbs_backward_step') sbs_backward_step.cfg_dir = "backscatter/backward_step" diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index c6e4da09034b..dc5bb8302b34 100755 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -921,10 +921,25 @@ def main(): ddes_flatplate.cfg_dir = "ddes/flatplate" ddes_flatplate.cfg_file = "ddes_flatplate.cfg" ddes_flatplate.test_iter = 10 - ddes_flatplate.test_vals = [-2.714713, -5.763293, -0.214960, 0.023758, 0.000000] + ddes_flatplate.test_vals = [-2.714713, -5.938404, -0.214960, 0.023758, 0.000000] ddes_flatplate.unsteady = True test_list.append(ddes_flatplate) + # Hybrid RANS/LES models on the ONERA M6 wing, restarting from a RANS solution + ddes_oneram6_vals = {"sst_ddes": [-3.562792, -0.782250, 1.862155, 0.262000, 0.023186], + "sst_iddes": [-3.543730, 3.063407, 2.101695, 0.262015, 0.023189], + "sst_siddes": [-3.543749, 3.063407, 2.101707, 0.262000, 0.023186], + "sst_eddes": [-3.562408, 0.258674, 1.861872, 0.262000, 0.023186], + "sa_eddes": [-3.510006, -3.683557, 0.266420, 0.023471]} + for model, vals in ddes_oneram6_vals.items(): + ddes_oneram6 = TestCase('ddes_oneram6_' + model) + ddes_oneram6.cfg_dir = "ddes/oneram6" + ddes_oneram6.cfg_file = "ddes_oneram6_" + model + ".cfg" + ddes_oneram6.test_iter = 5 + ddes_oneram6.test_vals = vals + ddes_oneram6.unsteady = True + test_list.append(ddes_oneram6) + # unsteady pitching NACA0015, SA unst_inc_turb_naca0015_sa = TestCase('unst_inc_turb_naca0015_sa') unst_inc_turb_naca0015_sa.cfg_dir = "unsteady/pitching_naca0015_rans_inc" diff --git a/UnitTests/Common/geometry/CGeometry_test.cpp b/UnitTests/Common/geometry/CGeometry_test.cpp index 49b5fd87b155..387510783fd4 100644 --- a/UnitTests/Common/geometry/CGeometry_test.cpp +++ b/UnitTests/Common/geometry/CGeometry_test.cpp @@ -140,3 +140,15 @@ TEST_CASE("Set bound control volume", "[Geometry]") { CHECK(TestCase->geometry->vertex[3][2]->GetNormal()[1] == -0.0625); CHECK(TestCase->geometry->vertex[5][3]->GetNormal()[2] == 0.03125); } + +TEST_CASE("Wall-normal edge spacing", "[Geometry]") { + const su2double origin[3] = {0.0, 0.0, 0.0}; + const su2double normal[3] = {0.6, 0.8, 0.0}; + const su2double normalEdge[3] = {0.3, 0.4, 0.0}; + const su2double tangentEdge[3] = {-0.8, 0.6, 0.0}; + const su2double skewEdge[3] = {1.2, -0.275, 4.0}; + CHECK(GeometryToolbox::WallNormalEdgeLength(3, origin, normalEdge, normal) == Approx(0.5)); + CHECK(GeometryToolbox::WallNormalEdgeLength(3, origin, tangentEdge, normal) == Approx(0.0).margin(1e-14)); + CHECK(GeometryToolbox::WallNormalEdgeLength(2, origin, skewEdge, normal) == Approx(0.5)); + CHECK(GeometryToolbox::WallNormalEdgeLength(3, skewEdge, origin, normal) == Approx(0.5)); +} diff --git a/UnitTests/SU2_CFD/numerics/CNumerics_tests.cpp b/UnitTests/SU2_CFD/numerics/CNumerics_tests.cpp index b5e2300c9fe3..28b5db872ed3 100644 --- a/UnitTests/SU2_CFD/numerics/CNumerics_tests.cpp +++ b/UnitTests/SU2_CFD/numerics/CNumerics_tests.cpp @@ -31,6 +31,7 @@ #include #include #include "../../../SU2_CFD/include/numerics/CNumerics.hpp" +#include "../../../SU2_CFD/include/variables/CTurbSSTVariable.hpp" #include "../../../SU2_CFD/include/numerics/NEMO/NEMO_diffusion.hpp" TEST_CASE("NTS blending has a minimum of 0.05", "[Upwind/central blending]") { @@ -243,3 +244,31 @@ TEST_CASE("NEMO corrected viscous residual returns distinct i and j Jacobians", } } } + +TEST_CASE("Vortex tilting uses a velocity-only gradient view", "[EDDES]") { + std::stringstream options; + options << "SOLVER= RANS\nKIND_TURB_MODEL= SST\nHYBRID_RANSLES= SST_EDDES\nTIME_DOMAIN= YES\n" + "TIME_MARCHING= DUAL_TIME_STEPPING-2ND_ORDER\nTIME_STEP= 0.001\nREYNOLDS_NUMBER= 5\n"; + CConfig config(options, SU2_COMPONENT::SU2_CFD, false); + + for (unsigned short nDim : {2, 3}) { + const su2double constants[11] = {}; + CTurbSSTVariable turb(1.0, 1.0, 1.0, 1, nDim, 2, constants, &config); + + // Standard flow and five-species NEMO primitive layouts. + for (unsigned short velocityIndex : {1, 7}) { + su2activematrix gradient(velocityIndex + nDim, nDim); + gradient = su2double(100.0); + for (unsigned short i = 0; i < nDim; ++i) + for (unsigned short j = 0; j < nDim; ++j) gradient(i + velocityIndex, j) = i == j ? i + 1.0 : 0.0; + auto velocityGradient = CMatrixView(gradient) + velocityIndex; + const su2double vorticity[3] = {1.0, 1.0, 0.0}; + turb.SetVortex_Tilting(0, velocityGradient, vorticity, 1.0); + REQUIRE(turb.GetVortex_Tilting(0) == Approx(0.5)); + + const su2double zeroVorticity[3] = {0.0, 0.0, 0.0}; + turb.SetVortex_Tilting(0, velocityGradient, zeroVorticity, 1.0); + REQUIRE(turb.GetVortex_Tilting(0) == 1.0); + } + } +} diff --git a/config_template.cfg b/config_template.cfg index daddef60a494..865232548ddb 100644 --- a/config_template.cfg +++ b/config_template.cfg @@ -175,16 +175,18 @@ UNST_ADJOINT_ITER= 0 % % ------------------------------- DES Parameters ------------------------------% % -% Specify Hybrid RANS/LES model (SA_DES, SA_DDES, SA_ZDES, SA_EDDES) +% Specify Hybrid RANS/LES model (SA_DES, SA_DDES, SA_ZDES, SA_EDDES, SST_DDES, SST_IDDES, SST_SIDDES, SST_EDDES) HYBRID_RANSLES= SA_DDES % -% DES Constant (0.65) +% DES Constant of the SA hybrid models (0.65). +% The SST hybrid models use C_DES = 0.78 F1 + 0.61 (1 - F1) and ignore DES_CONST (with a warning). DES_CONST= 0.65 % % User-specified LES filter width (if negative, it is computed based on the local cell size, default -1.0) +% Only for the SA hybrid models. LES_FILTER_WIDTH= -1.0 % -% Stochastic Backscatter Model (NO, YES) +% Stochastic Backscatter Model (NO, YES), only with the SA hybrid models (SA_DES, SA_DDES, SA_ZDES, SA_EDDES) STOCHASTIC_BACKSCATTER= NO % % Backscatter lengthscale coefficient (0.1) @@ -217,7 +219,7 @@ SBS_IN_BOX= NO % Bounds of the box where the Stochastic Backscatter Model is activated (x_min, x_max, y_min, y_max, z_min, z_max) SBS_BOX_BOUNDS= (0.0, 0.0, 0.0, 0.0, 0.0, 0.0) % -% Enforce LES mode in Hybrid RANS-LES Simulations (NO, YES) +% Enforce LES mode in Hybrid RANS-LES Simulations (NO, YES), only for the SA hybrid models ENFORCE_LES= NO % % -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------%