@@ -643,21 +643,17 @@ void CIncNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **sol
643643}
644644
645645void CIncNSSolver::SetTau_Wall_WF (CGeometry *geometry, CSolver **solver_container, const CConfig *config) {
646- /* ---
647- The wall function implemented herein is based on Nichols and Nelson, AIAA J. v32 n6 2004.
648- ---*/
646+ /* --- The wall function implemented herein is based on Nichols and Nelson, AIAA J. v32 n6 2004. ---*/
649647
650- unsigned long notConvergedCounter = 0 ; /* --- counts the number of wall cells that are not converged ---*/
651- unsigned long smallYPlusCounter = 0 ; /* --- counts the number of wall cells where y+ < 5 ---*/
648+ unsigned long notConvergedCounter = 0 ; /* --- Counts the number of wall cells that are not converged ---*/
649+ unsigned long smallYPlusCounter = 0 ; /* --- Counts the number of wall cells where y+ < 5 ---*/
652650
653651 const su2double Gas_Constant = config->GetGas_ConstantND ();
654652 const su2double Cp = (Gamma / Gamma_Minus_One) * Gas_Constant;
655- const su2double tol = 1e-12 ; /* !< \brief convergence criterium for the Newton solver, note that 1e-10 is too large */
656- const unsigned short max_iter = config->GetwallModel_MaxIter ();
653+ const auto max_iter = config->GetwallModel_MaxIter ();
657654 const su2double relax = config->GetwallModel_RelFac ();
658655
659- /* --- Compute the recovery factor
660- * use Molecular (Laminar) Prandtl number (see Nichols & Nelson, nomenclature ) ---*/
656+ /* --- Compute the recovery factor use Molecular (Laminar) Prandtl number (see Nichols & Nelson, nomenclature ) ---*/
661657
662658 const su2double Recovery = pow (config->GetPrandtl_Lam (), (1.0 /3.0 ));
663659
@@ -701,7 +697,7 @@ void CIncNSSolver::SetTau_Wall_WF(CGeometry *geometry, CSolver **solver_containe
701697
702698 const auto Normal = geometry->vertex [iMarker][iVertex]->GetNormal ();
703699
704- su2double Area = GeometryToolbox::Norm (nDim, Normal);
700+ const su2double Area = GeometryToolbox::Norm (nDim, Normal);
705701
706702 su2double UnitNormal[MAXNDIM] = {0.0 };
707703 for (auto iDim = 0u ; iDim < nDim; iDim++)
@@ -716,13 +712,13 @@ void CIncNSSolver::SetTau_Wall_WF(CGeometry *geometry, CSolver **solver_containe
716712
717713 /* --- Compute the wall-parallel velocity at first point off the wall ---*/
718714
719- su2double VelNormal = GeometryToolbox::DotProduct (int (MAXNDIM), Vel, UnitNormal);
715+ const su2double VelNormal = GeometryToolbox::DotProduct (int (MAXNDIM), Vel, UnitNormal);
720716
721717 su2double VelTang[MAXNDIM] = {0.0 };
722718 for (auto iDim = 0u ; iDim < nDim; iDim++)
723719 VelTang[iDim] = Vel[iDim] - VelNormal*UnitNormal[iDim];
724720
725- su2double VelTangMod = GeometryToolbox::Norm (int (MAXNDIM), VelTang);
721+ const su2double VelTangMod = GeometryToolbox::Norm (int (MAXNDIM), VelTang);
726722
727723 /* --- Compute normal distance of the interior point from the wall ---*/
728724
@@ -735,9 +731,9 @@ void CIncNSSolver::SetTau_Wall_WF(CGeometry *geometry, CSolver **solver_containe
735731 * In incompressible flows, we can assume that there is no velocity-related
736732 * temperature change Prandtl: T+ = Pr*y+ ---*/
737733 su2double T_Wall = nodes->GetTemperature (iPoint);
738- su2double Conductivity_Wall = nodes->GetThermalConductivity (iPoint);
734+ const su2double Conductivity_Wall = nodes->GetThermalConductivity (iPoint);
739735
740- /* --- if a wall temperature was given, we compute the local heat flux using k*dT/dn ---*/
736+ /* --- If a wall temperature was given, we compute the local heat flux using k*dT/dn ---*/
741737
742738 su2double q_w = 0.0 ;
743739
@@ -746,32 +742,33 @@ void CIncNSSolver::SetTau_Wall_WF(CGeometry *geometry, CSolver **solver_containe
746742 q_w = Conductivity_Wall * (T_Wall - T_n) / (WallDistMod);
747743 }
748744 else if (config->GetMarker_All_KindBC (iMarker) == HEAT_FLUX) {
749- q_w = config->GetWall_HeatFlux (Marker_Tag)/ config->GetHeat_Flux_Ref ();
745+ q_w = config->GetWall_HeatFlux (Marker_Tag) / config->GetHeat_Flux_Ref ();
750746 }
751747 else if (config->GetMarker_All_KindBC (iMarker) == HEAT_TRANSFER) {
752- const su2double Transfer_Coefficient = config->GetWall_HeatTransfer_Coefficient (Marker_Tag) * config->GetTemperature_Ref ()/config->GetHeat_Flux_Ref ();
753- const su2double Tinfinity = config->GetWall_HeatTransfer_Temperature (Marker_Tag)/config->GetTemperature_Ref ();
748+ const su2double Transfer_Coefficient = config->GetWall_HeatTransfer_Coefficient (Marker_Tag) *
749+ config->GetTemperature_Ref ()/config->GetHeat_Flux_Ref ();
750+ const su2double Tinfinity = config->GetWall_HeatTransfer_Temperature (Marker_Tag) / config->GetTemperature_Ref ();
754751 q_w = Transfer_Coefficient * (Tinfinity - T_Wall);
755752 }
756753
757- /* --- incompressible formulation ---*/
754+ /* --- Incompressible formulation ---*/
758755
759756 su2double Density_Wall = nodes->GetDensity (iPoint);
760- su2double Lam_Visc_Normal = nodes->GetLaminarViscosity (Point_Normal);
757+ const su2double Lam_Visc_Normal = nodes->GetLaminarViscosity (Point_Normal);
761758
762759 /* --- Compute the shear stress at the wall in the regular fashion
763760 * by using the stress tensor on the surface ---*/
764761
765762 su2double tau[MAXNDIM][MAXNDIM] = {{0.0 }};
766- su2double Lam_Visc_Wall = nodes->GetLaminarViscosity (iPoint);
763+ const su2double Lam_Visc_Wall = nodes->GetLaminarViscosity (iPoint);
767764 su2double Eddy_Visc_Wall = nodes->GetEddyViscosity (iPoint);
768765
769766 CNumerics::ComputeStressTensor (nDim, tau, nodes->GetGradient_Primitive (iPoint)+1 , Lam_Visc_Wall);
770767
771768 su2double TauTangent[MAXNDIM] = {0.0 };
772769 GeometryToolbox::TangentProjection (nDim, tau, UnitNormal, TauTangent);
773770
774- su2double WallShearStress = GeometryToolbox::Norm (int (MAXNDIM), TauTangent);
771+ const su2double WallShearStress = GeometryToolbox::Norm (int (MAXNDIM), TauTangent);
775772
776773 /* --- Calculate the quantities from boundary layer theory and
777774 * iteratively solve for a new wall shear stress. Use the current wall
@@ -782,37 +779,40 @@ void CIncNSSolver::SetTau_Wall_WF(CGeometry *geometry, CSolver **solver_containe
782779 su2double U_Tau = max (1.0e-6 ,sqrt (WallShearStress/Density_Wall));
783780 su2double Y_Plus = 0.99 *config->GetwallModel_MinYPlus (); // use clipping value as minimum
784781
785- su2double Y_Plus_Start = Density_Wall * U_Tau * WallDistMod / Lam_Visc_Wall;
782+ const su2double Y_Plus_Start = Density_Wall * U_Tau * WallDistMod / Lam_Visc_Wall;
786783
787784 /* --- Automatic switch off when y+ < "limit" according to Nichols & Nelson (2004) ---*/
788785
789786 if (Y_Plus_Start < config->GetwallModel_MinYPlus ()) {
790787 smallYPlusCounter++;
791788 continue ;
792789 }
790+
791+ /* --- Convergence criterium for the Newton solver, note that 1e-10 is too large ---*/
792+ const su2double tol = 1e-12 ;
793793 while (fabs (diff) > tol) {
794794
795795 /* --- Friction velocity and u+ ---*/
796796
797- su2double U_Plus = VelTangMod/U_Tau;
797+ const su2double U_Plus = VelTangMod/U_Tau;
798798
799799 /* --- Gamma, Beta, Q, and Phi, defined by Nichols & Nelson (2004) page 1110 ---*/
800800
801- su2double Gam = Recovery*U_Tau*U_Tau/(2.0 *Cp*T_Wall);
802- su2double Beta = q_w*Lam_Visc_Wall/(Density_Wall*T_Wall*Conductivity_Wall*U_Tau);
803- su2double Q = sqrt (Beta*Beta + 4.0 *Gam);
804- su2double Phi = asin (-1.0 *Beta/Q);
801+ const su2double Gam = Recovery*U_Tau*U_Tau/(2.0 *Cp*T_Wall);
802+ const su2double Beta = q_w*Lam_Visc_Wall/(Density_Wall*T_Wall*Conductivity_Wall*U_Tau);
803+ const su2double Q = sqrt (Beta*Beta + 4.0 *Gam);
804+ const su2double Phi = asin (-1.0 *Beta/Q);
805805
806806 /* --- Y+ defined by White & Christoph (compressibility and heat transfer) negative value for (2.0*Gam*U_Plus - Beta)/Q ---*/
807807
808- su2double Y_Plus_White = exp ((kappa/sqrt (Gam))*(asin ((2.0 *Gam*U_Plus - Beta)/Q) - Phi))*exp (-1.0 *kappa*B);
808+ const su2double Y_Plus_White = exp ((kappa/sqrt (Gam))*(asin ((2.0 *Gam*U_Plus - Beta)/Q) - Phi))*exp (-1.0 *kappa*B);
809809
810810 /* --- Spalding's universal form for the BL velocity with the
811811 * outer velocity form of White & Christoph above. ---*/
812812 const su2double kUp = kappa*U_Plus;
813813 Y_Plus = U_Plus + Y_Plus_White - (exp (-1.0 *kappa*B)* (1.0 + kUp + 0.5 *kUp *kUp + kUp *kUp *kUp /6.0 ));
814814
815- su2double dypw_dyp = 2.0 *Y_Plus_White*(kappa*sqrt (Gam)/Q)*sqrt (1.0 - pow (2.0 *Gam*U_Plus - Beta,2.0 )/(Q*Q));
815+ const su2double dypw_dyp = 2.0 *Y_Plus_White*(kappa*sqrt (Gam)/Q)*sqrt (1.0 - pow (2.0 *Gam*U_Plus - Beta,2.0 )/(Q*Q));
816816
817817 Eddy_Visc_Wall = Lam_Visc_Wall*(1.0 + dypw_dyp - kappa*exp (-1.0 *kappa*B)*
818818 (1.0 + kappa*U_Plus + kappa*kappa*U_Plus*U_Plus/2.0 )
@@ -825,7 +825,7 @@ void CIncNSSolver::SetTau_Wall_WF(CGeometry *geometry, CSolver **solver_containe
825825
826826 /* --- Gradient of function defined above --- */
827827
828- su2double grad_diff = Density_Wall * WallDistMod / Lam_Visc_Wall + VelTangMod / (U_Tau * U_Tau) +
828+ const su2double grad_diff = Density_Wall * WallDistMod / Lam_Visc_Wall + VelTangMod / (U_Tau * U_Tau) +
829829 kappa /(U_Tau * sqrt (Gam)) * asin (U_Plus * sqrt (Gam)) * Y_Plus_White -
830830 exp (-1.0 * B * kappa) * (0.5 * pow (VelTangMod * kappa / U_Tau, 3 ) +
831831 pow (VelTangMod * kappa / U_Tau, 2 ) + VelTangMod * kappa / U_Tau) / U_Tau;
@@ -852,7 +852,7 @@ void CIncNSSolver::SetTau_Wall_WF(CGeometry *geometry, CSolver **solver_containe
852852 EddyViscWall[iMarker][iVertex] = Eddy_Visc_Wall;
853853 UTau[iMarker][iVertex] = U_Tau;
854854
855- su2double Tau_Wall = (1.0 /Density_Wall)*pow (Y_Plus*Lam_Visc_Wall/WallDistMod,2.0 );
855+ const su2double Tau_Wall = (1.0 /Density_Wall)*pow (Y_Plus*Lam_Visc_Wall/WallDistMod,2.0 );
856856
857857 /* --- Store this value for the wall shear stress at the node. ---*/
858858 nodes->SetTau_Wall (iPoint, Tau_Wall);
0 commit comments