diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 73b6b81e29e4..0c0b032af637 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -1216,13 +1216,10 @@ inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigne SSTParsedOptions.production = SST_OPTIONS::UQ; } - // Parse compressibility options + // Parse compressibility options, stored in compWilcox and compSarkar so that they can be combined with a + // production modifier if (sst_compWilcox && sst_compSarkar) { SU2_MPI::Error("Please select only one compressibility correction (COMPRESSIBILITY-WILCOX or COMPRESSIBILITY-SARKAR).", CURRENT_FUNCTION); - } else if (sst_compWilcox) { - SSTParsedOptions.production = SST_OPTIONS::COMP_Wilcox; - } else if (sst_compSarkar) { - SSTParsedOptions.production = SST_OPTIONS::COMP_Sarkar; } SSTParsedOptions.sust = sst_sust; diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index bb3887748fd4..01cec4044ce7 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -4705,6 +4705,36 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i Rotating_Frame = (Kind_GridMovement == ROTATING_FRAME); + /*--- The finite volume flow solvers apply these source terms with a single numerics object, which is built + for only one of them: combinations would apply one source several times and ignore the others. Only these + solvers (and their discrete adjoints) are checked: e.g. elasticity uses BODY_FORCE and GRAVITY_FORCE together. ---*/ + + if (GetFluidProblem() && !GetNEMOProblem()) { + const bool inc = (Kind_Regime == ENUM_REGIME::INCOMPRESSIBLE); + const int nSources = int(Body_Force) + int(Rotating_Frame) + int(Axisymmetric) + int(GravityForce && !inc) + + int(inc && Kind_DensityModel == INC_DENSITYMODEL::BOUSSINESQ) + + int(inc && Kind_Streamwise_Periodic != ENUM_STREAMWISE_PERIODIC::NONE); + if (nSources > 1) { + SU2_MPI::Error("Only one of BODY_FORCE, GRID_MOVEMENT= ROTATING_FRAME, AXISYMMETRIC, GRAVITY_FORCE (compressible), " + "INC_DENSITY_MODEL= BOUSSINESQ and KIND_STREAMWISE_PERIODIC (incompressible) can be used at a time.", + CURRENT_FUNCTION); + } + } + + /*--- The second source object, for radiation, the energy correction of incompressible streamwise periodic flow + (without periodic temperature) or vorticity confinement, is also built for only one of them. ---*/ + + if (GetFluidProblem() && !GetNEMOProblem()) { + const bool inc = (Kind_Regime == ENUM_REGIME::INCOMPRESSIBLE); + const bool periodicOutlet = inc && Kind_Streamwise_Periodic != ENUM_STREAMWISE_PERIODIC::NONE && Energy_Equation && + !Streamwise_Periodic_Temperature; + if (int(Radiation) + int(periodicOutlet) + int(VorticityConfinement) > 1) { + SU2_MPI::Error("Only one of RADIATION, the energy correction of KIND_STREAMWISE_PERIODIC (incompressible, " + "STREAMWISE_PERIODIC_TEMPERATURE= NO) and VORTICITY_CONFINEMENT can be used at a time.", + CURRENT_FUNCTION); + } + } + /*--- In case the grid movement parameters have not been declared in the config file, set them equal to zero for safety. Also check to make sure that for each option, a value has been declared for each moving marker. ---*/ @@ -5064,6 +5094,11 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i if (Restart || ((Kind_MGCycle == MG_CYCLE::FULL) && ContinuousAdjoint)) Kind_MGCycle = MG_CYCLE::V; + /*--- The multigrid arrays hold at most 10 coarse levels (CMultiGridIntegration::MAX_MG_LEVELS). ---*/ + if (nMGLevels > 10) { + SU2_MPI::Error("MGLEVEL must be between 0 and 10; larger multigrid hierarchies are not supported.", CURRENT_FUNCTION); + } + FinestMesh = MESH_0; if (Kind_MGCycle == MG_CYCLE::FULL) FinestMesh = nMGLevels; @@ -5081,6 +5116,14 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i Kind_Solver == MAIN_SOLVER::FEM_EULER) Kind_Turb_Model = TURB_MODEL::NONE; + /*--- SST has no engine or actuator-disk boundary conditions: the faces would get no turbulence flux at all. + Checked after the turbulence model of Euler zones is cleared (multizone). ---*/ + if (Kind_Turb_Model == TURB_MODEL::SST && + (nMarker_EngineInflow + nMarker_EngineExhaust + nMarker_ActDiskInlet + nMarker_ActDiskOutlet) > 0) { + SU2_MPI::Error("MARKER_ENGINE_INFLOW, MARKER_ENGINE_EXHAUST and MARKER_ACTDISK are not supported with the SST model.", + CURRENT_FUNCTION); + } + Kappa_2nd_Flow = jst_coeff[0]; Kappa_4th_Flow = jst_coeff[1]; Kappa_2nd_AdjFlow = jst_adj_coeff[0]; @@ -6794,16 +6837,12 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) { cout << "\nperturbing the Reynold's Stress Matrix towards " << eig_val_comp << " component turbulence"; if (uq_permute) cout << " (permuting eigenvectors)"; break; - case SST_OPTIONS::COMP_Wilcox: - cout << " with compressibility correction of Wilcox"; - break; - case SST_OPTIONS::COMP_Sarkar: - cout << " with compressibility correction of Sarkar"; - break; default: cout << " with no production modification"; break; } + if (sstParsedOptions.compWilcox) cout << ", with compressibility correction of Wilcox"; + if (sstParsedOptions.compSarkar) cout << ", with compressibility correction of Sarkar"; if (sstParsedOptions.dll){ cout << "\nusing non dimensional lower limits relative to infinity values clipping by Coefficients:" ; diff --git a/Docs/SSTEnergy.md b/Docs/SSTEnergy.md new file mode 100644 index 000000000000..bef1b970a5dd --- /dev/null +++ b/Docs/SSTEnergy.md @@ -0,0 +1,32 @@ +# SST turbulent kinetic energy in the compressible solver + +The compressible SST solver stores total energy per unit mass as +`E = e + |u|²/2 + k`. Thermodynamic pressure and temperature use `e`; +total enthalpy and its convective flux include `k`. Flow Jacobians hold `k` +fixed because it is advanced by the separate turbulence solver. + +This energy convention does not imply that every term of the full +Favre-averaged energy equation is modeled. The current SSTm formulation: + +- omits the isotropic `-2 rho k I/3` term from turbulent stress; +- uses approximate strain-based production `P = mu_t 2S:S` before applying + the production limiter (other production options modify this expression); +- omits molecular diffusion and turbulent transport of `k` from the total + energy flux. Temperature heat conduction is still present. + +These are modeling approximations, distinct from interpreting `k` as +thermal energy inside a numerical flux or its Jacobian. The +[Turbulence Modeling Resource SST definitions](https://tmbwg.github.io/turbmodels/sst.html) +explicitly describe the SSTm production approximation, and its +[compressible RANS implementation notes](https://tmbwg.github.io/turbmodels/implementrans.html) +allow omission of the energy transport term involving the gradient of `k`. + +For unmodified strain production, its difference from the contraction of +SU2's deviatoric turbulent stress with the velocity gradient is +`2 mu_t (div u)²/3`, before limiting. At fixed total energy, additional +production of `k` reduces thermal energy. This difference vanishes for +incompressible flow and can matter in shocks and strong expansions. The +production limiter, sustaining terms, transition coupling, and production +modifiers prevent interpreting this expression as the actual production +excess in every configuration. Changing these approximations requires +choosing and validating a different SST formulation. diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index dd5c3a86dba6..4845396bfbab 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -69,7 +69,14 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER const auto chunkSize = computeStaticChunkSize(nPointDomain, omp_get_max_threads(), OMP_MAX_CHUNK); #endif - static constexpr size_t MAXNVAR = 20; + static constexpr size_t MAXNVAR = 32; + + /*--- Called by all threads of a parallel region: only the master may call MPI (MPI_THREAD_FUNNELED). ---*/ + if (varEnd > MAXNVAR) { + BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS + SU2_MPI::Error("Number of variables is too large, increase MAXNVAR.", CURRENT_FUNCTION); + END_SU2_OMP_SAFE_GLOBAL_ACCESS + } /*--- For each (non-halo) volume integrate over its faces (edges). ---*/ diff --git a/SU2_CFD/include/limiters/computeLimiters_impl.hpp b/SU2_CFD/include/limiters/computeLimiters_impl.hpp index eabb74a27455..c5bc908d423a 100644 --- a/SU2_CFD/include/limiters/computeLimiters_impl.hpp +++ b/SU2_CFD/include/limiters/computeLimiters_impl.hpp @@ -86,8 +86,12 @@ void computeLimiters_impl(CSolver* solver, constexpr size_t MAXNVAR = 32; static_assert(MAXNVAR >= MAX_TRANSPORTED_SPECIES, "MAXNVAR (size of the limiter work arrays) must be at least MAX_TRANSPORTED_SPECIES."); - if (varEnd > MAXNVAR) + /*--- Called by all threads of a parallel region: only the master may call MPI (MPI_THREAD_FUNNELED). ---*/ + if (varEnd > MAXNVAR) { + BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS SU2_MPI::Error("Number of variables is too large, increase MAXNVAR.", CURRENT_FUNCTION); + END_SU2_OMP_SAFE_GLOBAL_ACCESS + } const size_t nPointDomain = geometry.GetnPointDomain(); const size_t nPoint = geometry.GetnPoint(); diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index 1b22ed12a63d..bf95136240d2 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -1160,10 +1160,11 @@ class CNumerics { * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face. * \param[in] val_scale - Scale of the projection. * \param[out] val_Proj_Jac_tensor - Pointer to the projected inviscid Jacobian. + * \param[in] val_tke - Turbulent kinetic energy contained in the total energy (SST), held fixed. */ void GetInviscidProjJac(const su2double *val_velocity, const su2double *val_energy, const su2double *val_normal, su2double val_scale, - su2double **val_Proj_Jac_tensor) const; + su2double **val_Proj_Jac_tensor, su2double val_tke = 0.0) const; /*! * \brief Compute the projection of the inviscid Jacobian matrices (incompressible). @@ -1236,11 +1237,12 @@ class CNumerics { * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face. * \param[in] val_scale - Scale of the projection. * \param[out] val_Proj_Jac_tensor - Pointer to the projected inviscid Jacobian. + * \param[in] val_tke - Turbulent kinetic energy contained in the total energy (SST), held fixed. */ void GetInviscidProjJac(const su2double *val_velocity, const su2double *val_enthalphy, const su2double *val_chi, const su2double *val_kappa, const su2double *val_normal, su2double val_scale, - su2double **val_Proj_Jac_tensor) const; + su2double **val_Proj_Jac_tensor, su2double val_tke = 0.0) const; /*! * \brief Mapping between primitives variables P and conservatives variables C. @@ -1267,7 +1269,7 @@ class CNumerics { void GetPMatrix(const su2double *val_density, const su2double *val_velocity, const su2double *val_soundspeed, const su2double *val_enthalpy, const su2double *val_chi, const su2double *val_kappa, - const su2double *val_normal, su2double **val_p_tensor) const; + const su2double *val_normal, su2double **val_p_tensor, su2double val_tke = 0.0) const; /*! * \brief Computation of the matrix P, this matrix diagonalize the conservative Jacobians in @@ -1281,12 +1283,13 @@ class CNumerics { template void GetPMatrix(const su2double& density, const su2double* velocity, const su2double& soundspeed, const su2double* normal, - Matrix& p_tensor) const { + Matrix& p_tensor, su2double tke = 0.0) const { + /*--- With SST the total energy contains k (tke): it is added to the kinetic energy of the energy row. ---*/ const su2double rhooc = density / soundspeed; const su2double rhoxc = density * soundspeed; if (nDim == 2) { - const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(2, velocity); + const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(2, velocity) + tke; const su2double projvel = GeometryToolbox::DotProduct(2, velocity, normal); p_tensor[0][0] = 1.0; @@ -1309,7 +1312,7 @@ class CNumerics { p_tensor[3][2] = 0.5 * (ke * rhooc + density * projvel + rhoxc / Gamma_Minus_One); p_tensor[3][3] = 0.5 * (ke * rhooc - density * projvel + rhoxc / Gamma_Minus_One); } else { - const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(3, velocity); + const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(3, velocity) + tke; const su2double projvel = GeometryToolbox::DotProduct(3, velocity, normal); p_tensor[0][0] = normal[0]; @@ -1444,7 +1447,7 @@ class CNumerics { void GetPMatrix_inv(su2double **val_invp_tensor, const su2double *val_density, const su2double *val_velocity, const su2double *val_soundspeed, const su2double *val_chi, const su2double *val_kappa, - const su2double *val_normal) const; + const su2double *val_normal, su2double val_tke = 0.0) const; /*! * \brief Computation of the matrix P^{-1}, this matrix diagonalize the conservative Jacobians @@ -1458,7 +1461,8 @@ class CNumerics { template void GetPMatrix_inv(const su2double& density, const su2double* velocity, const su2double& soundspeed, const su2double* normal, - Matrix& inv_p_tensor) const { + Matrix& inv_p_tensor, su2double tke = 0.0) const { + /*--- With SST the total energy contains k (tke), dp/drho = (gamma-1) (|u|^2/2 - k). ---*/ const su2double rhoxc = density * soundspeed; const su2double c2 = pow(soundspeed, 2); const su2double gm1 = Gamma_Minus_One; @@ -1469,7 +1473,7 @@ class CNumerics { if (nDim == 3) { const su2double k2orho = normal[2] / density; - const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(3, velocity); + const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(3, velocity) - tke; const su2double projvel_o_rho = GeometryToolbox::DotProduct(3, velocity, normal) / density; inv_p_tensor[0][0] = normal[0] + k1orho * velocity[2] - k2orho * velocity[1] - normal[0] * gm1_o_c2 * ke; @@ -1502,7 +1506,7 @@ class CNumerics { inv_p_tensor[4][3] = -k2orho - gm1_o_rhoxc * velocity[2]; inv_p_tensor[4][4] = gm1_o_rhoxc; } else { - const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(2, velocity); + const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(2, velocity) - tke; const su2double projvel_o_rho = GeometryToolbox::DotProduct(2, velocity, normal) / density; inv_p_tensor[0][0] = 1 - gm1_o_c2 * ke; diff --git a/SU2_CFD/include/numerics/flow/convection/roe.hpp b/SU2_CFD/include/numerics/flow/convection/roe.hpp index 4bd4210a8f58..5801acdd06d9 100644 --- a/SU2_CFD/include/numerics/flow/convection/roe.hpp +++ b/SU2_CFD/include/numerics/flow/convection/roe.hpp @@ -45,6 +45,7 @@ class CUpwRoeBase_Flow : public CNumerics { su2double *ProjFlux_j = nullptr, *Conservatives_j = nullptr; su2double **P_Tensor = nullptr, **invP_Tensor = nullptr; su2double RoeDensity, RoeEnthalpy, RoeSoundSpeed, ProjVelocity, RoeSoundSpeed2, kappa; + su2double RoeTke = 0.0; /*!< \brief Roe-averaged k (SST, contained in the total energy). */ su2double* Flux = nullptr; /*!< \brief The flux accross the face. */ su2double** Jacobian_i = nullptr; /*!< \brief The Jacobian w.r.t. point i after computation. */ diff --git a/SU2_CFD/include/numerics/flow/flow_sources.hpp b/SU2_CFD/include/numerics/flow/flow_sources.hpp index d83b20aa6fad..50bd8a77914c 100644 --- a/SU2_CFD/include/numerics/flow/flow_sources.hpp +++ b/SU2_CFD/include/numerics/flow/flow_sources.hpp @@ -72,7 +72,8 @@ class CSourceBase_Flow : public CNumerics { */ class CSourceAxisymmetric_Flow : public CSourceBase_Flow { protected: - bool implicit, viscous, rans; + bool implicit, viscous; + bool tkeInEnergy; /*!< \brief SST: k is part of the total energy (turb_ke_i is set by the solver). */ su2double yinv{0.0}; /*! diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index c6140d922ad9..9f73f9cdd90f 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -939,33 +939,27 @@ class CSourcePieceWise_TurbSST final : public CNumerics { P_Base = sqrt(StrainMag_i*VorticityMag); break; - case SST_OPTIONS::COMP_Wilcox: - P_Base = StrainMag_i; - if (Mt >= 0.25) { - zetaFMt = 2.0 * (Mt * Mt - 0.25 * 0.25); - } - break; - - case SST_OPTIONS::COMP_Sarkar: - P_Base = StrainMag_i; - if (Mt >= 0.25) { - zetaFMt = 0.5 * (Mt * Mt); - } - break; - default: /*--- Base production term for SST-1994 and SST-2003 ---*/ P_Base = StrainMag_i; break; } + /*--- Compressibility corrections, independent of the production modifier. ---*/ + if (sstParsedOptions.compWilcox && Mt >= 0.25) { + zetaFMt = 2.0 * (Mt * Mt - 0.25 * 0.25); + } + if (sstParsedOptions.compSarkar && Mt >= 0.25) { + zetaFMt = 0.5 * (Mt * Mt); + } + /*--- Production limiter. ---*/ const su2double prod_limit = prod_lim_const * beta_star * Density_i * ScalarVar_i[1] * ScalarVar_i[0]; su2double P = Eddy_Viscosity_i * pow(P_Base, 2); su2double pk = max(0.0, min(P, prod_limit)); - const auto& eddy_visc_var = sstParsedOptions.version == SST_OPTIONS::V1994 ? VorticityMag : StrainMag_i; + const su2double eddy_visc_var = sstParsedOptions.version == SST_OPTIONS::V1994 ? VorticityMag : StrainMag_i; const su2double zeta = max(ScalarVar_i[1], eddy_visc_var * F2_i / a1); /*--- Production limiter only for V2003, recompute for V1994. ---*/ @@ -989,7 +983,7 @@ class CSourcePieceWise_TurbSST final : public CNumerics { pw = max(pw, sust_w); } - if (sstParsedOptions.production == SST_OPTIONS::COMP_Sarkar) { + if (sstParsedOptions.compSarkar) { 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; pk += Dilatation_Sarkar; } @@ -997,7 +991,7 @@ class CSourcePieceWise_TurbSST final : public CNumerics { /*--- Dissipation ---*/ su2double dk = beta_star * Density_i * ScalarVar_i[1] * ScalarVar_i[0] * (1.0 + zetaFMt); - 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 * ScalarVar_i[1] * ScalarVar_i[1] * (1.0 - beta_star/beta_blended * zetaFMt); /*--- LM model coupling with production and dissipation term for k transport equation---*/ if (config->GetKind_Trans_Model() == TURB_TRANS_MODEL::LM) { @@ -1022,7 +1016,8 @@ 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); 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); + Jacobian_i[1][1] = -2.0 * beta_blended * ScalarVar_i[1] * Volume * (1.0 - beta_star/beta_blended * zetaFMt); + /*--- Contribution due to 2D axisymmetric formulation, after the implicit part since it * adds to the Jacobian (which the assignments above would otherwise overwrite). ---*/ diff --git a/SU2_CFD/include/numerics_simd/flow/convection/centered.hpp b/SU2_CFD/include/numerics_simd/flow/convection/centered.hpp index 0affa4940544..2198e3ce2a28 100644 --- a/SU2_CFD/include/numerics_simd/flow/convection/centered.hpp +++ b/SU2_CFD/include/numerics_simd/flow/convection/centered.hpp @@ -52,15 +52,21 @@ class CCenteredBase : public Base { const su2double fixFactor; const bool dynamicGrid; const su2double stretchParam = 0.3; + const CVariable* const tkeVars; /*!< \brief SST turbulence variables (k is part of the total energy), else nullptr. */ /*! * \brief Constructor, store some constants and forward args to base. */ - template - CCenteredBase(const CConfig& config, Ts&... args) : Base(config, args...), - gamma(config.GetGamma()), - fixFactor(config.GetCent_Jac_Fix_Factor()), - dynamicGrid(config.GetDynamic_Grid()) { + template + CCenteredBase(const CConfig& config, Ts&... args) + : Base(config, args...), + gamma(config.GetGamma()), + fixFactor(config.GetCent_Jac_Fix_Factor()), + dynamicGrid(config.GetDynamic_Grid()), + tkeVars(config.GetKind_Turb_Model() == TURB_MODEL::SST ? findTurbVars(args...) : nullptr) {} + + FORCEINLINE Double getTke(const Int& point) const { + return tkeVars ? gatherVariables(point, tkeVars->GetSolution()) : Double(0.0); } /*! @@ -140,8 +146,14 @@ class CCenteredBase : public Base { MatrixDbl jac_i, jac_j; if (implicit) { - jac_i = inviscidProjJac(gamma, V.i.velocity(), U.i.energy(), normal, 0.5); - jac_j = inviscidProjJac(gamma, V.j.velocity(), U.j.energy(), normal, 0.5); + /*--- With SST the total energy contains k, held fixed in the Jacobian. ---*/ + Double tke_i = 0.0, tke_j = 0.0; + if (tkeVars) { + tke_i = gatherVariables(iPoint, tkeVars->GetSolution()); + tke_j = gatherVariables(jPoint, tkeVars->GetSolution()); + } + jac_i = inviscidProjJac(gamma, V.i.velocity(), U.i.energy(), normal, 0.5, tke_i); + jac_j = inviscidProjJac(gamma, V.j.velocity(), U.j.energy(), normal, 0.5, tke_j); } /*--- Grid motion. ---*/ @@ -262,10 +274,10 @@ class CJSTScheme : public CCenteredBase,Decorator> { } if (implicit) { - const Double dissip_i = fixFactor * (eps2 + eps4*(ni+1)) * lambda; - const Double dissip_j = -fixFactor * (eps2 + eps4*(nj+1)) * lambda; - scalarDissipationJacobian(V.i, gamma, dissip_i, jac_i); - scalarDissipationJacobian(V.j, gamma, dissip_j, jac_j); + const Double dissip_i = fixFactor * (eps2 + eps4 * (ni + 1)) * lambda; + const Double dissip_j = -fixFactor * (eps2 + eps4 * (nj + 1)) * lambda; + scalarDissipationJacobian(V.i, gamma, dissip_i, jac_i, Base::getTke(iPoint)); + scalarDissipationJacobian(V.j, gamma, dissip_j, jac_j, Base::getTke(jPoint)); } } }; @@ -283,6 +295,7 @@ class CJSTmatScheme : public CCenteredBase,Decorator> { using Base::nVar; using Base::gamma; using Base::fixFactor; + using Base::tkeVars; const su2double kappa2; const su2double kappa4; const su2double entropyFix; @@ -336,25 +349,39 @@ class CJSTmatScheme : public CCenteredBase,Decorator> { VectorDbl scalarDissip; for (size_t iVar = 0; iVar < nVar; ++iVar) { - scalarDissip(iVar) = eps2*diffU(iVar) - eps4*(lapl_i(iVar)-lapl_j(iVar)); + scalarDissip(iVar) = eps2 * diffU(iVar) - eps4 * (lapl_i(iVar) - lapl_j(iVar)); } + Double tke_i = 0.0, tke_j = 0.0; + if (tkeVars) { + tke_i = gatherVariables(iPoint, tkeVars->GetSolution()); + tke_j = gatherVariables(jPoint, tkeVars->GetSolution()); + } + const Double avgTke = 0.5 * (tke_i + tke_j); + MatrixDbl scalarJac; if (implicit) { scalarJac = Double(0.0); - Double factor = fixFactor * (eps2 + 0.5*eps4*(ni+nj+2)); - scalarDissipationJacobian(avgV, gamma, factor, scalarJac); + Double factor = fixFactor * (eps2 + 0.5 * eps4 * (ni + nj + 2)); + scalarDissipationJacobian(avgV, gamma, factor, scalarJac, avgTke); } /*--- Compute matrix dissipation terms. ---*/ const auto unitProjVel = dot(avgV.velocity(), unitNormal); - auto pMat = pMatrix(gamma, avgV.density(), avgV.velocity(), - unitProjVel, avgV.speedSound(), unitNormal); + // Remove changes in k before acoustic projection, including the fourth-order term. + Double rhoDeltaTke = eps2 * avgV.density() * (tke_i - tke_j); + if (tkeVars) { + const auto lapK_i = gatherVariables(iPoint, solution.GetUndivided_Laplacian(), nVar); + const auto lapK_j = gatherVariables(jPoint, solution.GetUndivided_Laplacian(), nVar); + rhoDeltaTke -= eps4 * (lapK_i - lapK_j - avgTke * (lapl_i(0) - lapl_j(0))); + } + scalarDissip(nVar - 1) -= rhoDeltaTke; + auto pMat = pMatrix(gamma, avgV.density(), avgV.velocity(), unitProjVel, avgV.speedSound(), unitNormal, avgTke); auto pMatInv = pMatrixInv(gamma, avgV.density(), avgV.velocity(), - unitProjVel, avgV.speedSound(), unitNormal); + unitProjVel, avgV.speedSound(), unitNormal, avgTke); /*--- Compute limited absolute eigenvalues (times area). ---*/ @@ -394,6 +421,7 @@ class CJSTmatScheme : public CCenteredBase,Decorator> { } } } + flux(nVar-1) += lambda(0) * rhoDeltaTke; } }; @@ -462,8 +490,8 @@ class CJSTkeScheme : public CCenteredBase,Decorator> { } if (implicit) { - scalarDissipationJacobian(V.i, gamma, fixFactor*dissip, jac_i); - scalarDissipationJacobian(V.j, gamma, -fixFactor*dissip, jac_j); + scalarDissipationJacobian(V.i, gamma, fixFactor * dissip, jac_i, Base::getTke(iPoint)); + scalarDissipationJacobian(V.j, gamma, -fixFactor * dissip, jac_j, Base::getTke(jPoint)); } } }; @@ -529,8 +557,8 @@ class CLaxScheme : public CCenteredBase,Decorator> { } if (implicit) { - scalarDissipationJacobian(V.i, gamma, fixFactor*dissip, jac_i); - scalarDissipationJacobian(V.j, gamma, -fixFactor*dissip, jac_j); + scalarDissipationJacobian(V.i, gamma, fixFactor * dissip, jac_i, Base::getTke(iPoint)); + scalarDissipationJacobian(V.j, gamma, -fixFactor * dissip, jac_j, Base::getTke(jPoint)); } } }; diff --git a/SU2_CFD/include/numerics_simd/flow/convection/common.hpp b/SU2_CFD/include/numerics_simd/flow/convection/common.hpp index 1e97735ef7e2..13fcd5fc13de 100644 --- a/SU2_CFD/include/numerics_simd/flow/convection/common.hpp +++ b/SU2_CFD/include/numerics_simd/flow/convection/common.hpp @@ -60,7 +60,9 @@ FORCEINLINE CPair reconstructPrimitives(const Int& iEdge, const CPair& V1st, const VectorDbl& vector_ij, const VariableType& solution, - Double& nonPhysical) { + Double& nonPhysical, + const Double& tke_i = Double(0.0), + const Double& tke_j = Double(0.0)) { static_assert(ReconVarType::nVar <= PrimVarType::nVar); const auto& gradients = solution.GetGradient_Reconstruction(); @@ -101,7 +103,7 @@ FORCEINLINE CPair reconstructPrimitives(const Int& iEdge, /*--- Test the sign of the Roe-averaged speed of sound. ---*/ const Double R = sqrt(abs(V.j.density() / V.i.density())); /*--- Delay dividing by R+1 until comparing enthalpy and velocity magnitude. ---*/ - const Double enthalpy = R*V.j.enthalpy() + V.i.enthalpy(); + const Double enthalpy = R*(V.j.enthalpy() - tke_j) + V.i.enthalpy() - tke_i; Double v_squared = 0.0; for (size_t iDim = 0; iDim < nDim; ++iDim) { v_squared += pow(R*V.j.velocity(iDim) + V.i.velocity(iDim), 2); @@ -134,9 +136,11 @@ FORCEINLINE CPair reconstructPrimitives(const Int& iEdge, */ template FORCEINLINE MatrixDbl pMatrix(const Double& gamma, const Double& density, const RandomAccessIterator& velocity, - const Double& projVel, const Double& speedSound, const VectorDbl& normal) { + const Double& projVel, const Double& speedSound, const VectorDbl& normal, + const Double& tke = Double(0.0)) { MatrixDbl pMat; - const Double vel2 = 0.5*squaredNorm(velocity); + /*--- With SST the total energy contains k (tke). ---*/ + const Double vel2 = 0.5*squaredNorm(velocity) + tke; if (nDim == 2) { pMat(0,0) = 1.0; @@ -197,11 +201,13 @@ FORCEINLINE MatrixDbl pMatrix(const Double& gamma, const Double& density template FORCEINLINE MatrixDbl pMatrixInv(const Double& gamma, const Double& density, const RandomAccessIterator& velocity, const Double& projVel, - const Double& speedSound, const VectorDbl& normal) { + const Double& speedSound, const VectorDbl& normal, + const Double& tke = Double(0.0)) { MatrixDbl pMatInv; const Double c2 = pow(speedSound,2); - const Double vel2 = 0.5*squaredNorm(velocity); + /*--- With SST the total energy contains k (tke), dp/drho = (gamma-1) (|u|^2/2 - k). ---*/ + const Double vel2 = 0.5*squaredNorm(velocity) - tke; const Double oneOnRho = 1 / density; if (nDim == 2) { @@ -273,19 +279,30 @@ FORCEINLINE VectorDbl inviscidProjFlux(const PrimVarType& V, return flux; } +/*! + * \brief Turbulence variables among the constructor arguments of a scheme (nullptr if there are none). + */ +inline const CVariable* findTurbVars() { return nullptr; } +template +const CVariable* findTurbVars(T& first, Ts&... rest) { + if constexpr (std::is_convertible::value) return first; + else return findTurbVars(rest...); +} + /*! * \brief Jacobian of the convective flux (compressible flow, ideal gas). + * \note With SST the total energy contains k (tke), which is held fixed. */ template FORCEINLINE MatrixDbl inviscidProjJac(const Double& gamma, RandomAccessIterator velocity, const Double& energy, const VectorDbl& normal, - const Double& scale) { + const Double& scale, const Double& tke = Double(0.0)) { MatrixDbl jac; Double projVel = dot(velocity, normal); Double gamma_m_1 = gamma-1; - Double phi = 0.5*gamma_m_1*squaredNorm(velocity); - Double a1 = gamma*energy - phi; + Double phi = gamma_m_1*(0.5*squaredNorm(velocity) - tke); // dp/drho, k held fixed + Double a1 = gamma*energy - gamma_m_1*(0.5*squaredNorm(velocity) + tke); // total enthalpy jac(0,0) = 0.0; for (size_t iDim = 0; iDim < nDim; ++iDim) { @@ -385,21 +402,20 @@ FORCEINLINE Double correctedSpectralRadius(const Int& iPoint, /*! * \brief Update of a flux Jacobian due to a scalar dissipation term. */ -template -FORCEINLINE void scalarDissipationJacobian(const VariableType& V, - const Double& gamma, - Double dissipConst, - MatrixDbl& jac) { +template +FORCEINLINE void scalarDissipationJacobian(const VariableType& V, const Double& gamma, Double dissipConst, + MatrixDbl& jac, const Double& tke = Double(0.0)) { /*--- Diagonal entries. ---*/ - for (size_t iVar = 0; iVar < nVar-1; ++iVar) { - jac(iVar,iVar) += dissipConst; + for (size_t iVar = 0; iVar < nVar - 1; ++iVar) { + jac(iVar, iVar) += dissipConst; } - jac(nVar-1,nVar-1) += dissipConst * gamma; + jac(nVar - 1, nVar - 1) += dissipConst * gamma; + jac(nVar - 1, 0) -= dissipConst * (gamma - 1.0) * tke; /*--- N-1 columns of last row. ---*/ - dissipConst *= gamma-1.0; + dissipConst *= gamma - 1.0; for (size_t iDim = 0; iDim < VariableType::nDim; ++iDim) { - jac(nVar-1,iDim+1) -= dissipConst * V.velocity(iDim); - jac(nVar-1,0) += dissipConst * pow(V.velocity(iDim), 2); + jac(nVar - 1, iDim + 1) -= dissipConst * V.velocity(iDim); + jac(nVar - 1, 0) += 0.5 * dissipConst * pow(V.velocity(iDim), 2); } } diff --git a/SU2_CFD/include/numerics_simd/flow/convection/upwind.hpp b/SU2_CFD/include/numerics_simd/flow/convection/upwind.hpp index f4cb098028d6..65227e35bc3e 100644 --- a/SU2_CFD/include/numerics_simd/flow/convection/upwind.hpp +++ b/SU2_CFD/include/numerics_simd/flow/convection/upwind.hpp @@ -61,6 +61,7 @@ class CUpwindBase : public Base { const bool muscl; const su2double umusclKappa; const LIMITER typeLimiter; + const CVariable* const tkeVars; /*!< \brief SST turbulence variables (k is part of the total energy), else nullptr. */ /*! * \brief Constructor, store some constants and forward args to base. @@ -73,7 +74,8 @@ class CUpwindBase : public Base { dynamicGrid(config.GetDynamic_Grid()), muscl(finestGrid && config.GetMUSCL_Flow()), umusclKappa(config.GetMUSCL_Kappa_Flow()), - typeLimiter(config.GetKind_SlopeLimit_Flow()) { + typeLimiter(config.GetKind_SlopeLimit_Flow()), + tkeVars(config.GetKind_Turb_Model() == TURB_MODEL::SST ? findTurbVars(args...) : nullptr) { } public: @@ -119,10 +121,15 @@ class CUpwindBase : public Base { V1st.j.all = gatherVariables(jPoint, solution.GetPrimitive()); /*--- Recompute density and enthalpy instead of reconstructing. ---*/ + Double tke_i = 0.0, tke_j = 0.0; + if (tkeVars) { + tke_i = gatherVariables(iPoint, tkeVars->GetSolution()); + tke_j = gatherVariables(jPoint, tkeVars->GetSolution()); + } Double nonPhysical; auto V = reconstructPrimitives >( iEdge, iPoint, jPoint, gamma, gasConst, muscl, umusclKappa, umusclRamp, - typeLimiter, V1st, vector_ij, solution, nonPhysical); + typeLimiter, V1st, vector_ij, solution, nonPhysical, tke_i, tke_j); /*--- Compute conservative variables. ---*/ @@ -178,6 +185,7 @@ class CRoeScheme : public CUpwindBase, Decorator> { using Base::gamma; using Base::gasConst; using Base::dynamicGrid; + using Base::tkeVars; public: /*! @@ -190,6 +198,7 @@ class CRoeScheme : public CUpwindBase, Decorator> { typeDissip(static_cast(config.GetKind_RoeLowDiss())) { } + /*! * \brief Updates flux and Jacobians with standard Roe dissipation. * \note "Ts" is here just in case other schemes in the family need extra args. @@ -210,9 +219,14 @@ class CRoeScheme : public CUpwindBase, Decorator> { const CEulerVariable& solution, const CGeometry& geometry, Ts&...) const { - /*--- Roe averaged variables. ---*/ + /*--- Roe averaged variables. With SST the total enthalpy of the cells contains k. ---*/ - auto roeAvg = roeAveragedVariables(gamma, V, unitNormal); + Double tke_i = 0.0, tke_j = 0.0; + if (tkeVars) { + tke_i = gatherVariables(iPoint, tkeVars->GetSolution()); + tke_j = gatherVariables(jPoint, tkeVars->GetSolution()); + } + auto roeAvg = roeAveragedVariables(gamma, V, unitNormal, tke_i, tke_j); /*--- Grid motion. ---*/ @@ -249,8 +263,8 @@ class CRoeScheme : public CUpwindBase, Decorator> { flux(iVar) = 0.5 * (flux_i(iVar) + flux_j(iVar)); } if (implicit) { - jac_i = inviscidProjJac(gamma, V.i.velocity(), U.i.energy(), normal, kappa); - jac_j = inviscidProjJac(gamma, V.j.velocity(), U.j.energy(), normal, kappa); + jac_i = inviscidProjJac(gamma, V.i.velocity(), U.i.energy(), normal, kappa, tke_i); + jac_j = inviscidProjJac(gamma, V.j.velocity(), U.j.energy(), normal, kappa, tke_j); } /*--- Correct for grid motion. ---*/ @@ -270,12 +284,12 @@ class CRoeScheme : public CUpwindBase, Decorator> { /*--- P tensor. ---*/ auto pMat = pMatrix(gamma, roeAvg.density, roeAvg.velocity, - roeAvg.projVel, roeAvg.speedSound, unitNormal); + roeAvg.projVel, roeAvg.speedSound, unitNormal, roeAvg.tke); /*--- Inverse P tensor. ---*/ auto pMatInv = pMatrixInv(gamma, roeAvg.density, roeAvg.velocity, - roeAvg.projVel, roeAvg.speedSound, unitNormal); + roeAvg.projVel, roeAvg.speedSound, unitNormal, roeAvg.tke); /*--- Diference between conservative variables at jPoint and iPoint. ---*/ @@ -284,6 +298,11 @@ class CRoeScheme : public CUpwindBase, Decorator> { deltaU(iVar) = U.j.all(iVar) - U.i.all(iVar); } + /*--- With SST rho*E contains rho*k, and Delta(rho k) = rho_roe Delta k + k_roe Delta rho. The part with Delta k + is not a pressure jump: remove it before the projection and advect it with the contact wave. ---*/ + const Double rhoDeltaTke = roeAvg.density * (tke_j - tke_i); + deltaU(nVar-1) -= rhoDeltaTke; + /*--- Dissipation terms. ---*/ Double dissipation = roeDissipation(iPoint, jPoint, typeDissip, solution); @@ -309,6 +328,7 @@ class CRoeScheme : public CUpwindBase, Decorator> { } } } + flux(nVar-1) -= (1-kappa) * area * dissipation * lambda(0) * rhoDeltaTke; } }; @@ -330,6 +350,7 @@ class CMSWScheme : public CUpwindBase, Decorator> { using Base::gamma; using Base::gasConst; using Base::dynamicGrid; + using Base::tkeVars; public: /*! @@ -397,10 +418,16 @@ class CMSWScheme : public CUpwindBase, Decorator> { lambda(nDim) = fmax(projVel_i + soundSpeed_i, 0); lambda(nDim+1) = fmax(projVel_i - soundSpeed_i, 0); + /*--- With SST the total energy contains k, taken from the cells. ---*/ + Double tke_i = 0.0, tke_j = 0.0; + if (tkeVars) { + tke_i = gatherVariables(iPoint, tkeVars->GetSolution()); + tke_j = gatherVariables(jPoint, tkeVars->GetSolution()); + } auto pMat = pMatrix(gamma, Vweighted.i.density(), Vweighted.i.velocity(), - projVel_i, soundSpeed_i, unitNormal); + projVel_i, soundSpeed_i, unitNormal, tke_i); auto pMatInv = pMatrixInv(gamma, Vweighted.i.density(), Vweighted.i.velocity(), - projVel_i, soundSpeed_i, unitNormal); + projVel_i, soundSpeed_i, unitNormal, tke_i); auto updateFlux = [&](const auto& u, auto& jac) { for (size_t iVar = 0; iVar < nVar; ++iVar) { @@ -429,9 +456,9 @@ class CMSWScheme : public CUpwindBase, Decorator> { lambda(nDim+1) = fmin(projVel_j - soundSpeed_j, 0); pMat = pMatrix(gamma, Vweighted.j.density(), Vweighted.j.velocity(), - projVel_j, soundSpeed_j, unitNormal); + projVel_j, soundSpeed_j, unitNormal, tke_j); pMatInv = pMatrixInv(gamma, Vweighted.j.density(), Vweighted.j.velocity(), - projVel_j, soundSpeed_j, unitNormal); + projVel_j, soundSpeed_j, unitNormal, tke_j); updateFlux(U.j.all, jac_j); } }; diff --git a/SU2_CFD/include/numerics_simd/flow/diffusion/viscous_fluxes.hpp b/SU2_CFD/include/numerics_simd/flow/diffusion/viscous_fluxes.hpp index fa2b90d3d592..6e5d73bb9e1d 100644 --- a/SU2_CFD/include/numerics_simd/flow/diffusion/viscous_fluxes.hpp +++ b/SU2_CFD/include/numerics_simd/flow/diffusion/viscous_fluxes.hpp @@ -80,6 +80,7 @@ class CCompressibleViscousFluxBase : public CNumericsSIMD { const bool useSA_QCR; const bool wallFun; const bool uq; + const bool tkeInEnergy; const bool uq_permute; const size_t uq_eigval_comp; const su2double uq_delta_b; @@ -90,22 +91,21 @@ class CCompressibleViscousFluxBase : public CNumericsSIMD { /*! * \brief Constructor, initialize constants and booleans. */ - template - CCompressibleViscousFluxBase(const CConfig& config, int iMesh, - const CVariable* turbVars_, Ts&...) : - gamma(config.GetGamma()), - gasConst(config.GetGas_ConstantND()), - prandtlTurb(config.GetPrandtl_Turb()), - correct(iMesh == MESH_0), - useSA_QCR(config.GetSAParsedOptions().qcr2000), - wallFun(config.GetWall_Functions()), - uq(config.GetSSTParsedOptions().uq), - uq_permute(config.GetUQ_Permute()), - uq_eigval_comp(config.GetEig_Val_Comp()), - uq_delta_b(config.GetUQ_Delta_B()), - uq_urlx(config.GetUQ_URLX()), - turbVars(turbVars_) { - } + template + CCompressibleViscousFluxBase(const CConfig& config, int iMesh, const CVariable* turbVars_, Ts&...) + : gamma(config.GetGamma()), + gasConst(config.GetGas_ConstantND()), + prandtlTurb(config.GetPrandtl_Turb()), + correct(iMesh == MESH_0), + useSA_QCR(config.GetSAParsedOptions().qcr2000), + wallFun(config.GetWall_Functions()), + uq(config.GetSSTParsedOptions().uq), + tkeInEnergy(config.GetKind_Turb_Model() == TURB_MODEL::SST), + uq_permute(config.GetUQ_Permute()), + uq_eigval_comp(config.GetEig_Val_Comp()), + uq_delta_b(config.GetUQ_Delta_B()), + uq_urlx(config.GetUQ_URLX()), + turbVars(turbVars_) {} /*! * \brief Add viscous contributions to flux and jacobians. @@ -276,16 +276,17 @@ class CCompressibleViscousFlux : public CCompressibleViscousFluxBase - FORCEINLINE VectorDbl energyJacobian(const PrimitiveType& V, - const MatrixDbl& dtau, - const Double& thermalCond, - const Double& area, - const Double& dist_ij, - Ts&... args) const { + template + FORCEINLINE VectorDbl energyJacobian(const PrimitiveType& V, const MatrixDbl& dtau, + const Double& thermalCond, const Double& area, const Double& dist_ij, + const Int& iPoint, const Int& jPoint, const VariableType&) const { Double vel2 = 0.5 * squaredNorm(V.velocity()); - Double phi = (gamma-1) / V.density(); - Double RdTdrho = phi*vel2 - V.pressure() / pow(V.density(),2); + Double phi = (gamma - 1) / V.density(); + Double tke = 0.0; + if (this->tkeInEnergy) + tke = 0.5 * (gatherVariables(iPoint, this->turbVars->GetSolution()) + + gatherVariables(jPoint, this->turbVars->GetSolution())); + Double RdTdrho = phi * (vel2 - tke) - V.pressure() / pow(V.density(), 2); Double condOnRd = thermalCond / (gasConst * dist_ij); Double contraction = 0.0; for (size_t iDim = 0; iDim < nDim; ++iDim) { diff --git a/SU2_CFD/include/numerics_simd/flow/variables.hpp b/SU2_CFD/include/numerics_simd/flow/variables.hpp index ce929ffab774..03341878b126 100644 --- a/SU2_CFD/include/numerics_simd/flow/variables.hpp +++ b/SU2_CFD/include/numerics_simd/flow/variables.hpp @@ -107,15 +107,19 @@ struct CRoeVariables { Double enthalpy; Double speedSound; Double projVel; + Double tke; /*!< \brief Roe-averaged k (SST, part of the total enthalpy). */ }; /*! * \brief Compute Roe-averaged variables from pair of primitive variables. + * \note With SST the total enthalpy contains k (tke_i, tke_j), which is not part of the speed of sound. */ template FORCEINLINE CRoeVariables roeAveragedVariables(const Double& gamma, const CPair& V, - const VectorDbl& normal) { + const VectorDbl& normal, + const Double& tke_i = Double(0.0), + const Double& tke_j = Double(0.0)) { CRoeVariables roeAvg; Double R = sqrt(V.j.density() / V.i.density()); Double D = 1 / (R+1); @@ -124,7 +128,8 @@ FORCEINLINE CRoeVariables roeAveragedVariables(const Double& gamma, roeAvg.velocity(iDim) = (R*V.j.velocity(iDim) + V.i.velocity(iDim)) * D; } roeAvg.enthalpy = (R*V.j.enthalpy() + V.i.enthalpy()) * D; - roeAvg.speedSound = sqrt((gamma-1) * (roeAvg.enthalpy - 0.5*squaredNorm(roeAvg.velocity))); + roeAvg.tke = (R*tke_j + tke_i) * D; + roeAvg.speedSound = sqrt((gamma-1) * (roeAvg.enthalpy - 0.5*squaredNorm(roeAvg.velocity) - roeAvg.tke)); roeAvg.projVel = dot(roeAvg.velocity, normal); return roeAvg; } diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index bb426fb321cd..f958c3759588 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -419,11 +419,13 @@ class CEulerSolver : public CFVMFlowSolverBase::ComputeVerificationError(CGeometry* geometry, CCo } template -void CFVMFlowSolverBase::CompleteImplicitIteration(CGeometry *geometry, CSolver**, CConfig *config) { +void CFVMFlowSolverBase::CompleteImplicitIteration(CGeometry *geometry, CSolver** solver_container, CConfig *config) { SU2_ZONE_SCOPED - if constexpr (R == ENUM_REGIME::COMPRESSIBLE) ComputeUnderRelaxationFactor(config); + if constexpr (R == ENUM_REGIME::COMPRESSIBLE) ComputeUnderRelaxationFactor(config, solver_container); /*--- Update solution with under-relaxation and communicate it. ---*/ @@ -615,10 +615,10 @@ void CFVMFlowSolverBase::CompleteImplicitIteration(CGeometry *geometry, CS } template -void CFVMFlowSolverBase::ImplicitEuler_Iteration(CGeometry *geometry, CSolver**, CConfig *config) { +void CFVMFlowSolverBase::ImplicitEuler_Iteration(CGeometry *geometry, CSolver** solver_container, CConfig *config) { SU2_ZONE_SCOPED - PrepareImplicitIteration(geometry, nullptr, config); + PrepareImplicitIteration(geometry, solver_container, config); /*--- Solve or smooth the linear system. ---*/ @@ -637,7 +637,7 @@ void CFVMFlowSolverBase::ImplicitEuler_Iteration(CGeometry *geometry, CSol } END_SU2_OMP_SAFE_GLOBAL_ACCESS - CompleteImplicitIteration(geometry, nullptr, config); + CompleteImplicitIteration(geometry, solver_container, config); } template @@ -1155,6 +1155,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve const bool ideal_gas = (config->GetKind_FluidModel() == STANDARD_AIR) || (config->GetKind_FluidModel() == IDEAL_GAS); const auto iVel = prim_idx.Velocity(); + const bool compressibleProjection = FlowRegime == ENUM_REGIME::COMPRESSIBLE && iVel == 1 && nVar == nDim + 2; /*--- Blazek chapter 8.: * The components of the momentum residual normal to the symmetry plane are zeroed out. @@ -1184,8 +1185,8 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; } - /*--- Energy terms due to grid movement (aka work of pressure forces). ---*/ - if (dynamic_grid) { + /*--- The classical compressible projection below already supplies wall pressure work. ---*/ + if (dynamic_grid && !compressibleProjection) { su2double* V_reflected = GetCharacPrimVar(val_marker, iVertex); conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), @@ -1217,8 +1218,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve /*--- Compute the residual using an upwind scheme. ---*/ auto residual = conv_numerics->ComputeResidual(config); - /*--- Use just the energy fluxes to update the residual, adding the others would - * increase numerical diffusion which we wish to avoid if possible. ---*/ + /*--- Energy fluxes for the other conservative layouts. ---*/ for (auto iVar = iVel + nDim; iVar < nVar; iVar++) { LinSysRes(iPoint, iVar) += residual.residual[iVar]; } @@ -1243,14 +1243,16 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve su2double* solutionOld = nodes->GetSolution_Old(iPoint); su2double gridVel[MAXNDIM] = {}; + su2double gridNormalVel = 0.0; if (dynamic_grid) { for (auto iDim = 0u; iDim < nDim; iDim++) { gridVel[iDim] = geometry->nodes->GetGridVel(iPoint)[iDim]; } + gridNormalVel = GeometryToolbox::DotProduct(nDim, gridVel, UnitNormal); if (FlowRegime == ENUM_REGIME::COMPRESSIBLE) { for(auto iDim = 0u; iDim < nDim; iDim++) { /*--- Multiply by density since we are correcting conservative variables. ---*/ - gridVel[iDim] *= nodes->GetDensity(iPoint); + gridVel[iDim] *= compressibleProjection ? solutionOld[0] : nodes->GetDensity(iPoint); } } } @@ -1261,20 +1263,27 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve for (auto iDim = 0u; iDim < nDim; iDim++) { solutionOld[iVel + iDim] -= vp * UnitNormal[iDim]; } + if (compressibleProjection) { + solutionOld[iVel + nDim] -= gridNormalVel * vp; + } /*--- Keep only the tangential part of the momentum residuals. ---*/ su2double normalRes = 0.0; for (auto iDim = 0u; iDim < nDim; iDim++) { normalRes += LinSysRes(iPoint, iVel + iDim) * UnitNormal[iDim]; } + if (compressibleProjection) { + /*--- Project in the wall frame: normal momentum follows density, with consistent pressure work. ---*/ + normalRes -= gridNormalVel * LinSysRes(iPoint, 0); + LinSysRes(iPoint, iVel + nDim) -= gridNormalVel * normalRes; + } for (auto iDim = 0u; iDim < nDim; iDim++) { LinSysRes(iPoint, iVel + iDim) -= normalRes * UnitNormal[iDim]; } /*--- Jacobian contribution for implicit integration. ---*/ if (implicit) { - /*--- Modify the Jacobians according to the modification of the residual - * J_new = (I - n * n^T) * J where n = {0, nx, ny, nz, 0, ...} ---*/ + /*--- Apply the same wall-frame projection to the Jacobians. ---*/ su2double mat[MAXNVAR * MAXNVAR] = {}; for (auto iVar = 0u; iVar < nVar; iVar++) @@ -1282,6 +1291,13 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve for (auto iDim = 0u; iDim < nDim; iDim++) for (auto jDim = 0u; jDim < nDim; jDim++) mat[(iDim + iVel) * nVar + jDim + iVel] -= UnitNormal[iDim] * UnitNormal[jDim]; + if (compressibleProjection) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + mat[(iDim + iVel) * nVar] += gridNormalVel * UnitNormal[iDim]; + mat[(iVel + nDim) * nVar + iVel + iDim] -= gridNormalVel * UnitNormal[iDim]; + } + mat[(iVel + nDim) * nVar] += gridNormalVel * gridNormalVel; + } auto ModifyJacobian = [&](const unsigned long jPoint) { su2double jac[MAXNVAR * MAXNVAR], newJac[MAXNVAR * MAXNVAR]; @@ -1306,6 +1322,10 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve for (auto iDim = 0u; iDim < nDim; iDim++) { normalRes += Res_TruncError[iVel + iDim] * UnitNormal[iDim]; } + if (compressibleProjection) { + normalRes -= gridNormalVel * Res_TruncError[0]; + Res_TruncError[iVel + nDim] -= gridNormalVel * normalRes; + } for (auto iDim = 0u; iDim < nDim; iDim++) { Res_TruncError[iVel + iDim] -= normalRes * UnitNormal[iDim]; } @@ -1389,6 +1409,11 @@ void CFVMFlowSolverBase::BC_Fluid_Interface(CGeometry* geometry, /*--- Set primitive variables ---*/ conv_numerics->SetPrimitive(PrimVar_i, PrimVar_j); + if (FlowRegime == ENUM_REGIME::COMPRESSIBLE && config->GetKind_Turb_Model() == TURB_MODEL::SST) { + const auto* turb = solver_container[TURB_SOL]; + conv_numerics->SetTurbKineticEnergy(turb->GetNodes()->GetSolution(iPoint, 0), + turb->GetSlidingState(iMarker, iVertex, 0, jVertex)); + } if (FlowRegime == ENUM_REGIME::COMPRESSIBLE && !ideal_gas) { P_static = PrimVar_j[nDim + 1]; @@ -2974,6 +2999,7 @@ void CFVMFlowSolverBase::MultigridProjectEulerWall(CGeometry* geo bool use_solution_old) { const auto iVel = prim_idx.Velocity(); const auto nDim = geometry->GetnDim(); + const bool compressibleProjection = FlowRegime == ENUM_REGIME::COMPRESSIBLE && iVel == 1 && nVar == nDim + 2; for (auto iMarker = 0u; iMarker < config->GetnMarker_All(); iMarker++) { if (config->GetMarker_All_KindBC(iMarker) != EULER_WALL) continue; @@ -3004,12 +3030,15 @@ void CFVMFlowSolverBase::MultigridProjectEulerWall(CGeometry* geo * For dynamic grids subtract the grid velocity to enforce (v - v_grid).n = 0, * multiplying by density for compressible flow (conservative variables). ---*/ su2double gridVel[MAXNDIM] = {}; - if (dynamic_grid && !use_solution_old) { + su2double gridNormalVel = 0.0; + if (dynamic_grid && (compressibleProjection || !use_solution_old)) { for (auto iDim = 0u; iDim < nDim; iDim++) gridVel[iDim] = geometry->nodes->GetGridVel(iPoint)[iDim]; + gridNormalVel = GeometryToolbox::DotProduct(nDim, gridVel, UnitNormal); if constexpr (FlowRegime == ENUM_REGIME::COMPRESSIBLE) { - for (auto iDim = 0u; iDim < nDim; iDim++) - gridVel[iDim] *= nodes->GetDensity(iPoint); + /*--- Corrections carry their own density increment, rather than the current solution density. ---*/ + const auto density = compressibleProjection ? sol[0] : nodes->GetDensity(iPoint); + for (auto iDim = 0u; iDim < nDim; iDim++) gridVel[iDim] *= density; } } @@ -3019,6 +3048,7 @@ void CFVMFlowSolverBase::MultigridProjectEulerWall(CGeometry* geo /*--- Project to tangent plane. ---*/ for (auto iDim = 0u; iDim < nDim; iDim++) sol[iVel + iDim] -= momentum_n * UnitNormal[iDim]; + if (compressibleProjection) sol[iVel + nDim] -= gridNormalVel * momentum_n; } END_SU2_OMP_FOR } diff --git a/SU2_CFD/include/solvers/CNEMOEulerSolver.hpp b/SU2_CFD/include/solvers/CNEMOEulerSolver.hpp index 99b58553de1b..88387a267d6e 100644 --- a/SU2_CFD/include/solvers/CNEMOEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CNEMOEulerSolver.hpp @@ -197,7 +197,7 @@ class CNEMOEulerSolver : public CFVMFlowSolverBase OutlierMitigation; - }; diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index 377a0c818881..4e9484a7933a 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -990,7 +990,9 @@ class CVariable { * \param[in] iPoint - Point index. * \return Pointer to the undivided laplacian vector. */ - inline su2double *GetUndivided_Laplacian(unsigned long iPoint) { return Undivided_Laplacian[iPoint]; } + virtual su2double GetRhoTke(unsigned long iPoint) const { return 0.0; } + + inline su2double* GetUndivided_Laplacian(unsigned long iPoint) { return Undivided_Laplacian[iPoint]; } /*! * \brief Get the undivided laplacian of the solution. diff --git a/SU2_CFD/src/numerics/CNumerics.cpp b/SU2_CFD/src/numerics/CNumerics.cpp index 4c94d73c590b..4c7cc8863a33 100644 --- a/SU2_CFD/src/numerics/CNumerics.cpp +++ b/SU2_CFD/src/numerics/CNumerics.cpp @@ -175,7 +175,7 @@ void CNumerics::GetInviscidIncProjFlux(const su2double *val_density, void CNumerics::GetInviscidProjJac(const su2double *val_velocity, const su2double *val_energy, const su2double *val_normal, su2double val_scale, - su2double **val_Proj_Jac_Tensor) const { + su2double **val_Proj_Jac_Tensor, su2double val_tke) const { const bool wasActive = AD::BeginPassive(); unsigned short iDim, jDim; su2double sqvel, proj_vel, phi, a1, a2; @@ -186,8 +186,9 @@ void CNumerics::GetInviscidProjJac(const su2double *val_velocity, const su2doubl proj_vel += val_velocity[iDim]*val_normal[iDim]; } - phi = 0.5*Gamma_Minus_One*sqvel; - a1 = Gamma*(*val_energy)-phi; + /*--- dp/drho, with p = (gamma-1)*(rho*E - |rho*u|^2/(2*rho) - rho*k) and k held fixed; a1 is the total enthalpy. ---*/ + phi = Gamma_Minus_One*(0.5*sqvel - val_tke); + a1 = Gamma*(*val_energy) - Gamma_Minus_One*(0.5*sqvel + val_tke); a2 = Gamma-1.0; val_Proj_Jac_Tensor[0][0] = 0.0; @@ -214,7 +215,7 @@ void CNumerics::GetInviscidProjJac(const su2double *val_velocity, const su2doubl void CNumerics::GetInviscidProjJac(const su2double *val_velocity, const su2double *val_enthalpy, const su2double *val_chi, const su2double *val_kappa, const su2double *val_normal, su2double val_scale, - su2double **val_Proj_Jac_Tensor) const { + su2double **val_Proj_Jac_Tensor, su2double val_tke) const { const bool wasActive = AD::BeginPassive(); unsigned short iDim, jDim; su2double sqvel, proj_vel, phi, a1, a2; @@ -225,7 +226,8 @@ void CNumerics::GetInviscidProjJac(const su2double *val_velocity, const su2doubl proj_vel += val_velocity[iDim]*val_normal[iDim]; } - phi = *val_chi + 0.5*sqvel*(*val_kappa); + /*--- dp/drho = Chi + Kappa * d(rho*e)/drho, with rho*e = rho*E - |rho*u|^2/(2*rho) - rho*k and k held fixed. ---*/ + phi = *val_chi + (0.5*sqvel - val_tke)*(*val_kappa); a1 = *val_enthalpy; a2 = *val_kappa; @@ -381,7 +383,7 @@ void CNumerics::GetPreconditionedProjJac(const su2double *val_density, const su2 void CNumerics::GetPMatrix(const su2double *val_density, const su2double *val_velocity, const su2double *val_soundspeed, const su2double *val_enthalpy, const su2double *val_chi, const su2double *val_kappa, - const su2double *val_normal, su2double **val_p_tensor) const { + const su2double *val_normal, su2double **val_p_tensor, su2double val_tke) const { su2double sqvel, rhooc, zeta; //su2double rhoxc, c2; @@ -392,7 +394,7 @@ void CNumerics::GetPMatrix(const su2double *val_density, const su2double *val_ve if (nDim == 2) { sqvel = val_velocity[0]*val_velocity[0]+val_velocity[1]*val_velocity[1]; - zeta = sqvel - (*val_kappa*0.5*sqvel + *val_chi)/(*val_kappa); + zeta = sqvel - (*val_kappa*0.5*sqvel + *val_chi)/(*val_kappa) + val_tke; // SST: k in the total energy val_p_tensor[0][0] = 1.0; val_p_tensor[0][1]=0.0; @@ -416,7 +418,7 @@ void CNumerics::GetPMatrix(const su2double *val_density, const su2double *val_ve } else { sqvel = val_velocity[0]*val_velocity[0]+val_velocity[1]*val_velocity[1]+val_velocity[2]*val_velocity[2]; - zeta = sqvel - (*val_kappa*0.5*sqvel + *val_chi)/(*val_kappa); + zeta = sqvel - (*val_kappa*0.5*sqvel + *val_chi)/(*val_kappa) + val_tke; // SST: k in the total energy val_p_tensor[0][0]=val_normal[0]; val_p_tensor[0][1]=val_normal[1]; @@ -453,7 +455,8 @@ void CNumerics::GetPMatrix(const su2double *val_density, const su2double *val_ve void CNumerics::GetPMatrix_inv(su2double **val_invp_tensor, const su2double *val_density, const su2double *val_velocity, const su2double *val_soundspeed, - const su2double *val_chi, const su2double *val_kappa, const su2double *val_normal) const { + const su2double *val_chi, const su2double *val_kappa, const su2double *val_normal, + su2double val_tke) const { su2double rhoxc, c2, k0orho, k1orho, sqvel, k_o_c2, k_o_rhoxc, dp_drho; @@ -466,7 +469,7 @@ void CNumerics::GetPMatrix_inv(su2double **val_invp_tensor, const su2double *val if (nDim == 3) { sqvel = val_velocity[0]*val_velocity[0]+val_velocity[1]*val_velocity[1]+val_velocity[2]*val_velocity[2]; - dp_drho = *val_chi + 0.5*sqvel*(*val_kappa); + dp_drho = *val_chi + (0.5*sqvel - val_tke)*(*val_kappa); // SST: k held fixed val_invp_tensor[0][0]=val_normal[0]-val_normal[2]*val_velocity[1] / *val_density + val_normal[1]*val_velocity[2] / *val_density - val_normal[0]*dp_drho/c2; val_invp_tensor[0][1]=val_normal[0]*val_velocity[0]*k_o_c2; @@ -500,7 +503,7 @@ void CNumerics::GetPMatrix_inv(su2double **val_invp_tensor, const su2double *val } else { sqvel = val_velocity[0]*val_velocity[0]+val_velocity[1]*val_velocity[1]; - dp_drho = *val_chi + 0.5*sqvel*(*val_kappa); + dp_drho = *val_chi + (0.5*sqvel - val_tke)*(*val_kappa); // SST: k held fixed val_invp_tensor[0][0] = 1.0 - dp_drho/c2; val_invp_tensor[0][1]= k_o_c2*val_velocity[0]; diff --git a/SU2_CFD/src/numerics/flow/convection/ausm_slau.cpp b/SU2_CFD/src/numerics/flow/convection/ausm_slau.cpp index 3e3c99562917..120222c166c1 100644 --- a/SU2_CFD/src/numerics/flow/convection/ausm_slau.cpp +++ b/SU2_CFD/src/numerics/flow/convection/ausm_slau.cpp @@ -115,11 +115,12 @@ void CUpwAUSMPLUS_SLAU_Base_Flow::ApproximateJacobian(su2double **val_Jacobian_i sq_vel += RoeVelocity[iDim]*RoeVelocity[iDim]; } RoeEnthalpy = (R*Enthalpy_j+Enthalpy_i)/(R+1); - RoeSoundSpeed = sqrt(fabs((Gamma-1)*(RoeEnthalpy-0.5*sq_vel))); + /*--- With SST the total enthalpy contains k, which is not part of the speed of sound. ---*/ + RoeSoundSpeed = sqrt(fabs((Gamma-1)*(RoeEnthalpy-0.5*sq_vel-(R*turb_ke_j+turb_ke_i)/(R+1)))); /*--- Compute P and Lambda (do it with the Normal) ---*/ - GetPMatrix(RoeDensity, RoeVelocity, RoeSoundSpeed, UnitNormal, P_Tensor); + GetPMatrix(RoeDensity, RoeVelocity, RoeSoundSpeed, UnitNormal, P_Tensor, (R*turb_ke_j+turb_ke_i)/(R+1)); /*--- Flow eigenvalues and Entropy correctors ---*/ @@ -129,11 +130,11 @@ void CUpwAUSMPLUS_SLAU_Base_Flow::ApproximateJacobian(su2double **val_Jacobian_i Lambda[nVar-1] = ProjVelocity - RoeSoundSpeed; /*--- Compute inverse P ---*/ - GetPMatrix_inv(RoeDensity, RoeVelocity, RoeSoundSpeed, UnitNormal, invP_Tensor); + GetPMatrix_inv(RoeDensity, RoeVelocity, RoeSoundSpeed, UnitNormal, invP_Tensor, (R*turb_ke_j+turb_ke_i)/(R+1)); /*--- Jacobians of the inviscid flux, scale = 0.5 because val_residual ~ 0.5*(fc_i+fc_j)*Normal ---*/ - GetInviscidProjJac(Velocity_i, &Energy_i, Normal, 0.5, val_Jacobian_i); - GetInviscidProjJac(Velocity_j, &Energy_j, Normal, 0.5, val_Jacobian_j); + GetInviscidProjJac(Velocity_i, &Energy_i, Normal, 0.5, val_Jacobian_i, turb_ke_i); + GetInviscidProjJac(Velocity_j, &Energy_j, Normal, 0.5, val_Jacobian_j, turb_ke_j); /*--- Roe's Flux approximation ---*/ @@ -221,13 +222,14 @@ void CUpwAUSMPLUS_SLAU_Base_Flow::AccurateJacobian(const CConfig* config, su2dou sq_veli += Velocity_i[iDim] * Velocity_i[iDim]; sq_velj += Velocity_j[iDim] * Velocity_j[iDim]; } - dVi_dUi[nDim] = 0.5*Gamma_Minus_One*sq_veli; - dVj_dUj[nDim] = 0.5*Gamma_Minus_One*sq_velj; + /*--- With SST the total energy contains k, held fixed: dp/drho = (gamma-1)(|u|^2/2 - k). ---*/ + dVi_dUi[nDim] = Gamma_Minus_One*(0.5*sq_veli - turb_ke_i); + dVj_dUj[nDim] = Gamma_Minus_One*(0.5*sq_velj - turb_ke_j); dVi_dUi[nDim+1] = dVj_dUj[nDim+1] = 1.0; - dHi_drhoi = 0.5*(Gamma-2.0)*sq_veli - Gamma*Pressure_i/((Gamma-1.0)*Density_i); - dHj_drhoj = 0.5*(Gamma-2.0)*sq_velj - Gamma*Pressure_j/((Gamma-1.0)*Density_j); + dHi_drhoi = 0.5*(Gamma-2.0)*sq_veli - Gamma*Pressure_i/((Gamma-1.0)*Density_i) - Gamma*turb_ke_i; + dHj_drhoj = 0.5*(Gamma-2.0)*sq_velj - Gamma*Pressure_j/((Gamma-1.0)*Density_j) - Gamma*turb_ke_j; dVi_dUi[nDim+2] = dHi_drhoi * oneOnRhoi; dVj_dUj[nDim+2] = dHj_drhoj * oneOnRhoj; } @@ -324,6 +326,7 @@ CNumerics::ResidualType<> CUpwAUSMPLUS_SLAU_Base_Flow::ComputeResidual(const CCo AD::SetPreaccIn(Normal, nDim); AD::SetPreaccIn(V_i, nDim+4); AD::SetPreaccIn(V_j, nDim+4); + AD::SetPreaccIn(turb_ke_i); AD::SetPreaccIn(turb_ke_j); // SST: k in the total energy /*--- Variables for the general form and primitives for mass flux and pressure calculation. ---*/ /*--- F_{1/2} = ||A|| ( 0.5 * mdot * (psi_i+psi_j) - 0.5 * |mdot| * (psi_i-psi_j) + N * pf ) ---*/ @@ -413,8 +416,9 @@ void CUpwAUSMPLUSUP_Flow::ComputeMassAndPressureFluxes(const CConfig* config, su /*--- Compute interface speed of sound (aF) ---*/ - su2double astarL = sqrt(2.0*(Gamma-1.0)/(Gamma+1.0)*Enthalpy_i); - su2double astarR = sqrt(2.0*(Gamma-1.0)/(Gamma+1.0)*Enthalpy_j); + /*--- With SST the total enthalpy contains k, which is not part of the critical speed of sound. ---*/ + su2double astarL = sqrt(2.0*(Gamma-1.0)/(Gamma+1.0)*(Enthalpy_i-turb_ke_i)); + su2double astarR = sqrt(2.0*(Gamma-1.0)/(Gamma+1.0)*(Enthalpy_j-turb_ke_j)); su2double ahatL = astarL*astarL/max(astarL, ProjVelocity_i); su2double ahatR = astarR*astarR/max(astarR,-ProjVelocity_j); @@ -584,7 +588,7 @@ void CUpwAUSMPLUSUP_Flow::ComputeMassAndPressureFluxes(const CConfig* config, su astar_b *= 2.0*tmp; Vn_i_b -= tmp*tmp * aF_b; } - H_i_b = sqrt(0.5*(Gamma-1.0)/((Gamma+1.0)*Enthalpy_i)) * astar_b; + H_i_b = sqrt(0.5*(Gamma-1.0)/((Gamma+1.0)*(Enthalpy_i-turb_ke_i))) * astar_b; H_j_b = 0.0; } else { @@ -593,7 +597,7 @@ void CUpwAUSMPLUSUP_Flow::ComputeMassAndPressureFluxes(const CConfig* config, su astar_b *= 2.0*tmp; Vn_j_b += tmp*tmp * aF_b; } - H_j_b = sqrt(0.5*(Gamma-1.0)/((Gamma+1.0)*Enthalpy_j)) * astar_b; + H_j_b = sqrt(0.5*(Gamma-1.0)/((Gamma+1.0)*(Enthalpy_j-turb_ke_j))) * astar_b; H_i_b = 0.0; } @@ -639,8 +643,9 @@ void CUpwAUSMPLUSUP2_Flow::ComputeMassAndPressureFluxes(const CConfig* config, s /*--- Compute interface speed of sound (aF) ---*/ - su2double astarL = sqrt(2.0*(Gamma-1.0)/(Gamma+1.0)*Enthalpy_i); - su2double astarR = sqrt(2.0*(Gamma-1.0)/(Gamma+1.0)*Enthalpy_j); + /*--- With SST the total enthalpy contains k, which is not part of the critical speed of sound. ---*/ + su2double astarL = sqrt(2.0*(Gamma-1.0)/(Gamma+1.0)*(Enthalpy_i-turb_ke_i)); + su2double astarR = sqrt(2.0*(Gamma-1.0)/(Gamma+1.0)*(Enthalpy_j-turb_ke_j)); su2double ahatL = astarL*astarL/max(astarL, ProjVelocity_i); su2double ahatR = astarR*astarR/max(astarR,-ProjVelocity_j); @@ -731,11 +736,12 @@ void CUpwSLAU_Flow::ComputeMassAndPressureFluxes(const CConfig* config, su2doubl sq_velj += Velocity_j[iDim]*Velocity_j[iDim]; } + /*--- With SST the total energy contains k, which is not part of the speed of sound. ---*/ su2double Energy_i = Enthalpy_i - Pressure_i/Density_i; - SoundSpeed_i = sqrt(fabs(Gamma*Gamma_Minus_One*(Energy_i-0.5*sq_veli))); + SoundSpeed_i = sqrt(fabs(Gamma*Gamma_Minus_One*(Energy_i-0.5*sq_veli-turb_ke_i))); su2double Energy_j = Enthalpy_j - Pressure_j/Density_j; - SoundSpeed_j = sqrt(fabs(Gamma*Gamma_Minus_One*(Energy_j-0.5*sq_velj))); + SoundSpeed_j = sqrt(fabs(Gamma*Gamma_Minus_One*(Energy_j-0.5*sq_velj-turb_ke_j))); /*--- Compute interface speed of sound (aF), and left/right Mach number ---*/ @@ -842,6 +848,7 @@ CNumerics::ResidualType<> CUpwAUSM_Flow::ComputeResidual(const CConfig* config) AD::SetPreaccIn(Normal, nDim); AD::SetPreaccIn(V_i, nDim+4); AD::SetPreaccIn(V_j, nDim+4); + AD::SetPreaccIn(turb_ke_i); AD::SetPreaccIn(turb_ke_j); // SST: k in the total energy /*--- Face area (norm or the normal vector) ---*/ Area = GeometryToolbox::Norm(nDim, Normal); @@ -860,7 +867,7 @@ CNumerics::ResidualType<> CUpwAUSM_Flow::ComputeResidual(const CConfig* config) Density_i = V_i[nDim+2]; Enthalpy_i = V_i[nDim+3]; Energy_i = Enthalpy_i - Pressure_i/Density_i; - SoundSpeed_i = sqrt(fabs(Gamma*Gamma_Minus_One*(Energy_i-0.5*sq_vel))); + SoundSpeed_i = sqrt(fabs(Gamma*Gamma_Minus_One*(Energy_i-0.5*sq_vel-turb_ke_i))); // SST: E contains k /*--- Primitive variables at point j ---*/ sq_vel = 0.0; @@ -872,7 +879,7 @@ CNumerics::ResidualType<> CUpwAUSM_Flow::ComputeResidual(const CConfig* config) Density_j = V_j[nDim+2]; Enthalpy_j = V_j[nDim+3]; Energy_j = Enthalpy_j - Pressure_j/Density_j; - SoundSpeed_j = sqrt(fabs(Gamma*Gamma_Minus_One*(Energy_j-0.5*sq_vel))); + SoundSpeed_j = sqrt(fabs(Gamma*Gamma_Minus_One*(Energy_j-0.5*sq_vel-turb_ke_j))); // SST: E contains k /*--- Projected velocities ---*/ ProjVelocity_i = 0.0; ProjVelocity_j = 0.0; @@ -925,10 +932,11 @@ CNumerics::ResidualType<> CUpwAUSM_Flow::ComputeResidual(const CConfig* config) sq_vel += RoeVelocity[iDim]*RoeVelocity[iDim]; } RoeEnthalpy = (R*Enthalpy_j+Enthalpy_i)/(R+1); - RoeSoundSpeed = sqrt(fabs((Gamma-1)*(RoeEnthalpy-0.5*sq_vel))); + /*--- With SST the total enthalpy contains k, which is not part of the speed of sound. ---*/ + RoeSoundSpeed = sqrt(fabs((Gamma-1)*(RoeEnthalpy-0.5*sq_vel-(R*turb_ke_j+turb_ke_i)/(R+1)))); /*--- Compute P and Lambda (do it with the Normal) ---*/ - GetPMatrix(RoeDensity, RoeVelocity, RoeSoundSpeed, UnitNormal, P_Tensor); + GetPMatrix(RoeDensity, RoeVelocity, RoeSoundSpeed, UnitNormal, P_Tensor, (R*turb_ke_j+turb_ke_i)/(R+1)); ProjVelocity = 0.0; ProjVelocity_i = 0.0; ProjVelocity_j = 0.0; for (iDim = 0; iDim < nDim; iDim++) { @@ -944,11 +952,11 @@ CNumerics::ResidualType<> CUpwAUSM_Flow::ComputeResidual(const CConfig* config) Lambda[nVar-1] = ProjVelocity - RoeSoundSpeed; /*--- Compute inverse P ---*/ - GetPMatrix_inv(RoeDensity, RoeVelocity, RoeSoundSpeed, UnitNormal, invP_Tensor); + GetPMatrix_inv(RoeDensity, RoeVelocity, RoeSoundSpeed, UnitNormal, invP_Tensor, (R*turb_ke_j+turb_ke_i)/(R+1)); /*--- Jacobias of the inviscid flux, scale = 0.5 because val_residual ~ 0.5*(fc_i+fc_j)*Normal ---*/ - GetInviscidProjJac(Velocity_i, &Energy_i, Normal, 0.5, Jacobian_i); - GetInviscidProjJac(Velocity_j, &Energy_j, Normal, 0.5, Jacobian_j); + GetInviscidProjJac(Velocity_i, &Energy_i, Normal, 0.5, Jacobian_i, turb_ke_i); + GetInviscidProjJac(Velocity_j, &Energy_j, Normal, 0.5, Jacobian_j, turb_ke_j); /*--- Roe's Flux approximation ---*/ for (iVar = 0; iVar < nVar; iVar++) { diff --git a/SU2_CFD/src/numerics/flow/convection/centered.cpp b/SU2_CFD/src/numerics/flow/convection/centered.cpp index 761bcab8d7a2..ec433eb38efc 100644 --- a/SU2_CFD/src/numerics/flow/convection/centered.cpp +++ b/SU2_CFD/src/numerics/flow/convection/centered.cpp @@ -31,7 +31,7 @@ CCentLaxInc_Flow::CCentLaxInc_Flow(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config) : CNumerics(val_nDim, val_nVar, config) { implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); - variable_density = ((config->GetKind_DensityModel() == INC_DENSITYMODEL::VARIABLE) || (config->GetKind_DensityModel() == INC_DENSITYMODEL::FLAMELET)); + variable_density = config->GetVariable_Density_Model(); /* A grid is defined as dynamic if there's rigid grid movement or grid deformation AND the problem is time domain */ dynamic_grid = config->GetDynamic_Grid(); fix_factor = config->GetCent_Inc_Jac_Fix_Factor(); @@ -161,17 +161,25 @@ CNumerics::ResidualType<> CCentLaxInc_Flow::ComputeResidual(const CConfig* confi ProjVelocity += 0.5*(GridVel_i[iDim]+GridVel_j[iDim])*Normal[iDim]; /*--- Residual contributions ---*/ - for (iVar = 0; iVar < nVar; iVar++) { + for (iVar = 0; iVar < nVar; iVar++) ProjFlux[iVar] -= ProjVelocity * 0.5*(U_i[iVar]+U_j[iVar]); - /*--- Jacobian contributions ---*/ - /*--- Implicit terms ---*/ - if (implicit) { - for (iDim = 0; iDim < nDim+1; iDim++){ - Jacobian_i[iDim+1][iDim+1] -= 0.5*ProjVelocity*DensityInc_i; - Jacobian_j[iDim+1][iDim+1] -= 0.5*ProjVelocity*DensityInc_j; + /*--- Jacobian of -ProjVelocity * 0.5*U, with U = (rho, rho*u, rho*h), w.r.t. the primitives (p, u, h), added + once. The density depends on h (variable density models) and not on the pressure. ---*/ + if (implicit) { + auto addGridJacobian = [&](su2double **Jac, su2double rho, const su2double *vel, su2double h, su2double T, + su2double cp) { + const auto dRhodh = variable_density ? su2double(-rho / (T * cp)) : su2double(0.0); + const su2double factor = 0.5*ProjVelocity; + Jac[0][nDim+1] -= factor*dRhodh; + for (iDim = 0; iDim < nDim; iDim++) { + Jac[iDim+1][iDim+1] -= factor*rho; + Jac[iDim+1][nDim+1] -= factor*vel[iDim]*dRhodh; } - } + Jac[nDim+1][nDim+1] -= factor*(rho + h*dRhodh); + }; + addGridJacobian(Jacobian_i, DensityInc_i, Velocity_i, Enthalpy_i, Temperature_i, Cp_i); + addGridJacobian(Jacobian_j, DensityInc_j, Velocity_j, Enthalpy_j, Temperature_j, Cp_j); } } @@ -250,7 +258,7 @@ CNumerics::ResidualType<> CCentLaxInc_Flow::ComputeResidual(const CConfig* confi CCentJSTInc_Flow::CCentJSTInc_Flow(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config) : CNumerics(val_nDim, val_nVar, config) { implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); - variable_density = (config->GetVariable_Density_Model()); + variable_density = config->GetVariable_Density_Model(); energy = config->GetEnergy_Equation(); /* A grid is defined as dynamic if there's rigid grid movement or grid deformation AND the problem is time domain */ dynamic_grid = config->GetDynamic_Grid(); @@ -401,17 +409,25 @@ CNumerics::ResidualType<> CCentJSTInc_Flow::ComputeResidual(const CConfig* confi ProjVelocity += 0.5*(GridVel_i[iDim]+GridVel_j[iDim])*Normal[iDim]; /*--- Residual contributions ---*/ - for (iVar = 0; iVar < nVar; iVar++) { + for (iVar = 0; iVar < nVar; iVar++) ProjFlux[iVar] -= ProjVelocity * 0.5*(U_i[iVar]+U_j[iVar]); - /*--- Jacobian contributions ---*/ - /*--- Implicit terms ---*/ - if (implicit) { - for (iDim = 0; iDim < nDim+1; iDim++){ - Jacobian_i[iDim+1][iDim+1] -= 0.5*ProjVelocity*DensityInc_i; - Jacobian_j[iDim+1][iDim+1] -= 0.5*ProjVelocity*DensityInc_j; + /*--- Jacobian of -ProjVelocity * 0.5*U, with U = (rho, rho*u, rho*h), w.r.t. the primitives (p, u, h), added + once. The density depends on h (variable density models) and not on the pressure. ---*/ + if (implicit) { + auto addGridJacobian = [&](su2double **Jac, su2double rho, const su2double *vel, su2double h, su2double T, + su2double cp) { + const auto dRhodh = variable_density ? su2double(-rho / (T * cp)) : su2double(0.0); + const su2double factor = 0.5*ProjVelocity; + Jac[0][nDim+1] -= factor*dRhodh; + for (iDim = 0; iDim < nDim; iDim++) { + Jac[iDim+1][iDim+1] -= factor*rho; + Jac[iDim+1][nDim+1] -= factor*vel[iDim]*dRhodh; } - } + Jac[nDim+1][nDim+1] -= factor*(rho + h*dRhodh); + }; + addGridJacobian(Jacobian_i, DensityInc_i, Velocity_i, Enthalpy_i, Temperature_i, Cp_i); + addGridJacobian(Jacobian_j, DensityInc_j, Velocity_j, Enthalpy_j, Temperature_j, Cp_j); } } diff --git a/SU2_CFD/src/numerics/flow/convection/fds.cpp b/SU2_CFD/src/numerics/flow/convection/fds.cpp index f51eb664026f..c76104302c49 100644 --- a/SU2_CFD/src/numerics/flow/convection/fds.cpp +++ b/SU2_CFD/src/numerics/flow/convection/fds.cpp @@ -249,19 +249,23 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config ProjVelocity += 0.5*(GridVel_i[iDim]+GridVel_j[iDim])*Normal[iDim]; /*--- Residual contributions ---*/ - for (iVar = 0; iVar < nVar; iVar++) { + for (iVar = 0; iVar < nVar; iVar++) Flux[iVar] -= ProjVelocity * 0.5*(U_i[iVar]+U_j[iVar]); - /*--- Jacobian contributions ---*/ - /*--- Implicit terms ---*/ - if (implicit) { - for (iDim = 0; iDim < nDim; iDim++){ - Jacobian_i[iDim+1][iDim+1] -= 0.5*ProjVelocity*DensityInc_i; - Jacobian_j[iDim+1][iDim+1] -= 0.5*ProjVelocity*DensityInc_j; + /*--- Jacobian of -ProjVelocity * 0.5*U, with U = (rho, rho*u, rho*h), w.r.t. the primitives (p, u, h), added + once. The density depends on h (variable density models) and not on the pressure. ---*/ + if (implicit) { + auto addGridJacobian = [&](su2double **Jac, su2double rho, const su2double *vel, su2double h, su2double dRhodh) { + const su2double factor = 0.5*ProjVelocity; + Jac[0][nDim+1] -= factor*dRhodh; + for (iDim = 0; iDim < nDim; iDim++) { + Jac[iDim+1][iDim+1] -= factor*rho; + Jac[iDim+1][nDim+1] -= factor*vel[iDim]*dRhodh; } - Jacobian_i[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_i; - Jacobian_j[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_j; - } + Jac[nDim+1][nDim+1] -= factor*(rho + h*dRhodh); + }; + addGridJacobian(Jacobian_i, DensityInc_i, Velocity_i, Enthalpy_i, dRhodh_i); + addGridJacobian(Jacobian_j, DensityInc_j, Velocity_j, Enthalpy_j, dRhodh_j); } } diff --git a/SU2_CFD/src/numerics/flow/convection/fvs.cpp b/SU2_CFD/src/numerics/flow/convection/fvs.cpp index 8a17f01c6d29..fdf6ab74a5ef 100644 --- a/SU2_CFD/src/numerics/flow/convection/fvs.cpp +++ b/SU2_CFD/src/numerics/flow/convection/fvs.cpp @@ -45,6 +45,8 @@ CNumerics::ResidualType<> CUpwMSW_Flow::ComputeResidual(const CConfig* config) { AD::StartPreacc(); AD::SetPreaccIn(V_i, nDim + 4); AD::SetPreaccIn(V_j, nDim + 4); + AD::SetPreaccIn(turb_ke_i); // SST: k in the total energy + AD::SetPreaccIn(turb_ke_j); AD::SetPreaccIn(Sensor_i, Sensor_j); AD::SetPreaccIn(Normal, nDim); if (dynamic_grid) { @@ -71,8 +73,9 @@ CNumerics::ResidualType<> CUpwMSW_Flow::ComputeResidual(const CConfig* config) { /*--- Recompute the speed of sound because it is not MUSCL-reconstructed. ---*/ const su2double sqvel_i = GeometryToolbox::SquaredNorm(nDim, V_i + 1); const su2double sqvel_j = GeometryToolbox::SquaredNorm(nDim, V_j + 1); - const su2double c_i = sqrt(fmax((Gamma - 1) * (H_i - 0.5 * sqvel_i), EPS)); - const su2double c_j = sqrt(fmax((Gamma - 1) * (H_j - 0.5 * sqvel_j), EPS)); + /*--- With SST the total enthalpy contains k, which is not part of the speed of sound. ---*/ + const su2double c_i = sqrt(fmax((Gamma - 1) * (H_i - 0.5 * sqvel_i - turb_ke_i), EPS)); + const su2double c_j = sqrt(fmax((Gamma - 1) * (H_j - 0.5 * sqvel_j - turb_ke_j), EPS)); /*--- Recompute conservatives ---*/ @@ -109,6 +112,8 @@ CNumerics::ResidualType<> CUpwMSW_Flow::ComputeResidual(const CConfig* config) { } Vst_i[nDim + 4] = onemw * c_i + w * c_j; Vst_j[nDim + 4] = onemw * c_j + w * c_i; + const su2double tkest_i = onemw * turb_ke_i + w * turb_ke_j; + const su2double tkest_j = onemw * turb_ke_j + w * turb_ke_i; su2double Velst_i[MAXNDIM] = {}, Velst_j[MAXNDIM] = {}; su2double ProjVelst_i{}, ProjVelst_j{}; @@ -132,15 +137,16 @@ CNumerics::ResidualType<> CUpwMSW_Flow::ComputeResidual(const CConfig* config) { /*--- Compute projected P, invP, and Lambda ---*/ su2double P_Tensor[MAXNVAR][MAXNVAR], invP_Tensor[MAXNVAR][MAXNVAR]; - GetPMatrix(Vst_i[nDim + 2], Velst_i, Vst_i[nDim + 4], UnitNormal, P_Tensor); - GetPMatrix_inv(Vst_i[nDim + 2], Velst_i, Vst_i[nDim + 4], UnitNormal, invP_Tensor); + GetPMatrix(Vst_i[nDim + 2], Velst_i, Vst_i[nDim + 4], UnitNormal, P_Tensor, tkest_i); + GetPMatrix_inv(Vst_i[nDim + 2], Velst_i, Vst_i[nDim + 4], UnitNormal, invP_Tensor, tkest_i); /*--- Projected flux (f+) at i ---*/ for (auto iVar = 0u; iVar < MAXNVAR; ++iVar) { Fc[iVar] = 0; } - auto UpdateFlux = [&](const auto* U, auto* Jacobian) { + auto UpdateFlux = [&](auto* U, auto* Jacobian, su2double deltaTke) { + U[nVar - 1] -= U[0] * deltaTke; for (auto iVar = 0u; iVar < nVar; ++iVar) { for (auto jVar = 0u; jVar < nVar; ++jVar) { su2double Proj_ModJac_Tensor_i = 0.0; @@ -153,9 +159,14 @@ CNumerics::ResidualType<> CUpwMSW_Flow::ComputeResidual(const CConfig* config) { Fc[iVar] += Proj_ModJac_Tensor_i * Area * U[jVar]; Jacobian[iVar][jVar] = Proj_ModJac_Tensor_i * Area; } + Jacobian[iVar][0] -= Jacobian[iVar][nVar - 1] * deltaTke; + if (iVar + 1 == nVar) { + Fc[iVar] += Lambda[0] * Area * U[0] * deltaTke; + Jacobian[iVar][0] += Lambda[0] * Area * deltaTke; + } } }; - UpdateFlux(U_i, Jacobian_i); + UpdateFlux(U_i, Jacobian_i, turb_ke_i - tkest_i); /*--- Flow eigenvalues at j (Lambda-) ---*/ @@ -167,12 +178,12 @@ CNumerics::ResidualType<> CUpwMSW_Flow::ComputeResidual(const CConfig* config) { /*--- Compute projected P, invP, and Lambda ---*/ - GetPMatrix(Vst_j[nDim + 2], Velst_j, Vst_j[nDim + 4], UnitNormal, P_Tensor); - GetPMatrix_inv(Vst_j[nDim + 2], Velst_j, Vst_j[nDim + 4], UnitNormal, invP_Tensor); + GetPMatrix(Vst_j[nDim + 2], Velst_j, Vst_j[nDim + 4], UnitNormal, P_Tensor, tkest_j); + GetPMatrix_inv(Vst_j[nDim + 2], Velst_j, Vst_j[nDim + 4], UnitNormal, invP_Tensor, tkest_j); /*--- Projected flux (f-) ---*/ - UpdateFlux(U_j, Jacobian_j); + UpdateFlux(U_j, Jacobian_j, turb_ke_j - tkest_j); AD::SetPreaccOut(Fc, nVar); AD::EndPreacc(); diff --git a/SU2_CFD/src/numerics/flow/convection/hllc.cpp b/SU2_CFD/src/numerics/flow/convection/hllc.cpp index b6ff0eef2d16..0e74d2492627 100644 --- a/SU2_CFD/src/numerics/flow/convection/hllc.cpp +++ b/SU2_CFD/src/numerics/flow/convection/hllc.cpp @@ -177,8 +177,9 @@ CNumerics::ResidualType<> CUpwHLLC_Flow::ComputeResidual(const CConfig* config) Energy_i = Enthalpy_i - Pressure_i / Density_i; Energy_j = Enthalpy_j - Pressure_j / Density_j; - SoundSpeed_i = sqrt((Enthalpy_i - 0.5 * sq_vel_i) * Gamma_Minus_One); - SoundSpeed_j = sqrt((Enthalpy_j - 0.5 * sq_vel_j) * Gamma_Minus_One); + /*--- With SST the total enthalpy contains k, which is not part of the speed of sound. ---*/ + SoundSpeed_i = sqrt((Enthalpy_i - 0.5 * sq_vel_i - turb_ke_i) * Gamma_Minus_One); + SoundSpeed_j = sqrt((Enthalpy_j - 0.5 * sq_vel_j - turb_ke_j) * Gamma_Minus_One); /*--- Projected velocities ---*/ @@ -202,7 +203,8 @@ CNumerics::ResidualType<> CUpwHLLC_Flow::ComputeResidual(const CConfig* config) /*--- Roe-averaged speed of sound ---*/ - RoeSoundSpeed = sqrt( Gamma_Minus_One * ( RoeEnthalpy - 0.5 * sq_velRoe ) ); + const su2double RoeTke = ( sqrt(Density_j) * turb_ke_j + sqrt(Density_i) * turb_ke_i ) / Rrho; + RoeSoundSpeed = sqrt( Gamma_Minus_One * ( RoeEnthalpy - 0.5 * sq_velRoe - RoeTke ) ); /*--- Speed of sound at L and R ---*/ @@ -308,7 +310,7 @@ CNumerics::ResidualType<> CUpwHLLC_Flow::ComputeResidual(const CConfig* config) Jacobian_j[iVar][jVar] = 0; const su2double chi = 0.0; - GetInviscidProjJac(Velocity_i, &Enthalpy_i, &chi, &Gamma_Minus_One, UnitNormal, 1.0, Jacobian_i); + GetInviscidProjJac(Velocity_i, &Enthalpy_i, &chi, &Gamma_Minus_One, UnitNormal, 1.0, Jacobian_i, turb_ke_i); } else { @@ -324,7 +326,7 @@ CNumerics::ResidualType<> CUpwHLLC_Flow::ComputeResidual(const CConfig* config) /*--- Computing pressure derivatives d/dU_L (PI) ---*/ - dPI_dU[0] = 0.5 * Gamma_Minus_One * sq_vel_i; + dPI_dU[0] = Gamma_Minus_One * (0.5 * sq_vel_i - turb_ke_i); // k (SST) held fixed for (iDim = 0; iDim < nDim; iDim++) dPI_dU[iDim+1] = - Gamma_Minus_One * Velocity_i[iDim]; dPI_dU[nVar-1] = Gamma_Minus_One; @@ -397,7 +399,7 @@ CNumerics::ResidualType<> CUpwHLLC_Flow::ComputeResidual(const CConfig* config) /*--- Computing d/dU_R (Sm) ---*/ - dSm_dU[0] = ( ProjVelocity_j * ProjVelocity_j - sM * sR - 0.5 * Gamma_Minus_One * sq_vel_j ) / RHO; + dSm_dU[0] = ( ProjVelocity_j * ProjVelocity_j - sM * sR - Gamma_Minus_One * (0.5 * sq_vel_j - turb_ke_j) ) / RHO; for (iDim = 0; iDim < nDim; iDim++) dSm_dU[iDim+1] = - ( UnitNormal[iDim] * ( 2 * ProjVelocity_j - sR - sM) - Gamma_Minus_One * Velocity_j[iDim] ) / RHO; dSm_dU[nVar-1] = - Gamma_Minus_One / RHO; @@ -444,7 +446,7 @@ CNumerics::ResidualType<> CUpwHLLC_Flow::ComputeResidual(const CConfig* config) Jacobian_i[iVar][jVar] = 0; const su2double chi = 0.0; - GetInviscidProjJac(Velocity_j, &Enthalpy_j, &chi, &Gamma_Minus_One, UnitNormal, 1.0, Jacobian_j); + GetInviscidProjJac(Velocity_j, &Enthalpy_j, &chi, &Gamma_Minus_One, UnitNormal, 1.0, Jacobian_j, turb_ke_j); } else { @@ -460,7 +462,7 @@ CNumerics::ResidualType<> CUpwHLLC_Flow::ComputeResidual(const CConfig* config) /*--- Computing d/dU_L (Sm) ---*/ - dSm_dU[0] = ( - ProjVelocity_i * ProjVelocity_i + sM * sL + 0.5 * Gamma_Minus_One * sq_vel_i ) / RHO; + dSm_dU[0] = ( - ProjVelocity_i * ProjVelocity_i + sM * sL + Gamma_Minus_One * (0.5 * sq_vel_i - turb_ke_i) ) / RHO; for (iDim = 0; iDim < nDim; iDim++) dSm_dU[iDim+1] = ( UnitNormal[iDim] * ( 2 * ProjVelocity_i - sL - sM ) - Gamma_Minus_One * Velocity_i[iDim] ) / RHO; dSm_dU[nVar-1] = Gamma_Minus_One / RHO; @@ -503,7 +505,7 @@ CNumerics::ResidualType<> CUpwHLLC_Flow::ComputeResidual(const CConfig* config) /*--- Computing pressure derivatives d/dU_R (PI) ---*/ - dPI_dU[0] = 0.5 * Gamma_Minus_One * sq_vel_j; + dPI_dU[0] = Gamma_Minus_One * (0.5 * sq_vel_j - turb_ke_j); // k (SST) held fixed for (iDim = 0; iDim < nDim; iDim++) dPI_dU[iDim+1] = - Gamma_Minus_One * Velocity_j[iDim]; dPI_dU[nVar-1] = Gamma_Minus_One; @@ -693,8 +695,9 @@ CNumerics::ResidualType<> CUpwGeneralHLLC_Flow::ComputeResidual(const CConfig* c } Energy_i = Enthalpy_i - Pressure_i / Density_i; - StaticEnthalpy_i = Enthalpy_i - 0.5 * sq_vel_i; - StaticEnergy_i = Energy_i - 0.5 * sq_vel_i; + /*--- With SST the total energy and enthalpy contain k. ---*/ + StaticEnthalpy_i = Enthalpy_i - 0.5 * sq_vel_i - turb_ke_i; + StaticEnergy_i = Energy_i - 0.5 * sq_vel_i - turb_ke_i; Kappa_i = S_i[1] / Density_i; Chi_i = S_i[0] - Kappa_i * StaticEnergy_i; @@ -702,8 +705,8 @@ CNumerics::ResidualType<> CUpwGeneralHLLC_Flow::ComputeResidual(const CConfig* c Energy_j = Enthalpy_j - Pressure_j / Density_j; - StaticEnthalpy_j = Enthalpy_j - 0.5 * sq_vel_j; - StaticEnergy_j = Energy_j - 0.5 * sq_vel_j; + StaticEnthalpy_j = Enthalpy_j - 0.5 * sq_vel_j - turb_ke_j; + StaticEnergy_j = Energy_j - 0.5 * sq_vel_j - turb_ke_j; Kappa_j = S_j[1] / Density_j; Chi_j = S_j[0] - Kappa_j * StaticEnergy_j; @@ -745,7 +748,8 @@ CNumerics::ResidualType<> CUpwGeneralHLLC_Flow::ComputeResidual(const CConfig* c /*--- Roe-averaged speed of sound ---*/ //RoeSoundSpeed2 = RoeChi + RoeKappa * ( RoeEnthalpy - 0.5 * sq_velRoe ); - RoeSoundSpeed = sqrt( RoeChi + RoeKappa * ( RoeEnthalpy - 0.5 * sq_velRoe ) ); + RoeSoundSpeed = sqrt( RoeChi + RoeKappa * ( RoeEnthalpy - 0.5 * sq_velRoe + - ( sqrt(Density_j) * turb_ke_j + sqrt(Density_i) * turb_ke_i ) / Rrho ) ); /*--- Speed of sound at L and R ---*/ @@ -850,7 +854,7 @@ CNumerics::ResidualType<> CUpwGeneralHLLC_Flow::ComputeResidual(const CConfig* c Jacobian_j[iVar][jVar] = 0; - GetInviscidProjJac(Velocity_i, &Enthalpy_i, &Chi_i, &Kappa_i, UnitNormal, 1.0, Jacobian_i); + GetInviscidProjJac(Velocity_i, &Enthalpy_i, &Chi_i, &Kappa_i, UnitNormal, 1.0, Jacobian_i, turb_ke_i); } else { @@ -866,7 +870,7 @@ CNumerics::ResidualType<> CUpwGeneralHLLC_Flow::ComputeResidual(const CConfig* c /*--- Computing pressure derivatives d/dU_L (PI) ---*/ - dPI_dU[0] = Chi_i + 0.5 * Kappa_i * sq_vel_i; + dPI_dU[0] = Chi_i + Kappa_i * (0.5 * sq_vel_i - turb_ke_i); // k (SST) held fixed for (iDim = 0; iDim < nDim; iDim++) dPI_dU[iDim+1] = - Kappa_i * Velocity_i[iDim]; dPI_dU[nVar-1] = Kappa_i; @@ -940,7 +944,7 @@ CNumerics::ResidualType<> CUpwGeneralHLLC_Flow::ComputeResidual(const CConfig* c /*--- Computing pressure derivatives d/dU_R (PI) ---*/ - dPI_dU[0] = Chi_j + 0.5 * Kappa_j * sq_vel_j; + dPI_dU[0] = Chi_j + Kappa_j * (0.5 * sq_vel_j - turb_ke_j); // k (SST) held fixed for (iDim = 0; iDim < nDim; iDim++) dPI_dU[iDim+1] = - Kappa_j * Velocity_j[iDim]; dPI_dU[nVar-1] = Kappa_j; @@ -994,7 +998,7 @@ CNumerics::ResidualType<> CUpwGeneralHLLC_Flow::ComputeResidual(const CConfig* c for (jVar = 0; jVar < nVar; jVar++) Jacobian_i[iVar][jVar] = 0; - GetInviscidProjJac(Velocity_j, &Enthalpy_j, &Chi_j, &Kappa_j, UnitNormal, 1.0, Jacobian_j); + GetInviscidProjJac(Velocity_j, &Enthalpy_j, &Chi_j, &Kappa_j, UnitNormal, 1.0, Jacobian_j, turb_ke_j); } else { @@ -1010,7 +1014,7 @@ CNumerics::ResidualType<> CUpwGeneralHLLC_Flow::ComputeResidual(const CConfig* c /*--- Computing pressure derivatives d/dU_L (PI) ---*/ - dPI_dU[0] = Chi_i + 0.5 * Kappa_i * sq_vel_i; + dPI_dU[0] = Chi_i + Kappa_i * (0.5 * sq_vel_i - turb_ke_i); // k (SST) held fixed for (iDim = 0; iDim < nDim; iDim++) dPI_dU[iDim+1] = - Kappa_i * Velocity_i[iDim]; dPI_dU[nVar-1] = Kappa_i; @@ -1061,7 +1065,7 @@ CNumerics::ResidualType<> CUpwGeneralHLLC_Flow::ComputeResidual(const CConfig* c /*--- Computing pressure derivatives d/dU_R (PI) ---*/ - dPI_dU[0] = Chi_j + 0.5 * Kappa_j * sq_vel_j; + dPI_dU[0] = Chi_j + Kappa_j * (0.5 * sq_vel_j - turb_ke_j); // k (SST) held fixed for (iDim = 0; iDim < nDim; iDim++) dPI_dU[iDim+1] = - Kappa_j * Velocity_j[iDim]; dPI_dU[nVar-1] = Kappa_j; diff --git a/SU2_CFD/src/numerics/flow/convection/roe.cpp b/SU2_CFD/src/numerics/flow/convection/roe.cpp index 9021393b3897..ec73bae349fc 100644 --- a/SU2_CFD/src/numerics/flow/convection/roe.cpp +++ b/SU2_CFD/src/numerics/flow/convection/roe.cpp @@ -101,6 +101,7 @@ CNumerics::ResidualType<> CUpwRoeBase_Flow::ComputeResidual(const CConfig* confi AD::StartPreacc(); AD::SetPreaccIn(V_i, nDim+4); AD::SetPreaccIn(V_j, nDim+4); AD::SetPreaccIn(Normal, nDim); + AD::SetPreaccIn(turb_ke_i); AD::SetPreaccIn(turb_ke_j); // SST: k in the total energy if (dynamic_grid) { AD::SetPreaccIn(GridVel_i, nDim); AD::SetPreaccIn(GridVel_j, nDim); } @@ -146,7 +147,9 @@ CNumerics::ResidualType<> CUpwRoeBase_Flow::ComputeResidual(const CConfig* confi sq_vel += RoeVelocity[iDim]*RoeVelocity[iDim]; } RoeEnthalpy = (R*Enthalpy_j+Enthalpy_i)/(R+1); - RoeSoundSpeed2 = (Gamma-1)*(RoeEnthalpy-0.5*sq_vel); + /*--- With SST the total enthalpy contains k, which is not part of the speed of sound. ---*/ + RoeTke = (R*turb_ke_j+turb_ke_i)/(R+1); + RoeSoundSpeed2 = (Gamma-1)*(RoeEnthalpy-0.5*sq_vel-RoeTke); /*--- Negative RoeSoundSpeed^2, the jump variables is too large, clear fluxes and exit. ---*/ @@ -170,7 +173,7 @@ CNumerics::ResidualType<> CUpwRoeBase_Flow::ComputeResidual(const CConfig* confi /*--- P tensor ---*/ - GetPMatrix(RoeDensity, RoeVelocity, RoeSoundSpeed, UnitNormal, P_Tensor); + GetPMatrix(RoeDensity, RoeVelocity, RoeSoundSpeed, UnitNormal, P_Tensor, RoeTke); /*--- Projected velocity adjusted for mesh motion ---*/ @@ -222,8 +225,8 @@ CNumerics::ResidualType<> CUpwRoeBase_Flow::ComputeResidual(const CConfig* confi Flux[iVar] = 0.5*(ProjFlux_i[iVar]+ProjFlux_j[iVar]); if (implicit) { - GetInviscidProjJac(Velocity_i, &Energy_i, Normal, 0.5, Jacobian_i); - GetInviscidProjJac(Velocity_j, &Energy_j, Normal, 0.5, Jacobian_j); + GetInviscidProjJac(Velocity_i, &Energy_i, Normal, 0.5, Jacobian_i, turb_ke_i); + GetInviscidProjJac(Velocity_j, &Energy_j, Normal, 0.5, Jacobian_j, turb_ke_j); } /*--- Finalize in children class ---*/ @@ -261,12 +264,17 @@ void CUpwRoe_Flow::FinalizeResidual(su2double *val_residual, su2double **val_Jac unsigned short iVar, jVar, kVar; /*--- Compute inverse P tensor ---*/ - GetPMatrix_inv(RoeDensity, RoeVelocity, RoeSoundSpeed, UnitNormal, invP_Tensor); + GetPMatrix_inv(RoeDensity, RoeVelocity, RoeSoundSpeed, UnitNormal, invP_Tensor, RoeTke); /*--- Diference between conservative variables at jPoint and iPoint ---*/ for (iVar = 0; iVar < nVar; iVar++) Diff_U[iVar] = Conservatives_j[iVar]-Conservatives_i[iVar]; + /*--- With SST rho*E contains rho*k, and Delta(rho k) = RoeDensity Delta k + RoeTke Delta rho. The part with + Delta k is not a pressure jump: remove it before the projection and advect it with the contact wave. ---*/ + const su2double rhoDeltaTke = RoeDensity*(turb_ke_j-turb_ke_i); + Diff_U[nVar-1] -= rhoDeltaTke; + /*--- Low dissipation formulation ---*/ if (roe_low_dissipation) Dissipation_ij = GetRoe_Dissipation(Dissipation_i, Dissipation_j, Sensor_i, Sensor_j, config); @@ -291,6 +299,7 @@ void CUpwRoe_Flow::FinalizeResidual(su2double *val_residual, su2double **val_Jac } } } + val_residual[nVar-1] -= (1.0-kappa)*Lambda[0]*rhoDeltaTke*Area*Dissipation_ij; } @@ -334,9 +343,12 @@ void CUpwL2Roe_Flow::FinalizeResidual(su2double *val_residual, su2double **val_J delta_wave[2] = proj_delta_vel + delta_p/(RoeDensity*RoeSoundSpeed); delta_wave[3] = -proj_delta_vel + delta_p/(RoeDensity*RoeSoundSpeed); } else { - delta_wave[0] = delta_rho - delta_p/RoeSoundSpeed2; - delta_wave[1] = (UnitNormal[0]*delta_vel[2]-UnitNormal[2]*delta_vel[0])*zeta; - delta_wave[2] = (UnitNormal[1]*delta_vel[0]-UnitNormal[0]*delta_vel[1])*zeta; + /*--- The first three columns of the 3D P matrix combine the entropy wave (weighted by the normal) with the + shear waves, so their strengths are n_j (Delta rho - Delta p / c^2) + (Delta u x n)_j. ---*/ + const auto delta_entropy = delta_rho - delta_p/RoeSoundSpeed2; + delta_wave[0] = UnitNormal[0]*delta_entropy + (delta_vel[1]*UnitNormal[2]-delta_vel[2]*UnitNormal[1])*zeta; + delta_wave[1] = UnitNormal[1]*delta_entropy + (delta_vel[2]*UnitNormal[0]-delta_vel[0]*UnitNormal[2])*zeta; + delta_wave[2] = UnitNormal[2]*delta_entropy + (delta_vel[0]*UnitNormal[1]-delta_vel[1]*UnitNormal[0])*zeta; delta_wave[3] = proj_delta_vel + delta_p/(RoeDensity*RoeSoundSpeed); delta_wave[4] = -proj_delta_vel + delta_p/(RoeDensity*RoeSoundSpeed); } @@ -347,11 +359,14 @@ void CUpwL2Roe_Flow::FinalizeResidual(su2double *val_residual, su2double **val_J for (kVar = 0; kVar < nVar; kVar++) val_residual[iVar] -= (1.0-kappa)*Lambda[kVar]*delta_wave[kVar]*P_Tensor[iVar][kVar]*Area; + /*--- With SST, the jump of k in rho*E is advected with the contact wave. ---*/ + val_residual[nVar-1] -= (1.0-kappa)*Lambda[0]*RoeDensity*(turb_ke_j-turb_ke_i)*Area; + if (!implicit) return; /*--- If implicit use the Jacobians of the standard Roe scheme as an approximation ---*/ - GetPMatrix_inv(RoeDensity, RoeVelocity, RoeSoundSpeed, UnitNormal, invP_Tensor); + GetPMatrix_inv(RoeDensity, RoeVelocity, RoeSoundSpeed, UnitNormal, invP_Tensor, RoeTke); for (iVar = 0; iVar < nVar; iVar++) { for (jVar = 0; jVar < nVar; jVar++) { @@ -407,9 +422,12 @@ void CUpwLMRoe_Flow::FinalizeResidual(su2double *val_residual, su2double **val_J delta_wave[2] = proj_delta_vel + delta_p/(RoeDensity*RoeSoundSpeed); delta_wave[3] = -proj_delta_vel + delta_p/(RoeDensity*RoeSoundSpeed); } else { - delta_wave[0] = delta_rho - delta_p/RoeSoundSpeed2; - delta_wave[1] = (UnitNormal[0]*delta_vel[2]-UnitNormal[2]*delta_vel[0]); - delta_wave[2] = (UnitNormal[1]*delta_vel[0]-UnitNormal[0]*delta_vel[1]); + /*--- The first three columns of the 3D P matrix combine the entropy wave (weighted by the normal) with the + shear waves, so their strengths are n_j (Delta rho - Delta p / c^2) + (Delta u x n)_j. ---*/ + const auto delta_entropy = delta_rho - delta_p/RoeSoundSpeed2; + delta_wave[0] = UnitNormal[0]*delta_entropy + (delta_vel[1]*UnitNormal[2]-delta_vel[2]*UnitNormal[1]); + delta_wave[1] = UnitNormal[1]*delta_entropy + (delta_vel[2]*UnitNormal[0]-delta_vel[0]*UnitNormal[2]); + delta_wave[2] = UnitNormal[2]*delta_entropy + (delta_vel[0]*UnitNormal[1]-delta_vel[1]*UnitNormal[0]); delta_wave[3] = proj_delta_vel + delta_p/(RoeDensity*RoeSoundSpeed); delta_wave[4] = -proj_delta_vel + delta_p/(RoeDensity*RoeSoundSpeed); } @@ -420,11 +438,14 @@ void CUpwLMRoe_Flow::FinalizeResidual(su2double *val_residual, su2double **val_J for (kVar = 0; kVar < nVar; kVar++) val_residual[iVar] -= (1.0-kappa)*Lambda[kVar]*delta_wave[kVar]*P_Tensor[iVar][kVar]*Area; + /*--- With SST, the jump of k in rho*E is advected with the contact wave. ---*/ + val_residual[nVar-1] -= (1.0-kappa)*Lambda[0]*RoeDensity*(turb_ke_j-turb_ke_i)*Area; + if (!implicit) return; /*--- If implicit use the Jacobians of the standard Roe scheme as an approximation ---*/ - GetPMatrix_inv(RoeDensity, RoeVelocity, RoeSoundSpeed, UnitNormal, invP_Tensor); + GetPMatrix_inv(RoeDensity, RoeVelocity, RoeSoundSpeed, UnitNormal, invP_Tensor, RoeTke); for (iVar = 0; iVar < nVar; iVar++) { for (jVar = 0; jVar < nVar; jVar++) { @@ -562,7 +583,8 @@ CNumerics::ResidualType<> CUpwTurkel_Flow::ComputeResidual(const CConfig* config sq_vel += RoeVelocity[iDim]*RoeVelocity[iDim]; } RoeEnthalpy = (R*Enthalpy_j+Enthalpy_i)/(R+1); - RoeSoundSpeed = sqrt(fabs((Gamma-1)*(RoeEnthalpy-0.5*sq_vel))); + /*--- With SST the total enthalpy contains k, which is not part of the speed of sound. ---*/ + RoeSoundSpeed = sqrt(fabs((Gamma-1)*(RoeEnthalpy-0.5*sq_vel-(R*turb_ke_j+turb_ke_i)/(R+1)))); RoePressure = RoeDensity/Gamma*RoeSoundSpeed*RoeSoundSpeed; /*--- Compute ProjFlux_i ---*/ @@ -621,16 +643,21 @@ CNumerics::ResidualType<> CUpwTurkel_Flow::ComputeResidual(const CConfig* config GetPrecondJacobian(Beta2, r_hat, s_hat, t_hat, rhoB2a2, Lambda, UnitNormal, absPeJac); /*--- Compute the matrix from entropic variables to conserved variables ---*/ - GetinvRinvPe(Beta2, RoeEnthalpy, RoeSoundSpeed, RoeDensity, RoeVelocity, invRinvPe); + const su2double roeTke = (R * turb_ke_j + turb_ke_i) / (R + 1); + GetinvRinvPe(Beta2, RoeEnthalpy - roeTke, RoeSoundSpeed, RoeDensity, RoeVelocity, invRinvPe); + for (iVar = 0; iVar < nVar; ++iVar) invRinvPe[nVar - 1][iVar] += roeTke * invRinvPe[0][iVar]; /*--- Compute the matrix from entropic variables to conserved variables ---*/ GetRMatrix(RoePressure, RoeSoundSpeed, RoeDensity, RoeVelocity, R_Tensor); + for (iVar = 0; iVar < nVar; ++iVar) R_Tensor[iVar][0] -= roeTke * R_Tensor[iVar][nVar - 1]; + const su2double rhoDeltaTke = RoeDensity * (turb_ke_j - turb_ke_i); + Diff_U[nVar - 1] -= rhoDeltaTke; if (implicit) { /*--- Jacobians of the inviscid flux, scaled by 0.5 because Flux ~ 0.5*(fc_i+fc_j)*Normal ---*/ - GetInviscidProjJac(Velocity_i, &Energy_i, Normal, 0.5, Jacobian_i); - GetInviscidProjJac(Velocity_j, &Energy_j, Normal, 0.5, Jacobian_j); + GetInviscidProjJac(Velocity_i, &Energy_i, Normal, 0.5, Jacobian_i, turb_ke_i); + GetInviscidProjJac(Velocity_j, &Energy_j, Normal, 0.5, Jacobian_j, turb_ke_j); } for (iVar = 0; iVar < nVar; iVar ++) { @@ -661,6 +688,8 @@ CNumerics::ResidualType<> CUpwTurkel_Flow::ComputeResidual(const CConfig* config } } + Flux[nVar - 1] -= 0.5 * fabs(ProjVelocity) * Area * rhoDeltaTke; + /*--- Contributions due to mesh motion---*/ if (dynamic_grid) { ProjVelocity = 0.0; @@ -741,6 +770,7 @@ CNumerics::ResidualType<> CUpwGeneralRoe_Flow::ComputeResidual(const CConfig* co AD::StartPreacc(); AD::SetPreaccIn(V_i, nDim+4); AD::SetPreaccIn(V_j, nDim+4); AD::SetPreaccIn(Normal, nDim); + AD::SetPreaccIn(turb_ke_i); AD::SetPreaccIn(turb_ke_j); // SST: k in the total energy AD::SetPreaccIn(S_i, 2); AD::SetPreaccIn(S_j, 2); if (dynamic_grid) { AD::SetPreaccIn(GridVel_i, nDim); AD::SetPreaccIn(GridVel_j, nDim); @@ -768,7 +798,7 @@ CNumerics::ResidualType<> CUpwGeneralRoe_Flow::ComputeResidual(const CConfig* co Density_i = V_i[nDim+2]; Enthalpy_i = V_i[nDim+3]; Energy_i = Enthalpy_i - Pressure_i/Density_i; - StaticEnthalpy_i = Enthalpy_i - 0.5*Velocity2_i; + StaticEnthalpy_i = Enthalpy_i - 0.5*Velocity2_i - turb_ke_i; // SST: H contains k StaticEnergy_i = StaticEnthalpy_i - Pressure_i/Density_i; Kappa_i = S_i[1]/Density_i; @@ -788,7 +818,7 @@ CNumerics::ResidualType<> CUpwGeneralRoe_Flow::ComputeResidual(const CConfig* co Enthalpy_j = V_j[nDim+3]; Energy_j = Enthalpy_j - Pressure_j/Density_j; - StaticEnthalpy_j = Enthalpy_j - 0.5*Velocity2_j; + StaticEnthalpy_j = Enthalpy_j - 0.5*Velocity2_j - turb_ke_j; // SST: H contains k StaticEnergy_j = StaticEnthalpy_j - Pressure_j/Density_j; Kappa_j = S_j[1]/Density_j; @@ -811,8 +841,8 @@ CNumerics::ResidualType<> CUpwGeneralRoe_Flow::ComputeResidual(const CConfig* co for (iVar = 0; iVar < nVar; iVar++) { Flux[iVar] = 0.0; for (jVar = 0; jVar < nVar; jVar++) { - Jacobian_i[iVar][iVar] = 0.0; - Jacobian_j[iVar][iVar] = 0.0; + Jacobian_i[iVar][jVar] = 0.0; + Jacobian_j[iVar][jVar] = 0.0; } } AD::SetPreaccOut(Flux, nVar); @@ -831,7 +861,8 @@ CNumerics::ResidualType<> CUpwGeneralRoe_Flow::ComputeResidual(const CConfig* co /*--- Compute P and Lambda (do it with the Normal) ---*/ - GetPMatrix(&RoeDensity, RoeVelocity, &RoeSoundSpeed, &RoeEnthalpy, &RoeChi, &RoeKappa, UnitNormal, P_Tensor); + GetPMatrix(&RoeDensity, RoeVelocity, &RoeSoundSpeed, &RoeEnthalpy, &RoeChi, &RoeKappa, UnitNormal, P_Tensor, + (R*turb_ke_j+turb_ke_i)/(R+1)); ProjVelocity = 0.0; ProjVelocity_i = 0.0; ProjVelocity_j = 0.0; for (iDim = 0; iDim < nDim; iDim++) { @@ -901,9 +932,12 @@ CNumerics::ResidualType<> CUpwGeneralRoe_Flow::ComputeResidual(const CConfig* co delta_wave[2] = proj_delta_vel + delta_p/(RoeDensity*RoeSoundSpeed); delta_wave[3] = -proj_delta_vel + delta_p/(RoeDensity*RoeSoundSpeed); } else { - delta_wave[0] = delta_rho - delta_p/(RoeSoundSpeed*RoeSoundSpeed); - delta_wave[1] = UnitNormal[0]*delta_vel[2]-UnitNormal[2]*delta_vel[0]; - delta_wave[2] = UnitNormal[1]*delta_vel[0]-UnitNormal[0]*delta_vel[1]; + /*--- The first three columns of the 3D P matrix combine the entropy wave (weighted by the normal) with the + shear waves, so their strengths are n_j (Delta rho - Delta p / c^2) + (Delta u x n)_j. ---*/ + const auto delta_entropy = delta_rho - delta_p/(RoeSoundSpeed*RoeSoundSpeed); + delta_wave[0] = UnitNormal[0]*delta_entropy + delta_vel[1]*UnitNormal[2]-delta_vel[2]*UnitNormal[1]; + delta_wave[1] = UnitNormal[1]*delta_entropy + delta_vel[2]*UnitNormal[0]-delta_vel[0]*UnitNormal[2]; + delta_wave[2] = UnitNormal[2]*delta_entropy + delta_vel[0]*UnitNormal[1]-delta_vel[1]*UnitNormal[0]; delta_wave[3] = proj_delta_vel + delta_p/(RoeDensity*RoeSoundSpeed); delta_wave[4] = -proj_delta_vel + delta_p/(RoeDensity*RoeSoundSpeed); } @@ -914,6 +948,8 @@ CNumerics::ResidualType<> CUpwGeneralRoe_Flow::ComputeResidual(const CConfig* co for (jVar = 0; jVar < nVar; jVar++) Flux[iVar] -= 0.5*Lambda[jVar]*delta_wave[jVar]*P_Tensor[iVar][jVar]*Area; } + /*--- With SST, the jump of k in rho*E is advected with the contact wave. ---*/ + Flux[nVar-1] -= 0.5*Lambda[0]*RoeDensity*(turb_ke_j-turb_ke_i)*Area; /*--- Flux contribution due to grid motion ---*/ if (dynamic_grid) { @@ -929,20 +965,26 @@ CNumerics::ResidualType<> CUpwGeneralRoe_Flow::ComputeResidual(const CConfig* co /*--- Compute inverse P ---*/ - GetPMatrix_inv(invP_Tensor, &RoeDensity, RoeVelocity, &RoeSoundSpeed, &RoeChi , &RoeKappa, UnitNormal); + GetPMatrix_inv(invP_Tensor, &RoeDensity, RoeVelocity, &RoeSoundSpeed, &RoeChi , &RoeKappa, UnitNormal, + (R*turb_ke_j+turb_ke_i)/(R+1)); /*--- Jacobians of the inviscid flux, scaled by 0.5 because val_resconv ~ 0.5*(fc_i+fc_j)*Normal ---*/ - GetInviscidProjJac(Velocity_i, &Enthalpy_i, &Chi_i, &Kappa_i, Normal, 0.5, Jacobian_i); + GetInviscidProjJac(Velocity_i, &Enthalpy_i, &Chi_i, &Kappa_i, Normal, 0.5, Jacobian_i, turb_ke_i); - GetInviscidProjJac(Velocity_j, &Enthalpy_j, &Chi_j, &Kappa_j, Normal, 0.5, Jacobian_j); + GetInviscidProjJac(Velocity_j, &Enthalpy_j, &Chi_j, &Kappa_j, Normal, 0.5, Jacobian_j, turb_ke_j); /*--- Diference variables iPoint and jPoint ---*/ for (iVar = 0; iVar < nVar; iVar++) Diff_U[iVar] = U_j[iVar]-U_i[iVar]; + /*--- With SST, the part of the jump of rho*E due to the jump of k is not a pressure jump: remove it before the + projection and advect it with the contact wave. ---*/ + const su2double rhoDeltaTke = RoeDensity*(turb_ke_j-turb_ke_i); + Diff_U[nVar-1] -= rhoDeltaTke; + /*--- Roe's Flux approximation ---*/ for (iVar = 0; iVar < nVar; iVar++) { Flux[iVar] = 0.5*(ProjFlux_i[iVar]+ProjFlux_j[iVar]); @@ -959,6 +1001,7 @@ CNumerics::ResidualType<> CUpwGeneralRoe_Flow::ComputeResidual(const CConfig* co Jacobian_j[iVar][jVar] -= (1.0-kappa)*Proj_ModJac_Tensor_ij*Area; } } + Flux[nVar-1] -= (1.0-kappa)*Lambda[0]*rhoDeltaTke*Area; /*--- Jacobian contributions due to grid motion ---*/ if (dynamic_grid) { @@ -1017,6 +1060,6 @@ void CUpwGeneralRoe_Flow::ComputeRoeAverage() { // // } - RoeSoundSpeed2 = RoeChi + RoeKappa*(RoeEnthalpy-0.5*sq_vel); + RoeSoundSpeed2 = RoeChi + RoeKappa*(RoeEnthalpy-0.5*sq_vel-(R*turb_ke_j+turb_ke_i)/(R+1)); // SST: H contains k } diff --git a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp index eca315d00373..276663b1306f 100644 --- a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp +++ b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp @@ -539,9 +539,9 @@ void CAvgGrad_Flow::SetHeatFluxJacobian(const su2double *val_Mean_PrimVar, /*--- R times partial derivatives of temp. ---*/ - const su2double R_dTdu0 = -Pressure/(Density*Density) + 0.5*sqvel*phi; - const su2double R_dTdu1 = -phi*val_Mean_PrimVar[1]; - const su2double R_dTdu2 = -phi*val_Mean_PrimVar[2]; + const su2double R_dTdu0 = -Pressure / (Density * Density) + (0.5 * sqvel - Mean_turb_ke) * phi; + const su2double R_dTdu1 = -phi * val_Mean_PrimVar[1]; + const su2double R_dTdu2 = -phi * val_Mean_PrimVar[2]; const su2double heat_flux_factor = val_thermal_conductivity/val_heat_capacity_cp + val_eddy_viscosity/Prandtl_Turb; const su2double cpoR = Gamma/Gamma_Minus_One; // cp over R diff --git a/SU2_CFD/src/numerics/flow/flow_sources.cpp b/SU2_CFD/src/numerics/flow/flow_sources.cpp index 2baa440496aa..1cfbdc9cf245 100644 --- a/SU2_CFD/src/numerics/flow/flow_sources.cpp +++ b/SU2_CFD/src/numerics/flow/flow_sources.cpp @@ -54,7 +54,7 @@ CSourceAxisymmetric_Flow::CSourceAxisymmetric_Flow(unsigned short val_nDim, unsi implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); viscous = config->GetViscous(); - rans = (config->GetKind_Turb_Model() != TURB_MODEL::NONE); + tkeInEnergy = (config->GetKind_Turb_Model() == TURB_MODEL::SST); } @@ -74,7 +74,9 @@ CNumerics::ResidualType<> CSourceAxisymmetric_Flow::ComputeResidual(const CConfi Velocity_i = U_i[iDim+1] / U_i[0]; sq_vel += Velocity_i * Velocity_i; } - Pressure_i = Gamma_Minus_One*U_i[0]*(U_i[nDim+1]/U_i[0]-0.5*sq_vel); + /*--- With SST the total energy contains k. ---*/ + const su2double tke = tkeInEnergy ? turb_ke_i : 0.0; + Pressure_i = Gamma_Minus_One*U_i[0]*(U_i[nDim+1]/U_i[0]-0.5*sq_vel-tke); Enthalpy_i = (U_i[nDim+1] + Pressure_i) / U_i[0]; /*--- Smooth blending between gradient formulation and standard formulation ---*/ @@ -138,8 +140,9 @@ CNumerics::ResidualType<> CSourceAxisymmetric_Flow::ComputeResidual(const CConfi jacobian[3][0] = -Gamma*U_i[2]*U_i[3]/(U_i[0]*U_i[0]) + (Gamma-1)*U_i[2]*(U_i[1]*U_i[1]+U_i[2]*U_i[2])/(U_i[0]*U_i[0]*U_i[0]); jacobian[3][1] = -(Gamma-1)*U_i[2]*U_i[1]/(U_i[0]*U_i[0]); - jacobian[3][2] = Gamma*U_i[3]/U_i[0] - 1/2*(Gamma-1)*( (U_i[1]*U_i[1]+U_i[2]*U_i[2])/(U_i[0]*U_i[0]) + 2*U_i[2]*U_i[2]/(U_i[0]*U_i[0]) ); + jacobian[3][2] = Gamma*U_i[3]/U_i[0] - 0.5*(Gamma-1)*( (U_i[1]*U_i[1]+U_i[2]*U_i[2])/(U_i[0]*U_i[0]) + 2*U_i[2]*U_i[2]/(U_i[0]*U_i[0]) ); jacobian[3][3] = Gamma*U_i[2]/U_i[0]; + jacobian[3][2] -= Gamma_Minus_One*tke; // k is a variable of the turbulence solver for (iVar=0; iVar < nVar; iVar++) for (jVar=0; jVar < nVar; jVar++) @@ -161,8 +164,6 @@ CNumerics::ResidualType<> CSourceAxisymmetric_Flow::ComputeResidual(const CConfi void CSourceAxisymmetric_Flow::ResidualDiffusion(){ - if (!rans){ turb_ke_i = 0.0; } - su2double laminar_viscosity_i = V_i[nDim+5]; su2double eddy_viscosity_i = V_i[nDim+6]; su2double thermal_conductivity_i = V_i[nDim+7]; @@ -181,7 +182,7 @@ void CSourceAxisymmetric_Flow::ResidualDiffusion(){ -TWO3*AuxVar_Grad_i[0][1]); residual[3] -= Volume*(yinv*(total_viscosity_i*(u*(PrimVar_Grad_i[2][0]+PrimVar_Grad_i[1][1]) +v*TWO3*(2*PrimVar_Grad_i[2][1]-PrimVar_Grad_i[1][0] - -v*yinv+U_i[0]*turb_ke_i)) + -v*yinv)) +total_conductivity_i*PrimVar_Grad_i[0][1]) -TWO3*(AuxVar_Grad_i[1][1]+AuxVar_Grad_i[2][0])); } diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index 984b7c857e90..978d74a2dfcf 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -65,6 +65,7 @@ CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, (config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_2ND); const bool time_stepping = (config->GetTime_Marching() == TIME_MARCHING::TIME_STEPPING); const bool adjoint = config->GetContinuous_Adjoint() || config->GetDiscrete_Adjoint(); + const bool tkeNeeded = (rans && config->GetKind_Turb_Model() == TURB_MODEL::SST); int Unst_RestartIter = 0; unsigned long iPoint, iMarker, counter_local = 0, counter_global = 0; @@ -246,6 +247,7 @@ CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, Density_Inf = config->GetDensity_FreeStreamND(); Energy_Inf = config->GetEnergy_FreeStreamND(); Mach_Inf = config->GetMach(); + const su2double TKE_Inf = config->GetTke_FreeStreamND(); /*--- Initialize the secondary values for direct derivative approximations ---*/ @@ -315,6 +317,7 @@ CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, Velocity2 += pow(nodes->GetSolution(iPoint,iDim+1)/Density,2); StaticEnergy= nodes->GetEnergy(iPoint) - 0.5*Velocity2; + if (tkeNeeded) StaticEnergy -= TKE_Inf; GetFluidModel()->SetTDState_rhoe(Density, StaticEnergy); Pressure= GetFluidModel()->GetPressure(); @@ -1843,6 +1846,9 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain const bool muscl = (config->GetMUSCL_Flow() && (iMesh == MESH_0)); const bool limiter = (config->GetKind_SlopeLimit_Flow() != LIMITER::NONE); + /*--- SST: the total enthalpy of the cells contains k. ---*/ + const bool tkeInEnergy = (config->GetKind_Turb_Model() == TURB_MODEL::SST); + const CVariable* turbNodes = tkeInEnergy ? solver_container[TURB_SOL]->GetNodes() : nullptr; const bool van_albada = (config->GetKind_SlopeLimit_Flow() == LIMITER::VAN_ALBADA_EDGE); const su2double kappa = config->GetMUSCL_Kappa_Flow(); @@ -1883,6 +1889,13 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain numerics->SetNormal(geometry->edges->GetNormal(iEdge)); + su2double tke_i = 0.0, tke_j = 0.0; + if (tkeInEnergy) { + tke_i = turbNodes->GetSolution(iPoint, 0); + tke_j = turbNodes->GetSolution(jPoint, 0); + numerics->SetTurbKineticEnergy(tke_i, tke_j); + } + auto Coord_i = geometry->nodes->GetCoord(iPoint); auto Coord_j = geometry->nodes->GetCoord(jPoint); @@ -1947,27 +1960,39 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain } - /*--- Recompute the reconstructed quantities in a thermodynamically consistent way. ---*/ + /*--- Check for non-physical solutions after reconstruction. If found, use the + cell-average value of the solution. This is a locally 1st order approximation, + which is typically only active during the start-up of a calculation. + Pressure and density are checked before the fluid model is evaluated with them. ---*/ - if (!ideal_gas || low_mach_corr) { - ComputeConsistentExtrapolation(GetFluidModel(), nDim, Primitive_i, Secondary_i); - ComputeConsistentExtrapolation(GetFluidModel(), nDim, Primitive_j, Secondary_j); - } + auto nonPositive = [](su2double value) { return !(value > 0.0) || !std::isfinite(SU2_TYPE::GetValue(value)); }; + bool neg_pres_or_rho_i = nonPositive(Primitive_i[prim_idx.Pressure()]) || nonPositive(Primitive_i[prim_idx.Density()]); + bool neg_pres_or_rho_j = nonPositive(Primitive_j[prim_idx.Pressure()]) || nonPositive(Primitive_j[prim_idx.Density()]); - /*--- Low-Mach number correction. ---*/ + if (!neg_pres_or_rho_i && !neg_pres_or_rho_j) { + /*--- Recompute the reconstructed quantities in a thermodynamically consistent way. + With SST the total enthalpy contains k, taken from the cells (as the vectorized reconstruction does). ---*/ - if (low_mach_corr) { - LowMachPrimitiveCorrection(GetFluidModel(), nDim, Primitive_i, Primitive_j); - } + if (!ideal_gas || low_mach_corr || tkeInEnergy) { + ComputeConsistentExtrapolation(GetFluidModel(), nDim, Primitive_i, Secondary_i, tke_i); + ComputeConsistentExtrapolation(GetFluidModel(), nDim, Primitive_j, Secondary_j, tke_j); + } - /*--- Check for non-physical solutions after reconstruction. If found, use the - cell-average value of the solution. This is a locally 1st order approximation, - which is typically only active during the start-up of a calculation. ---*/ + /*--- Low-Mach number correction. ---*/ + + if (low_mach_corr) { + LowMachPrimitiveCorrection(GetFluidModel(), nDim, Primitive_i, Primitive_j, tke_i, tke_j); + } - bool neg_pres_or_rho_i = (Primitive_i[prim_idx.Pressure()] < 0.0) || (Primitive_i[prim_idx.Density()] < 0.0); - bool neg_pres_or_rho_j = (Primitive_j[prim_idx.Pressure()] < 0.0) || (Primitive_j[prim_idx.Density()] < 0.0); + /*--- The correction changes the face states, check them again. ---*/ - su2double R = sqrt(fabs(Primitive_j[prim_idx.Density()]/Primitive_i[prim_idx.Density()])); + neg_pres_or_rho_i = nonPositive(Primitive_i[prim_idx.Pressure()]) || nonPositive(Primitive_i[prim_idx.Density()]); + neg_pres_or_rho_j = nonPositive(Primitive_j[prim_idx.Pressure()]) || nonPositive(Primitive_j[prim_idx.Density()]); + } + + su2double R = 1.0; + if (!neg_pres_or_rho_i && !neg_pres_or_rho_j) + R = sqrt(Primitive_j[prim_idx.Density()]/Primitive_i[prim_idx.Density()]); su2double sq_vel = 0.0; for (auto iDim = 0u; iDim < nDim; iDim++) { su2double RoeVelocity = (R * Primitive_j[iDim + prim_idx.Velocity()] + @@ -1976,7 +2001,14 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain } su2double RoeEnthalpy = (R * Primitive_j[prim_idx.Enthalpy()] + Primitive_i[prim_idx.Enthalpy()]) / (R+1); - const bool neg_sound_speed = ((Gamma-1)*(RoeEnthalpy-0.5*sq_vel) < 0.0); + const su2double RoeTke = (R * tke_j + tke_i) / (R+1); // SST: the total enthalpy contains k + /*--- Speed of sound of the Roe average and of each side (schemes such as HLLC use both). ---*/ + auto negSoundSpeed2 = [&](const su2double* prim, su2double tke) { + const su2double vel2 = GeometryToolbox::SquaredNorm(nDim, &prim[prim_idx.Velocity()]); + return (Gamma-1)*(prim[prim_idx.Enthalpy()] - 0.5*vel2 - tke) < 0.0; + }; + const bool neg_sound_speed = ((Gamma-1)*(RoeEnthalpy-0.5*sq_vel-RoeTke) < 0.0) || + negSoundSpeed2(Primitive_i, tke_i) || negSoundSpeed2(Primitive_j, tke_j); bool bad_recon = neg_sound_speed || neg_pres_or_rho_i || neg_pres_or_rho_j; bad_recon = nodes->UpdateNonPhysicalEdgeCounter(iEdge, bad_recon); counter_local += bad_recon; @@ -2036,7 +2068,7 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain } void CEulerSolver::ComputeConsistentExtrapolation(CFluidModel *fluidModel, unsigned short nDim, - su2double *primitive, su2double *secondary) { + su2double *primitive, su2double *secondary, su2double tke) { SU2_ZONE_SCOPED const CEulerVariable::CIndices prim_idx(nDim, 0); const su2double density = primitive[prim_idx.Density()]; @@ -2046,7 +2078,7 @@ void CEulerSolver::ComputeConsistentExtrapolation(CFluidModel *fluidModel, unsig fluidModel->SetTDState_Prho(pressure, density); primitive[prim_idx.Temperature()] = fluidModel->GetTemperature(); - primitive[prim_idx.Enthalpy()] = fluidModel->GetStaticEnergy() + pressure / density + 0.5*velocity2; + primitive[prim_idx.Enthalpy()] = fluidModel->GetStaticEnergy() + pressure / density + 0.5*velocity2 + tke; primitive[prim_idx.SoundSpeed()] = fluidModel->GetSoundSpeed(); secondary[0] = fluidModel->GetdPdrho_e(); secondary[1] = fluidModel->GetdPde_rho(); @@ -2054,7 +2086,8 @@ void CEulerSolver::ComputeConsistentExtrapolation(CFluidModel *fluidModel, unsig } void CEulerSolver::LowMachPrimitiveCorrection(CFluidModel *fluidModel, unsigned short nDim, - su2double *primitive_i, su2double *primitive_j) { + su2double *primitive_i, su2double *primitive_j, + su2double tke_i, su2double tke_j) { SU2_ZONE_SCOPED unsigned short iDim; @@ -2085,10 +2118,10 @@ void CEulerSolver::LowMachPrimitiveCorrection(CFluidModel *fluidModel, unsigned } fluidModel->SetEnergy_Prho(primitive_i[nDim+1], primitive_i[nDim+2]); - primitive_i[nDim+3]= fluidModel->GetStaticEnergy() + primitive_i[nDim+1]/primitive_i[nDim+2] + 0.5*velocity2_i; + primitive_i[nDim+3]= fluidModel->GetStaticEnergy() + primitive_i[nDim+1]/primitive_i[nDim+2] + 0.5*velocity2_i + tke_i; fluidModel->SetEnergy_Prho(primitive_j[nDim+1], primitive_j[nDim+2]); - primitive_j[nDim+3]= fluidModel->GetStaticEnergy() + primitive_j[nDim+1]/primitive_j[nDim+2] + 0.5*velocity2_j; + primitive_j[nDim+3]= fluidModel->GetStaticEnergy() + primitive_j[nDim+1]/primitive_j[nDim+2] + 0.5*velocity2_j + tke_j; } @@ -2205,7 +2238,7 @@ void CEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain numerics->SetAuxVarGrad(nodes->GetAuxVarGradient(iPoint), nullptr); /*--- Set turbulence kinetic energy ---*/ - if (rans){ + if (config->GetKind_Turb_Model() == TURB_MODEL::SST){ CVariable* turbNodes = solver_container[TURB_SOL]->GetNodes(); numerics->SetTurbKineticEnergy(turbNodes->GetSolution(iPoint,0), turbNodes->GetSolution(iPoint,0)); } @@ -2393,12 +2426,11 @@ void CEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, const CConfig *co const su2double Pressure_i = nodes->GetPressure(iPoint); /*--- Initialize. ---*/ - for (unsigned short iVar = 0; iVar < nVar; iVar++) - nodes->SetUnd_Lapl(iPoint, iVar, 0.0); + for (unsigned short iVar = 0; iVar < nVar; iVar++) nodes->SetUnd_Lapl(iPoint, iVar, 0.0); + if (nodes->GetUndivided_Laplacian().cols() > nVar) nodes->SetUnd_Lapl(iPoint, nVar, 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. ---*/ @@ -2410,7 +2442,9 @@ void CEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, const CConfig *co nodes->AddUnd_Lapl(iPoint, iVar, nodes->GetSolution(jPoint,iVar)-nodes->GetSolution(iPoint,iVar)); su2double Pressure_j = nodes->GetPressure(jPoint); - nodes->AddUnd_Lapl(iPoint, nVar-1, Pressure_j-Pressure_i); + nodes->AddUnd_Lapl(iPoint, nVar - 1, Pressure_j - Pressure_i); + if (nodes->GetUndivided_Laplacian().cols() > nVar) + nodes->AddUnd_Lapl(iPoint, nVar, nodes->GetRhoTke(jPoint) - nodes->GetRhoTke(iPoint)); } } END_SU2_OMP_FOR @@ -2537,7 +2571,7 @@ void CEulerSolver::PrepareImplicitIteration(CGeometry *geometry, CSolver**, CCon PrepareImplicitIteration_impl(precond, geometry, config); } -void CEulerSolver::ComputeUnderRelaxationFactor(const CConfig* config) { +void CEulerSolver::ComputeUnderRelaxationFactor(const CConfig* config, CSolver** solver_container) { SU2_ZONE_SCOPED /*--- Loop over the solution update given by relaxing the linear system for this @@ -2559,6 +2593,11 @@ void CEulerSolver::ComputeUnderRelaxationFactor(const CConfig* config) { e_old -= 0.5 * pow(nodes->GetSolution(iPoint, jVar), 2) / rho_old; e_new -= 0.5 * pow(nodes->GetSolution(iPoint, jVar) + LinSysSol(iPoint, jVar), 2) / rho_new; } + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) { + const su2double tke = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0); + e_old -= rho_old * tke; + e_new -= rho_new * tke; + } ratio = fmax(ratio, fabs(e_new - e_old) / max(e_old, EPS)); su2double localUnderRelaxation = fmin(allowableRatio / fmax(ratio, EPS), 1); @@ -2727,25 +2766,25 @@ void CEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPoint soundspeed = nodes->GetSoundSpeed(iPoint); sq_vel = nodes->GetVelocity2(iPoint); + const su2double tke = + config->GetKind_Turb_Model() == TURB_MODEL::SST ? su2double(nodes->GetRhoTke(iPoint) / rho) : su2double(0.0); + /*---Calculating the inverse of the preconditioning matrix that multiplies the time derivative */ - preconditioner[0][0] = 0.5*sq_vel; - preconditioner[0][nVar-1] = 1.0; - for (iDim = 0; iDim < nDim; iDim ++) - preconditioner[0][1+iDim] = -1.0*U_i[iDim+1]/rho; + preconditioner[0][0] = 0.5 * sq_vel - tke; + preconditioner[0][nVar - 1] = 1.0; + for (iDim = 0; iDim < nDim; iDim++) preconditioner[0][1 + iDim] = -1.0 * U_i[iDim + 1] / rho; - for (iDim = 0; iDim < nDim; iDim ++) { - preconditioner[iDim+1][0] = 0.5*sq_vel*U_i[iDim+1]/rho; - preconditioner[iDim+1][nVar-1] = U_i[iDim+1]/rho; - for (jDim = 0; jDim < nDim; jDim ++) { - preconditioner[iDim+1][1+jDim] = -1.0*U_i[jDim+1]/rho*U_i[iDim+1]/rho; + for (iDim = 0; iDim < nDim; iDim++) { + preconditioner[iDim + 1][0] = (0.5 * sq_vel - tke) * U_i[iDim + 1] / rho; + preconditioner[iDim + 1][nVar - 1] = U_i[iDim + 1] / rho; + for (jDim = 0; jDim < nDim; jDim++) { + preconditioner[iDim + 1][1 + jDim] = -1.0 * U_i[jDim + 1] / rho * U_i[iDim + 1] / rho; } } - preconditioner[nVar-1][0] = 0.5*sq_vel*enthalpy; - preconditioner[nVar-1][nVar-1] = enthalpy; - for (iDim = 0; iDim < nDim; iDim ++) - preconditioner[nVar-1][1+iDim] = -1.0*U_i[iDim+1]/rho*enthalpy; - + preconditioner[nVar - 1][0] = (0.5 * sq_vel - tke) * enthalpy; + preconditioner[nVar - 1][nVar - 1] = enthalpy; + for (iDim = 0; iDim < nDim; iDim++) preconditioner[nVar - 1][1 + iDim] = -1.0 * U_i[iDim + 1] / rho * enthalpy; for (iVar = 0; iVar < nVar; iVar ++ ) { for (jVar = 0; jVar < nVar; jVar ++ ) { @@ -5020,7 +5059,9 @@ void CEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container, bool implicit = config->GetKind_TimeIntScheme() == EULER_IMPLICIT; bool viscous = config->GetViscous(); - bool tkeNeeded = config->GetKind_Turb_Model() == TURB_MODEL::SST; + bool tkeNeeded = (config->GetKind_Turb_Model() == TURB_MODEL::SST); + CVariable* turbNodes = nullptr; + if (tkeNeeded) turbNodes = solver_container[TURB_SOL]->GetNodes(); auto *Normal = new su2double[nDim]; @@ -5170,7 +5211,8 @@ void CEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container, } Pressure = Density*SoundSpeed*SoundSpeed/Gamma; Energy = Pressure/(Gamma_Minus_One*Density) + 0.5*Velocity2; - if (tkeNeeded) Energy += GetTke_Inf(); + /*--- k of the boundary node, not the free-stream value, which decays right away in the domain (#1851). ---*/ + if (tkeNeeded) Energy += turbNodes->GetSolution(iPoint,0); /*--- Store new primitive state for computing the flux. ---*/ @@ -5187,6 +5229,16 @@ void CEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container, conv_numerics->SetPrimitive(V_domain, V_infty); + /*--- SST: both states contain the k of the node in their total enthalpy. ---*/ + + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) { + + const su2double tke = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0); + + conv_numerics->SetTurbKineticEnergy(tke, tke); + + } + if (dynamic_grid) { conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); @@ -5267,6 +5319,8 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, tkeNeeded = config->GetKind_Turb_Model() == TURB_MODEL::SST, ideal_gas = config->GetKind_FluidModel() == STANDARD_AIR || config->GetKind_FluidModel() == IDEAL_GAS; + CVariable* turbNodes = nullptr; + if (tkeNeeded) turbNodes = solver_container[TURB_SOL]->GetNodes(); su2double **P_Tensor = new su2double*[nVar], **invP_Tensor = new su2double*[nVar]; @@ -5312,7 +5366,8 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, const auto Density_i = nodes->GetDensity(iPoint); const auto Energy_i = nodes->GetEnergy(iPoint); - const su2double StaticEnergy_i = Energy_i - 0.5*Velocity2_i; + su2double StaticEnergy_i = Energy_i - 0.5*Velocity2_i; + if (tkeNeeded) StaticEnergy_i -= turbNodes->GetSolution(iPoint, 0); GetFluidModel()->SetTDState_rhoe(Density_i, StaticEnergy_i); @@ -5366,7 +5421,6 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, Density_e = GetFluidModel()->GetDensity(); StaticEnergy_e = GetFluidModel()->GetStaticEnergy(); Energy_e = StaticEnergy_e + 0.5 * Velocity2_e; - if (tkeNeeded) Energy_e += GetTke_Inf(); break; case STATIC_SUPERSONIC_INFLOW_PT: @@ -5392,7 +5446,6 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, Density_e = GetFluidModel()->GetDensity(); StaticEnergy_e = GetFluidModel()->GetStaticEnergy(); Energy_e = StaticEnergy_e + 0.5 * Velocity2_e; - if (tkeNeeded) Energy_e += GetTke_Inf(); break; case STATIC_SUPERSONIC_INFLOW_PD: @@ -5419,7 +5472,6 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, Density_e = GetFluidModel()->GetDensity(); StaticEnergy_e = GetFluidModel()->GetStaticEnergy(); Energy_e = StaticEnergy_e + 0.5 * Velocity2_e; - if (tkeNeeded) Energy_e += GetTke_Inf(); break; case DENSITY_VELOCITY: @@ -5435,7 +5487,9 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, for (auto iDim = 0u; iDim < nDim; iDim++) Velocity_e[iDim] = VelMag_e*Flow_Dir[iDim]; + /*--- The total energy of the node already contains k, which is added below to every case. ---*/ Energy_e = Energy_i; + if (tkeNeeded) Energy_e -= turbNodes->GetSolution(iPoint, 0); break; case STATIC_PRESSURE: @@ -5459,11 +5513,18 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, break; } + /*--- k of the boundary node, not the free-stream value, which decays right away in the domain (#1851). + It is also removed from the static energy of the boundary state. ---*/ + const su2double Tke_e = tkeNeeded ? turbNodes->GetSolution(iPoint, 0) : 0.0; + Energy_e += Tke_e; + /*--- Compute P (matrix of right eigenvectors) ---*/ - conv_numerics->GetPMatrix(&Density_i, Velocity_i, &SoundSpeed_i, &Enthalpy_i, &Chi_i, &Kappa_i, UnitNormal, P_Tensor); + conv_numerics->GetPMatrix(&Density_i, Velocity_i, &SoundSpeed_i, &Enthalpy_i, &Chi_i, &Kappa_i, UnitNormal, P_Tensor, + Tke_e); /*--- Compute inverse P (matrix of left eigenvectors)---*/ - conv_numerics->GetPMatrix_inv(invP_Tensor, &Density_i, Velocity_i, &SoundSpeed_i, &Chi_i, &Kappa_i, UnitNormal); + conv_numerics->GetPMatrix_inv(invP_Tensor, &Density_i, Velocity_i, &SoundSpeed_i, &Chi_i, &Kappa_i, UnitNormal, + Tke_e); /*--- eigenvalues contribution due to grid motion ---*/ su2double ProjVelocity_i = GeometryToolbox::DotProduct(nDim, Velocity_i, UnitNormal); @@ -5512,7 +5573,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, const auto Velocity2_b = GeometryToolbox::SquaredNorm(nDim, Velocity_b); const su2double Energy_b = u_b[nVar-1]/Density_b; - const su2double StaticEnergy_b = Energy_b - 0.5*Velocity2_b; + const su2double StaticEnergy_b = Energy_b - 0.5*Velocity2_b - Tke_e; GetFluidModel()->SetTDState_rhoe(Density_b, StaticEnergy_b); /*--- Store number of Newton iterations at BC ---*/ @@ -5566,7 +5627,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, } /*--- Compute flux Jacobian in state b ---*/ - conv_numerics->GetInviscidProjJac(Velocity_b, &Enthalpy_b, &Chi_b, &Kappa_b, Normal, 1.0, Jacobian_b); + conv_numerics->GetInviscidProjJac(Velocity_b, &Enthalpy_b, &Chi_b, &Kappa_b, Normal, 1.0, Jacobian_b, Tke_e); /*--- Jacobian contribution due to grid motion ---*/ if (dynamic_grid){ @@ -5656,7 +5717,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, /*--- Turbulent kinetic energy ---*/ - if (config->GetKind_Turb_Model() == TURB_MODEL::SST) + if (tkeNeeded) visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); @@ -5712,6 +5773,8 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain bool tkeNeeded = (config->GetKind_Turb_Model() == TURB_MODEL::SST); const bool ideal_gas = config->GetKind_FluidModel() == STANDARD_AIR || config->GetKind_FluidModel() == IDEAL_GAS; + CVariable* turbNodes = nullptr; + if (tkeNeeded) turbNodes = solver_container[TURB_SOL]->GetNodes(); su2double *Normal, *turboNormal, *UnitNormal, *FlowDirMix, FlowDirMixMag, *turboVelocity; Normal = new su2double[nDim]; @@ -5785,6 +5848,7 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain Energy_i = nodes->GetEnergy(iPoint); StaticEnergy_i = Energy_i - 0.5*Velocity2_i; + if (tkeNeeded) StaticEnergy_i -= turbNodes->GetSolution(iPoint, 0); GetFluidModel()->SetTDState_rhoe(Density_i, StaticEnergy_i); @@ -5801,7 +5865,7 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain ProjVelocity_i += Velocity_i[iDim]*UnitNormal[iDim]; su2double donorAverages[5] = {0.0}; - switch (config->GetKind_Data_Giles(Marker_Tag)){ + switch (config->GetKind_Data_Riemann(Marker_Tag)){ case MIXING_IN: case MIXING_IN_1D: case MIXING_OUT: case MIXING_OUT_1D: for (auto mixVar = 0u; mixVar < 5; mixVar++) donorAverages[mixVar] = GetMixingState(val_marker, iSpan, mixVar); break; @@ -5848,7 +5912,7 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain Density_e = GetFluidModel()->GetDensity(); StaticEnergy_e = GetFluidModel()->GetStaticEnergy(); Energy_e = StaticEnergy_e + 0.5 * Velocity2_e; - if (tkeNeeded) Energy_e += GetTke_Inf(); + if (tkeNeeded) Energy_e += turbNodes->GetSolution(iPoint, 0); break; case MIXING_IN: @@ -5883,7 +5947,7 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain Density_e = GetFluidModel()->GetDensity(); StaticEnergy_e = GetFluidModel()->GetStaticEnergy(); Energy_e = StaticEnergy_e + 0.5 * Velocity2_e; - // if (tkeNeeded) Energy_e += GetTke_Inf(); + if (tkeNeeded) Energy_e += turbNodes->GetSolution(iPoint, 0); break; @@ -5901,6 +5965,7 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain Velocity2_e += Velocity_e[iDim]*Velocity_e[iDim]; } Energy_e = GetFluidModel()->GetStaticEnergy() + 0.5*Velocity2_e; + if (tkeNeeded) Energy_e += turbNodes->GetSolution(iPoint, 0); break; case STATIC_PRESSURE: @@ -5918,6 +5983,7 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain Velocity2_e += Velocity_e[iDim]*Velocity_e[iDim]; } Energy_e = GetFluidModel()->GetStaticEnergy() + 0.5*Velocity2_e; + if (tkeNeeded) Energy_e += turbNodes->GetSolution(iPoint, 0); break; @@ -5935,6 +6001,7 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain Velocity2_e += Velocity_e[iDim]*Velocity_e[iDim]; } Energy_e = GetFluidModel()->GetStaticEnergy() + 0.5*Velocity2_e; + if (tkeNeeded) Energy_e += turbNodes->GetSolution(iPoint, 0); break; default: @@ -5943,10 +6010,13 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain } /*--- Compute P (matrix of right eigenvectors) ---*/ - conv_numerics->GetPMatrix(&Density_i, Velocity_i, &SoundSpeed_i, &Enthalpy_i, &Chi_i, &Kappa_i, UnitNormal, P_Tensor); + const su2double Tke_i = tkeNeeded ? turbNodes->GetSolution(iPoint, 0) : 0.0; // SST: k in the total energy + conv_numerics->GetPMatrix(&Density_i, Velocity_i, &SoundSpeed_i, &Enthalpy_i, &Chi_i, &Kappa_i, UnitNormal, P_Tensor, + Tke_i); /*--- Compute inverse P (matrix of left eigenvectors)---*/ - conv_numerics->GetPMatrix_inv(invP_Tensor, &Density_i, Velocity_i, &SoundSpeed_i, &Chi_i, &Kappa_i, UnitNormal); + conv_numerics->GetPMatrix_inv(invP_Tensor, &Density_i, Velocity_i, &SoundSpeed_i, &Chi_i, &Kappa_i, UnitNormal, + Tke_i); /*--- eigenvalues contribution due to grid motion ---*/ if (dynamic_grid){ @@ -6010,7 +6080,7 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain Velocity2_b += Velocity_b[iDim]*Velocity_b[iDim]; } Energy_b = u_b[nVar-1]/Density_b; - StaticEnergy_b = Energy_b - 0.5*Velocity2_b; + StaticEnergy_b = Energy_b - 0.5*Velocity2_b - Tke_i; // SST: k in the total energy GetFluidModel()->SetTDState_rhoe(Density_b, StaticEnergy_b); Pressure_b = GetFluidModel()->GetPressure(); Temperature_b = GetFluidModel()->GetTemperature(); @@ -6066,7 +6136,7 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain } /*--- Compute flux Jacobian in state b ---*/ - conv_numerics->GetInviscidProjJac(Velocity_b, &Enthalpy_b, &Chi_b, &Kappa_b, Normal, 1.0, Jacobian_b); + conv_numerics->GetInviscidProjJac(Velocity_b, &Enthalpy_b, &Chi_b, &Kappa_b, Normal, 1.0, Jacobian_b, Tke_i); /*--- Jacobian contribution due to grid motion ---*/ if (dynamic_grid) @@ -6768,6 +6838,9 @@ void CEulerSolver::BC_Giles(CGeometry *geometry, CSolver **solver_container, CNu Energy_i = nodes->GetEnergy(iPoint); StaticEnergy_i = Energy_i - 0.5*Velocity2_i; + /*--- SST: the total energy contains k. ---*/ + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) + StaticEnergy_i -= solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0); GetFluidModel()->SetTDState_rhoe(Density_i, StaticEnergy_i); @@ -7024,6 +7097,9 @@ void CEulerSolver::BC_Giles(CGeometry *geometry, CSolver **solver_container, CNu Energy_b = GetFluidModel()->GetStaticEnergy() + 0.5*Velocity2_b; Temperature_b= GetFluidModel()->GetTemperature(); Enthalpy_b = Energy_b + Pressure_b/Density_b; + /*--- SST: the boundary state carries the k of the node in its total enthalpy, as the interior one. ---*/ + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) + Enthalpy_b += solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0); /*--- Primitive variables, using the derived quantities ---*/ V_boundary[0] = Temperature_b; @@ -7041,6 +7117,16 @@ void CEulerSolver::BC_Giles(CGeometry *geometry, CSolver **solver_container, CNu /*--- Set various quantities in the solver class ---*/ conv_numerics->SetPrimitive(V_domain, V_boundary); + + /*--- SST: both states contain the k of the node in their total enthalpy. ---*/ + + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) { + + const su2double tke = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0); + + conv_numerics->SetTurbKineticEnergy(tke, tke); + + } conv_numerics->SetSecondary(S_domain, S_boundary); @@ -7264,6 +7350,8 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, Velocity2 += Velocity[iDim]*Velocity[iDim]; } Energy = V_domain[nDim+3] - V_domain[nDim+1]/V_domain[nDim+2]; + /*--- SST: the total enthalpy of the domain contains k, the imposed total enthalpy does not. ---*/ + if (tkeNeeded) Energy -= solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); Pressure = V_domain[nDim+1]; H_Total = (Gamma*Gas_Constant/Gamma_Minus_One)*T_Total; SoundSpeed2 = Gamma*Pressure/Density; @@ -7334,7 +7422,6 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, /*--- Using pressure, density, & velocity, compute the energy ---*/ Energy = Pressure/(Density*Gamma_Minus_One) + 0.5*Velocity2; - if (tkeNeeded) Energy += GetTke_Inf(); /*--- Primitive variables, using the derived quantities ---*/ @@ -7345,6 +7432,9 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, V_inlet[nDim+2] = Density; V_inlet[nDim+3] = Energy + Pressure/Density; + /*--- k of the boundary node, not the free-stream value, which decays right away in the domain (#1851). ---*/ + if (tkeNeeded) V_inlet[nDim+3] += solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); + break; } /*--- Mass flow has been specified at the inlet. ---*/ @@ -7406,7 +7496,6 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, /*--- Energy for the fictitious inlet state ---*/ Energy = Pressure/(Density*Gamma_Minus_One) + 0.5*Vel_Mag*Vel_Mag; - if (tkeNeeded) Energy += GetTke_Inf(); /*--- Primitive variables, using the derived quantities ---*/ Temperature = Pressure / ( Gas_Constant * Density); @@ -7417,6 +7506,9 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, V_inlet[nDim+2] = Density; V_inlet[nDim+3] = Energy + Pressure/Density; + /*--- k of the boundary node, not the free-stream value, which decays right away in the domain (#1851). ---*/ + if (tkeNeeded) V_inlet[nDim+3] += solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); + break; } default: @@ -7428,6 +7520,16 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, conv_numerics->SetPrimitive(V_domain, V_inlet); + /*--- SST: both states contain the k of the node in their total enthalpy. ---*/ + + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) { + + const su2double tke = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0); + + conv_numerics->SetTurbKineticEnergy(tke, tke); + + } + if (dynamic_grid) conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); @@ -7465,6 +7567,9 @@ void CEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, bool gravity = (config->GetGravityForce()); bool tkeNeeded = (config->GetKind_Turb_Model() == TURB_MODEL::SST); + CVariable* turbNodes = nullptr; + if (tkeNeeded) turbNodes = solver_container[TURB_SOL]->GetNodes(); + auto *Normal = new su2double[nDim]; /*--- Loop over all the vertices on this boundary marker ---*/ @@ -7546,7 +7651,7 @@ void CEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, Velocity2 += Velocity[iDim]*Velocity[iDim]; } Energy = P_Exit/(Density*Gamma_Minus_One) + 0.5*Velocity2; - if (tkeNeeded) Energy += GetTke_Inf(); + if (tkeNeeded) Energy += turbNodes->GetSolution(iPoint,0); /*--- Conservative variables, using the derived quantities ---*/ V_outlet[0] = Pressure / ( Gas_Constant * Density); @@ -7560,6 +7665,11 @@ void CEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, /*--- Set various quantities in the solver class ---*/ conv_numerics->SetPrimitive(V_domain, V_outlet); + /*--- SST: both states contain the k of the node in their total enthalpy. ---*/ + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) { + const su2double tke = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0); + conv_numerics->SetTurbKineticEnergy(tke, tke); + } if (dynamic_grid) conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); @@ -7657,13 +7767,7 @@ void CEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_con /*--- Compute the energy from the specified state. ---*/ const su2double Velocity2 = GeometryToolbox::SquaredNorm(int(MAXNDIM), Velocity); - su2double Energy = Pressure / (Density * Gamma_Minus_One) + 0.5 * Velocity2; - if (tkeNeeded) { - const su2double* Turb_Properties = config->GetInlet_TurbVal(Marker_Tag); - const su2double Intensity = Turb_Properties[0]; - const su2double Tke = 3.0 / 2.0 * (Velocity2 * pow(Intensity, 2)); - Energy += Tke; - } + const su2double Energy = Pressure / (Density * Gamma_Minus_One) + 0.5 * Velocity2; /*--- Primitive variables, using the derived quantities. ---*/ @@ -7675,6 +7779,9 @@ void CEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_con for (unsigned short iDim = 0; iDim < nDim; iDim++) V_inlet[iDim+prim_idx.Velocity()] = Velocity[iDim]; + /*--- k of the boundary node, not the free-stream value, which decays right away in the domain (#1851). ---*/ + if (tkeNeeded) V_inlet[prim_idx.Enthalpy()] += solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); + /*--- Current solution at this boundary node. ---*/ const auto* V_domain = nodes->GetPrimitive(iPoint); @@ -7689,6 +7796,11 @@ void CEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_con conv_numerics->SetNormal(Normal); conv_numerics->SetPrimitive(V_domain, V_inlet); + /*--- SST: both states contain the k of the node in their total enthalpy. ---*/ + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) { + const su2double tke = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0); + conv_numerics->SetTurbKineticEnergy(tke, tke); + } if (dynamic_grid) conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), @@ -7770,6 +7882,11 @@ void CEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solver_co conv_numerics->SetNormal(Normal); conv_numerics->SetPrimitive(V_domain, V_outlet); + /*--- SST: both states contain the k of the node in their total enthalpy. ---*/ + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) { + const su2double tke = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0); + conv_numerics->SetTurbKineticEnergy(tke, tke); + } if (config->GetKind_FluidModel() != STANDARD_AIR && config->GetKind_FluidModel() != IDEAL_GAS) conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); @@ -7990,7 +8107,7 @@ void CEulerSolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_contai } Energy = Inflow_Pressure/(Density*Gamma_Minus_One) + 0.5*Velocity2; - if (tkeNeeded) Energy += GetTke_Inf(); + if (tkeNeeded) Energy += solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); // node k, see #1851 /*--- Conservative variables, using the derived quantities ---*/ @@ -8006,6 +8123,11 @@ void CEulerSolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_contai conv_numerics->SetNormal(Normal); conv_numerics->SetPrimitive(V_domain, V_inflow); + /*--- SST: both states contain the k of the node in their total enthalpy. ---*/ + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) { + const su2double tke = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0); + conv_numerics->SetTurbKineticEnergy(tke, tke); + } /*--- Set grid movement ---*/ @@ -8155,6 +8277,8 @@ void CEulerSolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_conta Velocity2 += Velocity[iDim]*Velocity[iDim]; } Energy = V_domain[nDim+3] - V_domain[nDim+1]/V_domain[nDim+2]; + /*--- SST: the total enthalpy of the domain contains k, the imposed total enthalpy does not. ---*/ + if (tkeNeeded) Energy -= solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); Pressure = V_domain[nDim+1]; H_Exhaust = (Gamma*Gas_Constant/Gamma_Minus_One)*Exhaust_Temperature; SoundSpeed2 = Gamma*Pressure/Density; @@ -8227,7 +8351,7 @@ void CEulerSolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_conta /*--- Using pressure, density, & velocity, compute the energy ---*/ Energy = Pressure/(Density*Gamma_Minus_One) + 0.5*Velocity2; - if (tkeNeeded) Energy += GetTke_Inf(); + if (tkeNeeded) Energy += solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); // node k, see #1851 /*--- Primitive variables, using the derived quantities ---*/ @@ -8258,6 +8382,11 @@ void CEulerSolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_conta conv_numerics->SetNormal(Normal); conv_numerics->SetPrimitive(V_domain, V_exhaust); + /*--- SST: both states contain the k of the node in their total enthalpy. ---*/ + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) { + const su2double tke = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0); + conv_numerics->SetTurbKineticEnergy(tke, tke); + } /*--- Set grid movement ---*/ @@ -8519,7 +8648,7 @@ void CEulerSolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, C Velocity2 += Velocity[iDim]*Velocity[iDim]; } Energy = Pressure/(Density*Gamma_Minus_One) + 0.5*Velocity2; - if (tkeNeeded) Energy += GetTke_Inf(); + if (tkeNeeded) Energy += solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); // node k, see #1851 /*--- Conservative variables, using the derived quantities ---*/ @@ -8531,6 +8660,11 @@ void CEulerSolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, C V_inlet[nDim+3] = Energy + Pressure/Density; V_inlet[nDim+4] = SoundSpeed; conv_numerics->SetPrimitive(V_domain, V_inlet); + /*--- SST: both states contain the k of the node in their total enthalpy. ---*/ + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) { + const su2double tke = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0); + conv_numerics->SetTurbKineticEnergy(tke, tke); + } } @@ -8606,6 +8740,8 @@ void CEulerSolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, C Velocity2 += Velocity[iDim]*Velocity[iDim]; } Energy = V_domain[nDim+3] - V_domain[nDim+1]/V_domain[nDim+2]; + /*--- SST: the total enthalpy of the domain contains k, the imposed total enthalpy does not. ---*/ + if (tkeNeeded) Energy -= solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); Pressure = V_domain[nDim+1]; H_Total = (Gamma*Gas_Constant/Gamma_Minus_One)*T_Total; SoundSpeed2 = Gamma*Pressure/Density; @@ -8674,7 +8810,7 @@ void CEulerSolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, C /*--- Using pressure, density, & velocity, compute the energy ---*/ Energy = Pressure/(Density*Gamma_Minus_One) + 0.5*Velocity2; - if (tkeNeeded) Energy += GetTke_Inf(); + if (tkeNeeded) Energy += solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); // node k, see #1851 /*--- Primitive variables, using the derived quantities ---*/ @@ -8686,6 +8822,11 @@ void CEulerSolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, C V_outlet[nDim+3] = Energy + Pressure/Density; V_outlet[nDim+4] = sqrt(SoundSpeed2); conv_numerics->SetPrimitive(V_domain, V_outlet); + /*--- SST: both states contain the k of the node in their total enthalpy. ---*/ + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) { + const su2double tke = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0); + conv_numerics->SetTurbKineticEnergy(tke, tke); + } } @@ -8922,7 +9063,7 @@ void CEulerSolver::BC_ActDisk_VariableLoad(CGeometry *geometry, CSolver **solver Velocity2 += Velocity[iDim]*Velocity[iDim]; } Energy = Pressure/(Density*Gamma_Minus_One) + 0.5*Velocity2; - if (tkeNeeded) Energy += GetTke_Inf(); + if (tkeNeeded) Energy += solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); // node k, see #1851 /*--- Conservative variables, using the derived quantities ---*/ @@ -8933,6 +9074,11 @@ void CEulerSolver::BC_ActDisk_VariableLoad(CGeometry *geometry, CSolver **solver V_inlet[nDim+3] = Energy + Pressure/Density; V_inlet[nDim+4] = SoundSpeed; conv_numerics->SetPrimitive(V_domain, V_inlet); + /*--- SST: both states contain the k of the node in their total enthalpy. ---*/ + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) { + const su2double tke = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0); + conv_numerics->SetTurbKineticEnergy(tke, tke); + } } else { /*--- Acoustic Riemann invariant extrapolation form the interior domain. ---*/ @@ -8970,7 +9116,7 @@ void CEulerSolver::BC_ActDisk_VariableLoad(CGeometry *geometry, CSolver **solver /*--- Computation of the enthalpy, total energy, temperature and speed of sound. ---*/ H_out = H_in/Density_in + Fa/Density_out; Energy = H_out - Pressure_out/Density_out; - if (tkeNeeded) Energy += GetTke_Inf(); + if (tkeNeeded) Energy += solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); // node k, see #1851 Temperature_out = (Energy-0.5*Velocity2/(pow(Density_out,2)))*(Gamma_Minus_One/Gas_Constant); SoS_out = sqrt(Gamma*Gas_Constant*Temperature_out); @@ -8984,6 +9130,11 @@ void CEulerSolver::BC_ActDisk_VariableLoad(CGeometry *geometry, CSolver **solver V_outlet[nDim+3] = H_out; V_outlet[nDim+4] = SoS_out; conv_numerics->SetPrimitive(V_domain, V_outlet); + /*--- SST: both states contain the k of the node in their total enthalpy. ---*/ + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) { + const su2double tke = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0); + conv_numerics->SetTurbKineticEnergy(tke, tke); + } } /*--- Grid Movement (NOT TESTED!)---*/ diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index 08af0f78e72b..b40147bae432 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -2294,7 +2294,7 @@ void CIncEulerSolver::SetRangePressure(CGeometry *geometry, CSolver **solver_con BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { minP = MinP; - SU2_MPI::Allreduce(&minP, &MinP, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&minP, &MinP, 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); maxP = MaxP; SU2_MPI::Allreduce(&maxP, &MaxP, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); diff --git a/SU2_CFD/src/solvers/CNEMOEulerSolver.cpp b/SU2_CFD/src/solvers/CNEMOEulerSolver.cpp index 2a3ab7ac3c2a..d53d7cd17fad 100644 --- a/SU2_CFD/src/solvers/CNEMOEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CNEMOEulerSolver.cpp @@ -971,7 +971,7 @@ su2double CNEMOEulerSolver::ComputeUnderRelaxationFactor(unsigned short nSpecies return localUnderRelaxation; } -void CNEMOEulerSolver::ComputeUnderRelaxationFactor(const CConfig *config) { +void CNEMOEulerSolver::ComputeUnderRelaxationFactor(const CConfig* config, CSolver**) { SU2_ZONE_SCOPED const su2double allowableRatio = config->GetMaxUpdateFractionFlow(); diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index 681c3f5000a2..20860268c8a7 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -215,11 +215,11 @@ void CSolver::GetPeriodicCommCountAndType(const CConfig* config, break; case PERIODIC_IMPLICIT: COUNT_PER_POINT = nVar; - MPI_TYPE = COMM_TYPE::DOUBLE; + MPI_TYPE = COMM_TYPE::DOUBLE; break; case PERIODIC_LAPLACIAN: - COUNT_PER_POINT = nVar; - MPI_TYPE = COMM_TYPE::DOUBLE; + COUNT_PER_POINT = base_nodes->GetUndivided_Laplacian().cols(); + MPI_TYPE = COMM_TYPE::DOUBLE; break; case PERIODIC_MAX_EIG: COUNT_PER_POINT = 1; @@ -395,11 +395,11 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, unsigned long iPoint, msg_offset, buf_offset, iPeriodic; - auto *Diff = new su2double[nVar]; - auto *Und_Lapl = new su2double[nVar]; - auto *Sol_Min = new su2double[std::max(nVar, nPrimVarGrad)]; - auto *Sol_Max = new su2double[std::max(nVar, nPrimVarGrad)]; - auto *rotPrim_i = new su2double[std::max(nVar, nPrimVar)]; + auto* Diff = new su2double[nVar + 1]; + auto* Und_Lapl = new su2double[nVar + 1]; + auto* Sol_Min = new su2double[std::max(nVar, nPrimVarGrad)]; + auto* Sol_Max = new su2double[std::max(nVar, nPrimVarGrad)]; + auto* rotPrim_i = new su2double[std::max(nVar, nPrimVar)]; auto *rotPrim_j = new su2double[std::max(nVar, nPrimVar)]; su2double Sensor_i = 0.0, Sensor_j = 0.0, Pressure_i, Pressure_j; @@ -687,11 +687,9 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, consistently by using the complete control volume info from both sides of the periodic face. ---*/ - for (iVar = 0; iVar < nVar; iVar++) - Und_Lapl[iVar] = 0.0; + for (iVar = 0; iVar < COUNT_PER_POINT; iVar++) Und_Lapl[iVar] = 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. ---*/ @@ -708,10 +706,12 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, if (!(config->GetKind_Regime() == ENUM_REGIME::INCOMPRESSIBLE)) { Pressure_i = base_nodes->GetPressure(iPoint); Pressure_j = base_nodes->GetPressure(jPoint); - Diff[nVar-1] = ((base_nodes->GetSolution(iPoint,nVar-1) + Pressure_i) - - (base_nodes->GetSolution(jPoint,nVar-1) + Pressure_j)); + Diff[nVar - 1] = ((base_nodes->GetSolution(iPoint, nVar - 1) + Pressure_i) - + (base_nodes->GetSolution(jPoint, nVar - 1) + Pressure_j)); } + if (COUNT_PER_POINT > nVar) Diff[nVar] = base_nodes->GetRhoTke(iPoint) - base_nodes->GetRhoTke(jPoint); + boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint); boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint); @@ -719,9 +719,8 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, /*--- iPoint inside the domain, jPoint on the boundary ---*/ if (!boundary_i || boundary_j) { - if (geometry->nodes->GetDomain(iPoint)){ - for (iVar = 0; iVar< nVar; iVar++) - Und_Lapl[iVar] -= Diff[iVar]; + if (geometry->nodes->GetDomain(iPoint)) { + for (iVar = 0; iVar < COUNT_PER_POINT; iVar++) Und_Lapl[iVar] -= Diff[iVar]; } } } @@ -729,8 +728,7 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, /*--- Store the components to be communicated in the buffer. ---*/ - for (iVar = 0; iVar < nVar; iVar++) - bufDSend[buf_offset+iVar] = Und_Lapl[iVar]; + for (iVar = 0; iVar < COUNT_PER_POINT; iVar++) bufDSend[buf_offset + iVar] = Und_Lapl[iVar]; /*--- Rotate the momentum components of the Laplacian. ---*/ @@ -1314,8 +1312,8 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, /*--- Adjust the undivided Laplacian. The accumulation was with a subtraction before communicating, so now just add. ---*/ - for (iVar = 0; iVar < nVar; iVar++) - base_nodes->AddUnd_Lapl(iPoint, iVar, bufDRecv[buf_offset+iVar]); + for (iVar = 0; iVar < COUNT_PER_POINT; iVar++) + base_nodes->AddUnd_Lapl(iPoint, iVar, bufDRecv[buf_offset + iVar]); break; @@ -1465,14 +1463,17 @@ void CSolver::GetCommCountAndType(const CConfig* config, switch (commType) { case MPI_QUANTITIES::SOLUTION: case MPI_QUANTITIES::SOLUTION_OLD: - case MPI_QUANTITIES::UNDIVIDED_LAPLACIAN: case MPI_QUANTITIES::SOLUTION_LIMITER: - COUNT_PER_POINT = nVar; - MPI_TYPE = COMM_TYPE::DOUBLE; + COUNT_PER_POINT = nVar; + MPI_TYPE = COMM_TYPE::DOUBLE; + break; + case MPI_QUANTITIES::UNDIVIDED_LAPLACIAN: + COUNT_PER_POINT = base_nodes->GetUndivided_Laplacian().cols(); + MPI_TYPE = COMM_TYPE::DOUBLE; break; case MPI_QUANTITIES::MAX_EIGENVALUE: case MPI_QUANTITIES::SENSOR: - COUNT_PER_POINT = 1; + COUNT_PER_POINT = 1; MPI_TYPE = COMM_TYPE::DOUBLE; break; case MPI_QUANTITIES::SOLUTION_GRADIENT: @@ -1649,8 +1650,8 @@ void CSolver::InitiateComms(CGeometry *geometry, bufDSend[buf_offset] = base_nodes->GetDES_LengthScale(iPoint); break; case MPI_QUANTITIES::UNDIVIDED_LAPLACIAN: - for (iVar = 0; iVar < nVar; iVar++) - bufDSend[buf_offset+iVar] = base_nodes->GetUndivided_Laplacian(iPoint, iVar); + for (iVar = 0; iVar < COUNT_PER_POINT; iVar++) + bufDSend[buf_offset + iVar] = base_nodes->GetUndivided_Laplacian(iPoint, iVar); break; case MPI_QUANTITIES::SOLUTION_LIMITER: case MPI_QUANTITIES::PRIMITIVE_LIMITER: @@ -1816,8 +1817,8 @@ void CSolver::CompleteComms(CGeometry *geometry, base_nodes->SetDES_LengthScale(iPoint, bufDRecv[buf_offset]); break; case MPI_QUANTITIES::UNDIVIDED_LAPLACIAN: - for (iVar = 0; iVar < nVar; iVar++) - base_nodes->SetUnd_Lapl(iPoint, iVar, bufDRecv[buf_offset+iVar]); + for (iVar = 0; iVar < COUNT_PER_POINT; iVar++) + base_nodes->SetUnd_Lapl(iPoint, iVar, bufDRecv[buf_offset + iVar]); break; case MPI_QUANTITIES::SOLUTION_LIMITER: case MPI_QUANTITIES::PRIMITIVE_LIMITER: diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 89a7b8579b07..a089b2cf1eb0 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -124,6 +124,15 @@ CTurbSSTSolver::CTurbSSTSolver(CGeometry *geometry, CConfig *config, const CSolv su2double kine_Inf = 3.0/2.0*(VelMag2*Intensity*Intensity); su2double omega_Inf = rhoInf*kine_Inf/(muLamInf*viscRatio); + /*--- A zero turbulence intensity, viscosity ratio or free-stream velocity gives k = 0 or omega = 0 (or infinite), + and then mu_t = 0/0 in the whole field. ---*/ + if (!(kine_Inf > 0.0 && omega_Inf > 0.0 && std::isfinite(SU2_TYPE::GetValue(kine_Inf)) && + std::isfinite(SU2_TYPE::GetValue(omega_Inf)))) { + SU2_MPI::Error("SST: the free-stream k and omega must be positive and finite.\n" + "Set FREESTREAM_TURBULENCEINTENSITY > 0 and FREESTREAM_TURB2LAMVISCRATIO > 0 with a nonzero\n" + "free-stream velocity.", CURRENT_FUNCTION); + } + Solution_Inf[0] = kine_Inf; Solution_Inf[1] = omega_Inf; @@ -251,7 +260,7 @@ void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai const su2double kine = nodes->GetSolution(iPoint,0); const su2double omega = nodes->GetSolution(iPoint,1); - const auto& eddy_visc_var = sstParsedOptions.version == SST_OPTIONS::V1994 ? VorticityMag : StrainMag; + const su2double 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)); nodes->SetmuT(iPoint, muT); @@ -580,7 +589,6 @@ void CTurbSSTSolver::SetTurbVars_WF(CGeometry *geometry, CSolver **solver_contai su2double solution[MAXNVAR] = {k, omega}; nodes->SetSolution_Old(iPoint_Neighbor,solution); - nodes->SetSolution(iPoint,solution); LinSysRes.SetBlock_Zero(iPoint_Neighbor); @@ -777,15 +785,15 @@ void CTurbSSTSolver::BC_Inlet_Turbo(CGeometry *geometry, CSolver **solver_contai su2double rho = flowSolver->GetAverageDensity(val_marker, iSpan); su2double pressure = flowSolver->GetAveragePressure(val_marker, iSpan); - su2double kine = flowSolver->GetAverageKine(val_marker, iSpan); FluidModel->SetTDState_Prho(pressure, rho); su2double muLam = FluidModel->GetLaminarViscosity(); su2double VelMag2 = GeometryToolbox::SquaredNorm(nDim, flowSolver->GetAverageTurboVelocity(val_marker, iSpan)); + /*--- Imposed k from the intensity, omega from the imposed k and the viscosity ratio. ---*/ su2double kine_b = 3.0/2.0*(VelMag2*Intensity*Intensity); - su2double omega_b = rho*kine/(muLam*viscRatio); + su2double omega_b = rho*kine_b/(muLam*viscRatio); const su2double solution_j[] = {kine_b, omega_b}; diff --git a/SU2_CFD/src/variables/CEulerVariable.cpp b/SU2_CFD/src/variables/CEulerVariable.cpp index 7bc13eb675c0..71e929c10618 100644 --- a/SU2_CFD/src/variables/CEulerVariable.cpp +++ b/SU2_CFD/src/variables/CEulerVariable.cpp @@ -50,16 +50,20 @@ unsigned long EulerNSecVar(const CConfig *config) { return config->GetViscous() ? 8 : 2; } -CEulerVariable::CEulerVariable(su2double density, const su2double *velocity, su2double energy, unsigned long npoint, - unsigned long ndim, unsigned long nvar, const CConfig *config) - : CFlowVariable(npoint, ndim, nvar, ndim + 9, EulerNPrimVarGrad(config, ndim), config), - indices(ndim, 0) { - +CEulerVariable::CEulerVariable(su2double density, const su2double* velocity, su2double energy, unsigned long npoint, + unsigned long ndim, unsigned long nvar, const CConfig* config) + : CFlowVariable(npoint, ndim, nvar, ndim + 9, EulerNPrimVarGrad(config, ndim), config), + Gamma(config->GetGamma()), + indices(ndim, 0) { const bool dual_time = (config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_1ST) || (config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_2ND); const bool classical_rk4 = (config->GetKind_TimeIntScheme_Flow() == CLASSICAL_RK4_EXPLICIT); nSecondaryVar = EulerNSecVar(config); + // Carry rho*k separately through the matrix JST projection and periodic/MPI exchange. + if (Undivided_Laplacian.size() && config->GetKind_Turb_Model() == TURB_MODEL::SST && + config->GetKind_Centered_Flow() == CENTERED::JST_MAT) + Undivided_Laplacian.resize(nPoint, nVar + 1); /*--- Solution initialization ---*/ diff --git a/TestCases/axisymmetric_rans/air_nozzle/air_nozzle_density_velocity.cfg b/TestCases/axisymmetric_rans/air_nozzle/air_nozzle_density_velocity.cfg new file mode 100644 index 000000000000..208ad6b63159 --- /dev/null +++ b/TestCases/axisymmetric_rans/air_nozzle/air_nozzle_density_velocity.cfg @@ -0,0 +1,100 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Axisymmetric supersonic converging-diverging air nozzle, % +% Riemann DENSITY_VELOCITY inlet (k in the boundary energy) % +% Author: Florian Dittmann % +% Date: 2021.12.02 % +% File Version 8.5.0 "Harrier" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +SOLVER= RANS +KIND_TURB_MODEL= SST +RESTART_SOL= YES +AXISYMMETRIC= YES + +% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% +% +MACH_NUMBER= 1E-9 +INIT_OPTION= TD_CONDITIONS +FREESTREAM_OPTION= TEMPERATURE_FS +FREESTREAM_PRESSURE= 1400000 +FREESTREAM_TEMPERATURE= 373.15 +REF_DIMENSIONALIZATION= DIMENSIONAL + +% ---- IDEAL GAS, POLYTROPIC, VAN DER WAALS AND PENG ROBINSON CONSTANTS -------% +% +FLUID_MODEL= STANDARD_AIR + +% --------------------------- VISCOSITY MODEL ---------------------------------% +% +VISCOSITY_MODEL= CONSTANT_VISCOSITY +MU_CONSTANT= 1.716E-5 + +% --------------------------- THERMAL CONDUCTIVITY MODEL ----------------------% +% +CONDUCTIVITY_MODEL= CONSTANT_PRANDTL +PRANDTL_LAM= 0.72 +PRANDTL_TURB= 0.90 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +MARKER_HEATFLUX= ( WALL, 0.0 ) +MARKER_SYM= ( SYMMETRY ) +MARKER_RIEMANN= ( INFLOW, DENSITY_VELOCITY, 13.07, 100.0, 1.0, 0.0, 0.0, \ + OUTFLOW, STATIC_PRESSURE, 100000.0, 0.0, 0.0, 0.0, 0.0 ) +MARKER_MONITORING = (WALL) +MARKER_ANALYZE= (INFLOW) +% +% High free-stream turbulence, so that k is not negligible in the energy of the inlet state +FREESTREAM_TURBULENCEINTENSITY= 0.2 + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 1000.0 +CFL_ADAPT= NO +MAX_DELTA_TIME= 1E6 +OBJECTIVE_FUNCTION= DRAG + +% ----------- SLOPE LIMITER AND DISSIPATION SENSOR DEFINITION -----------------% +% +MUSCL_FLOW= YES +SLOPE_LIMITER_FLOW= NONE + +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ILU_FILL_IN= 0 +LINEAR_SOLVER_ERROR= 0.01 +LINEAR_SOLVER_ITER= 10 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +CONV_NUM_METHOD_FLOW= ROE +ENTROPY_FIX_COEFF= 0.1 +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +TIME_DISCRE_TURB= EULER_IMPLICIT +CFL_REDUCTION_TURB= 1.0 + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +ITER= 3000 +CONV_RESIDUAL_MINVAL= -12 +CONV_STARTITER= 10 + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +MESH_FILENAME= nozzle.su2 +SOLUTION_FILENAME= solution_flow +RESTART_FILENAME= restart_flow +OUTPUT_WRT_FREQ= 1000 +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_ENERGY, RMS_TKE, RMS_DISSIPATION, SURFACE_STATIC_TEMPERATURE) diff --git a/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref b/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref index 1f0241b9e2fa..87ba683b8149 100644 --- a/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref +++ b/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref @@ -1,9 +1,9 @@ INDEX GRAD -0 -2.998512907701271e-03 -1 -1.584866997023666e-03 -2 -6.647075933794050e-04 -3 -2.112197065714601e-04 -4 -2.145348429280959e-04 -5 -6.735292498556252e-04 -6 -1.595607953604883e-03 -7 -3.004453684429480e-03 +0 -4.588838559391948e-04 +1 -2.411684253396962e-04 +2 -9.185692562532188e-05 +3 -1.653284043205054e-05 +4 -1.765443853566316e-05 +5 -9.511026937287119e-05 +6 -2.462259547955249e-04 +7 -4.652824150064567e-04 diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index 62ed29dcdbe2..916f2d680d84 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -149,7 +149,7 @@ def main(): poiseuille_profile.cfg_dir = "navierstokes/poiseuille" poiseuille_profile.cfg_file = "profile_poiseuille.cfg" poiseuille_profile.test_iter = 10 - poiseuille_profile.test_vals = [-12.004080, -7.638116, -0.000000, 2.089953] + poiseuille_profile.test_vals = [-12.004086, -7.637842, -0.000000, 2.089953] poiseuille_profile.test_vals_aarch64 = [-12.004276, -7.636719, -0.000000, 2.089953] test_list.append(poiseuille_profile) @@ -178,7 +178,7 @@ def main(): rae2822_sst.cfg_dir = "rans/rae2822" rae2822_sst.cfg_file = "turb_SST_RAE2822.cfg" rae2822_sst.test_iter = 20 - rae2822_sst.test_vals = [-1.472874, 5.886555, 0.669542, 0.023434, 100.000000] + rae2822_sst.test_vals = [-1.436649, 5.889182, 0.659764, 0.021350, 100.000000] test_list.append(rae2822_sst) # RAE2822 SST_SUST @@ -194,7 +194,7 @@ def main(): turb_flatplate.cfg_dir = "rans/flatplate" turb_flatplate.cfg_file = "turb_SA_flatplate.cfg" turb_flatplate.test_iter = 20 - turb_flatplate.test_vals = [-0.187373, 0.003723, 10.000000, -1.443902] + turb_flatplate.test_vals = [-0.187373, 0.003723, 10.000000, -1.444398] test_list.append(turb_flatplate) # ONERA M6 Wing @@ -210,7 +210,7 @@ def main(): turb_naca0012_sa.cfg_dir = "rans/naca0012" turb_naca0012_sa.cfg_file = "turb_NACA0012_sa.cfg" turb_naca0012_sa.test_iter = 5 - turb_naca0012_sa.test_vals = [-12.038075, -16.332088, 1.080346, 0.018385, 20.000000, -2.873507, 0.000000, -14.250270, 0.000000] + turb_naca0012_sa.test_vals = [-12.038098, -16.332088, 1.080346, 0.018385, 20.000000, -2.873012, 0.000000, -14.250270, 0.000000] turb_naca0012_sa.test_vals_aarch64 = [-12.038091, -16.332090, 1.080346, 0.018385, 20.000000, -2.873236, 0.000000, -14.250271, 0.000000] test_list.append(turb_naca0012_sa) @@ -219,7 +219,7 @@ def main(): turb_naca0012_sst.cfg_dir = "rans/naca0012" turb_naca0012_sst.cfg_file = "turb_NACA0012_sst.cfg" turb_naca0012_sst.test_iter = 10 - turb_naca0012_sst.test_vals = [-12.093978, -15.250833, -5.906324, 1.070413, 0.015775, -2.854996, 0.000000] + turb_naca0012_sst.test_vals = [-5.948963, -10.295280, -3.740016, 1.069295, 0.015905, -3.049395, 0.000000] turb_naca0012_sst.test_vals_aarch64 = [-12.075928, -15.246732, -5.861249, 1.070036, 0.015841, -2.835263, 0] test_list.append(turb_naca0012_sst) @@ -228,7 +228,7 @@ def main(): turb_naca0012_sst_sust.cfg_dir = "rans/naca0012" turb_naca0012_sst_sust.cfg_file = "turb_NACA0012_sst_sust.cfg" turb_naca0012_sst_sust.test_iter = 10 - turb_naca0012_sst_sust.test_vals = [-12.080835, -14.837175, -5.732908, 1.000893, 0.019109, -2.119767] + turb_naca0012_sst_sust.test_vals = [-9.951719, -11.674782, -5.092201, 1.000888, 0.019126, -1.639020] turb_naca0012_sst_sust.test_vals_aarch64 = [-12.073210, -14.836724, -5.732627, 1.000050, 0.019144, -2.629689] test_list.append(turb_naca0012_sst_sust) @@ -245,7 +245,7 @@ def main(): turb_naca0012_sst_expliciteuler.cfg_dir = "rans/naca0012" turb_naca0012_sst_expliciteuler.cfg_file = "turb_NACA0012_sst_expliciteuler.cfg" turb_naca0012_sst_expliciteuler.test_iter = 10 - turb_naca0012_sst_expliciteuler.test_vals = [-3.532365, -3.157224, 3.743381, 1.124798, 0.501715, -16.000000] + turb_naca0012_sst_expliciteuler.test_vals = [-3.408465, -3.157224, 3.743383, 1.124790, 0.501715, -16.000000] test_list.append(turb_naca0012_sst_expliciteuler) # PROPELLER @@ -265,7 +265,7 @@ def main(): axi_rans_air_nozzle_restart.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_restart.cfg_file = "air_nozzle_restart.cfg" axi_rans_air_nozzle_restart.test_iter = 10 - axi_rans_air_nozzle_restart.test_vals = [-5.068933, 0.504335, -2.835949, 1.707362, 0.000000] + axi_rans_air_nozzle_restart.test_vals = [-5.066047, 0.510609, -1.717316, 2.920473, 0.000000] axi_rans_air_nozzle_restart.test_vals_aarch64 = [-14.140441, -9.154674, -10.886121, -5.806594, 0.000000] test_list.append(axi_rans_air_nozzle_restart) @@ -279,7 +279,7 @@ def main(): turb_naca0012_sst_restart_mg.cfg_file = "turb_NACA0012_sst_multigrid_restart.cfg" turb_naca0012_sst_restart_mg.test_iter = 20 turb_naca0012_sst_restart_mg.ntest_vals = 5 - turb_naca0012_sst_restart_mg.test_vals = [-6.551665, -5.057150, 0.830240, -0.008811, 0.078187] + turb_naca0012_sst_restart_mg.test_vals = [-3.689602, -5.056964, 0.830559, -0.008732, 0.078126] test_list.append(turb_naca0012_sst_restart_mg) ############################# @@ -291,7 +291,7 @@ def main(): turb_naca0012_1c.cfg_dir = "rans_uq/naca0012" turb_naca0012_1c.cfg_file = "turb_NACA0012_uq_1c.cfg" turb_naca0012_1c.test_iter = 10 - turb_naca0012_1c.test_vals = [-4.978722, 1.343530, 0.443909, -0.029125] + turb_naca0012_1c.test_vals = [-4.964592, 1.345541, 0.446118, -0.028439] turb_naca0012_1c.test_vals_aarch64 = [-4.976620, 1.345983, 0.433171, -0.033685] test_list.append(turb_naca0012_1c) @@ -300,7 +300,7 @@ def main(): turb_naca0012_2c.cfg_dir = "rans_uq/naca0012" turb_naca0012_2c.cfg_file = "turb_NACA0012_uq_2c.cfg" turb_naca0012_2c.test_iter = 10 - turb_naca0012_2c.test_vals = [-5.482844, 1.260870, 0.404376, -0.040361] + turb_naca0012_2c.test_vals = [-5.482846, 1.260731, 0.404913, -0.040192] turb_naca0012_2c.test_vals_aarch64 = [-5.485484, 1.263406, 0.411442, -0.040859] test_list.append(turb_naca0012_2c) @@ -309,7 +309,7 @@ def main(): turb_naca0012_3c.cfg_dir = "rans_uq/naca0012" turb_naca0012_3c.cfg_file = "turb_NACA0012_uq_3c.cfg" turb_naca0012_3c.test_iter = 10 - turb_naca0012_3c.test_vals = [-5.583730, 1.228732, 0.381967, -0.046233] + turb_naca0012_3c.test_vals = [-5.583734, 1.228655, 0.379717, -0.047003] turb_naca0012_3c.test_vals_aarch64 = [-5.583737, 1.232005, 0.390258, -0.046305] test_list.append(turb_naca0012_3c) @@ -318,7 +318,7 @@ def main(): turb_naca0012_p1c1.cfg_dir = "rans_uq/naca0012" turb_naca0012_p1c1.cfg_file = "turb_NACA0012_uq_p1c1.cfg" turb_naca0012_p1c1.test_iter = 10 - turb_naca0012_p1c1.test_vals = [-5.134181, 1.283464, 0.553971, 0.011916] + turb_naca0012_p1c1.test_vals = [-5.165277, 1.279520, 0.549254, 0.010996] turb_naca0012_p1c1.test_vals_aarch64 = [-5.114189, 1.285037, 0.406851, -0.043003] test_list.append(turb_naca0012_p1c1) @@ -327,7 +327,7 @@ def main(): turb_naca0012_p1c2.cfg_dir = "rans_uq/naca0012" turb_naca0012_p1c2.cfg_file = "turb_NACA0012_uq_p1c2.cfg" turb_naca0012_p1c2.test_iter = 10 - turb_naca0012_p1c2.test_vals = [-5.553988, 1.234031, 0.424168, -0.033501] + turb_naca0012_p1c2.test_vals = [-5.553200, 1.234059, 0.424695, -0.033351] turb_naca0012_p1c2.test_vals_aarch64 = [-5.548245, 1.236384, 0.381821, -0.050337] test_list.append(turb_naca0012_p1c2) @@ -340,7 +340,7 @@ def main(): harmonic_balance.cfg_dir = "harmonic_balance" harmonic_balance.cfg_file = "HB.cfg" harmonic_balance.test_iter = 25 - harmonic_balance.test_vals = [-1.559187, 0.829574, 0.931511, 3.954440] + harmonic_balance.test_vals = [-1.556450, 0.840516, 0.943600, 3.957290] test_list.append(harmonic_balance) # Turbulent pitching NACA 64a010 airfoil @@ -501,7 +501,7 @@ def main(): square_cylinder.cfg_dir = "unsteady/square_cylinder" square_cylinder.cfg_file = "turb_square.cfg" square_cylinder.test_iter = 3 - square_cylinder.test_vals = [-2.560678, -1.175981, 0.062204, 1.399351, 2.219223, 1.399297, 2.217470, 0.000000] + square_cylinder.test_vals = [-2.560698, -1.175955, 0.062131, 1.399399, 2.220356, 1.399347, 2.218595, 0.000000] square_cylinder.unsteady = True test_list.append(square_cylinder) @@ -510,7 +510,7 @@ def main(): sine_gust.cfg_dir = "gust" sine_gust.cfg_file = "inv_gust_NACA0012.cfg" sine_gust.test_iter = 5 - sine_gust.test_vals = [-1.977498, 3.481817, -0.010724, -0.005369] + sine_gust.test_vals = [-1.977498, 3.481833, -0.012152, -0.004132] sine_gust.unsteady = True test_list.append(sine_gust) @@ -519,7 +519,7 @@ def main(): cosine_gust.cfg_dir = "gust" cosine_gust.cfg_file = "cosine_gust_zdir.cfg" cosine_gust.test_iter = 79 - cosine_gust.test_vals = [-2.418805, 0.002212, -0.001249, 0.000439, -0.000592] + cosine_gust.test_vals = [-2.418805, 0.003015, -0.001242, 0.000500, -0.000592] cosine_gust.unsteady = True cosine_gust.enabled_with_tsan = False test_list.append(cosine_gust) @@ -529,7 +529,7 @@ def main(): gust_mesh_defo.cfg_dir = "gust" gust_mesh_defo.cfg_file = "gust_with_mesh_deformation.cfg" gust_mesh_defo.test_iter = 6 - gust_mesh_defo.test_vals = [-1.844761, 0.001290, -0.000316] + gust_mesh_defo.test_vals = [-1.844761, 0.001449, -0.000344] gust_mesh_defo.unsteady = True gust_mesh_defo.enabled_with_tsan = False test_list.append(gust_mesh_defo) @@ -539,7 +539,7 @@ def main(): aeroelastic.cfg_dir = "aeroelastic" aeroelastic.cfg_file = "aeroelastic_NACA64A010.cfg" aeroelastic.test_iter = 2 - aeroelastic.test_vals = [-1.876632, 4.021071, 0.080087, 0.027953, -0.001641, -0.000127, -1.052229] + aeroelastic.test_vals = [-1.876631, 4.021081, 0.082286, 0.026921, -0.001638, -0.000130, -1.019527] aeroelastic.unsteady = True aeroelastic.enabled_on_cpu_arch = ["x86_64"] # Requires AVX-capable architecture test_list.append(aeroelastic) @@ -558,7 +558,7 @@ def main(): unst_inc_turb_naca0015_sa.cfg_dir = "unsteady/pitching_naca0015_rans_inc" unst_inc_turb_naca0015_sa.cfg_file = "config_incomp_turb_sa.cfg" unst_inc_turb_naca0015_sa.test_iter = 1 - unst_inc_turb_naca0015_sa.test_vals = [-3.008640, -6.889022, 1.435181, 0.433567] + unst_inc_turb_naca0015_sa.test_vals = [-3.007258, -6.887901, 1.435511, 0.433955] unst_inc_turb_naca0015_sa.unsteady = True test_list.append(unst_inc_turb_naca0015_sa) @@ -567,7 +567,7 @@ def main(): unst_deforming_naca0012.cfg_dir = "disc_adj_euler/naca0012_pitching_def" unst_deforming_naca0012.cfg_file = "inv_NACA0012_pitching_deform.cfg" unst_deforming_naca0012.test_iter = 5 - unst_deforming_naca0012.test_vals = [-3.666867, -3.796806, -3.719022, -3.150288] + unst_deforming_naca0012.test_vals = [-3.666017, -3.794928, -3.717606, -3.149231] unst_deforming_naca0012.unsteady = True unst_deforming_naca0012.enabled_with_tsan = False test_list.append(unst_deforming_naca0012) @@ -602,7 +602,7 @@ def main(): Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg" Jones_tc_restart.test_iter = 5 - Jones_tc_restart.test_vals = [-11.959253, -12.213612, -19.314223, -13.600253, -19.077186, -13.444728, 73286.000000, 73286.000000, 0.020056, 82.286000] + Jones_tc_restart.test_vals = [-0.170804, -0.162041, -8.236409, -2.533080, -7.364785, -1.876220, 73290.000000, 73290.000000, 0.020065, 82.291000] test_list.append(Jones_tc_restart) # 2D axial stage @@ -610,7 +610,7 @@ def main(): axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D" axial_stage2D.cfg_file = "Axial_stage2D.cfg" axial_stage2D.test_iter = 20 - axial_stage2D.test_vals = [1.167512, 1.598494, -2.928579, 2.573642, -2.527390, 3.016171, 106370.000000, 106370.000000, 5.726800, 64.383000] + axial_stage2D.test_vals = [1.166038, 1.598534, -2.928564, 2.573650, -2.527328, 3.016255, 106370.000000, 106370.000000, 5.726800, 64.395000] test_list.append(axial_stage2D) # 2D transonic stator restart @@ -618,7 +618,7 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-4.367144, -2.487733, -2.079075, 1.728173, -1.464952, 3.225025, -471620.000000, 94.839000, -0.051124] + transonic_stator_restart.test_vals = [-4.363280, -2.484853, -2.078097, 1.730856, -1.464954, 3.223391, -471620.000000, 94.839000, -0.098969] transonic_stator_restart.test_vals_aarch64 = [-4.442510, -2.561369, -2.165778, 1.652750, -1.355494, 3.172712, -471620.000000, 94.843000, -0.043825] test_list.append(transonic_stator_restart) @@ -640,7 +640,7 @@ def main(): uniform_flow.cfg_dir = "sliding_interface/uniform_flow" uniform_flow.cfg_file = "uniform_NN.cfg" uniform_flow.test_iter = 5 - uniform_flow.test_vals = [5.000000, 0.000000, -0.195002, -10.624453] + uniform_flow.test_vals = [5.000000, 0.000000, -0.193990, -10.624456] uniform_flow.unsteady = True uniform_flow.multizone = True test_list.append(uniform_flow) @@ -659,7 +659,7 @@ def main(): channel_2D.cfg_dir = "sliding_interface/channel_2D" channel_2D.cfg_file = "channel_2D_WA.cfg" channel_2D.test_iter = 2 - channel_2D.test_vals = [2.000000, 0.000000, 0.466339, 0.346858, 0.397486] + channel_2D.test_vals = [2.000000, 0.000000, 0.399108, 0.350302, 0.405584] channel_2D.unsteady = True channel_2D.multizone = True test_list.append(channel_2D) @@ -681,7 +681,7 @@ def main(): pipe.cfg_dir = "sliding_interface/pipe" pipe.cfg_file = "pipe_NN.cfg" pipe.test_iter = 2 - pipe.test_vals = [0.070225, 0.528891, 0.684177, 0.970350, 1.065268] + pipe.test_vals = [0.024970, 0.452310, 0.562858, 0.974611, 1.031083] pipe.unsteady = True pipe.multizone = True test_list.append(pipe) @@ -691,7 +691,7 @@ def main(): rotating_cylinders.cfg_dir = "sliding_interface/rotating_cylinders" rotating_cylinders.cfg_file = "rot_cylinders_WA.cfg" rotating_cylinders.test_iter = 3 - rotating_cylinders.test_vals = [3.000000, 0.000000, 0.686432, 1.159463, 1.151135] + rotating_cylinders.test_vals = [3.000000, 0.000000, 0.686419, 1.152596, 1.145896] rotating_cylinders.unsteady = True rotating_cylinders.multizone = True test_list.append(rotating_cylinders) @@ -701,7 +701,7 @@ def main(): supersonic_vortex_shedding.cfg_dir = "sliding_interface/supersonic_vortex_shedding" supersonic_vortex_shedding.cfg_file = "sup_vor_shed_WA.cfg" supersonic_vortex_shedding.test_iter = 5 - supersonic_vortex_shedding.test_vals = [5.000000, 0.000000, 1.126036, 1.081765] + supersonic_vortex_shedding.test_vals = [5.000000, 0.000000, 1.128138, 1.064251] supersonic_vortex_shedding.unsteady = True supersonic_vortex_shedding.multizone = True test_list.append(supersonic_vortex_shedding) @@ -752,7 +752,7 @@ def main(): fsi2d.cfg_dir = "fea_fsi/WallChannel_2d" fsi2d.cfg_file = "configFSI.cfg" fsi2d.test_iter = 4 - fsi2d.test_vals = [4.000000, 0.000000, -3.726029, -4.277532] + fsi2d.test_vals = [4.000000, 0.000000, -3.725535, -4.278762] fsi2d.multizone= True fsi2d.unsteady = True fsi2d.enabled_with_tsan = False @@ -763,7 +763,7 @@ def main(): dyn_fsi.cfg_dir = "fea_fsi/dyn_fsi" dyn_fsi.cfg_file = "config.cfg" dyn_fsi.test_iter = 4 - dyn_fsi.test_vals = [-4.330727, -4.152808, 0.000000, 102.000000] + dyn_fsi.test_vals = [-4.328791, -4.152991, 0.000000, 102.000000] dyn_fsi.multizone = True dyn_fsi.unsteady = True test_list.append(dyn_fsi) @@ -773,7 +773,7 @@ def main(): fsi_cht_restart.cfg_dir = "fea_fsi/stat_fsi" fsi_cht_restart.cfg_file = "config_restart.cfg" fsi_cht_restart.test_iter = 0 - fsi_cht_restart.test_vals = [5.000000, 0.006352, -1.960362, -9.327033, -9.644570, -9.319618, 608.380000, -0.012974, 0.000000, 20.000000] + fsi_cht_restart.test_vals = [5.000000, 0.006352, -1.960362, -9.327033, -9.619476, -9.319378, 608.380000, -0.012974, 0.000000, 20.000000] fsi_cht_restart.multizone = True test_list.append(fsi_cht_restart) diff --git a/TestCases/hybrid_regression_AD.py b/TestCases/hybrid_regression_AD.py index 38250303b4c4..fea2813315d2 100644 --- a/TestCases/hybrid_regression_AD.py +++ b/TestCases/hybrid_regression_AD.py @@ -87,7 +87,7 @@ def main(): discadj_rans_naca0012_sst.cfg_dir = "disc_adj_rans/naca0012" discadj_rans_naca0012_sst.cfg_file = "turb_NACA0012_sst.cfg" discadj_rans_naca0012_sst.test_iter = 10 - discadj_rans_naca0012_sst.test_vals = [-2.201555, -0.175213, 3.045200, -0.041846] + discadj_rans_naca0012_sst.test_vals = [-2.201606, -0.172546, 3.045700, -0.041853] discadj_rans_naca0012_sst.test_vals_aarch64 = [-2.201855, -0.172443, 3.043400, -0.041820] test_list.append(discadj_rans_naca0012_sst) @@ -188,7 +188,7 @@ def main(): discadj_pitchingNACA0012.cfg_dir = "disc_adj_euler/naca0012_pitching" discadj_pitchingNACA0012.cfg_file = "inv_NACA0012_pitching.cfg" discadj_pitchingNACA0012.test_iter = 4 - discadj_pitchingNACA0012.test_vals = [-1.041975, -1.513011, -0.006202, 0.000012] + discadj_pitchingNACA0012.test_vals = [-1.128086, -1.582652, -0.006613, 0.000011] discadj_pitchingNACA0012.tol = 0.01 discadj_pitchingNACA0012.unsteady = True discadj_pitchingNACA0012.enabled_with_tsan = False diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 633094038b04..bf9743eb8da0 100755 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -359,7 +359,7 @@ def main(): ramp_msw.cfg_dir = "euler/ramp" ramp_msw.cfg_file = "inv_ramp_msw.cfg" ramp_msw.test_iter = 100 - ramp_msw.test_vals = [-7.242600, -1.471141, -0.077507, 0.054419] + ramp_msw.test_vals = [-6.972874, -1.216000, -0.077507, 0.054419] # Newton-Krylov residual histories vary across MPI environments; keep force checks tight. ramp_msw.tol = [0.5, 0.5, 0.00001, 0.00001] test_list.append(ramp_msw) @@ -495,7 +495,7 @@ def main(): rae2822_sst.cfg_dir = "rans/rae2822" rae2822_sst.cfg_file = "turb_SST_RAE2822.cfg" rae2822_sst.test_iter = 20 - rae2822_sst.test_vals = [-1.486489, 5.881103, 0.661483, 0.023767, 100.000000] + rae2822_sst.test_vals = [-1.493359, 5.883418, 0.657627, 0.022989, 100.000000] test_list.append(rae2822_sst) # RAE2822 SST_SUST @@ -543,7 +543,7 @@ def main(): turb_flatplate_sst_roughBCKnopp.cfg_dir = "rans/flatplate/roughness/bc_knopp" turb_flatplate_sst_roughBCKnopp.cfg_file = "turb_SST_flatplate_roughBCKnopp.cfg" turb_flatplate_sst_roughBCKnopp.test_iter = 10 - turb_flatplate_sst_roughBCKnopp.test_vals = [-5.058634, -2.460850, -2.847064, 0.447200, -2.595042, 1.497149, -0.188079, 0.004571] + turb_flatplate_sst_roughBCKnopp.test_vals = [-4.619122, -2.026481, -2.392910, 0.885845, -2.501638, 1.532115, -0.188182, 0.004571] test_list.append(turb_flatplate_sst_roughBCKnopp) # FLAT PLATE, ROUGHNESS BC AUPOIX SST @@ -551,7 +551,7 @@ def main(): turb_flatplate_sst_roughBCAupoix.cfg_dir = "rans/flatplate/roughness/bc_aupoix" turb_flatplate_sst_roughBCAupoix.cfg_file = "turb_SST_flatplate_roughBCAupoix.cfg" turb_flatplate_sst_roughBCAupoix.test_iter = 10 - turb_flatplate_sst_roughBCAupoix.test_vals = [-5.278728, -2.302982, -2.890419, 0.227585, -1.393786, 3.192601, -0.188729, 0.0071821] + turb_flatplate_sst_roughBCAupoix.test_vals = [-4.844108, -2.112938, -2.523195, 0.663960, -1.393641, 3.192483, -0.188503, 0.007182] test_list.append(turb_flatplate_sst_roughBCAupoix) # FLAT PLATE, WALL FUNCTIONS, COMPRESSIBLE SA, restart from a solution without wall functions @@ -595,7 +595,7 @@ def main(): turb_naca0012_sa.cfg_dir = "rans/naca0012" turb_naca0012_sa.cfg_file = "turb_NACA0012_sa.cfg" turb_naca0012_sa.test_iter = 5 - turb_naca0012_sa.test_vals = [-12.037577, -16.376949, 1.080346, 0.018385, 20.000000, -1.564038, 20.000000, -4.180921, 0.000000] + turb_naca0012_sa.test_vals = [-12.037491, -16.376949, 1.080346, 0.018385, 20.000000, -1.564168, 20.000000, -4.180902, 0.000000] turb_naca0012_sa.test_vals_aarch64 = [-12.037489, -16.376949, 1.080346, 0.018385, 20.000000, -1.564143, 20.000000, -4.180945, 0.000000] turb_naca0012_sa.timeout = 3200 test_list.append(turb_naca0012_sa) @@ -605,7 +605,7 @@ def main(): turb_naca0012_sst.cfg_dir = "rans/naca0012" turb_naca0012_sst.cfg_file = "turb_NACA0012_sst.cfg" turb_naca0012_sst.test_iter = 10 - turb_naca0012_sst.test_vals = [-12.094688, -15.251093, -5.906365, 1.070413, 0.015775, -2.376161, 0.000000] + turb_naca0012_sst.test_vals = [-5.949151, -10.294577, -3.763019, 1.069291, 0.015902, -3.459014, 0.000000] turb_naca0012_sst.test_vals_aarch64 = [-12.075620, -15.246688, -5.861276, 1.070036, 0.015841, -1.991001, 0.000000] turb_naca0012_sst.timeout = 3200 test_list.append(turb_naca0012_sst) @@ -650,7 +650,7 @@ def main(): turb_naca0012_sst_sust.cfg_dir = "rans/naca0012" turb_naca0012_sst_sust.cfg_file = "turb_NACA0012_sst_sust.cfg" turb_naca0012_sst_sust.test_iter = 10 - turb_naca0012_sst_sust.test_vals = [-12.082121, -14.837177, -5.733436, 1.000893, 0.019109, -2.240926] + turb_naca0012_sst_sust.test_vals = [-9.963808, -11.675704, -5.093478, 1.000889, 0.019126, -1.603990] turb_naca0012_sst_sust.test_vals_aarch64 = [-12.073964, -14.836726, -5.732390, 1.000050, 0.019144, -2.229074] turb_naca0012_sst_sust.timeout = 3200 test_list.append(turb_naca0012_sst_sust) @@ -660,7 +660,7 @@ def main(): turb_naca0012_sst_2003_Vm.cfg_dir = "rans/naca0012" turb_naca0012_sst_2003_Vm.cfg_file = "turb_NACA0012_sst_2003-Vm.cfg" turb_naca0012_sst_2003_Vm.test_iter = 10 - turb_naca0012_sst_2003_Vm.test_vals = [-10.168739, -3.668709, 1.060563, 0.019147, -2.282800] + turb_naca0012_sst_2003_Vm.test_vals = [-10.076544, -3.586031, 1.059474, 0.019231, -3.088893] turb_naca0012_sst_2003_Vm.timeout = 3200 test_list.append(turb_naca0012_sst_2003_Vm) @@ -669,7 +669,7 @@ def main(): turb_naca0012_sst_1994_KLm.cfg_dir = "rans/naca0012" turb_naca0012_sst_1994_KLm.cfg_file = "turb_NACA0012_sst_1994-KLm.cfg" turb_naca0012_sst_1994_KLm.test_iter = 10 - turb_naca0012_sst_1994_KLm.test_vals = [-10.390871, -3.701584, 1.062164, 0.019076, -2.426123] + turb_naca0012_sst_1994_KLm.test_vals = [-10.196762, -3.596952, 1.061057, 0.019163, -3.186595] turb_naca0012_sst_1994_KLm.timeout = 3200 test_list.append(turb_naca0012_sst_1994_KLm) @@ -678,7 +678,7 @@ def main(): turb_naca0012_sst_fixedvalues.cfg_dir = "rans/naca0012" turb_naca0012_sst_fixedvalues.cfg_file = "turb_NACA0012_sst_fixedvalues.cfg" turb_naca0012_sst_fixedvalues.test_iter = 10 - turb_naca0012_sst_fixedvalues.test_vals = [-10.440016, 0.774146, 1.022363, 0.040546, -3.736437] + turb_naca0012_sst_fixedvalues.test_vals = [-10.440029, 0.774146, 1.022363, 0.040546, -3.736439] turb_naca0012_sst_fixedvalues.timeout = 3200 test_list.append(turb_naca0012_sst_fixedvalues) @@ -687,7 +687,7 @@ def main(): turb_naca0012_sst_expliciteuler.cfg_dir = "rans/naca0012" turb_naca0012_sst_expliciteuler.cfg_file = "turb_NACA0012_sst_expliciteuler.cfg" turb_naca0012_sst_expliciteuler.test_iter = 10 - turb_naca0012_sst_expliciteuler.test_vals = [-3.532365, -3.157224, 3.743381, 1.124798, 0.501715, -16.000000] + turb_naca0012_sst_expliciteuler.test_vals = [-3.408465, -3.157224, 3.743383, 1.124790, 0.501715, -16.000000] turb_naca0012_sst_expliciteuler.timeout = 3200 test_list.append(turb_naca0012_sst_expliciteuler) @@ -719,11 +719,19 @@ def main(): axi_rans_air_nozzle_restart.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_restart.cfg_file = "air_nozzle_restart.cfg" axi_rans_air_nozzle_restart.test_iter = 10 - axi_rans_air_nozzle_restart.test_vals = [-5.144831, 0.426691, -2.894552, 1.607260, 0.000000] + axi_rans_air_nozzle_restart.test_vals = [-5.126464, 0.450358, -1.631056, 2.883065, 0.000000] axi_rans_air_nozzle_restart.test_vals_aarch64 = [-14.143310, -9.163287, -10.858232, -5.787715, 0.000000] axi_rans_air_nozzle_restart.tol = 0.0001 test_list.append(axi_rans_air_nozzle_restart) + # Riemann DENSITY_VELOCITY inlet with SST: k of the node in the energy of the boundary state + axi_rans_air_nozzle_density_velocity = TestCase('axi_rans_air_nozzle_density_velocity') + axi_rans_air_nozzle_density_velocity.cfg_dir = "axisymmetric_rans/air_nozzle" + axi_rans_air_nozzle_density_velocity.cfg_file = "air_nozzle_density_velocity.cfg" + axi_rans_air_nozzle_density_velocity.test_iter = 10 + axi_rans_air_nozzle_density_velocity.test_vals = [-1.879323, 4.022709, 0.514084, 4.414617, 702.55, 702.55] + test_list.append(axi_rans_air_nozzle_density_velocity) + ################################# ## Compressible RANS Restart ### ################################# @@ -734,7 +742,7 @@ def main(): turb_naca0012_sst_restart_mg.cfg_file = "turb_NACA0012_sst_multigrid_restart.cfg" turb_naca0012_sst_restart_mg.test_iter = 20 turb_naca0012_sst_restart_mg.ntest_vals = 5 - turb_naca0012_sst_restart_mg.test_vals = [-6.560190, -5.057149, 0.830238, -0.008812, 0.078167] + turb_naca0012_sst_restart_mg.test_vals = [-3.692233, -5.056998, 0.830505, -0.008795, 0.078083] turb_naca0012_sst_restart_mg.timeout = 3200 turb_naca0012_sst_restart_mg.tol = 0.000001 test_list.append(turb_naca0012_sst_restart_mg) @@ -772,7 +780,7 @@ def main(): inc_nozzle.cfg_dir = "incomp_euler/nozzle" inc_nozzle.cfg_file = "inv_nozzle.cfg" inc_nozzle.test_iter = 20 - inc_nozzle.test_vals = [-6.051005, -5.361765, 0.006999, 0.127295] + inc_nozzle.test_vals = [-6.357399, -5.618580, 0.004548, 0.126243] test_list.append(inc_nozzle) # Laminar wall mounted cylinder, Euler walls, cylinder wall diagonally split @@ -1166,7 +1174,7 @@ def main(): turb_naca0012_1c.cfg_dir = "rans_uq/naca0012" turb_naca0012_1c.cfg_file = "turb_NACA0012_uq_1c.cfg" turb_naca0012_1c.test_iter = 10 - turb_naca0012_1c.test_vals = [-4.979554, 1.344291, 0.666805, 0.010247] + turb_naca0012_1c.test_vals = [-4.965424, 1.346117, 0.672687, 0.011931] turb_naca0012_1c.test_vals_aarch64 = [-4.981036, 1.345868, 0.673232, 0.010091] test_list.append(turb_naca0012_1c) @@ -1175,7 +1183,7 @@ def main(): turb_naca0012_2c.cfg_dir = "rans_uq/naca0012" turb_naca0012_2c.cfg_file = "turb_NACA0012_uq_2c.cfg" turb_naca0012_2c.test_iter = 10 - turb_naca0012_2c.test_vals = [-5.482691, 1.262918, 0.529442, -0.023584] + turb_naca0012_2c.test_vals = [-5.482676, 1.262851, 0.535634, -0.021752] turb_naca0012_2c.test_vals_aarch64 = [-5.484365, 1.264701, 0.501741, -0.033109] test_list.append(turb_naca0012_2c) @@ -1184,7 +1192,7 @@ def main(): turb_naca0012_3c.cfg_dir = "rans_uq/naca0012" turb_naca0012_3c.cfg_file = "turb_NACA0012_uq_3c.cfg" turb_naca0012_3c.test_iter = 10 - turb_naca0012_3c.test_vals = [-5.583617, 1.229594, 0.463384, -0.035444] + turb_naca0012_3c.test_vals = [-5.583621, 1.229520, 0.465410, -0.035039] test_list.append(turb_naca0012_3c) # NACA0012 p1c1 @@ -1192,7 +1200,7 @@ def main(): turb_naca0012_p1c1.cfg_dir = "rans_uq/naca0012" turb_naca0012_p1c1.cfg_file = "turb_NACA0012_uq_p1c1.cfg" turb_naca0012_p1c1.test_iter = 10 - turb_naca0012_p1c1.test_vals = [-5.129555, 1.283892, 0.808074, 0.047784] + turb_naca0012_p1c1.test_vals = [-5.164519, 1.279293, 0.810485, 0.048509] turb_naca0012_p1c1.test_vals_aarch64 = [-5.122100, 1.284478, 0.608744, -0.008593] test_list.append(turb_naca0012_p1c1) @@ -1201,7 +1209,7 @@ def main(): turb_naca0012_p1c2.cfg_dir = "rans_uq/naca0012" turb_naca0012_p1c2.cfg_file = "turb_NACA0012_uq_p1c2.cfg" turb_naca0012_p1c2.test_iter = 10 - turb_naca0012_p1c2.test_vals = [-5.554045, 1.234446, 0.603731, -0.008717] + turb_naca0012_p1c2.test_vals = [-5.553255, 1.234324, 0.608768, -0.007437] test_list.append(turb_naca0012_p1c2) ###################################### @@ -1213,7 +1221,7 @@ def main(): harmonic_balance.cfg_dir = "harmonic_balance" harmonic_balance.cfg_file = "HB.cfg" harmonic_balance.test_iter = 25 - harmonic_balance.test_vals = [-1.559187, 0.829575, 0.931512, 3.954440] + harmonic_balance.test_vals = [-1.556449, 0.840517, 0.943602, 3.957291] test_list.append(harmonic_balance) # Turbulent pitching NACA 64a010 airfoil @@ -1234,7 +1242,7 @@ def main(): rot_naca0012.cfg_dir = "rotating/naca0012" rot_naca0012.cfg_file = "rot_NACA0012.cfg" rot_naca0012.test_iter = 25 - rot_naca0012.test_vals = [-0.023360, 0.082942, 2.000000, -1.182142] + rot_naca0012.test_vals = [-0.028757, 0.058709, 2.000000, -1.147370] test_list.append(rot_naca0012) # Lid-driven cavity @@ -1262,7 +1270,7 @@ def main(): square_cylinder.cfg_dir = "unsteady/square_cylinder" square_cylinder.cfg_file = "turb_square.cfg" square_cylinder.test_iter = 3 - square_cylinder.test_vals = [-1.175979, 0.062203, 1.399352, 2.219226, 1.399298, 2.217472, 0.000000] + square_cylinder.test_vals = [-1.175953, 0.062131, 1.399400, 2.220360, 1.399348, 2.218598, 0.000000] square_cylinder.unsteady = True test_list.append(square_cylinder) @@ -1284,7 +1292,7 @@ def main(): sine_gust.cfg_dir = "gust" sine_gust.cfg_file = "inv_gust_NACA0012.cfg" sine_gust.test_iter = 5 - sine_gust.test_vals = [-1.977498, 3.481817, -0.011360, -0.005241] + sine_gust.test_vals = [-1.977498, 3.481833, -0.013388, -0.003910] sine_gust.unsteady = True test_list.append(sine_gust) @@ -1313,7 +1321,7 @@ def main(): unst_inc_turb_naca0015_sa.cfg_dir = "unsteady/pitching_naca0015_rans_inc" unst_inc_turb_naca0015_sa.cfg_file = "config_incomp_turb_sa.cfg" unst_inc_turb_naca0015_sa.test_iter = 1 - unst_inc_turb_naca0015_sa.test_vals = [-3.004011, -6.876257, 1.487888, 0.421869] + unst_inc_turb_naca0015_sa.test_vals = [-3.002783, -6.875096, 1.487783, 0.421690] unst_inc_turb_naca0015_sa.unsteady = True test_list.append(unst_inc_turb_naca0015_sa) @@ -1369,7 +1377,7 @@ def main(): datadriven_fluidModel.cfg_dir = "nicf/datadriven" datadriven_fluidModel.cfg_file = "datadriven_nozzle.cfg" datadriven_fluidModel.test_iter = 50 - datadriven_fluidModel.test_vals = [-6.283594, -3.253961, -4.172935, -0.949415, -2.046039, 1.546933] + datadriven_fluidModel.test_vals = [-5.779669, -2.794058, -3.760455, -0.618981, -1.475343, 1.677566] test_list.append(datadriven_fluidModel) ###################################### @@ -1390,7 +1398,7 @@ def main(): Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg" Jones_tc_restart.test_iter = 5 - Jones_tc_restart.test_vals = [-11.905727, -12.211201, -19.212537, -13.508616, -19.078613, -13.445675, 73286.000000, 73286.000000, 0.020056, 82.286000] + Jones_tc_restart.test_vals = [-0.170809, -0.162035, -8.236415, -2.533086, -7.364784, -1.876217, 73290.000000, 73290.000000, 0.020065, 82.291000] test_list.append(Jones_tc_restart) # 2D axial stage @@ -1398,7 +1406,7 @@ def main(): axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D" axial_stage2D.cfg_file = "Axial_stage2D.cfg" axial_stage2D.test_iter = 20 - axial_stage2D.test_vals = [1.167500, 1.598546, -2.928573, 2.573647, -2.527331, 3.016254, 106370.000000, 106370.000000, 5.726800, 64.383000] + axial_stage2D.test_vals = [1.166016, 1.598547, -2.928563, 2.573651, -2.527330, 3.016254, 106370.000000, 106370.000000, 5.726800, 64.395000] test_list.append(axial_stage2D) # 2D transonic stator restart @@ -1406,7 +1414,7 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-4.365636, -2.482248, -2.081252, 1.729763, -1.467305, 3.231073, -471620.000000, 94.837000, -0.046834] + transonic_stator_restart.test_vals = [-4.361754, -2.479177, -2.080217, 1.732474, -1.467446, 3.229306, -471620.000000, 94.837000, -0.093140] transonic_stator_restart.test_vals_aarch64 = [-4.437809, -2.553049, -2.164729, 1.657542, -1.356823, 3.178788, -471620.000000, 94.842000, -0.040365] test_list.append(transonic_stator_restart) @@ -1428,7 +1436,7 @@ def main(): uniform_flow.cfg_dir = "sliding_interface/uniform_flow" uniform_flow.cfg_file = "uniform_NN.cfg" uniform_flow.test_iter = 5 - uniform_flow.test_vals = [5.000000, 0.000000, -0.195001, -10.624448] + uniform_flow.test_vals = [5.000000, 0.000000, -0.193989, -10.624451] uniform_flow.unsteady = True uniform_flow.multizone = True test_list.append(uniform_flow) @@ -1446,7 +1454,7 @@ def main(): channel_2D.cfg_dir = "sliding_interface/channel_2D" channel_2D.cfg_file = "channel_2D_WA.cfg" channel_2D.test_iter = 2 - channel_2D.test_vals = [2.000000, 0.000000, 0.466408, 0.346806, 0.397328] + channel_2D.test_vals = [2.000000, 0.000000, 0.399141, 0.350260, 0.405570] channel_2D.timeout = 100 channel_2D.unsteady = True channel_2D.multizone = True @@ -1468,7 +1476,7 @@ def main(): pipe.cfg_dir = "sliding_interface/pipe" pipe.cfg_file = "pipe_NN.cfg" pipe.test_iter = 2 - pipe.test_vals = [0.070225, 0.528893, 0.684173, 0.970355, 1.065262] + pipe.test_vals = [0.024970, 0.452312, 0.562852, 0.974613, 1.031075] pipe.unsteady = True pipe.multizone = True test_list.append(pipe) @@ -1478,7 +1486,7 @@ def main(): rotating_cylinders.cfg_dir = "sliding_interface/rotating_cylinders" rotating_cylinders.cfg_file = "rot_cylinders_WA.cfg" rotating_cylinders.test_iter = 3 - rotating_cylinders.test_vals = [3.000000, 0.000000, 0.686431, 1.159459, 1.151139] + rotating_cylinders.test_vals = [3.000000, 0.000000, 0.686417, 1.152593, 1.145900] rotating_cylinders.unsteady = True rotating_cylinders.multizone = True test_list.append(rotating_cylinders) @@ -1488,7 +1496,7 @@ def main(): supersonic_vortex_shedding.cfg_dir = "sliding_interface/supersonic_vortex_shedding" supersonic_vortex_shedding.cfg_file = "sup_vor_shed_WA.cfg" supersonic_vortex_shedding.test_iter = 5 - supersonic_vortex_shedding.test_vals = [5.000000, 0.000000, 1.126036, 1.081775] + supersonic_vortex_shedding.test_vals = [5.000000, 0.000000, 1.128138, 1.064262] supersonic_vortex_shedding.unsteady = True supersonic_vortex_shedding.multizone = True test_list.append(supersonic_vortex_shedding) @@ -1498,7 +1506,7 @@ def main(): bars_SST_2D.cfg_dir = "sliding_interface/bars_SST_2D" bars_SST_2D.cfg_file = "bars.cfg" bars_SST_2D.test_iter = 13 - bars_SST_2D.test_vals = [13.000000, -0.464267, -1.541047] + bars_SST_2D.test_vals = [13.000000, -0.457935, -1.540951] bars_SST_2D.multizone = True test_list.append(bars_SST_2D) @@ -1597,7 +1605,7 @@ def main(): fsi2d.cfg_dir = "fea_fsi/WallChannel_2d" fsi2d.cfg_file = "configFSI.cfg" fsi2d.test_iter = 4 - fsi2d.test_vals = [4, 0, -3.726013, -4.277529] + fsi2d.test_vals = [4.000000, 0.000000, -3.725519, -4.278760] fsi2d.command = TestCase.Command(exec = "parallel_computation_fsi.py", param = "-f") fsi2d.multizone= True fsi2d.unsteady = True @@ -1608,7 +1616,7 @@ def main(): dyn_fsi.cfg_dir = "fea_fsi/dyn_fsi" dyn_fsi.cfg_file = "config.cfg" dyn_fsi.test_iter = 4 - dyn_fsi.test_vals = [-4.330741, -4.152826, 0.000000, 75.000000] + dyn_fsi.test_vals = [-4.328805, -4.153009, 0.000000, 75.000000] dyn_fsi.multizone = True dyn_fsi.unsteady = True test_list.append(dyn_fsi) @@ -1698,7 +1706,7 @@ def main(): pywrapper_turb_naca0012_sst.cfg_dir = "rans/naca0012" pywrapper_turb_naca0012_sst.cfg_file = "turb_NACA0012_sst.cfg" pywrapper_turb_naca0012_sst.test_iter = 10 - pywrapper_turb_naca0012_sst.test_vals = [-12.094688, -15.251093, -5.906365, 1.070413, 0.015775, -2.376161, 0.000000] + pywrapper_turb_naca0012_sst.test_vals = [-5.949151, -10.294577, -3.763019, 1.069291, 0.015902, -3.459014, 0.000000] pywrapper_turb_naca0012_sst.test_vals_aarch64 = [-12.075620, -15.246688, -5.861276, 1.070036, 0.015841, -1.991001, 0.000000] pywrapper_turb_naca0012_sst.command = TestCase.Command("mpirun -np 2", "SU2_CFD.py", "--parallel -f") pywrapper_turb_naca0012_sst.timeout = 3200 @@ -1709,7 +1717,7 @@ def main(): pywrapper_square_cylinder.cfg_dir = "unsteady/square_cylinder" pywrapper_square_cylinder.cfg_file = "turb_square.cfg" pywrapper_square_cylinder.test_iter = 10 - pywrapper_square_cylinder.test_vals = [-1.178521, -0.349772, 1.401402, 2.359105, 1.401729, 2.300974, 0.000000] + pywrapper_square_cylinder.test_vals = [-1.178744, -0.349499, 1.401128, 2.358038, 1.401474, 2.301063, 0.000000] pywrapper_square_cylinder.command = TestCase.Command("mpirun -np 2", "SU2_CFD.py", "--parallel -f") pywrapper_square_cylinder.unsteady = True test_list.append(pywrapper_square_cylinder) @@ -1719,7 +1727,7 @@ def main(): pywrapper_aeroelastic.cfg_dir = "aeroelastic" pywrapper_aeroelastic.cfg_file = "aeroelastic_NACA64A010.cfg" pywrapper_aeroelastic.test_iter = 2 - pywrapper_aeroelastic.test_vals = [-1.876636, 4.021064, 0.080986, 0.027812, -0.001643, -0.000126, -0.965663] + pywrapper_aeroelastic.test_vals = [-1.876625, 4.021088, 0.083361, 0.026765, -0.001638, -0.000130, -0.947102] pywrapper_aeroelastic.command = TestCase.Command("mpirun -np 2", "SU2_CFD.py", "--parallel -f") pywrapper_aeroelastic.unsteady = True test_list.append(pywrapper_aeroelastic) @@ -1738,7 +1746,7 @@ def main(): pywrapper_fsi2d.cfg_dir = "fea_fsi/WallChannel_2d" pywrapper_fsi2d.cfg_file = "configFSI.cfg" pywrapper_fsi2d.test_iter = 4 - pywrapper_fsi2d.test_vals = [4.000000, 0.000000, -3.726013, -4.277529] + pywrapper_fsi2d.test_vals = [4.000000, 0.000000, -3.725519, -4.278760] pywrapper_fsi2d.command = TestCase.Command("mpirun -np 2", "SU2_CFD.py", "--nZone 2 --fsi True --parallel -f") pywrapper_fsi2d.unsteady = True pywrapper_fsi2d.multizone = True @@ -1749,7 +1757,7 @@ def main(): pywrapper_unsteadyFSI.cfg_dir = "py_wrapper/dyn_fsi" pywrapper_unsteadyFSI.cfg_file = "config.cfg" pywrapper_unsteadyFSI.test_iter = 4 - pywrapper_unsteadyFSI.test_vals = [0, 31, 5, 47, -1.756677, -2.828286, -7.638545, -6.863930, 0.000156] + pywrapper_unsteadyFSI.test_vals = [0.000000, 30.000000, 5.000000, 48.000000, -1.756676, -2.828284, -7.625018, -6.863923, 0.000156] pywrapper_unsteadyFSI.command = TestCase.Command("mpirun -np 2", "python", "run.py") pywrapper_unsteadyFSI.unsteady = True pywrapper_unsteadyFSI.multizone = True @@ -1760,7 +1768,7 @@ def main(): pywrapper_unsteadyCHT.cfg_dir = "py_wrapper/flatPlate_unsteady_CHT" pywrapper_unsteadyCHT.cfg_file = "unsteady_CHT_FlatPlate_Conf.cfg" pywrapper_unsteadyCHT.test_iter = 5 - pywrapper_unsteadyCHT.test_vals = [-1.614168, 2.260203, -0.008065, 0.201068] + pywrapper_unsteadyCHT.test_vals = [-1.614169, 2.260208, -0.008127, 0.201931] pywrapper_unsteadyCHT.command = TestCase.Command("mpirun -np 2", "python", "launch_unsteady_CHT_FlatPlate.py --parallel -f") pywrapper_unsteadyCHT.unsteady = True test_list.append(pywrapper_unsteadyCHT) @@ -1780,7 +1788,7 @@ def main(): pywrapper_deformingBump.cfg_dir = "py_wrapper/deforming_bump_in_channel" pywrapper_deformingBump.cfg_file = "config.cfg" pywrapper_deformingBump.test_iter = 1 - pywrapper_deformingBump.test_vals = [0.500000, 0.000000, -2.556310, -1.270841, -2.350592, 2.606850, 8.015020, -0.301652] + pywrapper_deformingBump.test_vals = [0.500000, 0.000000, -2.556310, -1.270836, -2.351316, 2.905858, 9.953163, -0.946408] pywrapper_deformingBump.command = TestCase.Command("mpirun -np 2", "python", "run.py") pywrapper_deformingBump.unsteady = True test_list.append(pywrapper_deformingBump) @@ -2036,7 +2044,7 @@ def main(): cgns_writer.cfg_dir = "cgns_writer" cgns_writer.cfg_file = "config.cfg" cgns_writer.test_iter = 1 - cgns_writer.test_vals = [-2.974473, 0.640256, 5.371028, -6.732060] + cgns_writer.test_vals = [-2.974219, 0.639253, 5.371471, -6.721279] cgns_writer.new_output = True test_list.append(cgns_writer) diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index dba175cb826a..9edfc65b7b84 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -91,7 +91,7 @@ def main(): discadj_rans_naca0012_sst.cfg_dir = "disc_adj_rans/naca0012" discadj_rans_naca0012_sst.cfg_file = "turb_NACA0012_sst.cfg" discadj_rans_naca0012_sst.test_iter = 10 - discadj_rans_naca0012_sst.test_vals = [-2.226820, -0.256327, -2.299900, -0.003171] + discadj_rans_naca0012_sst.test_vals = [-2.226827, -0.253089, -2.299100, -0.003174] discadj_rans_naca0012_sst.test_vals_aarch64 = [-2.226852, -0.253100, -2.299300, -0.003164] test_list.append(discadj_rans_naca0012_sst) @@ -150,7 +150,7 @@ def main(): discadj_axisymmetric_rans_nozzle.cfg_dir = "axisymmetric_rans/air_nozzle" discadj_axisymmetric_rans_nozzle.cfg_file = "air_nozzle_restart.cfg" discadj_axisymmetric_rans_nozzle.test_iter = 10 - discadj_axisymmetric_rans_nozzle.test_vals = [9.742490, 5.136583, 7.106490, 2.488167] + discadj_axisymmetric_rans_nozzle.test_vals = [9.738700, 5.135180, 7.101795, 2.487548] discadj_axisymmetric_rans_nozzle.no_restart = True test_list.append(discadj_axisymmetric_rans_nozzle) @@ -217,7 +217,7 @@ def main(): discadj_pitchingNACA0012.cfg_dir = "disc_adj_euler/naca0012_pitching" discadj_pitchingNACA0012.cfg_file = "inv_NACA0012_pitching.cfg" discadj_pitchingNACA0012.test_iter = 4 - discadj_pitchingNACA0012.test_vals = [-1.039711, -1.508402, -0.006059, 0.000012] + discadj_pitchingNACA0012.test_vals = [-1.115587, -1.573317, -0.006474, 0.000010] discadj_pitchingNACA0012.tol = 0.01 discadj_pitchingNACA0012.unsteady = True test_list.append(discadj_pitchingNACA0012) @@ -251,7 +251,7 @@ def main(): discadj_trans_stator.cfg_dir = "disc_adj_turbomachinery/transonic_stator_2D" discadj_trans_stator.cfg_file = "transonic_stator.cfg" discadj_trans_stator.test_iter = 79 - discadj_trans_stator.test_vals = [79.000000, -7.555647, -10.335486, -10.356919, -13.629543] + discadj_trans_stator.test_vals = [79.000000, -7.554772, -10.335151, -10.357769, -13.628908] discadj_trans_stator.test_vals_aarch64 = [79.000000, -7.555647, -10.335486, -10.356919, -13.629543] test_list.append(discadj_trans_stator) @@ -260,7 +260,7 @@ def main(): discadj_axial_stage.cfg_dir = "disc_adj_turbomachinery/axial_stage_2D" discadj_axial_stage.cfg_file = "Axial_stage2D.cfg" discadj_axial_stage.test_iter = 79 - discadj_axial_stage.test_vals = [79.000000, -6.606356, -7.139726] + discadj_axial_stage.test_vals = [79.000000, -6.605179, -7.180296] discadj_axial_stage.test_vals_aarch64 = [79.000000, -6.606356, -7.139726] test_list.append(discadj_axial_stage) @@ -315,7 +315,7 @@ def main(): discadj_fsi2.cfg_dir = "disc_adj_fsi/Airfoil_2d" discadj_fsi2.cfg_file = "config.cfg" discadj_fsi2.test_iter = 8 - discadj_fsi2.test_vals = [-3.824633, 1.979516, -3.863368, 0.295450, 3.839800] + discadj_fsi2.test_vals = [-3.824635, 1.979542, -3.863368, 0.295450, 3.839800] discadj_fsi2.test_vals_aarch64 = [-3.824870, 1.979160, -3.863368, 0.295450, 3.839800] discadj_fsi2.tol = 0.00001 test_list.append(discadj_fsi2) diff --git a/TestCases/py_wrapper/translating_NACA0012/forces_0.csv.ref b/TestCases/py_wrapper/translating_NACA0012/forces_0.csv.ref index 0c9091d233ae..d6ec7617edf2 100644 --- a/TestCases/py_wrapper/translating_NACA0012/forces_0.csv.ref +++ b/TestCases/py_wrapper/translating_NACA0012/forces_0.csv.ref @@ -1,200 +1,200 @@ -199, -0.94, -0.00, 0.00 -0, -2.79, 19.21, 0.00 -1, -4.07, 28.05, 0.00 -2, -5.12, 35.35, 0.00 -3, -6.07, 41.99, 0.00 -4, -6.89, 47.80, 0.00 -5, -7.57, 52.73, 0.00 -6, -8.16, 57.03, 0.00 -7, -8.63, 60.64, 0.00 -8, -8.99, 63.49, 0.00 -9, -9.25, 65.69, 0.00 -10, -9.40, 67.22, 0.00 -11, -9.47, 68.21, 0.00 -12, -9.44, 68.52, 0.00 -13, -9.32, 68.22, 0.00 -14, -9.13, 67.36, 0.00 -15, -8.84, 65.83, 0.00 -16, -8.50, 63.93, 0.00 -17, -8.06, 61.28, 0.00 -18, -7.60, 58.37, 0.00 -19, -7.04, 54.67, 0.00 -20, -6.48, 50.91, 0.00 -21, -5.83, 46.37, 0.00 -22, -5.21, 41.95, 0.00 -23, -4.50, 36.73, 0.00 -24, -3.85, 31.89, 0.00 -25, -3.13, 26.30, 0.00 -26, -2.48, 21.12, 0.00 -27, -1.81, 15.63, 0.00 -28, -1.16, 10.19, 0.00 -29, -0.56, 5.01, 0.00 -30, -0.01, 0.07, 0.00 -31, 0.30, -2.76, 0.00 -32, 0.83, -7.82, 0.00 -33, 0.85, -8.14, 0.00 -34, 1.47, -14.33, 0.00 -35, 1.50, -14.91, 0.00 -36, 2.34, -23.79, 0.00 -37, 2.58, -26.78, 0.00 -38, 3.60, -38.33, 0.00 -39, 4.15, -45.32, 0.00 -40, 5.35, -59.93, 0.00 -41, 6.34, -73.02, 0.00 -42, 7.53, -89.47, 0.00 -43, 8.62, -105.75, 0.00 -44, 9.52, -120.93, 0.00 -45, 10.46, -137.99, 0.00 -46, 10.89, -149.59, 0.00 -47, 11.06, -158.86, 0.00 -48, 10.91, -164.51, 0.00 -49, 10.20, -162.29, 0.00 -50, 10.41, -175.95, 0.00 -51, 10.69, -193.01, 0.00 -52, 11.35, -220.88, 0.00 -53, 12.09, -256.22, 0.00 -54, 11.70, -273.60, 0.00 -55, 11.18, -293.17, 0.00 -56, 9.73, -292.14, 0.00 -57, 8.95, -317.19, 0.00 -58, 8.19, -357.93, 0.00 -59, 7.34, -424.98, 0.00 -60, 5.17, -454.05, 0.00 -61, 2.26, -432.87, 0.00 -62, -0.52, -418.79, 0.00 -63, -3.27, -407.56, 0.00 -64, -5.99, -395.49, 0.00 -65, -8.62, -381.54, 0.00 -66, -11.16, -366.54, 0.00 -67, -13.55, -350.35, 0.00 -68, -15.82, -334.23, 0.00 -69, -17.87, -316.57, 0.00 -70, -19.66, -297.72, 0.00 -71, -21.14, -277.56, 0.00 -72, -22.40, -258.00, 0.00 -73, -23.24, -236.77, 0.00 -74, -23.93, -217.26, 0.00 -75, -23.95, -194.85, 0.00 -76, -23.92, -175.24, 0.00 -77, -23.06, -152.62, 0.00 -78, -22.31, -133.79, 0.00 -79, -20.38, -110.93, 0.00 -80, -18.51, -91.56, 0.00 -81, -14.90, -67.05, 0.00 -82, -11.41, -46.70, 0.00 -83, -4.97, -18.48, 0.00 -84, -0.30, -1.01, 0.00 -85, 9.93, 30.30, 0.00 -86, 16.77, 46.17, 0.00 -87, 32.33, 79.93, 0.00 -88, 43.53, 96.08, 0.00 -89, 60.42, 118.16, 0.00 -90, 71.17, 122.11, 0.00 -91, 98.75, 146.81, 0.00 -92, 112.94, 143.03, 0.00 -93, 162.93, 171.80, 0.00 -94, 168.48, 143.12, 0.00 -95, 162.93, 106.12, 0.00 -96, 161.49, 74.02, 0.00 -97, 226.14, 61.20, 0.00 -98, 173.55, 23.29, 0.00 -99, 81.85, -0.00, 0.00 -100, 101.93, -13.68, 0.00 -101, 111.85, -30.27, 0.00 -102, 83.84, -38.43, 0.00 -103, 59.18, -38.55, 0.00 -104, 39.46, -33.52, 0.00 -105, 20.52, -21.64, 0.00 -106, 9.26, -11.73, 0.00 -107, -5.26, 7.82, 0.00 -108, -14.72, 25.25, 0.00 -109, -24.47, 47.86, 0.00 -110, -30.46, 67.22, 0.00 -111, -36.98, 91.44, 0.00 -112, -40.61, 111.80, 0.00 -113, -44.24, 135.04, 0.00 -114, -47.23, 159.29, 0.00 -115, -50.25, 186.80, 0.00 -116, -52.01, 212.78, 0.00 -117, -49.79, 224.02, 0.00 -118, -49.93, 247.03, 0.00 -119, -50.10, 272.69, 0.00 -120, -49.50, 296.79, 0.00 -121, -48.43, 320.54, 0.00 -122, -46.68, 341.98, 0.00 -123, -45.16, 367.44, 0.00 -124, -43.12, 391.55, 0.00 -125, -41.04, 418.22, 0.00 -126, -38.38, 441.96, 0.00 -127, -35.65, 468.10, 0.00 -128, -32.39, 490.58, 0.00 -129, -29.12, 515.86, 0.00 -130, -25.43, 537.19, 0.00 -131, -21.72, 561.44, 0.00 -132, -17.69, 581.14, 0.00 -133, -13.62, 602.77, 0.00 -134, -9.39, 620.72, 0.00 -135, -5.13, 639.76, 0.00 -136, -0.81, 656.52, 0.00 -137, 3.52, 673.60, 0.00 -138, 7.84, 688.01, 0.00 -139, 12.15, 703.61, 0.00 -140, 16.38, 716.38, 0.00 -141, 20.56, 728.93, 0.00 -142, 24.62, 739.26, 0.00 -143, 28.61, 749.93, 0.00 -144, 32.43, 758.20, 0.00 -145, 36.13, 765.81, 0.00 -146, 39.66, 772.00, 0.00 -147, 43.08, 777.93, 0.00 -148, 46.29, 782.12, 0.00 -149, 49.44, 786.83, 0.00 -150, 52.29, 788.58, 0.00 -151, 54.86, 787.96, 0.00 -152, 57.31, 787.22, 0.00 -153, 59.58, 785.72, 0.00 -154, 62.23, 790.29, 0.00 -155, 62.41, 765.50, 0.00 -156, 64.45, 765.33, 0.00 -157, 54.69, 630.25, 0.00 -158, 48.23, 540.32, 0.00 -159, -12.34, -134.66, 0.00 -160, -29.22, -310.97, 0.00 -161, -7.18, -74.61, 0.00 -162, -3.54, -35.94, 0.00 -163, -3.39, -33.73, 0.00 -164, -3.11, -30.30, 0.00 -165, -2.96, -28.33, 0.00 -166, -2.85, -26.76, 0.00 -167, -2.79, -25.71, 0.00 -168, -2.88, -26.13, 0.00 -169, -3.27, -29.13, 0.00 -170, -3.57, -31.34, 0.00 -171, -3.86, -33.32, 0.00 -172, -4.21, -35.80, 0.00 -173, -4.70, -39.42, 0.00 -174, -5.09, -42.12, 0.00 -175, -5.57, -45.47, 0.00 -176, -6.00, -48.33, 0.00 -177, -6.47, -51.51, 0.00 -178, -6.92, -54.40, 0.00 -179, -7.37, -57.26, 0.00 -180, -7.77, -59.72, 0.00 -181, -8.16, -62.01, 0.00 -182, -8.49, -63.90, 0.00 -183, -8.78, -65.39, 0.00 -184, -9.01, -66.52, 0.00 -185, -9.18, -67.19, 0.00 -186, -9.30, -67.46, 0.00 -187, -9.30, -67.00, 0.00 -188, -9.21, -65.84, 0.00 -189, -9.06, -64.37, 0.00 -190, -8.81, -62.23, 0.00 -191, -8.46, -59.42, 0.00 -192, -8.00, -55.90, 0.00 -193, -7.42, -51.65, 0.00 -194, -6.74, -46.78, 0.00 -195, -5.94, -41.07, 0.00 -196, -5.00, -34.54, 0.00 -197, -3.98, -27.42, 0.00 -198, -2.72, -18.72, 0.00 +199, -1.17, -0.00, 0.00 +0, -2.95, 20.29, 0.00 +1, -4.18, 28.84, 0.00 +2, -5.23, 36.10, 0.00 +3, -6.15, 42.53, 0.00 +4, -6.93, 48.08, 0.00 +5, -7.56, 52.66, 0.00 +6, -8.10, 56.60, 0.00 +7, -8.50, 59.71, 0.00 +8, -8.79, 62.08, 0.00 +9, -8.97, 63.72, 0.00 +10, -9.05, 64.69, 0.00 +11, -9.03, 65.05, 0.00 +12, -8.92, 64.73, 0.00 +13, -8.72, 63.82, 0.00 +14, -8.44, 62.29, 0.00 +15, -8.08, 60.19, 0.00 +16, -7.66, 57.63, 0.00 +17, -7.17, 54.52, 0.00 +18, -6.63, 50.92, 0.00 +19, -6.03, 46.87, 0.00 +20, -5.39, 42.34, 0.00 +21, -4.70, 37.42, 0.00 +22, -3.98, 32.07, 0.00 +23, -3.22, 26.31, 0.00 +24, -2.44, 20.21, 0.00 +25, -1.64, 13.74, 0.00 +26, -0.81, 6.92, 0.00 +27, 0.02, -0.21, 0.00 +28, 0.87, -7.67, 0.00 +29, 1.73, -15.42, 0.00 +30, 2.59, -23.45, 0.00 +31, 3.44, -31.75, 0.00 +32, 4.30, -40.35, 0.00 +33, 5.14, -49.19, 0.00 +34, 5.98, -58.26, 0.00 +35, 6.79, -67.59, 0.00 +36, 7.59, -77.17, 0.00 +37, 8.36, -86.92, 0.00 +38, 9.11, -96.91, 0.00 +39, 9.82, -107.11, 0.00 +40, 10.48, -117.46, 0.00 +41, 11.11, -127.97, 0.00 +42, 11.68, -138.70, 0.00 +43, 12.19, -149.57, 0.00 +44, 12.64, -160.59, 0.00 +45, 13.02, -171.67, 0.00 +46, 13.31, -182.81, 0.00 +47, 13.51, -194.00, 0.00 +48, 13.60, -205.19, 0.00 +49, 13.60, -216.39, 0.00 +50, 13.46, -227.38, 0.00 +51, 13.18, -237.98, 0.00 +52, 12.75, -248.20, 0.00 +53, 12.23, -259.17, 0.00 +54, 11.52, -269.25, 0.00 +55, 10.25, -268.75, 0.00 +56, 8.38, -251.63, 0.00 +57, 7.07, -250.64, 0.00 +58, 7.56, -330.47, 0.00 +59, 7.32, -423.80, 0.00 +60, 5.04, -442.56, 0.00 +61, 2.27, -433.32, 0.00 +62, -0.52, -423.85, 0.00 +63, -3.32, -414.18, 0.00 +64, -6.10, -403.22, 0.00 +65, -8.83, -390.82, 0.00 +66, -11.48, -377.12, 0.00 +67, -14.02, -362.49, 0.00 +68, -16.42, -346.83, 0.00 +69, -18.65, -330.39, 0.00 +70, -20.69, -313.30, 0.00 +71, -22.51, -295.58, 0.00 +72, -24.09, -277.38, 0.00 +73, -25.39, -258.74, 0.00 +74, -26.41, -239.83, 0.00 +75, -27.12, -220.65, 0.00 +76, -27.44, -201.00, 0.00 +77, -27.37, -181.18, 0.00 +78, -26.91, -161.37, 0.00 +79, -25.99, -141.45, 0.00 +80, -24.59, -121.63, 0.00 +81, -22.65, -101.90, 0.00 +82, -20.12, -82.33, 0.00 +83, -16.96, -63.03, 0.00 +84, -13.07, -44.08, 0.00 +85, -8.38, -25.59, 0.00 +86, -2.78, -7.65, 0.00 +87, 3.88, 9.59, 0.00 +88, 11.75, 25.94, 0.00 +89, 21.02, 41.10, 0.00 +90, 31.85, 54.64, 0.00 +91, 44.54, 66.22, 0.00 +92, 59.13, 74.88, 0.00 +93, 75.73, 79.85, 0.00 +94, 94.12, 79.95, 0.00 +95, 112.89, 73.53, 0.00 +96, 130.10, 59.63, 0.00 +97, 143.14, 38.74, 0.00 +98, 108.79, 14.60, 0.00 +99, 70.11, -0.00, 0.00 +100, 103.89, -13.94, 0.00 +101, 125.30, -33.91, 0.00 +102, 101.33, -46.45, 0.00 +103, 76.47, -49.81, 0.00 +104, 52.78, -44.83, 0.00 +105, 31.65, -33.37, 0.00 +106, 13.81, -17.49, 0.00 +107, -0.91, 1.35, 0.00 +108, -12.99, 22.28, 0.00 +109, -22.79, 44.57, 0.00 +110, -30.71, 67.77, 0.00 +111, -36.99, 91.47, 0.00 +112, -42.00, 115.63, 0.00 +113, -45.85, 139.97, 0.00 +114, -48.79, 164.55, 0.00 +115, -50.93, 189.35, 0.00 +116, -52.37, 214.25, 0.00 +117, -53.17, 239.25, 0.00 +118, -53.40, 264.16, 0.00 +119, -53.08, 288.91, 0.00 +120, -52.31, 313.64, 0.00 +121, -51.08, 338.04, 0.00 +122, -49.48, 362.46, 0.00 +123, -47.52, 386.68, 0.00 +124, -45.18, 410.24, 0.00 +125, -42.56, 433.63, 0.00 +126, -39.68, 456.92, 0.00 +127, -36.53, 479.69, 0.00 +128, -33.14, 501.84, 0.00 +129, -29.54, 523.29, 0.00 +130, -25.76, 544.22, 0.00 +131, -21.84, 564.63, 0.00 +132, -17.79, 584.27, 0.00 +133, -13.64, 603.37, 0.00 +134, -9.41, 621.47, 0.00 +135, -5.12, 638.73, 0.00 +136, -0.81, 655.59, 0.00 +137, 3.51, 671.32, 0.00 +138, 7.82, 685.90, 0.00 +139, 12.09, 699.98, 0.00 +140, 16.31, 713.08, 0.00 +141, 20.44, 724.72, 0.00 +142, 24.49, 735.59, 0.00 +143, 28.45, 745.67, 0.00 +144, 32.27, 754.47, 0.00 +145, 35.94, 761.95, 0.00 +146, 39.49, 768.62, 0.00 +147, 42.87, 774.27, 0.00 +148, 46.09, 778.66, 0.00 +149, 49.15, 782.31, 0.00 +150, 52.03, 784.73, 0.00 +151, 54.74, 786.18, 0.00 +152, 57.27, 786.69, 0.00 +153, 59.64, 786.42, 0.00 +154, 61.80, 784.85, 0.00 +155, 63.44, 778.18, 0.00 +156, 66.99, 795.52, 0.00 +157, 59.24, 682.66, 0.00 +158, 2.29, 25.63, 0.00 +159, -2.39, -26.12, 0.00 +160, 0.48, 5.10, 0.00 +161, 0.29, 2.98, 0.00 +162, 0.29, 2.94, 0.00 +163, 0.26, 2.60, 0.00 +164, 0.10, 0.99, 0.00 +165, -0.15, -1.43, 0.00 +166, -0.48, -4.49, 0.00 +167, -0.87, -8.02, 0.00 +168, -1.31, -11.91, 0.00 +169, -1.80, -16.06, 0.00 +170, -2.32, -20.39, 0.00 +171, -2.87, -24.79, 0.00 +172, -3.43, -29.21, 0.00 +173, -4.01, -33.63, 0.00 +174, -4.58, -37.92, 0.00 +175, -5.15, -42.07, 0.00 +176, -5.72, -46.09, 0.00 +177, -6.26, -49.84, 0.00 +178, -6.78, -53.32, 0.00 +179, -7.28, -56.54, 0.00 +180, -7.73, -59.39, 0.00 +181, -8.14, -61.90, 0.00 +182, -8.51, -64.01, 0.00 +183, -8.81, -65.66, 0.00 +184, -9.07, -66.93, 0.00 +185, -9.25, -67.69, 0.00 +186, -9.36, -67.91, 0.00 +187, -9.38, -67.59, 0.00 +188, -9.32, -66.65, 0.00 +189, -9.17, -65.15, 0.00 +190, -8.93, -63.04, 0.00 +191, -8.58, -60.25, 0.00 +192, -8.12, -56.77, 0.00 +193, -7.54, -52.51, 0.00 +194, -6.87, -47.65, 0.00 +195, -6.05, -41.87, 0.00 +196, -5.11, -35.27, 0.00 +197, -4.05, -27.89, 0.00 +198, -2.79, -19.21, 0.00 diff --git a/TestCases/py_wrapper/updated_moving_frame_NACA12/forces_0.csv.ref b/TestCases/py_wrapper/updated_moving_frame_NACA12/forces_0.csv.ref index 5168d86660a2..017384b3f498 100644 --- a/TestCases/py_wrapper/updated_moving_frame_NACA12/forces_0.csv.ref +++ b/TestCases/py_wrapper/updated_moving_frame_NACA12/forces_0.csv.ref @@ -1,200 +1,200 @@ -199, -0.99, -0.00, 0.00 -0, -2.91, 20.03, 0.00 -1, -4.14, 28.50, 0.00 -2, -5.20, 35.86, 0.00 -3, -6.14, 42.47, 0.00 -4, -6.97, 48.37, 0.00 -5, -7.67, 53.42, 0.00 -6, -8.25, 57.65, 0.00 -7, -8.70, 61.14, 0.00 -8, -9.00, 63.59, 0.00 -9, -9.19, 65.26, 0.00 -10, -9.25, 66.17, 0.00 -11, -9.21, 66.36, 0.00 -12, -9.11, 66.11, 0.00 -13, -8.91, 65.21, 0.00 -14, -8.68, 64.05, 0.00 -15, -8.38, 62.39, 0.00 -16, -8.03, 60.38, 0.00 -17, -7.63, 58.02, 0.00 -18, -7.15, 54.94, 0.00 -19, -6.64, 51.57, 0.00 -20, -6.03, 47.40, 0.00 -21, -5.39, 42.89, 0.00 -22, -4.70, 37.86, 0.00 -23, -3.97, 32.41, 0.00 -24, -3.25, 26.89, 0.00 -25, -2.49, 20.93, 0.00 -26, -1.80, 15.28, 0.00 -27, -1.07, 9.26, 0.00 -28, -0.43, 3.74, 0.00 -29, 0.22, -2.00, 0.00 -30, 0.74, -6.72, 0.00 -31, 1.23, -11.32, 0.00 -32, 1.61, -15.15, 0.00 -33, 1.99, -19.02, 0.00 -34, 2.29, -22.32, 0.00 -35, 2.64, -26.26, 0.00 -36, 2.79, -28.35, 0.00 -37, 2.88, -29.98, 0.00 -38, 2.58, -27.41, 0.00 -39, 2.40, -26.23, 0.00 -40, 2.14, -23.97, 0.00 -41, 2.88, -33.18, 0.00 -42, 0.07, -0.88, 0.00 -43, -7.69, 94.38, 0.00 -44, -15.57, 197.73, 0.00 -45, -17.94, 236.64, 0.00 -46, 4.70, -64.62, 0.00 -47, 28.52, -409.61, 0.00 -48, 30.19, -455.33, 0.00 -49, 29.54, -470.12, 0.00 -50, 27.35, -462.05, 0.00 -51, 25.31, -457.07, 0.00 -52, 23.08, -449.24, 0.00 -53, 21.94, -465.13, 0.00 -54, 21.48, -502.18, 0.00 -55, 22.02, -577.36, 0.00 -56, 20.47, -614.69, 0.00 -57, 16.29, -577.49, 0.00 -58, 12.59, -550.58, 0.00 -59, 9.32, -539.47, 0.00 -60, 6.05, -531.03, 0.00 -61, 2.73, -521.29, 0.00 -62, -0.63, -508.34, 0.00 -63, -3.96, -493.40, 0.00 -64, -7.24, -478.67, 0.00 -65, -10.46, -462.56, 0.00 -66, -13.57, -445.82, 0.00 -67, -16.54, -427.72, 0.00 -68, -19.38, -409.38, 0.00 -69, -22.00, -389.70, 0.00 -70, -24.45, -370.21, 0.00 -71, -26.59, -349.18, 0.00 -72, -28.53, -328.51, 0.00 -73, -30.06, -306.33, 0.00 -74, -31.33, -284.50, 0.00 -75, -32.15, -261.58, 0.00 -76, -32.58, -238.65, 0.00 -77, -32.48, -214.97, 0.00 -78, -32.01, -191.95, 0.00 -79, -31.12, -169.41, 0.00 -80, -29.76, -147.23, 0.00 -81, -28.42, -127.89, 0.00 -82, -26.46, -108.25, 0.00 -83, -25.23, -93.79, 0.00 -84, -23.18, -78.17, 0.00 -85, -22.06, -67.33, 0.00 -86, -20.11, -55.36, 0.00 -87, -17.52, -43.33, 0.00 -88, -14.90, -32.88, 0.00 -89, -7.49, -14.65, 0.00 -90, -1.78, -3.05, 0.00 -91, 11.94, 17.75, 0.00 -92, 21.51, 27.24, 0.00 -93, 37.02, 39.03, 0.00 -94, 47.69, 40.51, 0.00 -95, 60.96, 39.71, 0.00 -96, 70.98, 32.53, 0.00 -97, 78.52, 21.25, 0.00 -98, 83.66, 11.23, 0.00 -99, 49.17, -0.00, 0.00 -100, 124.12, -16.66, 0.00 -101, 184.07, -49.82, 0.00 -102, 164.48, -75.39, 0.00 -103, 133.69, -87.08, 0.00 -104, 109.43, -92.96, 0.00 -105, 76.86, -81.04, 0.00 -106, 57.12, -72.34, 0.00 -107, 33.93, -50.44, 0.00 -108, 19.70, -33.80, 0.00 -109, 3.84, -7.50, 0.00 -110, -6.08, 13.41, 0.00 -111, -17.27, 42.71, 0.00 -112, -24.34, 67.01, 0.00 -113, -32.29, 98.57, 0.00 -114, -37.23, 125.57, 0.00 -115, -42.27, 157.13, 0.00 -116, -45.00, 184.10, 0.00 -117, -47.22, 212.46, 0.00 -118, -48.02, 237.54, 0.00 -119, -48.54, 264.19, 0.00 -120, -48.03, 288.01, 0.00 -121, -47.18, 312.25, 0.00 -122, -45.73, 334.99, 0.00 -123, -43.96, 357.74, 0.00 -124, -41.77, 379.29, 0.00 -125, -39.34, 400.82, 0.00 -126, -36.68, 422.40, 0.00 -127, -33.75, 443.26, 0.00 -128, -30.64, 464.03, 0.00 -129, -27.30, 483.59, 0.00 -130, -23.83, 503.39, 0.00 -131, -20.19, 522.07, 0.00 -132, -16.46, 540.78, 0.00 -133, -12.62, 558.35, 0.00 -134, -8.71, 575.65, 0.00 -135, -4.74, 591.58, 0.00 -136, -0.75, 607.73, 0.00 -137, 3.26, 622.30, 0.00 -138, 7.25, 636.34, 0.00 -139, 11.22, 649.44, 0.00 -140, 15.14, 662.10, 0.00 -141, 18.99, 673.05, 0.00 -142, 22.76, 683.64, 0.00 -143, 26.45, 693.25, 0.00 -144, 30.01, 701.79, 0.00 -145, 33.44, 708.94, 0.00 -146, 36.75, 715.33, 0.00 -147, 39.92, 720.85, 0.00 -148, 42.91, 725.05, 0.00 -149, 45.76, 728.29, 0.00 -150, 48.36, 729.34, 0.00 -151, 50.65, 727.41, 0.00 -152, 53.13, 729.86, 0.00 -153, 53.65, 707.51, 0.00 -154, 41.35, 525.16, 0.00 -155, -10.50, -128.78, 0.00 -156, -10.40, -123.56, 0.00 -157, -0.38, -4.42, 0.00 -158, 0.07, 0.74, 0.00 -159, -0.56, -6.11, 0.00 -160, -0.06, -0.63, 0.00 -161, 0.35, 3.66, 0.00 -162, 0.54, 5.47, 0.00 -163, 0.57, 5.63, 0.00 -164, 0.50, 4.88, 0.00 -165, 0.34, 3.29, 0.00 -166, 0.13, 1.18, 0.00 -167, -0.18, -1.65, 0.00 -168, -0.56, -5.04, 0.00 -169, -1.04, -9.24, 0.00 -170, -1.56, -13.68, 0.00 -171, -2.17, -18.73, 0.00 -172, -2.78, -23.65, 0.00 -173, -3.45, -28.94, 0.00 -174, -4.09, -33.84, 0.00 -175, -4.78, -39.02, 0.00 -176, -5.44, -43.83, 0.00 -177, -6.12, -48.67, 0.00 -178, -6.74, -52.99, 0.00 -179, -7.38, -57.30, 0.00 -180, -7.94, -61.00, 0.00 -181, -8.47, -64.36, 0.00 -182, -8.92, -67.13, 0.00 -183, -9.27, -69.09, 0.00 -184, -9.56, -70.59, 0.00 -185, -9.71, -71.08, 0.00 -186, -9.80, -71.10, 0.00 -187, -9.76, -70.26, 0.00 -188, -9.64, -68.96, 0.00 -189, -9.45, -67.16, 0.00 -190, -9.17, -64.76, 0.00 -191, -8.82, -61.96, 0.00 -192, -8.34, -58.34, 0.00 -193, -7.78, -54.14, 0.00 -194, -7.08, -49.13, 0.00 -195, -6.24, -43.17, 0.00 -196, -5.26, -36.30, 0.00 -197, -4.14, -28.53, 0.00 -198, -2.87, -19.79, 0.00 +199, -1.20, -0.00, 0.00 +0, -2.91, 20.05, 0.00 +1, -4.09, 28.16, 0.00 +2, -5.15, 35.52, 0.00 +3, -6.05, 41.87, 0.00 +4, -6.83, 47.39, 0.00 +5, -7.46, 51.93, 0.00 +6, -7.98, 55.81, 0.00 +7, -8.38, 58.87, 0.00 +8, -8.66, 61.18, 0.00 +9, -8.83, 62.77, 0.00 +10, -8.90, 63.67, 0.00 +11, -8.88, 63.96, 0.00 +12, -8.76, 63.56, 0.00 +13, -8.55, 62.54, 0.00 +14, -8.25, 60.89, 0.00 +15, -7.87, 58.62, 0.00 +16, -7.43, 55.87, 0.00 +17, -6.91, 52.55, 0.00 +18, -6.34, 48.72, 0.00 +19, -5.72, 44.40, 0.00 +20, -5.03, 39.56, 0.00 +21, -4.31, 34.26, 0.00 +22, -3.53, 28.48, 0.00 +23, -2.58, 22.22, 0.00 +24, -1.88, 15.59, 0.00 +25, -1.01, 8.51, 0.00 +26, -0.13, 1.09, 0.00 +27, 0.77, -6.63, 0.00 +28, 1.68, -14.70, 0.00 +29, 2.59, -23.11, 0.00 +30, 3.50, -31.76, 0.00 +31, 4.42, -40.71, 0.00 +32, 5.31, -49.80, 0.00 +33, 6.18, -59.12, 0.00 +34, 7.01, -68.35, 0.00 +35, 7.81, -77.72, 0.00 +36, 8.54, -86.83, 0.00 +37, 9.21, -95.73, 0.00 +38, 9.85, -104.77, 0.00 +39, 10.46, -114.13, 0.00 +40, 11.15, -124.95, 0.00 +41, 11.87, -136.79, 0.00 +42, 12.52, -148.72, 0.00 +43, 13.07, -160.31, 0.00 +44, 13.44, -170.75, 0.00 +45, 13.71, -180.79, 0.00 +46, 13.51, -185.52, 0.00 +47, 12.80, -183.80, 0.00 +48, 11.79, -177.78, 0.00 +49, 11.16, -177.63, 0.00 +50, 11.17, -188.79, 0.00 +51, 9.75, -176.01, 0.00 +52, 4.86, -94.68, 0.00 +53, 4.39, -93.06, 0.00 +54, 19.50, -455.89, 0.00 +55, 22.62, -592.88, 0.00 +56, 18.86, -566.30, 0.00 +57, 15.60, -553.07, 0.00 +58, 12.49, -545.93, 0.00 +59, 9.27, -536.99, 0.00 +60, 6.00, -526.52, 0.00 +61, 2.70, -515.25, 0.00 +62, -0.62, -502.68, 0.00 +63, -3.92, -488.92, 0.00 +64, -7.18, -474.50, 0.00 +65, -10.38, -459.17, 0.00 +66, -13.48, -442.77, 0.00 +67, -16.47, -425.71, 0.00 +68, -19.30, -407.83, 0.00 +69, -21.98, -389.40, 0.00 +70, -24.47, -370.52, 0.00 +71, -26.74, -351.11, 0.00 +72, -28.76, -331.24, 0.00 +73, -30.51, -310.87, 0.00 +74, -31.96, -290.23, 0.00 +75, -33.11, -269.39, 0.00 +76, -33.87, -248.12, 0.00 +77, -34.26, -226.71, 0.00 +78, -34.25, -205.36, 0.00 +79, -33.78, -183.86, 0.00 +80, -32.84, -162.46, 0.00 +81, -31.37, -141.12, 0.00 +82, -29.30, -119.89, 0.00 +83, -26.60, -98.88, 0.00 +84, -23.17, -78.16, 0.00 +85, -18.94, -57.81, 0.00 +86, -13.77, -37.92, 0.00 +87, -7.52, -18.60, 0.00 +88, -0.02, -0.05, 0.00 +89, 8.93, 17.47, 0.00 +90, 19.56, 33.56, 0.00 +91, 32.17, 47.83, 0.00 +92, 46.93, 59.43, 0.00 +93, 64.05, 67.53, 0.00 +94, 83.40, 70.84, 0.00 +95, 103.82, 67.62, 0.00 +96, 123.49, 56.60, 0.00 +97, 140.08, 37.91, 0.00 +98, 109.25, 14.66, 0.00 +99, 71.57, -0.00, 0.00 +100, 106.90, -14.35, 0.00 +101, 132.12, -35.76, 0.00 +102, 110.67, -50.73, 0.00 +103, 87.56, -57.03, 0.00 +104, 64.93, -55.16, 0.00 +105, 44.35, -46.77, 0.00 +106, 26.67, -33.77, 0.00 +107, 11.84, -17.59, 0.00 +108, -0.51, 0.88, 0.00 +109, -10.69, 20.91, 0.00 +110, -19.06, 42.06, 0.00 +111, -25.85, 63.92, 0.00 +112, -31.37, 86.38, 0.00 +113, -35.77, 109.20, 0.00 +114, -39.24, 132.34, 0.00 +115, -41.89, 155.73, 0.00 +116, -43.81, 179.26, 0.00 +117, -45.11, 202.97, 0.00 +118, -45.82, 226.70, 0.00 +119, -46.00, 250.40, 0.00 +120, -45.73, 274.18, 0.00 +121, -44.98, 297.71, 0.00 +122, -43.85, 321.24, 0.00 +123, -42.34, 344.56, 0.00 +124, -40.45, 367.28, 0.00 +125, -38.27, 389.93, 0.00 +126, -35.82, 412.54, 0.00 +127, -33.10, 434.67, 0.00 +128, -30.13, 456.22, 0.00 +129, -26.93, 477.11, 0.00 +130, -23.55, 497.51, 0.00 +131, -20.01, 517.39, 0.00 +132, -16.33, 536.54, 0.00 +133, -12.55, 555.14, 0.00 +134, -8.67, 572.75, 0.00 +135, -4.73, 589.53, 0.00 +136, -0.75, 605.87, 0.00 +137, 3.25, 621.10, 0.00 +138, 7.24, 635.19, 0.00 +139, 11.20, 648.73, 0.00 +140, 15.12, 661.30, 0.00 +141, 18.97, 672.43, 0.00 +142, 22.74, 682.79, 0.00 +143, 26.41, 692.34, 0.00 +144, 29.96, 700.62, 0.00 +145, 33.38, 707.63, 0.00 +146, 36.67, 713.81, 0.00 +147, 39.81, 718.97, 0.00 +148, 42.78, 722.78, 0.00 +149, 45.57, 725.30, 0.00 +150, 47.98, 723.61, 0.00 +151, 51.05, 733.27, 0.00 +152, 54.58, 749.71, 0.00 +153, 24.36, 321.17, 0.00 +154, 0.10, 1.31, 0.00 +155, 3.44, 42.16, 0.00 +156, 4.87, 57.79, 0.00 +157, 5.10, 58.72, 0.00 +158, 5.46, 61.20, 0.00 +159, 5.65, 61.66, 0.00 +160, 5.66, 60.25, 0.00 +161, 5.52, 57.36, 0.00 +162, 5.26, 53.42, 0.00 +163, 4.86, 48.35, 0.00 +164, 4.38, 42.69, 0.00 +165, 3.80, 36.36, 0.00 +166, 3.17, 29.74, 0.00 +167, 2.46, 22.72, 0.00 +168, 1.73, 15.66, 0.00 +169, 0.95, 8.48, 0.00 +170, 0.16, 1.42, 0.00 +171, -0.64, -5.53, 0.00 +172, -1.44, -12.22, 0.00 +173, -2.22, -18.64, 0.00 +174, -3.00, -24.78, 0.00 +175, -3.74, -30.51, 0.00 +176, -4.46, -35.96, 0.00 +177, -5.15, -40.95, 0.00 +178, -5.80, -45.55, 0.00 +179, -6.40, -49.70, 0.00 +180, -6.95, -53.39, 0.00 +181, -7.45, -56.60, 0.00 +182, -7.89, -59.34, 0.00 +183, -8.26, -61.54, 0.00 +184, -8.58, -63.31, 0.00 +185, -8.82, -64.52, 0.00 +186, -8.98, -65.15, 0.00 +187, -9.05, -65.21, 0.00 +188, -9.04, -64.63, 0.00 +189, -8.94, -63.48, 0.00 +190, -8.73, -61.68, 0.00 +191, -8.42, -59.18, 0.00 +192, -8.00, -55.95, 0.00 +193, -7.46, -51.92, 0.00 +194, -6.81, -47.25, 0.00 +195, -6.01, -41.60, 0.00 +196, -5.09, -35.15, 0.00 +197, -4.02, -27.73, 0.00 +198, -2.84, -19.54, 0.00 diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 9d788dd6e5d5..6285234a676e 100755 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -224,7 +224,7 @@ def main(): poiseuille_profile.cfg_dir = "navierstokes/poiseuille" poiseuille_profile.cfg_file = "profile_poiseuille.cfg" poiseuille_profile.test_iter = 10 - poiseuille_profile.test_vals = [-12.003115, -7.626023, -0.000000, 2.089953] + poiseuille_profile.test_vals = [-12.003110, -7.625808, -0.000000, 2.089953] poiseuille_profile.test_vals_aarch64 = [-12.009012, -7.262299, -0.000000, 2.089953] #last 4 columns test_list.append(poiseuille_profile) @@ -252,7 +252,7 @@ def main(): rae2822_sst.cfg_dir = "rans/rae2822" rae2822_sst.cfg_file = "turb_SST_RAE2822.cfg" rae2822_sst.test_iter = 20 - rae2822_sst.test_vals = [-1.917411, -1.464736, 5.881403, 0.625075, 0.017288, 100.000000] + rae2822_sst.test_vals = [-1.849587, -1.466490, 5.887578, 0.592053, 0.015314, 100.000000] test_list.append(rae2822_sst) # RAE2822 SST_SUST @@ -276,7 +276,7 @@ def main(): turb_wallfunction_flatplate_sst.cfg_dir = "wallfunctions/flatplate/compressible_SST" turb_wallfunction_flatplate_sst.cfg_file = "turb_SST_flatplate.cfg" turb_wallfunction_flatplate_sst.test_iter = 10 - turb_wallfunction_flatplate_sst.test_vals = [-4.036300, -1.916264, -1.821790, 1.443878, -1.579554, 1.521535, 10.000000, -2.351460, 0.030011, 0.002409] + turb_wallfunction_flatplate_sst.test_vals = [-4.021540, -1.941019, -1.835888, 1.458341, -1.581319, 1.513862, 10.000000, -2.562969, 0.029270, 0.002412] test_list.append(turb_wallfunction_flatplate_sst) # FLAT PLATE, ROUGHNESS BC WILCOX2006 SST @@ -284,7 +284,7 @@ def main(): turb_flatplate_sst_roughBCWilcox2006.cfg_dir = "rans/flatplate/roughness/bc_wilcox2006" turb_flatplate_sst_roughBCWilcox2006.cfg_file = "turb_SST_flatplate_roughBCWilcox2006.cfg" turb_flatplate_sst_roughBCWilcox2006.test_iter = 10 - turb_flatplate_sst_roughBCWilcox2006.test_vals = [-5.117900, -2.534224, -2.904279, 0.381710, -3.100346, 1.180161, -0.188797, 0.004029] + turb_flatplate_sst_roughBCWilcox2006.test_vals = [-4.679459, -2.104822, -2.446835, 0.818054, -2.775001, 1.266518, -0.188523, 0.004029] test_list.append(turb_flatplate_sst_roughBCWilcox2006) # FLAT PLATE, WALL FUNCTIONS, COMPRESSIBLE SA @@ -309,7 +309,7 @@ def main(): turb_naca0012_sa.cfg_dir = "rans/naca0012" turb_naca0012_sa.cfg_file = "turb_NACA0012_sa.cfg" turb_naca0012_sa.test_iter = 5 - turb_naca0012_sa.test_vals = [-12.037299, -16.384159, 1.080346, 0.018385, 20.000000, -3.456989, 20.000000, -4.641253, 0.000000] + turb_naca0012_sa.test_vals = [-12.037313, -16.384159, 1.080346, 0.018385, 20.000000, -3.457122, 20.000000, -4.641254, 0.000000] turb_naca0012_sa.test_vals_aarch64 = [-12.037297, -16.384158, 1.080346, 0.018385, 20.000000, -3.455886, 20.000000, -4.641247, 0.000000] turb_naca0012_sa.timeout = 3200 test_list.append(turb_naca0012_sa) @@ -319,7 +319,7 @@ def main(): turb_naca0012_sst.cfg_dir = "rans/naca0012" turb_naca0012_sst.cfg_file = "turb_NACA0012_sst.cfg" turb_naca0012_sst.test_iter = 10 - turb_naca0012_sst.test_vals = [-12.094449, -15.251083, -5.906366, 1.070413, 0.015775, -3.178363, 0.000000] + turb_naca0012_sst.test_vals = [-5.948789, -10.293776, -3.762067, 1.069269, 0.015902, -3.345367, 0.000000] turb_naca0012_sst.test_vals_aarch64 = [-12.076068, -15.246740, -5.861280, 1.070036, 0.015841, -3.297854, 0.000000] turb_naca0012_sst.timeout = 3200 test_list.append(turb_naca0012_sst) @@ -342,7 +342,7 @@ def main(): turb_naca0012_sst_2003m.cfg_dir = "rans/naca0012" turb_naca0012_sst_2003m.cfg_file = "turb_NACA0012_sst_2003m.cfg" turb_naca0012_sst_2003m.test_iter = 10 - turb_naca0012_sst_2003m.test_vals = [-7.129622, -10.410728, -3.699440, 1.061671, 0.019047, -2.435494, 0.000000] + turb_naca0012_sst_2003m.test_vals = [-5.953767, -10.205843, -3.595874, 1.060514, 0.019139, -3.188840, 0.000000] turb_naca0012_sst_2003m.timeout = 3200 test_list.append(turb_naca0012_sst_2003m) @@ -351,7 +351,7 @@ def main(): turb_naca0012_sst_sust_restart.cfg_dir = "rans/naca0012" turb_naca0012_sst_sust_restart.cfg_file = "turb_NACA0012_sst_sust.cfg" turb_naca0012_sst_sust_restart.test_iter = 10 - turb_naca0012_sst_sust_restart.test_vals = [-12.080612, -14.837169, -5.733461, 1.000893, 0.019109, -2.633818] + turb_naca0012_sst_sust_restart.test_vals = [-9.962094, -11.675499, -5.093415, 1.000888, 0.019126, -1.923274] turb_naca0012_sst_sust_restart.test_vals_aarch64 = [-12.074189, -14.836725, -5.732398, 1.000050, 0.019144, -3.315560] turb_naca0012_sst_sust_restart.timeout = 3200 test_list.append(turb_naca0012_sst_sust_restart) @@ -361,7 +361,7 @@ def main(): turb_naca0012_sst_fixedvalues.cfg_dir = "rans/naca0012" turb_naca0012_sst_fixedvalues.cfg_file = "turb_NACA0012_sst_fixedvalues.cfg" turb_naca0012_sst_fixedvalues.test_iter = 10 - turb_naca0012_sst_fixedvalues.test_vals = [-5.206618, -10.436758, 0.774095, 1.021995, 0.040553, -3.477597] + turb_naca0012_sst_fixedvalues.test_vals = [-5.206619, -10.436774, 0.774095, 1.021995, 0.040553, -3.477596] turb_naca0012_sst_fixedvalues.timeout = 3200 test_list.append(turb_naca0012_sst_fixedvalues) @@ -383,17 +383,25 @@ def main(): axi_rans_air_nozzle_restart.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_restart.cfg_file = "air_nozzle_restart.cfg" axi_rans_air_nozzle_restart.test_iter = 10 - axi_rans_air_nozzle_restart.test_vals = [-5.135423, 0.436257, -2.874139, 1.664112, 0.000000] + axi_rans_air_nozzle_restart.test_vals = [-5.118766, 0.457805, -1.643100, 2.889958, 0.000000] axi_rans_air_nozzle_restart.test_vals_aarch64 = [-14.143715, -9.170705, -10.848554, -5.776746, 0.000000] axi_rans_air_nozzle_restart.tol = 0.0001 test_list.append(axi_rans_air_nozzle_restart) + # Riemann DENSITY_VELOCITY inlet with SST: k of the node in the energy of the boundary state + axi_rans_air_nozzle_density_velocity = TestCase('axi_rans_air_nozzle_density_velocity') + axi_rans_air_nozzle_density_velocity.cfg_dir = "axisymmetric_rans/air_nozzle" + axi_rans_air_nozzle_density_velocity.cfg_file = "air_nozzle_density_velocity.cfg" + axi_rans_air_nozzle_density_velocity.test_iter = 10 + axi_rans_air_nozzle_density_velocity.test_vals = [-1.879849, 4.023872, 0.501157, 4.419530, 704.80, 704.80] + test_list.append(axi_rans_air_nozzle_density_velocity) + # Axisymmetric air nozzle species axi_rans_air_nozzle_species = TestCase('axi_rans_air_nozzle_species') axi_rans_air_nozzle_species.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_species.cfg_file = "air_nozzle_species.cfg" axi_rans_air_nozzle_species.test_iter = 10 - axi_rans_air_nozzle_species.test_vals = [-2.243059, 3.273177, -1.947544, 5.883852, -2.469401, 0.000000] + axi_rans_air_nozzle_species.test_vals = [-2.148943, 3.342084, -1.939303, 5.883410, -2.443272, 0.000000] axi_rans_air_nozzle_species.tol = 0.0001 test_list.append(axi_rans_air_nozzle_species) @@ -407,7 +415,7 @@ def main(): turb_naca0012_sst_restart_mg.cfg_file = "turb_NACA0012_sst_multigrid_restart.cfg" turb_naca0012_sst_restart_mg.test_iter = 50 turb_naca0012_sst_restart_mg.ntest_vals = 5 - turb_naca0012_sst_restart_mg.test_vals = [-6.570974, -5.081421, 0.810883, -0.008830, 0.077967] + turb_naca0012_sst_restart_mg.test_vals = [-3.649967, -5.081630, 0.810585, -0.009208, 0.078506] turb_naca0012_sst_restart_mg.timeout = 3200 turb_naca0012_sst_restart_mg.tol = 0.000001 test_list.append(turb_naca0012_sst_restart_mg) @@ -760,7 +768,7 @@ def main(): turb_naca0012_1c.cfg_dir = "rans_uq/naca0012" turb_naca0012_1c.cfg_file = "turb_NACA0012_uq_1c.cfg" turb_naca0012_1c.test_iter = 10 - turb_naca0012_1c.test_vals = [-4.981181, 1.343583, 0.597111, 0.017244] + turb_naca0012_1c.test_vals = [-4.964306, 1.346025, 0.604256, 0.019699] turb_naca0012_1c.test_vals_aarch64 = [-4.992791, 1.342873, 0.557941, 0.003269] test_list.append(turb_naca0012_1c) @@ -769,7 +777,7 @@ def main(): turb_naca0012_2c.cfg_dir = "rans_uq/naca0012" turb_naca0012_2c.cfg_file = "turb_NACA0012_uq_2c.cfg" turb_naca0012_2c.test_iter = 10 - turb_naca0012_2c.test_vals = [-5.482907, 1.262063, 0.459671, -0.026410] + turb_naca0012_2c.test_vals = [-5.482904, 1.261984, 0.464231, -0.024984] test_list.append(turb_naca0012_2c) # NACA0012 3c @@ -777,7 +785,7 @@ def main(): turb_naca0012_3c.cfg_dir = "rans_uq/naca0012" turb_naca0012_3c.cfg_file = "turb_NACA0012_uq_3c.cfg" turb_naca0012_3c.test_iter = 10 - turb_naca0012_3c.test_vals = [-5.583768, 1.229824, 0.426258, -0.033150] + turb_naca0012_3c.test_vals = [-5.583772, 1.229781, 0.426469, -0.033207] test_list.append(turb_naca0012_3c) # NACA0012 p1c1 @@ -785,7 +793,7 @@ def main(): turb_naca0012_p1c1.cfg_dir = "rans_uq/naca0012" turb_naca0012_p1c1.cfg_file = "turb_NACA0012_uq_p1c1.cfg" turb_naca0012_p1c1.test_iter = 10 - turb_naca0012_p1c1.test_vals = [-5.127701, 1.284875, 0.779301, 0.086111] + turb_naca0012_p1c1.test_vals = [-5.163575, 1.280570, 0.794472, 0.091341] turb_naca0012_p1c1.test_vals_aarch64 = [-5.119942, 1.283920, 0.486264, -0.021518] test_list.append(turb_naca0012_p1c1) @@ -794,7 +802,7 @@ def main(): turb_naca0012_p1c2.cfg_dir = "rans_uq/naca0012" turb_naca0012_p1c2.cfg_file = "turb_NACA0012_uq_p1c2.cfg" turb_naca0012_p1c2.test_iter = 10 - turb_naca0012_p1c2.test_vals = [-5.553987, 1.235071, 0.521197, -0.004487] + turb_naca0012_p1c2.test_vals = [-5.553130, 1.235035, 0.577646, 0.018241] test_list.append(turb_naca0012_p1c2) ###################################### @@ -806,7 +814,7 @@ def main(): harmonic_balance.cfg_dir = "harmonic_balance" harmonic_balance.cfg_file = "HB.cfg" harmonic_balance.test_iter = 25 - harmonic_balance.test_vals = [-1.559187, 0.829575, 0.931512, 3.954440] + harmonic_balance.test_vals = [-1.556449, 0.840517, 0.943602, 3.957291] test_list.append(harmonic_balance) # Turbulent pitching NACA 64a010 airfoil @@ -826,7 +834,7 @@ def main(): rot_naca0012.cfg_dir = "rotating/naca0012" rot_naca0012.cfg_file = "rot_NACA0012.cfg" rot_naca0012.test_iter = 25 - rot_naca0012.test_vals = [-1.240352, 4.268727, -0.022164, 0.083891, 2.000000, -1.253214] + rot_naca0012.test_vals = [-1.281757, 4.222928, -0.027656, 0.059256, 2.000000, -1.218300] test_list.append(rot_naca0012) # Lid-driven cavity @@ -854,7 +862,7 @@ def main(): square_cylinder.cfg_dir = "unsteady/square_cylinder" square_cylinder.cfg_file = "turb_square.cfg" square_cylinder.test_iter = 3 - square_cylinder.test_vals = [-2.560678, -1.175979, 0.062202, 1.399351, 2.219234, 1.399297, 2.217479, 0.000000] + square_cylinder.test_vals = [-2.560698, -1.175954, 0.062130, 1.399399, 2.220367, 1.399347, 2.218605, 0.000000] square_cylinder.unsteady = True test_list.append(square_cylinder) @@ -863,7 +871,7 @@ def main(): sine_gust.cfg_dir = "gust" sine_gust.cfg_file = "inv_gust_NACA0012.cfg" sine_gust.test_iter = 5 - sine_gust.test_vals = [-1.977498, 3.481817, -0.010871, -0.005083] + sine_gust.test_vals = [-1.977498, 3.481833, -0.012952, -0.003623] sine_gust.unsteady = True test_list.append(sine_gust) @@ -872,7 +880,7 @@ def main(): aeroelastic.cfg_dir = "aeroelastic" aeroelastic.cfg_file = "aeroelastic_NACA64A010.cfg" aeroelastic.test_iter = 2 - aeroelastic.test_vals = [-1.876632, 4.021072, 0.080240, 0.027935, -0.001641, -0.000127, -1.133898] + aeroelastic.test_vals = [-1.876630, 4.021083, 0.082484, 0.026820, -0.001638, -0.000129, -1.081133] aeroelastic.unsteady = True test_list.append(aeroelastic) @@ -890,7 +898,7 @@ def main(): unst_inc_turb_naca0015_sa.cfg_dir = "unsteady/pitching_naca0015_rans_inc" unst_inc_turb_naca0015_sa.cfg_file = "config_incomp_turb_sa.cfg" unst_inc_turb_naca0015_sa.test_iter = 1 - unst_inc_turb_naca0015_sa.test_vals = [-3.007635, -6.879816, 1.445300, 0.419281] + unst_inc_turb_naca0015_sa.test_vals = [-3.005435, -6.878657, 1.445291, 0.420526] unst_inc_turb_naca0015_sa.unsteady = True test_list.append(unst_inc_turb_naca0015_sa) # unsteady pitching NACA64A010, RANS, SA @@ -906,7 +914,7 @@ def main(): unst_pitching_naca64a010_euler.cfg_dir = "unsteady/pitching_naca64a010_euler" unst_pitching_naca64a010_euler.cfg_file = "pitching_NACA64A010.cfg" unst_pitching_naca64a010_euler.test_iter = 2 - unst_pitching_naca64a010_euler.test_vals = [-1.186839, 4.280301, -0.039724, 0.000927] + unst_pitching_naca64a010_euler.test_vals = [-1.186839, 4.280671, -0.026619, 0.000937] unst_pitching_naca64a010_euler.unsteady = True test_list.append(unst_pitching_naca64a010_euler) # unsteady plunging NACA0012, Laminar NS @@ -923,7 +931,7 @@ def main(): unst_deforming_naca0012.cfg_dir = "disc_adj_euler/naca0012_pitching_def" unst_deforming_naca0012.cfg_file = "inv_NACA0012_pitching_deform.cfg" unst_deforming_naca0012.test_iter = 5 - unst_deforming_naca0012.test_vals = [-3.667005, -3.796733, -3.719112, -3.150401] + unst_deforming_naca0012.test_vals = [-3.666074, -3.794974, -3.717659, -3.149285] unst_deforming_naca0012.unsteady = True test_list.append(unst_deforming_naca0012) @@ -974,7 +982,7 @@ def main(): Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg" Jones_tc_restart.test_iter = 5 - Jones_tc_restart.test_vals = [-11.905629, -12.211684, -19.212618, -13.507994, -19.069281, -13.439288, 73286.000000, 73286.000000, 0.020056, 82.286000] + Jones_tc_restart.test_vals = [-0.170799, -0.162039, -8.236404, -2.533076, -7.364785, -1.876219, 73290.000000, 73290.000000, 0.020065, 82.291000] test_list.append(Jones_tc_restart) # 2D axial stage @@ -982,7 +990,7 @@ def main(): axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D" axial_stage2D.cfg_file = "Axial_stage2D.cfg" axial_stage2D.test_iter = 20 - axial_stage2D.test_vals = [1.167521, 1.598536, -2.928575, 2.573646, -2.527330, 3.016253, 106370.000000, 106370.000000, 5.726800, 64.383000] + axial_stage2D.test_vals = [1.166038, 1.598537, -2.928565, 2.573650, -2.527330, 3.016254, 106370.000000, 106370.000000, 5.726800, 64.395000] test_list.append(axial_stage2D) # 2D transonic stator restart @@ -990,7 +998,7 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-4.367784, -2.492912, -2.082414, 1.727491, -1.466974, 3.224730, -471620.000000, 94.839000, -0.052082] + transonic_stator_restart.test_vals = [-4.363858, -2.489999, -2.081340, 1.730232, -1.467013, 3.223220, -471620.000000, 94.839000, -0.100140] transonic_stator_restart.test_vals_aarch64 = [-4.367784, -2.492912, -2.082414, 1.727491, -1.466974, 3.224730, -471620.000000, 94.839000, -0.052082] test_list.append(transonic_stator_restart) @@ -1020,7 +1028,7 @@ def main(): uniform_flow.cfg_dir = "sliding_interface/uniform_flow" uniform_flow.cfg_file = "uniform_NN.cfg" uniform_flow.test_iter = 2 - uniform_flow.test_vals = [2.000000, 0.000000, -0.230639, -13.250208] + uniform_flow.test_vals = [2.000000, 0.000000, -0.230680, -13.248947] uniform_flow.test_vals_aarch64 = [2.000000, 0.000000, -0.230641, -13.249000] uniform_flow.tol = 0.000001 uniform_flow.unsteady = True @@ -1041,7 +1049,7 @@ def main(): channel_2D.cfg_dir = "sliding_interface/channel_2D" channel_2D.cfg_file = "channel_2D_WA.cfg" channel_2D.test_iter = 2 - channel_2D.test_vals = [2.000000, 0.000000, 0.466389, 0.346857, 0.397472] + channel_2D.test_vals = [2.000000, 0.000000, 0.399122, 0.350309, 0.405616] channel_2D.timeout = 100 channel_2D.unsteady = True channel_2D.multizone = True @@ -1064,7 +1072,7 @@ def main(): pipe.cfg_dir = "sliding_interface/pipe" pipe.cfg_file = "pipe_NN.cfg" pipe.test_iter = 2 - pipe.test_vals = [0.528897, 0.684175, 0.970353, 1.065262] + pipe.test_vals = [0.452310, 0.562852, 0.974610, 1.031075] pipe.unsteady = True pipe.multizone = True test_list.append(pipe) @@ -1074,7 +1082,7 @@ def main(): rotating_cylinders.cfg_dir = "sliding_interface/rotating_cylinders" rotating_cylinders.cfg_file = "rot_cylinders_WA.cfg" rotating_cylinders.test_iter = 3 - rotating_cylinders.test_vals = [3.000000, 0.000000, 0.686432, 1.159461, 1.151134] + rotating_cylinders.test_vals = [3.000000, 0.000000, 0.686419, 1.152594, 1.145895] rotating_cylinders.unsteady = True rotating_cylinders.multizone = True test_list.append(rotating_cylinders) @@ -1084,7 +1092,7 @@ def main(): supersonic_vortex_shedding.cfg_dir = "sliding_interface/supersonic_vortex_shedding" supersonic_vortex_shedding.cfg_file = "sup_vor_shed_WA.cfg" supersonic_vortex_shedding.test_iter = 5 - supersonic_vortex_shedding.test_vals = [5.000000, 0.000000, 1.126036, 1.081775] + supersonic_vortex_shedding.test_vals = [5.000000, 0.000000, 1.128138, 1.064261] supersonic_vortex_shedding.unsteady = True supersonic_vortex_shedding.multizone = True test_list.append(supersonic_vortex_shedding) @@ -1094,7 +1102,7 @@ def main(): bars_SST_2D.cfg_dir = "sliding_interface/bars_SST_2D" bars_SST_2D.cfg_file = "bars.cfg" bars_SST_2D.test_iter = 13 - bars_SST_2D.test_vals = [13.000000, -0.462697, -1.541051] + bars_SST_2D.test_vals = [13.000000, -0.456166, -1.540955] bars_SST_2D.multizone = True test_list.append(bars_SST_2D) @@ -1162,7 +1170,7 @@ def main(): fsi2d.cfg_dir = "fea_fsi/WallChannel_2d" fsi2d.cfg_file = "configFSI.cfg" fsi2d.test_iter = 4 - fsi2d.test_vals = [4, 0, -3.726015, -4.277528] + fsi2d.test_vals = [4.000000, 0.000000, -3.725521, -4.278759] fsi2d.multizone = True fsi2d.unsteady = True test_list.append(fsi2d) @@ -1172,7 +1180,7 @@ def main(): fsi_cht.cfg_dir = "fea_fsi/stat_fsi" fsi_cht.cfg_file = "config.cfg" fsi_cht.test_iter = 20 - fsi_cht.test_vals = [5.000000, -5.076997, -5.379435, -9.247798, -9.319892, -9.185018, 608.350000, -0.012973, 0.000000, 30.000000] + fsi_cht.test_vals = [5.000000, -5.077011, -5.379457, -9.247803, -9.320382, -9.185192, 608.350000, -0.012973, 0.000000, 29.000000] fsi_cht.multizone = True test_list.append(fsi_cht) @@ -1181,7 +1189,7 @@ def main(): dyn_fsi.cfg_dir = "fea_fsi/dyn_fsi" dyn_fsi.cfg_file = "config.cfg" dyn_fsi.test_iter = 4 - dyn_fsi.test_vals = [-4.330728, -4.152820, 0.000000, 85.000000] + dyn_fsi.test_vals = [-4.328792, -4.153004, 0.000000, 85.000000] dyn_fsi.multizone = True dyn_fsi.unsteady = True test_list.append(dyn_fsi) @@ -1696,7 +1704,7 @@ def main(): pywrapper_turb_naca0012_sst.cfg_dir = "rans/naca0012" pywrapper_turb_naca0012_sst.cfg_file = "turb_NACA0012_sst.cfg" pywrapper_turb_naca0012_sst.test_iter = 10 - pywrapper_turb_naca0012_sst.test_vals = [-12.094449, -15.251083, -5.906366, 1.070413, 0.015775, -3.178363, 0.000000] + pywrapper_turb_naca0012_sst.test_vals = [-5.948789, -10.293776, -3.762067, 1.069269, 0.015902, -3.345367, 0.000000] pywrapper_turb_naca0012_sst.test_vals_aarch64 = [-12.076068, -15.246740, -5.861280, 1.070036, 0.015841, -3.297854, 0.000000] pywrapper_turb_naca0012_sst.command = TestCase.Command(exec = "SU2_CFD.py", param = "-f") pywrapper_turb_naca0012_sst.timeout = 3200 @@ -1710,7 +1718,7 @@ def main(): pywrapper_square_cylinder.cfg_dir = "unsteady/square_cylinder" pywrapper_square_cylinder.cfg_file = "turb_square.cfg" pywrapper_square_cylinder.test_iter = 3 - pywrapper_square_cylinder.test_vals = [-2.560678, -1.175979, 0.062202, 1.399351, 2.219234, 1.399297, 2.217479, 0.000000] + pywrapper_square_cylinder.test_vals = [-2.560698, -1.175954, 0.062130, 1.399399, 2.220367, 1.399347, 2.218605, 0.000000] pywrapper_square_cylinder.command = TestCase.Command(exec = "SU2_CFD.py", param = "-f") pywrapper_square_cylinder.timeout = 1600 pywrapper_square_cylinder.tol = 0.00001 @@ -1724,7 +1732,7 @@ def main(): pywrapper_fsi2d.cfg_dir = "fea_fsi/WallChannel_2d" pywrapper_fsi2d.cfg_file = "configFSI.cfg" pywrapper_fsi2d.test_iter = 4 - pywrapper_fsi2d.test_vals = [4, 0, -3.726015, -4.277528] + pywrapper_fsi2d.test_vals = [4.000000, 0.000000, -3.725521, -4.278759] pywrapper_fsi2d.command = TestCase.Command(exec = "SU2_CFD.py", param = "--nZone 2 --fsi True -f") pywrapper_fsi2d.unsteady = True pywrapper_fsi2d.multizone = True diff --git a/TestCases/serial_regression_AD.py b/TestCases/serial_regression_AD.py index 295d2b9f3260..37340ab6ab70 100644 --- a/TestCases/serial_regression_AD.py +++ b/TestCases/serial_regression_AD.py @@ -96,7 +96,7 @@ def main(): discadj_rans_naca0012_sst.cfg_dir = "disc_adj_rans/naca0012" discadj_rans_naca0012_sst.cfg_file = "turb_NACA0012_sst.cfg" discadj_rans_naca0012_sst.test_iter = 10 - discadj_rans_naca0012_sst.test_vals = [-2.096075, -0.181237, 0.350380, -0.023435] + discadj_rans_naca0012_sst.test_vals = [-2.096038, -0.178557, 0.351620, -0.023443] test_list.append(discadj_rans_naca0012_sst) ####################################### @@ -158,7 +158,7 @@ def main(): discadj_pitchingNACA0012.cfg_dir = "disc_adj_euler/naca0012_pitching" discadj_pitchingNACA0012.cfg_file = "inv_NACA0012_pitching.cfg" discadj_pitchingNACA0012.test_iter = 4 - discadj_pitchingNACA0012.test_vals = [-1.057526, -1.512609, -0.004842, 0.000013] + discadj_pitchingNACA0012.test_vals = [-1.138369, -1.575068, -0.005301, 0.000003] discadj_pitchingNACA0012.unsteady = True test_list.append(discadj_pitchingNACA0012) @@ -167,7 +167,7 @@ def main(): unst_deforming_naca0012.cfg_dir = "disc_adj_euler/naca0012_pitching_def" unst_deforming_naca0012.cfg_file = "inv_NACA0012_pitching_deform_ad.cfg" unst_deforming_naca0012.test_iter = 4 - unst_deforming_naca0012.test_vals = [-1.874283, -1.768562, 4274.000000, 0.000003] + unst_deforming_naca0012.test_vals = [-1.875062, -1.766683, 4307.900000, 0.000003] unst_deforming_naca0012.unsteady = True test_list.append(unst_deforming_naca0012) @@ -200,7 +200,7 @@ def main(): discadj_trans_stator.cfg_dir = "disc_adj_turbomachinery/transonic_stator_2D" discadj_trans_stator.cfg_file = "transonic_stator.cfg" discadj_trans_stator.test_iter = 79 - discadj_trans_stator.test_vals = [79.000000, -7.308168, -9.891121, -10.038669, -13.368502] + discadj_trans_stator.test_vals = [79.000000, -7.306692, -9.889618, -10.037399, -13.367132] discadj_trans_stator.test_vals_aarch64 = [79.000000, -7.308167, -9.891117, -10.038669, -13.368501] test_list.append(discadj_trans_stator) @@ -209,7 +209,7 @@ def main(): discadj_axial_stage.cfg_dir = "disc_adj_turbomachinery/axial_stage_2D" discadj_axial_stage.cfg_file = "Axial_stage2D.cfg" discadj_axial_stage.test_iter = 79 - discadj_axial_stage.test_vals = [79.000000, -6.605593, -7.138207] + discadj_axial_stage.test_vals = [79.000000, -6.604508, -7.178602] discadj_axial_stage.test_vals_aarch64 = [79.000000, -6.605593, -7.138207] test_list.append(discadj_axial_stage) diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index 2f0031ada178..cae27d8bfd48 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -314,7 +314,7 @@ def main(): tutorial_unst_naca0012.cfg_dir = "../Tutorials/compressible_flow/Unsteady_NACA0012" tutorial_unst_naca0012.cfg_file = "unsteady_naca0012.cfg" tutorial_unst_naca0012.test_iter = 520 - tutorial_unst_naca0012.test_vals = [520.000000, 0.000000, -5.292091, 0.000000, 0.312095, 0.781939, 0.001784, 0.010509] + tutorial_unst_naca0012.test_vals = [520.000000, 0.000000, -5.299254, 0.000000, 0.306206, 0.779691, 0.003296, 0.016165] tutorial_unst_naca0012.test_vals_aarch64 = [520, 0, -5.292359, 0, 0.284720, 0.766329, 0.000954, 0.007565] tutorial_unst_naca0012.unsteady = True test_list.append(tutorial_unst_naca0012) diff --git a/TestCases/vandv.py b/TestCases/vandv.py index af7763a7c6a6..a704ba2afb49 100644 --- a/TestCases/vandv.py +++ b/TestCases/vandv.py @@ -63,7 +63,7 @@ def main(): flatplate_sst1994m.cfg_dir = "vandv/rans/flatplate" flatplate_sst1994m.cfg_file = "turb_flatplate_sst.cfg" flatplate_sst1994m.test_iter = 5 - flatplate_sst1994m.test_vals = [-13.041030, -10.136996, -10.941711, -7.986212, -10.323862, -4.732531, 0.002801] + flatplate_sst1994m.test_vals = [-5.418449, -3.351150, -2.912790, 0.065870, -2.985271, 1.227315, 0.002802] flatplate_sst1994m.test_vals_aarch64 = [-13.021715, -9.534786, -10.401912, -7.501836, -9.750800, -4.850665, 0.002807] test_list.append(flatplate_sst1994m) @@ -72,7 +72,7 @@ def main(): bump_sst1994m.cfg_dir = "vandv/rans/bump_in_channel" bump_sst1994m.cfg_file = "turb_bump_sst.cfg" bump_sst1994m.test_iter = 5 - bump_sst1994m.test_vals = [-11.928276, -10.095787, -9.512963, -6.445637, -11.774253, -6.985525, 0.004931] + bump_sst1994m.test_vals = [-6.497322, -4.234388, -3.813607, -1.011693, -4.012643, 0.181789, 0.004933] bump_sst1994m.test_vals_aarch64 = [-13.042689, -10.812982, -10.604523, -7.655547, -10.816257, -5.308083, 0.004911] test_list.append(bump_sst1994m) @@ -91,7 +91,7 @@ def main(): swbli_sst.cfg_dir = "vandv/rans/swbli" swbli_sst.cfg_file = "config_sst.cfg" swbli_sst.test_iter = 5 - swbli_sst.test_vals = [-11.569218, -10.909086, -11.607984, -10.431163, -11.407588, -2.637660, 0.001816, -1.305818, -3.514590, 13.399000] + swbli_sst.test_vals = [-6.628941, -5.974370, -6.441345, -5.452139, -7.663134, 0.071743, 0.001815, -1.199316, -3.785242, 13.399000] test_list.append(swbli_sst) # DSMA661 - SA @@ -99,7 +99,7 @@ def main(): dsma661_sa.cfg_dir = "vandv/rans/dsma661" dsma661_sa.cfg_file = "dsma661_sa_config.cfg" dsma661_sa.test_iter = 5 - dsma661_sa.test_vals = [-11.255401, -8.243277, -9.037333, -5.927120, -10.737675, 0.155687, 0.024232] + dsma661_sa.test_vals = [-11.247085, -8.242815, -8.952043, -5.904549, -10.737668, 0.155687, 0.024232] dsma661_sa.test_vals_aarch64 = [-11.293183, -8.241775, -9.083761, -6.011398, -10.737680, 0.155687, 0.024232] test_list.append(dsma661_sa) @@ -108,7 +108,7 @@ def main(): dsma661_sst.cfg_dir = "vandv/rans/dsma661" dsma661_sst.cfg_file = "dsma661_sst_config.cfg" dsma661_sst.test_iter = 5 - dsma661_sst.test_vals = [-11.025513, -8.156985, -9.056477, -5.949486, -10.650930, -7.888614, 0.155882, 0.023344] + dsma661_sst.test_vals = [-2.616671, 0.009492, -0.244740, 2.840296, -2.180395, 1.413352, 0.156029, 0.023339] dsma661_sst.test_vals_aarch64 = [-10.977195, -8.403731, -8.747068, -5.808899, -10.522786, -7.369851, 0.155875, 0.023353] test_list.append(dsma661_sst) diff --git a/UnitTests/Common/CConfig_tests.cpp b/UnitTests/Common/CConfig_tests.cpp index 0e57b7a1bab8..a39454f2a571 100644 --- a/UnitTests/Common/CConfig_tests.cpp +++ b/UnitTests/Common/CConfig_tests.cpp @@ -88,6 +88,20 @@ TEST_CASE("INIT_OPTION_INC defaults", "[Config]") { CHECK(GetInitOptionInc(ideal_gas_options + "INIT_OPTION_INC= DENSITY_INIT\n") == INIT_OPTION_INC::DENSITY_INIT); } +TEST_CASE("Supported multigrid levels are retained", "[Config][MultigridLimits]") { + for (const auto levels : {0, 10}) { + std::stringstream options(base_options + "MGLEVEL= " + std::to_string(levels) + "\n"); + CConfig config(options, SU2_COMPONENT::SU2_CFD, false); + CHECK(config.GetnMGLevels() == levels); + } +} + +TEST_CASE("Excessive multigrid levels are rejected", "[.MultigridLimitError]") { + std::stringstream options(base_options + "MGLEVEL= 11\n"); + CConfig config(options, SU2_COMPONENT::SU2_CFD, false); + FAIL("An unsupported multigrid hierarchy was accepted."); +} + TEST_CASE("HLLC and AUSM SLAU Jacobian options are independent", "[Config][HLLCOptions]") { for (const auto accurate : {false, true}) { for (const auto exactHLLC : {false, true}) { diff --git a/UnitTests/Common/check_multigrid_limits.py b/UnitTests/Common/check_multigrid_limits.py new file mode 100644 index 000000000000..5070fdaed3cc --- /dev/null +++ b/UnitTests/Common/check_multigrid_limits.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +"""Check the fatal configuration diagnostic in its own process.""" +import subprocess +import sys + +result = subprocess.run( + [sys.argv[1], "[.MultigridLimitError]"], capture_output=True, text=True, timeout=30 +) +expected = "MGLEVEL must be between 0 and 10" +if result.returncode == 0 or expected not in result.stdout + result.stderr: + raise RuntimeError( + "Unsupported MGLEVEL did not fail with its diagnostic:\n" + + result.stdout + + result.stderr + ) +print("PASS: MGLEVEL=11 is rejected with its supported range") diff --git a/UnitTests/SU2_CFD/numerics/ausm_tke_tests.cpp b/UnitTests/SU2_CFD/numerics/ausm_tke_tests.cpp new file mode 100644 index 000000000000..1a8decc8a0a0 --- /dev/null +++ b/UnitTests/SU2_CFD/numerics/ausm_tke_tests.cpp @@ -0,0 +1,173 @@ +/*! + * \file ausm_tke_tests.cpp + * \brief SLAU, SLAU2 and AUSM with the turbulent kinetic energy of SST in the total energy. + * \version 8.5.0 "Harrier" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "catch.hpp" +#include +#include +#include +#include +#include +#include "../../../SU2_CFD/include/numerics/flow/convection/ausm_slau.hpp" +#include "../../../SU2_CFD/include/numerics/flow/convection/fvs.hpp" + +namespace { + +constexpr su2double gamma = 1.4; + +std::unique_ptr MakeConfig(bool implicit = false) { + std::stringstream options; + options << "SOLVER= EULER\nCONV_NUM_METHOD_FLOW= SLAU\nMACH_NUMBER= 0.5\n"; + options << "TIME_DISCRE_FLOW= " + << (implicit ? "EULER_IMPLICIT\nUSE_ACCURATE_FLUX_JACOBIANS= YES\n" : "EULER_EXPLICIT\n"); + return std::make_unique(options, SU2_COMPONENT::SU2_CFD, false); +} + +/*--- Primitive variables (T, u, v, [w], p, rho, h, c) of an ideal gas whose total energy contains k. ---*/ +void Primitives(unsigned short nDim, su2double rho, const su2double* vel, su2double p, su2double k, su2double* V) { + su2double q2 = 0.0; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + V[iDim + 1] = vel[iDim]; + q2 += vel[iDim] * vel[iDim]; + } + V[0] = p / (rho * 287.058); + V[nDim + 1] = p; + V[nDim + 2] = rho; + V[nDim + 3] = gamma / (gamma - 1) * p / rho + 0.5 * q2 + k; + V[nDim + 4] = sqrt(gamma * p / rho); +} + +/*--- k changes neither the pressure nor the speed of sound: with the same density, velocity and pressure, the mass + and momentum fluxes must not depend on k, and the energy flux changes only by the advected k. ---*/ +void CheckTkeIndependence(CNumerics& numerics, const CConfig* config, unsigned short nDim, bool uniformTke = false) { + const su2double vel_i[3] = {0.8, 0.1, -0.05}, vel_j[3] = {0.6, -0.1, 0.05}, n[3] = {2.0 / 7, 3.0 / 7, 6.0 / 7}; + const su2double n2[2] = {0.6, 0.8}; + su2double Vi[10] = {0.0}, Vj[10] = {0.0}; + numerics.SetNormal(nDim == 2 ? n2 : n); + + su2double flux[2][5] = {{0.0}}; + /*--- MSW mixes the two states, so k must be uniform for the fluxes to be independent of it. ---*/ + const su2double k_i[2] = {0.0, 0.3}, k_j[2] = {0.0, uniformTke ? 0.3 : 0.2}; + for (int c = 0; c < 2; c++) { + Primitives(nDim, 1.2, vel_i, 1.1, k_i[c], Vi); + Primitives(nDim, 0.9, vel_j, 0.8, k_j[c], Vj); + numerics.SetPrimitive(Vi, Vj); + numerics.SetTurbKineticEnergy(k_i[c], k_j[c]); + const auto res = numerics.ComputeResidual(config); + for (unsigned short iVar = 0; iVar < nDim + 2; iVar++) flux[c][iVar] = res.residual[iVar]; + } + CAPTURE(nDim); + for (unsigned short iVar = 0; iVar < nDim + 1; iVar++) CHECK(flux[1][iVar] == Approx(flux[0][iVar]).epsilon(1e-12)); + /*--- Energy: the extra flux is the mass flux times the upwind k (the flow is from i to j here). ---*/ + CHECK(flux[1][nDim + 1] - flux[0][nDim + 1] == Approx(flux[0][0] * k_i[1]).epsilon(1e-10)); +} + +/*--- Largest difference between the (accurate) Jacobians and central differences of the flux with respect to the + conservative variables, k held fixed, relative to the largest entry. ---*/ +su2double JacobianError(CNumerics& numerics, const CConfig* config, su2double k) { + constexpr unsigned short nDim = 2, nVar = 4; + using State = std::array; + const su2double normal[2] = {0.6, 0.8}; + numerics.SetNormal(normal); + auto evaluate = [&](const State& Ui, const State& Uj, su2double* flux, su2double(*jac_i)[nVar], + su2double(*jac_j)[nVar]) { + su2double Vi[10] = {0.0}, Vj[10] = {0.0}; + for (int side = 0; side < 2; side++) { + const State& U = side ? Uj : Ui; + const su2double vel[2] = {U[1] / U[0], U[2] / U[0]}; + const su2double p = (gamma - 1) * (U[3] - 0.5 * (U[1] * U[1] + U[2] * U[2]) / U[0] - U[0] * k); + Primitives(nDim, U[0], vel, p, k, side ? Vj : Vi); + } + numerics.SetPrimitive(Vi, Vj); + numerics.SetTurbKineticEnergy(k, k); + const auto res = numerics.ComputeResidual(config); + for (unsigned short iVar = 0; iVar < nVar; iVar++) { + flux[iVar] = res.residual[iVar]; + if (jac_i) + for (unsigned short jVar = 0; jVar < nVar; jVar++) { + jac_i[iVar][jVar] = res.jacobian_i[iVar][jVar]; + jac_j[iVar][jVar] = res.jacobian_j[iVar][jVar]; + } + } + }; + const State Ui = {1.2, 0.72, 0.24, 1.1 / (gamma - 1) + 0.5 * (0.72 * 0.72 + 0.24 * 0.24) / 1.2 + 1.2 * k}; + const State Uj = {0.9, 0.36, -0.18, 0.8 / (gamma - 1) + 0.5 * (0.36 * 0.36 + 0.18 * 0.18) / 0.9 + 0.9 * k}; + su2double flux[nVar], jac_i[nVar][nVar], jac_j[nVar][nVar]; + evaluate(Ui, Uj, flux, jac_i, jac_j); + su2double maxErr = 0.0, maxJac = 0.0; + for (int side = 0; side < 2; side++) { + for (unsigned short jVar = 0; jVar < nVar; jVar++) { + State Up = side ? Uj : Ui, Um = Up; + const su2double h = 1e-6; + Up[jVar] += h; + Um[jVar] -= h; + su2double fp[nVar], fm[nVar]; + if (side) { + evaluate(Ui, Up, fp, nullptr, nullptr); + evaluate(Ui, Um, fm, nullptr, nullptr); + } else { + evaluate(Up, Uj, fp, nullptr, nullptr); + evaluate(Um, Uj, fm, nullptr, nullptr); + } + for (unsigned short iVar = 0; iVar < nVar; iVar++) { + const su2double jac = side ? jac_j[iVar][jVar] : jac_i[iVar][jVar]; + maxErr = std::max(maxErr, std::abs(jac - (fp[iVar] - fm[iVar]) / (2 * h))); + maxJac = std::max(maxJac, std::abs(jac)); + } + } + } + return maxErr / maxJac; +} + +} // namespace + +TEST_CASE("Accurate SLAU and AUSM+up Jacobians hold k fixed", "[AUSM][SST]") { + auto config = MakeConfig(true); + for (const su2double k : {0.0, 0.2}) { + CAPTURE(k); + CUpwSLAU_Flow slau(2, 4, config.get(), false); + CHECK(JacobianError(slau, config.get(), k) < 1e-4); + CUpwAUSMPLUSUP_Flow ausmup(2, 4, config.get()); + CHECK(JacobianError(ausmup, config.get(), k) < 1e-4); + } +} + +TEST_CASE("SLAU, SLAU2, AUSM, AUSM+up, AUSM+up2 and MSW do not use k in the speed of sound", "[AUSM][SST]") { + auto config = MakeConfig(); + for (const unsigned short nDim : {2, 3}) { + CUpwSLAU_Flow slau(nDim, nDim + 2, config.get(), false); + CheckTkeIndependence(slau, config.get(), nDim); + CUpwSLAU2_Flow slau2(nDim, nDim + 2, config.get(), false); + CheckTkeIndependence(slau2, config.get(), nDim); + CUpwAUSM_Flow ausm(nDim, nDim + 2, config.get()); + CheckTkeIndependence(ausm, config.get(), nDim); + CUpwAUSMPLUSUP_Flow ausmup(nDim, nDim + 2, config.get()); + CheckTkeIndependence(ausmup, config.get(), nDim); + CUpwAUSMPLUSUP2_Flow ausmup2(nDim, nDim + 2, config.get()); + CheckTkeIndependence(ausmup2, config.get(), nDim); + CUpwMSW_Flow msw(nDim, nDim + 2, config.get()); + CheckTkeIndependence(msw, config.get(), nDim, true); + } +} diff --git a/UnitTests/SU2_CFD/numerics/hllc_jacobian_tests.cpp b/UnitTests/SU2_CFD/numerics/hllc_jacobian_tests.cpp index a047452fb084..0d8f895335ea 100644 --- a/UnitTests/SU2_CFD/numerics/hllc_jacobian_tests.cpp +++ b/UnitTests/SU2_CFD/numerics/hllc_jacobian_tests.cpp @@ -1,7 +1,8 @@ /*! * \file hllc_jacobian_tests.cpp * \brief Finite-difference verification of the HLLC Jacobians (ideal and general gas, 2D and 3D), on fixed and moving - * faces, exact (USE_EXACT_HLLC_JACOBIANS) or default. + * faces, with the turbulent kinetic energy of SST in the total energy, exact (USE_EXACT_HLLC_JACOBIANS) or + * default. * \version 8.5.0 "Harrier" * * SU2 Project Website: https://su2code.github.io @@ -227,9 +228,11 @@ void CheckAllBranches(unsigned short nDim, bool moving, su2double k, bool exact) TEST_CASE("HLLC Jacobians match finite differences", "[HLLC]") { for (const unsigned short nDim : {2, 3}) { for (const bool moving : {false, true}) { - for (const bool exact : {false, true}) { - CheckAllBranches(nDim, moving, 0.0, exact); - CheckAllBranches(nDim, moving, 0.0, exact); + for (const su2double k : {0.0, 0.2}) { + for (const bool exact : {false, true}) { + CheckAllBranches(nDim, moving, k, exact); + CheckAllBranches(nDim, moving, k, exact); + } } } } diff --git a/UnitTests/SU2_CFD/numerics/roe_contact_tests.cpp b/UnitTests/SU2_CFD/numerics/roe_contact_tests.cpp new file mode 100644 index 000000000000..9c99a461f218 --- /dev/null +++ b/UnitTests/SU2_CFD/numerics/roe_contact_tests.cpp @@ -0,0 +1,125 @@ +/*! + * \file roe_contact_tests.cpp + * \brief Roe-type schemes must resolve a contact discontinuity and a shear layer exactly (upwind flux), in 2D + * and 3D, on faces not aligned with the axes. + * \version 8.5.0 "Harrier" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "catch.hpp" +#include +#include +#include +#include "../../../SU2_CFD/include/numerics/flow/convection/roe.hpp" + +namespace { + +constexpr su2double gamma = 1.4; + +std::unique_ptr MakeConfig(bool implicit) { + std::stringstream options; + options << "SOLVER= EULER\nCONV_NUM_METHOD_FLOW= ROE\nENTROPY_FIX_COEFF= 0.0\nROE_KAPPA= 0.5\n"; + options << "TIME_DISCRE_FLOW= " << (implicit ? "EULER_IMPLICIT" : "EULER_EXPLICIT") << "\n"; + return std::make_unique(options, SU2_COMPONENT::SU2_CFD, false); +} + +/*--- Primitive (T, u, v, [w], p, rho, h, c) and secondary (dp/drho_e, dp/de_rho) variables of an ideal gas. ---*/ +void State(unsigned short nDim, su2double rho, const su2double* vel, su2double p, su2double* V, su2double* S) { + su2double q2 = 0.0; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + V[iDim + 1] = vel[iDim]; + q2 += vel[iDim] * vel[iDim]; + } + V[0] = p / (rho * 287.058); + V[nDim + 1] = p; + V[nDim + 2] = rho; + V[nDim + 3] = gamma / (gamma - 1) * p / rho + 0.5 * q2; + V[nDim + 4] = sqrt(gamma * p / rho); + S[0] = p / rho; + S[1] = (gamma - 1) * rho; +} + +template +std::unique_ptr MakeScheme(unsigned short nDim, const CConfig* config) { + return std::make_unique(nDim, nDim + 2, config); +} +template <> +std::unique_ptr MakeScheme(unsigned short nDim, const CConfig* config) { + return std::make_unique(nDim, nDim + 2, config, false); +} + +/*--- Two states with the same pressure and normal velocity, different density and (with shear) tangential + velocity: a contact discontinuity, whose exact (upwind) flux is the flux of the upstream state. ---*/ +template +void CheckContact(const char* name, unsigned short nDim, const su2double* vel, bool implicit, bool shear) { + auto config = MakeConfig(implicit); + auto numerics = MakeScheme(nDim, config.get()); + + const su2double p = 1.0, rho_i = 1.4, rho_j = 0.7; + const su2double n2[2] = {0.6, 0.8}, n3[3] = {2.0 / 7, 3.0 / 7, 6.0 / 7}; + const su2double* n = (nDim == 2) ? n2 : n3; + const su2double t2[2] = {0.16, -0.12}, t3[3] = {0.15, -0.1, 0.0}; // tangential velocity jumps + const su2double* t = (nDim == 2) ? t2 : t3; + su2double vel_j[3] = {0.0}; + for (unsigned short iDim = 0; iDim < nDim; iDim++) vel_j[iDim] = vel[iDim] + (shear ? t[iDim] : 0.0); + + su2double Vi[10] = {0.0}, Vj[10] = {0.0}, Si[2], Sj[2]; + State(nDim, rho_i, vel, p, Vi, Si); + State(nDim, rho_j, vel_j, p, Vj, Sj); + numerics->SetPrimitive(Vi, Vj); + numerics->SetSecondary(Si, Sj); + numerics->SetNormal(n); + const auto res = numerics->ComputeResidual(config.get()); + + su2double un = 0.0; + for (unsigned short iDim = 0; iDim < nDim; iDim++) un += vel[iDim] * n[iDim]; + const su2double rho_up = (un >= 0.0) ? rho_i : rho_j; + const su2double* V_up = (un >= 0.0) ? Vi : Vj; + + CAPTURE(name, nDim, un, implicit, shear); + CHECK(res.residual[0] == Approx(rho_up * un).margin(1e-12)); + for (unsigned short iDim = 0; iDim < nDim; iDim++) + CHECK(res.residual[iDim + 1] == Approx(rho_up * V_up[iDim + 1] * un + p * n[iDim]).margin(1e-12)); + CHECK(res.residual[nDim + 1] == Approx(rho_up * V_up[nDim + 3] * un).margin(1e-12)); +} + +template +void CheckContacts(const char* name, bool implicit = true, bool shear = true) { + const su2double zero[3] = {0.0, 0.0, 0.0}, moving[3] = {0.3, -0.1, 0.2}, reverse[3] = {-0.3, 0.1, -0.2}; + for (const unsigned short nDim : {2, 3}) { + for (const auto* vel : {zero, moving, reverse}) { + CheckContact(name, nDim, vel, implicit, false); + if (shear) CheckContact(name, nDim, vel, implicit, true); + } + } +} + +} // namespace + +TEST_CASE("Roe schemes resolve a contact and a shear layer exactly", "[Roe]") { + CheckContacts("Roe"); + CheckContacts("general Roe", true); + CheckContacts("general Roe", false); + CheckContacts("LMRoe"); + /*--- L2Roe scales the tangential velocity jump at low Mach number (not upwind by design). ---*/ + CheckContacts("L2Roe", true, false); +} diff --git a/UnitTests/SU2_CFD/numerics/roe_tke_tests.cpp b/UnitTests/SU2_CFD/numerics/roe_tke_tests.cpp new file mode 100644 index 000000000000..928afd9062c2 --- /dev/null +++ b/UnitTests/SU2_CFD/numerics/roe_tke_tests.cpp @@ -0,0 +1,225 @@ +/*! + * \file roe_tke_tests.cpp + * \brief Roe eigenvector matrices with the turbulent kinetic energy of SST in the total energy. + * \version 8.5.0 "Harrier" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "catch.hpp" +#include "../../../SU2_CFD/include/numerics_simd/flow/convection/common.hpp" +#include +#include +#include +#include "../../../SU2_CFD/include/numerics/flow/convection/roe.hpp" +#include "../../../SU2_CFD/include/numerics/flow/convection/fvs.hpp" + +namespace { + +constexpr su2double gammaSST = 1.4; + +std::unique_ptr MakeConfig(bool implicit = true) { + std::stringstream options; + options << "SOLVER= EULER\nCONV_NUM_METHOD_FLOW= ROE\nENTROPY_FIX_COEFF= 0.0\nROE_KAPPA= 0.5\n"; + options << "TIME_DISCRE_FLOW= " << (implicit ? "EULER_IMPLICIT" : "EULER_EXPLICIT") << "\n"; + return std::make_unique(options, SU2_COMPONENT::SU2_CFD, false); +} + +/*--- Primitive variables (T, u, v, [w], p, rho, h, c) of an ideal gas whose total energy contains k. ---*/ +void Primitives(unsigned short nDim, su2double rho, const su2double* vel, su2double p, su2double k, su2double* V) { + su2double q2 = 0.0; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + V[iDim + 1] = vel[iDim]; + q2 += vel[iDim] * vel[iDim]; + } + V[0] = p / (rho * 287.058); + V[nDim + 1] = p; + V[nDim + 2] = rho; + V[nDim + 3] = gammaSST / (gammaSST - 1) * p / rho + 0.5 * q2 + k; + V[nDim + 4] = sqrt(gammaSST * p / rho); +} + +/*--- Secondary variables (dp/drho_e, dp/de_rho) of the ideal gas, for the general-gas schemes. ---*/ +void Secondary(su2double rho, su2double p, su2double* S) { + S[0] = p / rho; + S[1] = (gammaSST - 1) * rho; +} + +/*--- Common constructor for the schemes of the family. ---*/ +template +std::unique_ptr MakeScheme(unsigned short nDim, unsigned short nVar, const CConfig* config) { + return std::make_unique(nDim, nVar, config); +} +template <> +std::unique_ptr MakeScheme(unsigned short nDim, unsigned short nVar, const CConfig* config) { + return std::make_unique(nDim, nVar, config, false); +} + +/*--- Roe flux between two states with the same pressure and normal velocity and different density, k and (with + shear) tangential velocity. With the entropy fix off this is a contact discontinuity, whose exact (upwind) flux is + the flux of the upstream state. ---*/ +template +void CheckContactWithTkeJump(const char* name, unsigned short nDim, const su2double* vel, bool implicit, bool shear) { + auto config = MakeConfig(implicit); + const unsigned short nVar = nDim + 2; + auto numerics = MakeScheme(nDim, nVar, config.get()); + + const su2double p = 1.0, rho_i = 1.4, rho_j = 0.7, k_i = 0.1, k_j = 0.3; + const su2double n2[2] = {0.6, 0.8}, n3[3] = {2.0 / 7, 3.0 / 7, 6.0 / 7}; + const su2double* n = (nDim == 2) ? n2 : n3; + const su2double t2[2] = {0.16, -0.12}, t3[3] = {0.15, -0.1, 0.0}; // tangential velocity jumps + const su2double* t = (nDim == 2) ? t2 : t3; + su2double vel_j[3] = {0.0}; + for (unsigned short iDim = 0; iDim < nDim; iDim++) vel_j[iDim] = vel[iDim] + (shear ? t[iDim] : 0.0); + su2double Vi[10] = {0.0}, Vj[10] = {0.0}, Si[2], Sj[2]; + Primitives(nDim, rho_i, vel, p, k_i, Vi); + Primitives(nDim, rho_j, vel_j, p, k_j, Vj); + Secondary(rho_i, p, Si); + Secondary(rho_j, p, Sj); + numerics->SetPrimitive(Vi, Vj); + numerics->SetSecondary(Si, Sj); + numerics->SetNormal(n); + numerics->SetTurbKineticEnergy(k_i, k_j); + const auto res = numerics->ComputeResidual(config.get()); + + su2double un = 0.0; + for (unsigned short iDim = 0; iDim < nDim; iDim++) un += vel[iDim] * n[iDim]; + const su2double rho_up = (un >= 0.0) ? rho_i : rho_j; + const su2double* V_up = (un >= 0.0) ? Vi : Vj; + + CAPTURE(name, nDim, un, implicit, shear); + CHECK(res.residual[0] == Approx(rho_up * un).margin(1e-12)); + for (unsigned short iDim = 0; iDim < nDim; iDim++) + CHECK(res.residual[iDim + 1] == Approx(rho_up * V_up[iDim + 1] * un + p * n[iDim]).margin(1e-12)); + CHECK(res.residual[nVar - 1] == Approx(rho_up * V_up[nDim + 3] * un).margin(1e-12)); +} + +template +void CheckContactsWithTkeJump(const char* name, bool implicit = true, bool shear = true) { + const su2double zero[3] = {0.0, 0.0, 0.0}, moving[3] = {0.3, -0.1, 0.2}, reverse[3] = {-0.3, 0.1, -0.2}; + for (const unsigned short nDim : {2, 3}) { + for (const auto* vel : {zero, moving, reverse}) { + CheckContactWithTkeJump(name, nDim, vel, implicit, false); + if (shear) CheckContactWithTkeJump(name, nDim, vel, implicit, true); + } + } +} + +} // namespace + +TEST_CASE("Roe schemes resolve a contact with a jump of k exactly", "[Roe][SST]") { + CheckContactsWithTkeJump("Roe"); + CheckContactsWithTkeJump("general Roe", true); + CheckContactsWithTkeJump("general Roe", false); + CheckContactsWithTkeJump("LMRoe"); + /*--- L2Roe scales the tangential velocity jump at low Mach number (not upwind by design). ---*/ + CheckContactsWithTkeJump("L2Roe", true, false); +} + +TEST_CASE("Roe eigenvector matrices are inverse with k in the total energy", "[Roe][SST]") { + auto config = MakeConfig(); + for (const unsigned short nDim : {2, 3}) { + const unsigned short nVar = nDim + 2; + CUpwRoe_Flow numerics(nDim, nVar, config.get(), false); + const su2double velocity[3] = {0.4, -0.3, 0.2}, normal[3] = {2.0 / 7, 3.0 / 7, 6.0 / 7}; + const su2double n2[3] = {0.6, 0.8, 0.0}; + su2double P[5][5], Pinv[5][5]; + numerics.GetPMatrix(1.1, velocity, 1.2, nDim == 3 ? normal : n2, P, 0.3); + numerics.GetPMatrix_inv(1.1, velocity, 1.2, nDim == 3 ? normal : n2, Pinv, 0.3); + for (unsigned short i = 0; i < nVar; i++) { + for (unsigned short j = 0; j < nVar; j++) { + su2double prod = 0.0; + for (unsigned short l = 0; l < nVar; l++) prod += P[i][l] * Pinv[l][j]; + CAPTURE(nDim, i, j); + CHECK(prod == Approx(i == j ? 1.0 : 0.0).margin(1e-12)); + } + } + } +} + +TEST_CASE("Roe does not dissipate a stationary contact with k in the total energy", "[Roe][SST]") { + /*--- Zero velocity, same pressure and k on both sides, different density: a contact discontinuity at rest. + The Roe flux must be the pressure only (no mass or energy flux) when the entropy fix is off. ---*/ + auto config = MakeConfig(); + constexpr unsigned short nDim = 2, nVar = nDim + 2; + CUpwRoe_Flow numerics(nDim, nVar, config.get(), false); + + const su2double zero[2] = {0.0, 0.0}, p = 1.0, k = 0.2; + su2double Vi[10] = {0.0}, Vj[10] = {0.0}, normal[2] = {0.6, 0.8}; + Primitives(nDim, 1.4, zero, p, k, Vi); + Primitives(nDim, 0.7, zero, p, k, Vj); + numerics.SetPrimitive(Vi, Vj); + numerics.SetNormal(normal); + numerics.SetTurbKineticEnergy(k, k); + const auto res = numerics.ComputeResidual(config.get()); + + CHECK(res.residual[0] == Approx(0.0).margin(1e-12)); + CHECK(res.residual[1] == Approx(p * normal[0]).epsilon(1e-12)); + CHECK(res.residual[2] == Approx(p * normal[1]).epsilon(1e-12)); + CHECK(res.residual[3] == Approx(0.0).margin(1e-12)); +} + +TEST_CASE("Turkel preserves contacts with SST energy", "[Roe][SST][Turkel]") { + CheckContactsWithTkeJump("Turkel", true, false); +} + +TEST_CASE("Scalar MSW advects a pure k jump without acoustic flux", "[MSW][SST]") { + auto config = MakeConfig(); + for (const unsigned short dim : {2, 3}) { + for (const su2double speed : {-0.2, 0.0, 0.2}) { + CUpwMSW_Flow numerics(dim, dim + 2, config.get()); + su2double Vi[10] = {}, Vj[10] = {}, vel[3] = {speed, 0.0, 0.0}, normal[3] = {1.0, 0.0, 0.0}; + const su2double rho = 1.4, p = 1.0, ki = 0.1, kj = 3.0; + Primitives(dim, rho, vel, p, ki, Vi); + Primitives(dim, rho, vel, p, kj, Vj); + numerics.SetPrimitive(Vi, Vj); + numerics.SetTurbKineticEnergy(ki, kj); + numerics.SetSensor(0.0, 0.0); + numerics.SetNormal(normal); + const auto res = numerics.ComputeResidual(config.get()); + CAPTURE(dim, speed); + CHECK(res[0] == Approx(rho * speed).margin(1e-12)); + CHECK(res[1] == Approx(rho * speed * speed + p).margin(1e-12)); + for (unsigned short d = 1; d < dim; ++d) CHECK(res[d + 1] == Approx(0.0).margin(1e-12)); + const su2double h = gammaSST / (gammaSST - 1) * p / rho + 0.5 * speed * speed + (speed > 0 ? ki : kj); + CHECK(res[dim + 1] == Approx(rho * speed * h).margin(1e-12)); + } + } +} + +TEST_CASE("JST enthalpy dissipation Jacobian holds k fixed", "[JST][SST]") { + CCompressiblePrimitives<2, 6> V; + V.all = Double(0.0); + V.velocity(0) = 0.4; + V.velocity(1) = -0.3; + V.pressure() = 1.0; + V.density() = 1.4; + for (const su2double k : {0.0, 0.3, 10.0}) { + V.enthalpy() = gammaSST / (gammaSST - 1) / 1.4 + 0.125 + k; + MatrixDbl<4> jac; + jac = Double(0.0); + scalarDissipationJacobian(V, Double(gammaSST), Double(1.0), jac, Double(k)); + // Finite difference of rho*H = gammaSST*rhoE - (gammaSST-1)*(|rho*u|^2/(2*rho)+rho*k). + const auto rhoH = [&](su2double rho) { return gammaSST * 7.0 - (gammaSST - 1) * (0.245 / rho + rho * k); }; + const su2double fd = (rhoH(1.4 + 1e-5) - rhoH(1.4 - 1e-5)) / 2e-5; + for (size_t lane = 0; lane < Double::Size; ++lane) CHECK(jac(3, 0)[lane] == Approx(fd).margin(1e-9)); + } +} diff --git a/UnitTests/SU2_CFD/solvers/moving_wall_tests.cpp b/UnitTests/SU2_CFD/solvers/moving_wall_tests.cpp new file mode 100644 index 000000000000..1baf0c271428 --- /dev/null +++ b/UnitTests/SU2_CFD/solvers/moving_wall_tests.cpp @@ -0,0 +1,182 @@ +/*! + * \file moving_wall_tests.cpp + * \brief Regression for compressible wall projection in fixed and uniformly translating frames. + * \version 8.5.0 "Harrier" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "catch.hpp" +#include +#include +#include "../../UnitQuadTestCase.hpp" +#include "../../../SU2_CFD/include/numerics/flow/convection/hllc.hpp" +#include "../../../SU2_CFD/include/fluid/CPengRobinson.hpp" + +TEST_CASE("Compressible wall projection commutes with a Galilean boost", "[HLLC-wall]") { + for (const auto nDim : {2u, 3u}) { + for (const bool realGas : {false, true}) { + UnitQuadTestCase fixed, moving; + const std::string markers = + nDim == 2 ? "(x_minus,x_plus,y_minus,y_plus)" : "(x_minus,x_plus,y_minus,y_plus,z_minus,z_plus)"; + const std::string options = "SOLVER= EULER\nMESH_FORMAT= " + std::string(nDim == 2 ? "RECTANGLE" : "BOX") + + "\nMESH_BOX_SIZE= 5,5,5\nREF_DIMENSIONALIZATION= DIMENSIONAL\n" + "MACH_NUMBER= 0.1\nFREESTREAM_OPTION= DENSITY_FS\nFREESTREAM_DENSITY= 230\n" + "FREESTREAM_PRESSURE= 1500112\nGAS_CONSTANT= 35.152\n" + "CONV_NUM_METHOD_FLOW= HLLC\nTIME_DISCRE_FLOW= EULER_IMPLICIT\n" + "GRID_MOVEMENT= STEADY_TRANSLATION\nTRANSLATION_RATE= 0,0,0\nMARKER_EULER= " + + markers + "\nMARKER_MONITORING= (x_minus)\n" + + (realGas ? "FLUID_MODEL= PR_GAS\nGAMMA_VALUE= 1.0125\nCRITICAL_PRESSURE= " + "1415200\nCRITICAL_TEMPERATURE= 564.1\nACENTRIC_FACTOR= 0.529\n" + : "FLUID_MODEL= IDEAL_GAS\nGAMMA_VALUE= 1.4\n"); + fixed.config_options = moving.config_options = options; + fixed.InitConfig(); + fixed.InitGeometry(); + fixed.InitSolver(); + moving.InitConfig(); + moving.InitGeometry(); + moving.InitSolver(); + const auto nVar = nDim + 2; + const su2double boost[3] = {20, -7, 3}; + const su2double velocity[3] = {11, 4, -2}; + su2double B[5][5] = {}, T[5][5] = {}, baseJac[5][5] = {}, boostedJac[5][5] = {}; + su2double c2 = 0; + for (auto i = 0u; i < nVar; ++i) { + B[i][i] = T[i][i] = 1; + for (auto j = 0u; j < nVar; ++j) baseJac[i][j] = 1 + i + 2 * j; + } + for (auto i = 0u; i < nDim; ++i) { + c2 += boost[i] * boost[i]; + B[i + 1][0] = boost[i]; + T[i + 1][0] = -boost[i]; + B[nVar - 1][i + 1] = boost[i]; + T[nVar - 1][i + 1] = -boost[i]; + } + B[nVar - 1][0] = T[nVar - 1][0] = 0.5 * c2; + for (auto i = 0u; i < nVar; ++i) + for (auto j = 0u; j < nVar; ++j) + for (auto k = 0u; k < nVar; ++k) + for (auto l = 0u; l < nVar; ++l) boostedJac[i][j] += B[i][k] * baseJac[k][l] * T[l][j]; + std::unique_ptr fluid = + realGas ? std::unique_ptr(new CPengRobinson(1.0125, 35.152, 1415200, 564.1, 0.529)) + : std::unique_ptr(new CIdealGas(1.4, 35.152)); + fluid->SetTDState_Prho(1500112, 230); + std::array baseState{}; + baseState[0] = 230; + su2double speed2 = 0; + for (auto i = 0u; i < nDim; ++i) { + baseState[i + 1] = 230 * velocity[i]; + speed2 += velocity[i] * velocity[i]; + } + baseState[nVar - 1] = 230 * (fluid->GetStaticEnergy() + 0.5 * speed2); + const su2double baseResidual[5] = {0.3, -0.5, 0.2, 0.7, -0.1}; + for (auto frame = 0u; frame < 2; ++frame) { + auto& test = frame ? moving : fixed; + auto* solver = test.solver[FLOW_SOL]; + auto* nodes = static_cast(solver->GetNodes()); + for (auto p = 0ul; p < test.geometry->GetnPoint(); ++p) { + su2double state[5] = {}, residual[5] = {}; + for (auto i = 0u; i < nVar; ++i) + for (auto j = 0u; j < nVar; ++j) { + state[i] += (frame ? B[i][j] : (i == j)) * baseState[j]; + residual[i] += (frame ? B[i][j] : (i == j)) * baseResidual[j]; + } + nodes->SetSolution(p, state); + nodes->SetSolution_Old(p, state); + REQUIRE(nodes->SetPrimVar(p, fluid.get())); + nodes->SetSecondaryVar(p, fluid.get()); + for (auto i = 0u; i < nDim; ++i) test.geometry->nodes->SetGridVel(p, i, frame ? boost[i] : 0); + for (auto i = 0u; i < nVar; ++i) { + solver->LinSysRes(p, i) = residual[i]; + nodes->GetResTruncError(p)[i] = residual[i]; + } + su2double block[25] = {}; + for (auto i = 0u; i < nVar; ++i) + for (auto j = 0u; j < nVar; ++j) block[i * nVar + j] = frame ? boostedJac[i][j] : baseJac[i][j]; + solver->Jacobian.SetBlock(p, p, block); + for (auto k = 0u; k < test.geometry->nodes->GetnPoint(p); ++k) + solver->Jacobian.SetBlock(p, test.geometry->nodes->GetPoint(p, k), block); + } + std::unique_ptr numerics = + realGas ? std::unique_ptr(new CUpwGeneralHLLC_Flow(nDim, nVar, test.config.get())) + : std::unique_ptr(new CUpwHLLC_Flow(nDim, nVar, test.config.get())); + for (auto marker = 0u; marker < test.config->GetnMarker_All(); ++marker) + if (test.config->GetMarker_All_TagBound(marker) == "x_minus") + solver->BC_Sym_Plane(test.geometry.get(), test.solver, numerics.get(), nullptr, test.config.get(), marker); + } + for (auto p = 0ul; p < fixed.geometry->GetnPoint(); ++p) { + auto* f = fixed.solver[FLOW_SOL]; + auto* m = moving.solver[FLOW_SOL]; + for (auto i = 0u; i < nVar; ++i) { + su2double state = 0, residual = 0, truncation = 0; + for (auto j = 0u; j < nVar; ++j) { + state += B[i][j] * f->GetNodes()->GetSolution_Old(p)[j]; + residual += B[i][j] * f->LinSysRes(p, j); + truncation += B[i][j] * f->GetNodes()->GetResTruncError(p)[j]; + } + CHECK(m->GetNodes()->GetSolution_Old(p)[i] == Approx(state).margin(1e-6)); + CHECK(m->LinSysRes(p, i) == Approx(residual).margin(1e-8)); + CHECK(m->GetNodes()->GetResTruncError(p)[i] == Approx(truncation).margin(1e-8)); + for (auto block = 0u; block <= fixed.geometry->nodes->GetnPoint(p); ++block) { + const auto neighbor = block ? fixed.geometry->nodes->GetPoint(p, block - 1) : p; + for (auto j = 0u; j < nVar; ++j) { + su2double expected = 0; + for (auto k = 0u; k < nVar; ++k) + for (auto l = 0u; l < nVar; ++l) + expected += B[i][k] * f->Jacobian.GetBlock(p, neighbor)[k * nVar + l] * T[l][j]; + CHECK(m->Jacobian.GetBlock(p, neighbor)[i * nVar + j] == Approx(expected).margin(1e-5)); + } + } + } + } + + for (const bool correction : {false, true}) { + const su2double delta[5] = {0.3, -0.5, 0.2, 0.7, -0.1}; + for (auto frame = 0u; frame < 2; ++frame) { + auto& test = frame ? moving : fixed; + auto* solver = test.solver[FLOW_SOL]; + for (auto p = 0ul; p < test.geometry->GetnPoint(); ++p) { + su2double state[5] = {}; + for (auto i = 0u; i < nVar; ++i) + for (auto j = 0u; j < nVar; ++j) + state[i] += (frame ? B[i][j] : (i == j)) * (correction ? delta[j] : baseState[j]); + if (correction) + solver->GetNodes()->SetSolution_Old(p, state); + else + solver->GetNodes()->SetSolution(p, state); + } + solver->MultigridProjectEulerWall(test.geometry.get(), test.config.get(), correction); + } + for (auto p = 0ul; p < fixed.geometry->GetnPoint(); ++p) { + const auto* f = correction ? fixed.solver[FLOW_SOL]->GetNodes()->GetSolution_Old(p) + : fixed.solver[FLOW_SOL]->GetNodes()->GetSolution(p); + const auto* m = correction ? moving.solver[FLOW_SOL]->GetNodes()->GetSolution_Old(p) + : moving.solver[FLOW_SOL]->GetNodes()->GetSolution(p); + for (auto i = 0u; i < nVar; ++i) { + su2double expected = 0; + for (auto j = 0u; j < nVar; ++j) expected += B[i][j] * f[j]; + CHECK(m[i] == Approx(expected).margin(1e-6)); + } + } + } + } + } +} diff --git a/UnitTests/SU2_CFD/solvers/sst_energy_tests.cpp b/UnitTests/SU2_CFD/solvers/sst_energy_tests.cpp new file mode 100644 index 000000000000..809511e8036b --- /dev/null +++ b/UnitTests/SU2_CFD/solvers/sst_energy_tests.cpp @@ -0,0 +1,117 @@ +/*! + * \file sst_energy_tests.cpp + * \brief SST thermal-energy relaxation and matrix dissipation regressions. + * \version 8.5.0 "Harrier" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "catch.hpp" +#include "../../UnitQuadTestCase.hpp" + +TEST_CASE("SST relaxation limits thermal energy when k dominates", "[SST][UnderRelaxation]") { + UnitQuadTestCase test; + test.config_options = + "SOLVER= RANS\nMACH_NUMBER= 0.5\nREYNOLDS_NUMBER= 1e6\nKIND_TURB_MODEL= SST\n" + "MESH_FORMAT= RECTANGLE\nMESH_BOX_SIZE= 5,5,5\n" + "MARKER_HEATFLUX= (x_minus,0,x_plus,0,y_minus,0,y_plus,0)\n" + "TIME_DISCRE_FLOW= EULER_IMPLICIT\nMAX_UPDATE_FLOW= 0.2\n"; + std::stringstream options(test.config_options); + test.config = std::make_unique(options, SU2_COMPONENT::SU2_CFD, false); + test.InitGeometry(); + test.solver = + CSolverFactory::CreateSolverContainer(test.config->GetKind_Solver(), test.config.get(), test.geometry.get(), 0); + auto* flow = static_cast(test.solver[FLOW_SOL]); + auto* nodes = flow->GetNodes(); + auto* turb = test.solver[TURB_SOL]->GetNodes(); + for (auto p = 0ul; p < test.geometry->GetnPoint(); ++p) { + nodes->SetSolution(p, 0, 2.0); + nodes->SetSolution(p, 1, 0.0); + nodes->SetSolution(p, 2, 0.0); + nodes->SetSolution(p, 3, 201.0); + turb->SetSolution(p, 0, 100.0); + for (auto v = 0u; v < 4; ++v) flow->LinSysSol(p, v) = 0.0; + flow->LinSysSol(p, 3) = -10.0; + } + flow->ComputeUnderRelaxationFactor(test.config.get(), test.solver); + CHECK(nodes->GetUnderRelaxation(0) == Approx(0.02)); + CHECK(201.0 - 10.0 * nodes->GetUnderRelaxation(0) - 200.0 > 0.0); + // Exercise the production implicit-Euler caller, not only the relaxation helper. + nodes->Set_OldSolution(); + flow->Jacobian.SetValZero(); + for (auto p = 0ul; p < test.geometry->GetnPoint(); ++p) { + nodes->SetDelta_Time(p, test.geometry->nodes->GetVolume(p)); + nodes->SetRes_TruncErrorZero(p); + for (auto v = 0u; v < 4; ++v) flow->LinSysRes(p, v) = 0.0; + flow->LinSysRes(p, 3) = 10.0; + } + flow->ImplicitEuler_Iteration(test.geometry.get(), test.solver, test.config.get()); + CHECK(nodes->GetUnderRelaxation(0) == Approx(0.02)); + CHECK(nodes->GetSolution(0, 3) == Approx(200.8)); + delete test.solver[TURB_SOL]; +} + +#include "../../../SU2_CFD/include/variables/CNSVariable.hpp" +#include "../../../SU2_CFD/include/numerics_simd/flow/diffusion/viscous_fluxes.hpp" +#include "../../../SU2_CFD/include/numerics_simd/flow/convection/centered.hpp" + +TEST_CASE("JST matrix fourth-order k dissipation does not create pressure waves", "[SST][JST]") { + UnitQuadTestCase test; + test.config_options = + "SOLVER= RANS\nMACH_NUMBER= 0.5\nREYNOLDS_NUMBER= 1e6\nKIND_TURB_MODEL= SST\n" + "MESH_FORMAT= RECTANGLE\nMESH_BOX_SIZE= 5,5,5\n" + "MARKER_HEATFLUX= (x_minus,0,x_plus,0,y_minus,0,y_plus,0)\n" + "CONV_NUM_METHOD_FLOW= JST_MAT\nENTROPY_FIX_COEFF= 0\n"; + std::stringstream options(test.config_options); + test.config = std::make_unique(options, SU2_COMPONENT::SU2_CFD, false); + test.InitGeometry(); + test.solver = + CSolverFactory::CreateSolverContainer(test.config->GetKind_Solver(), test.config.get(), test.geometry.get(), 0); + auto* flow = static_cast(test.solver[FLOW_SOL]); + auto& nodes = *static_cast(flow->GetNodes()); + const CVariable* turb = test.solver[TURB_SOL]->GetNodes(); + for (auto p = 0ul; p < test.geometry->GetnPoint(); ++p) { + nodes.SetSensor(p, 0.0); + for (auto v = 0u; v < 5; ++v) nodes.SetUnd_Lapl(p, v, 0.0); + } + nodes.SetUnd_Lapl(0, 3, 2.0); + nodes.SetUnd_Lapl(0, 4, 2.0); // the energy Laplacian comes entirely from rho*k + CJSTmatScheme> scheme(*test.config, turb); + CPair> V; + V.i.all = Double(0.0); + V.i.density() = 1.0; + V.i.pressure() = 1.0; + V.i.speedSound() = sqrt(1.4); + V.i.enthalpy() = 3.5; + V.j = V.i; + VectorDbl<4> flux, diff; + flux = Double(0.0); + diff = Double(0.0); + VectorDbl<2> normal; + normal(0) = 1.0; + normal(1) = 0.0; + MatrixDbl<4> ji, jj; + scheme.finalizeFlux(flux, ji, jj, false, Double(1.0), Double(0.0), V.i, V, diff, Int(0ul), Int(1ul), *test.geometry, + nodes, normal); + for (size_t lane = 0; lane < Double::Size; ++lane) + for (size_t v = 0; v < 4; ++v) CHECK(flux(v)[lane] == Approx(0.0).margin(1e-12)); + delete test.solver[TURB_SOL]; +} diff --git a/UnitTests/SU2_CFD/solvers/under_relaxation_ad_tests.cpp b/UnitTests/SU2_CFD/solvers/under_relaxation_ad_tests.cpp index 431bee249cdc..fcad6cb1e551 100644 --- a/UnitTests/SU2_CFD/solvers/under_relaxation_ad_tests.cpp +++ b/UnitTests/SU2_CFD/solvers/under_relaxation_ad_tests.cpp @@ -57,7 +57,7 @@ TEST_CASE("Compressible under-relaxation owns its AD density values", "[UnderRel solver->LinSysSol(0, 0) = densityLimited ? 0.1 : 0.0; solver->LinSysSol(0, 1) = densityLimited ? 0.2 : 0.0; solver->LinSysSol(0, 3) = densityLimited ? 0.4 : 4.0; - solver->ComputeUnderRelaxationFactor(test.config.get()); + solver->ComputeUnderRelaxationFactor(test.config.get(), test.solver); su2double factor = nodes->GetUnderRelaxation(0); #ifdef CODI_REVERSE_TYPE AD::RegisterOutput(factor); diff --git a/UnitTests/meson.build b/UnitTests/meson.build index 18956627104d..0dbb9ada4dd9 100644 --- a/UnitTests/meson.build +++ b/UnitTests/meson.build @@ -16,7 +16,10 @@ su2_cfd_tests = files(['Common/CConfig_tests.cpp', 'SU2_CFD/fluid/CFluidCantera_tests.cpp', 'Common/toolboxes/multilayer_perceptron/CLookUp_ANN_tests.cpp', 'SU2_CFD/numerics/CNumerics_tests.cpp', + 'SU2_CFD/numerics/roe_contact_tests.cpp', 'SU2_CFD/numerics/hllc_jacobian_tests.cpp', + 'SU2_CFD/numerics/roe_tke_tests.cpp', + 'SU2_CFD/numerics/ausm_tke_tests.cpp', 'SU2_CFD/fluid/CFluidModel_tests.cpp', 'SU2_CFD/output/CNEMOCompOutput_tests.cpp', 'SU2_CFD/output/COutput_convergence_tests.cpp', @@ -25,6 +28,8 @@ su2_cfd_tests = files(['Common/CConfig_tests.cpp', 'SU2_CFD/scalar_muscl.cpp', 'SU2_CFD/scalar_limiter_eps.cpp', 'SU2_CFD/solvers/CNEMOEulerSolver_tests.cpp', + 'SU2_CFD/solvers/moving_wall_tests.cpp', + 'SU2_CFD/solvers/sst_energy_tests.cpp', 'SU2_CFD/solvers/supersonic_outlet_tests.cpp', 'SU2_CFD/nemo_viscous_assembly.cpp', 'SU2_CFD/windowing.cpp', @@ -62,6 +67,8 @@ if get_option('enable-tests') cpp_args: ['-fPIC', default_warning_flags, su2_cpp_args] ) test('Catch2 test driver', test_driver) + test('Multigrid configuration limits', python, + args: files('Common/check_multigrid_limits.py') + [test_driver.full_path()]) test('NEMO convergence field migration', python, args: files('SU2_CFD/output/check_nemo_convergence_migration.py') + [test_driver.full_path()], timeout: 300)