@@ -2528,26 +2528,21 @@ void CFVMFlowSolverBase<V, FlowRegime>::Friction_Forces(const CGeometry* geometr
25282528 /* --- Compute wall shear stress (using the stress tensor). Compute wall skin friction coefficient, and heat flux
25292529 * on the wall ---*/
25302530
2531- TauNormal = 0.0 ;
2532- for (iDim = 0 ; iDim < nDim; iDim++) TauNormal += TauElem[iDim] * UnitNormal[iDim];
2531+ TauNormal = GeometryToolbox::DotProduct (nDim, TauElem, UnitNormal);
25332532
2534- WallShearStress[iMarker][iVertex] = 0.0 ;
25352533 for (iDim = 0 ; iDim < nDim; iDim++) {
25362534 TauTangent[iDim] = TauElem[iDim] - TauNormal * UnitNormal[iDim];
25372535 /* --- in case of wall functions, we have computed the skin friction in the turbulence solver --- */
25382536 /* --- Note that in the wall model, we switch off the computation when the computed y+ < 5 --- */
25392537 /* --- We put YPlus to 1.0 so we have to compute skinfriction and the actual y+ in that case as well --- */
25402538 if (!wallfunctions || (wallfunctions && YPlus[iMarker][iVertex] < 5.0 ))
25412539 CSkinFriction[iMarker](iVertex,iDim) = TauTangent[iDim] * factorFric;
2542-
2543- WallShearStress[iMarker][iVertex] += TauTangent[iDim] * TauTangent[iDim];
25442540 }
2545- WallShearStress[iMarker][iVertex] = sqrt (WallShearStress[iMarker][iVertex] );
2541+ WallShearStress[iMarker][iVertex] = GeometryToolbox::Norm (nDim, TauTangent );
25462542
25472543 for (iDim = 0 ; iDim < nDim; iDim++) WallDist[iDim] = (Coord[iDim] - Coord_Normal[iDim]);
2548- WallDistMod = 0.0 ;
2549- for (iDim = 0 ; iDim < nDim; iDim++) WallDistMod += WallDist[iDim] * WallDist[iDim];
2550- WallDistMod = sqrt (WallDistMod);
2544+
2545+ WallDistMod = GeometryToolbox::Norm (nDim, WallDist);
25512546
25522547 /* --- Compute y+ and non-dimensional velocity ---*/
25532548
@@ -2563,17 +2558,15 @@ void CFVMFlowSolverBase<V, FlowRegime>::Friction_Forces(const CGeometry* geometr
25632558 // / TODO: Move these ifs to specialized functions.
25642559 if (!nemo){
25652560
2566- GradTemperature = 0.0 ;
2567-
25682561 if (FlowRegime == ENUM_REGIME::COMPRESSIBLE) {
2569- for (iDim = 0 ; iDim < nDim; iDim++) GradTemperature -= Grad_Temp[iDim] * UnitNormal[iDim] ;
2562+ GradTemperature = - GeometryToolbox::DotProduct ( nDim, Grad_Temp, UnitNormal) ;
25702563
25712564 Cp = (Gamma / Gamma_Minus_One) * Gas_Constant;
25722565 thermal_conductivity = Cp * Viscosity / Prandtl_Lam;
25732566 }
25742567 if (FlowRegime == ENUM_REGIME::INCOMPRESSIBLE) {
25752568 if (energy)
2576- for (iDim = 0 ; iDim < nDim; iDim++) GradTemperature -= Grad_Temp[iDim] * UnitNormal[iDim] ;
2569+ GradTemperature = - GeometryToolbox::DotProduct ( nDim, Grad_Temp, UnitNormal) ;
25772570
25782571 thermal_conductivity = nodes->GetThermalConductivity (iPoint);
25792572 }
@@ -2584,30 +2577,19 @@ void CFVMFlowSolverBase<V, FlowRegime>::Friction_Forces(const CGeometry* geometr
25842577
25852578 unsigned short iSpecies, nSpecies = config->GetnSpecies ();
25862579
2587- const auto thermal_conductivity_tr = nodes->GetThermalConductivity (iPoint);
2588- const auto thermal_conductivity_ve = nodes->GetThermalConductivity_ve (iPoint);
2589- const auto Grad_PrimVar = nodes->GetGradient_Primitive (iPoint);
2590- const auto PrimVar = nodes->GetPrimitive (iPoint);
2591- const auto Ds = nodes->GetDiffusionCoeff (iPoint);
2592- const auto hs = nodes->GetEnthalpys (iPoint);
2593-
2594- su2double rho = PrimVar[RHO_INDEX];
2595- su2double dYsn;
2580+ const auto & thermal_conductivity_tr = nodes->GetThermalConductivity (iPoint);
2581+ const auto & thermal_conductivity_ve = nodes->GetThermalConductivity_ve (iPoint);
2582+ const auto & Grad_PrimVar = nodes->GetGradient_Primitive (iPoint);
2583+ const auto & Ds = nodes->GetDiffusionCoeff (iPoint);
2584+ const auto & hs = nodes->GetEnthalpys (iPoint);
25962585
25972586 /* --- Compute enthalpy transport to surface due to mass diffusion ---*/
25982587 su2double sumJhs = 0.0 ;
2599- for (iDim = 0 ; iDim < nDim; iDim++) {
2600- for (iSpecies = 0 ; iSpecies < nSpecies; iSpecies++) {
2601- dYsn = Grad_PrimVar[RHOS_INDEX+iSpecies][iDim]/rho*UnitNormal[iDim];
2602- sumJhs += rho*Ds[iSpecies]*dYsn*hs[iSpecies];
2603- }
2604- }
2605-
2606- dTn = 0.0 ; dTven = 0.0 ;
2607- for (iDim = 0 ; iDim < nDim; iDim++) {
2608- dTn += Grad_PrimVar[T_INDEX][iDim]*UnitNormal[iDim];
2609- dTven += Grad_PrimVar[TVE_INDEX][iDim]*UnitNormal[iDim];
2610- }
2588+ for (iSpecies = 0 ; iSpecies < nSpecies; iSpecies++)
2589+ sumJhs += Ds[iSpecies]*hs[iSpecies]*GeometryToolbox::DotProduct (nDim, Grad_PrimVar[RHOS_INDEX+iSpecies], UnitNormal);
2590+
2591+ dTn = GeometryToolbox::DotProduct (nDim, Grad_PrimVar[T_INDEX], UnitNormal);
2592+ dTven = GeometryToolbox::DotProduct (nDim, Grad_PrimVar[TVE_INDEX], UnitNormal);
26112593
26122594 /* --- Surface energy balance: trans-rot heat flux, vib-el heat flux,
26132595 enthalpy transport due to mass diffusion ---*/
0 commit comments