diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index bf2122f01a7..ec4a555d6af 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -3487,11 +3487,6 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i SU2_MPI::Error("COMPRESSIBILITY-WILCOX only supported for SOLVER= RANS", CURRENT_FUNCTION); } - /*--- Check if turbulence model can be used for AXISYMMETRIC case---*/ - if (Axisymmetric && Kind_Turb_Model != TURB_MODEL::NONE && Kind_Turb_Model != TURB_MODEL::SST){ - SU2_MPI::Error("Axisymmetry is currently only supported for KIND_TURB_MODEL chosen as SST", CURRENT_FUNCTION); - } - /*--- Postprocess LM_OPTIONS into structure. ---*/ if (Kind_Trans_Model == TURB_TRANS_MODEL::LM) { lmParsedOptions = ParseLMOptions(LM_Options, nLM_Options, rank, Kind_Turb_Model); diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index a190d3de942..ce75b38f115 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -77,9 +77,41 @@ class CSourceBase_TurbSA : public CNumerics { const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ const SA_ParsedOptions options; /*!< \brief Struct with SA options. */ + const bool axisymmetric = false; bool transition_LM; + /*! + * \brief Add contribution from diffusion due to axisymmetric formulation to 2D residual + */ + inline void ResidualAxisymmetricDiffusion(su2double sigma) { + if (Coord_i[1] < EPS) return; + + const su2double yinv = 1.0 / Coord_i[1]; + const su2double& nue = ScalarVar_i[0]; + + const auto& density = V_i[idx.Density()]; + const auto& laminar_viscosity = V_i[idx.LaminarViscosity()]; + + const su2double nu = laminar_viscosity/density; + + su2double nu_e; + + if (options.version == SA_OPTIONS::NEG && nue < 0.0) { + const su2double cn1 = 16.0; + const su2double Xi = nue / nu; + const su2double fn = (cn1 + Xi*Xi*Xi) / (cn1 - Xi*Xi*Xi); + nu_e = nu + fn * nue; + } else { + nu_e = nu + nue; + } + + /* Diffusion source term */ + const su2double dv_axi = (1.0/sigma)*nu_e*ScalarVar_Grad_i[0][1]; + + Residual += yinv * dv_axi * Volume; + } + public: /*! * \brief Constructor of the class. @@ -90,6 +122,7 @@ class CSourceBase_TurbSA : public CNumerics { : CNumerics(nDim, 1, config), idx(nDim, config->GetnSpecies()), options(config->GetSAParsedOptions()), + axisymmetric(config->GetAxisymmetric()), transition_LM(config->GetKind_Trans_Model() == TURB_TRANS_MODEL::LM) { /*--- Setup the Jacobian pointer, we need to return su2double** but we know * the Jacobian is 1x1 so we use this trick to avoid heap allocation. ---*/ @@ -217,6 +250,9 @@ class CSourceBase_TurbSA : public CNumerics { SourceTerms::get(ScalarVar_i[0], var, Production, Destruction, CrossProduction, Jacobian_i[0]); Residual = (Production - Destruction + CrossProduction) * Volume; + + if (axisymmetric) ResidualAxisymmetricDiffusion(var.sigma); + Jacobian_i[0] *= Volume; } @@ -520,6 +556,19 @@ class CCompressibilityCorrection final : public ParentClass { const su2double d_CompCorrection = 2.0 * c5 * ScalarVar_i[0] / pow(sound_speed, 2) * aux_cc * Volume; const su2double CompCorrection = 0.5 * ScalarVar_i[0] * d_CompCorrection; + /*--- Axisymmetric contribution ---*/ + if (this->axisymmetric && this->Coord_i[1] > EPS) { + const su2double yinv = 1.0 / this->Coord_i[1]; + const su2double nue = ScalarVar_i[0]; + const su2double v = V_i[idx.Velocity() + 1]; + + const su2double d_axiCorrection = 2.0 * c5 * nue * pow(v * yinv / sound_speed, 2) * Volume; + const su2double axiCorrection = 0.5 * nue * d_axiCorrection; + + this->Residual -= axiCorrection; + this->Jacobian_i[0] -= d_axiCorrection; + } + this->Residual -= CompCorrection; this->Jacobian_i[0] -= d_CompCorrection; diff --git a/SU2_CFD/src/solvers/CTurbSASolver.cpp b/SU2_CFD/src/solvers/CTurbSASolver.cpp index f53596e9901..3a6c89e530d 100644 --- a/SU2_CFD/src/solvers/CTurbSASolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSASolver.cpp @@ -308,6 +308,8 @@ void CTurbSASolver::Viscous_Residual(const unsigned long iEdge, const CGeometry* void CTurbSASolver::Source_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, unsigned short iMesh) { + bool axisymmetric = config->GetAxisymmetric(); + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool harmonic_balance = (config->GetTime_Marching() == TIME_MARCHING::HARMONIC_BALANCE); const bool transition_BC = config->GetSAParsedOptions().bc; @@ -383,6 +385,11 @@ void CTurbSASolver::Source_Residual(CGeometry *geometry, CSolver **solver_contai numerics->SetIntermittency(solver_container[TRANS_SOL]->GetNodes()->GetSolution(iPoint, 0)); } + if (axisymmetric) { + /*--- Set y coordinate ---*/ + numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(iPoint)); + } + /*--- Compute the source term ---*/ auto residual = numerics->ComputeResidual(config);