diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index c6140d922ad9..6d60cc2c9652 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -261,7 +261,9 @@ class CSourceBase_TurbSA : public CNumerics { var.d_fv2 = 0.0; } else { var.fv2 = 1 - ScalarVar_i[0] / (nu + ScalarVar_i[0] * var.fv1); - var.d_fv2 = -(1 / nu - Ji_2 * var.d_fv1) / pow(1 + var.Ji * var.fv1, 2); + /*--- fv2 uses nue/nu, not Ji, which includes the roughness shift. ---*/ + const su2double chi = ScalarVar_i[0] / nu; + var.d_fv2 = -(1 / nu - pow(chi, 2) * var.d_fv1) / pow(1 + chi * var.fv1, 2); } /*--- Evaluate Omega with a rotational correction term. ---*/ @@ -393,15 +395,15 @@ struct Bsl { struct Edw { template static void get(const su2double*, unsigned short nDim, const MatrixType& velocity_grad, CSAVariables& var) { - su2double Sbar = 0.0; + su2double Sbar = 0.0, divVel = 0.0; for (unsigned short iDim = 0; iDim < nDim; ++iDim) { for (unsigned short jDim = 0; jDim < nDim; ++jDim) { Sbar += (velocity_grad[iDim][jDim] + velocity_grad[jDim][iDim]) * velocity_grad[iDim][jDim]; } + divVel += velocity_grad[iDim][iDim]; } - for (unsigned short iDim = 0; iDim < nDim; ++iDim) { - Sbar -= (2.0 / 3.0) * pow(velocity_grad[iDim][iDim], 2); - } + /*--- The square of the divergence, not the sum of the squared normal gradients. ---*/ + Sbar -= (2.0 / 3.0) * pow(divVel, 2); var.Omega = sqrt(max(Sbar, 0.0)); } }; @@ -517,11 +519,13 @@ struct Bsl { /*! \brief Edward. */ struct Edw { static void get(const su2double& nue, CSAVariables& var) { - var.r = min(nue * var.inv_Shat * var.inv_k2_d2, 10.0); - var.r = tanh(var.r) / tanh(1.0); + const su2double r0 = min(nue * var.inv_Shat * var.inv_k2_d2, 10.0); + var.r = tanh(r0) / tanh(1.0); + /*--- Chain rule through tanh, evaluated at the argument r0, zero where r0 is clipped. ---*/ var.d_r = (var.Shat - nue * var.d_Shat) * pow(var.inv_Shat, 2) * var.inv_k2_d2; - var.d_r = (1 - pow(tanh(var.r), 2.0)) * (var.d_r) / tanh(1.0); + var.d_r = (1 - pow(tanh(r0), 2)) * var.d_r / tanh(1.0); + if (r0 >= 10.0) var.d_r = 0.0; } }; }; diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index dd064b1af6bb..b12f53a344e4 100755 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -954,7 +954,7 @@ def main(): inc_flatplate_pb.cfg_dir = "incomp_rans/rough_flatplate" inc_flatplate_pb.cfg_file = "pb_rough_flatplate_incomp.cfg" inc_flatplate_pb.test_iter = 10 - inc_flatplate_pb.test_vals = [-4.063342, -9.884401, 0.000010, 0.228472] + inc_flatplate_pb.test_vals = [-4.064345, -9.885656, 0.000010, 0.227833] test_list.append(inc_flatplate_pb) #################### @@ -1057,7 +1057,7 @@ def main(): turbmod_sa_edw_rae2822.cfg_dir = "turbulence_models/sa/rae2822" turbmod_sa_edw_rae2822.cfg_file = "turb_SA_EDW_RAE2822.cfg" turbmod_sa_edw_rae2822.test_iter = 20 - turbmod_sa_edw_rae2822.test_vals = [-3.069523, -0.405788, -0.835321, -5.185709, 0.794436, 0.017856] + turbmod_sa_edw_rae2822.test_vals = [-3.068385, -0.406592, -0.835280, -5.180711, 0.793959, 0.017892] test_list.append(turbmod_sa_edw_rae2822) # SA Compressibility and Edwards @@ -1065,7 +1065,7 @@ def main(): turbmod_sa_comp_edw_rae2822.cfg_dir = "turbulence_models/sa/rae2822" turbmod_sa_comp_edw_rae2822.cfg_file = "turb_SA_COMP_EDW_RAE2822.cfg" turbmod_sa_comp_edw_rae2822.test_iter = 20 - turbmod_sa_comp_edw_rae2822.test_vals = [-3.067904, -0.338707, -0.811157, -5.279475, 0.809906, 0.019797] + turbmod_sa_comp_edw_rae2822.test_vals = [-3.067420, -0.339121, -0.811188, -5.278079, 0.809497, 0.019818] test_list.append(turbmod_sa_comp_edw_rae2822) # SA QCR diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index c6e4da09034b..13af78576d69 100755 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -572,7 +572,7 @@ def main(): inc_flatplate_pb.cfg_dir = "incomp_rans/rough_flatplate" inc_flatplate_pb.cfg_file = "pb_rough_flatplate_incomp.cfg" inc_flatplate_pb.test_iter = 10 - inc_flatplate_pb.test_vals = [-4.063342, -9.884401, 0.000010, 0.228472] + inc_flatplate_pb.test_vals = [-4.064345, -9.885656, 0.000010, 0.227833] test_list.append(inc_flatplate_pb) # FLAT PLATE, WALL FUNCTIONS, INCOMPRESSIBLE SST