@@ -356,16 +356,9 @@ bool CDriver::ComputeVertexForces(unsigned short iMarker, unsigned long iVertex)
356356 /* --- Parameters for the calculations ---*/
357357 // Pn: Pressure
358358 // Pinf: Pressure_infinite
359- // div_vel: Velocity divergence
360- // Dij: Dirac delta
361- su2double Pn = 0.0 , div_vel = 0.0 , Dij = 0.0 ;
359+ su2double Pn = 0.0 ;
362360 su2double Viscosity = 0.0 ;
363- su2double Grad_Vel[3 ][3 ] = { {0.0 , 0.0 , 0.0 } ,
364- {0.0 , 0.0 , 0.0 } ,
365- {0.0 , 0.0 , 0.0 } } ;
366- su2double Tau[3 ][3 ] = { {0.0 , 0.0 , 0.0 } ,
367- {0.0 , 0.0 , 0.0 } ,
368- {0.0 , 0.0 , 0.0 } } ;
361+ su2double Tau[3 ][3 ] = {{0.0 }};
369362
370363 su2double Pinf = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->GetPressure_Inf ();
371364
@@ -384,11 +377,6 @@ bool CDriver::ComputeVertexForces(unsigned short iMarker, unsigned long iVertex)
384377 /* --- Get the values of pressure and viscosity ---*/
385378 Pn = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->GetNodes ()->GetPressure (iPoint);
386379 if (viscous_flow) {
387- for (iDim=0 ; iDim<nDim; iDim++) {
388- for (jDim=0 ; jDim<nDim; jDim++) {
389- Grad_Vel[iDim][jDim] = solver_container[ZONE_0][INST_0][FinestMesh][FLOW_SOL]->GetNodes ()->GetGradient_Primitive (iPoint, iDim+1 , jDim);
390- }
391- }
392380 Viscosity = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->GetNodes ()->GetLaminarViscosity (iPoint);
393381 }
394382
@@ -399,23 +387,18 @@ bool CDriver::ComputeVertexForces(unsigned short iMarker, unsigned long iVertex)
399387
400388 /* --- Calculate the viscous (shear stress) part of tn in the fluid nodes (force units) ---*/
401389 if ((incompressible || compressible) && viscous_flow) {
402- div_vel = 0.0 ;
403- for (iDim = 0 ; iDim < nDim; iDim++)
404- div_vel += Grad_Vel[iDim][iDim];
405- if (incompressible) div_vel = 0.0 ;
406-
390+ CNumerics::ComputeStressTensor (nDim, Tau,
391+ solver_container[ZONE_0][INST_0][FinestMesh][FLOW_SOL]->GetNodes ()->GetGradient_Primitive (iPoint)+1 , Viscosity);
407392 for (iDim = 0 ; iDim < nDim; iDim++) {
408- for (jDim = 0 ; jDim < nDim; jDim++) {
409- Dij = 0.0 ; if (iDim == jDim) Dij = 1.0 ;
410- Tau[iDim][jDim] = Viscosity*(Grad_Vel[jDim][iDim] + Grad_Vel[iDim][jDim]) - TWO3*Viscosity*div_vel*Dij;
411- PyWrapNodalForce[iDim] += Tau[iDim][jDim]*Normal[jDim];
393+ for (jDim = 0 ; jDim < nDim; jDim++) {
394+ PyWrapNodalForce[iDim] += Tau[iDim][jDim]*Normal[jDim];
412395 }
413396 }
414397 }
415398
416399 // Divide by local are in case of force density communication.
417- for (iDim = 0 ; iDim < nDim; iDim++) {
418- PyWrapNodalForceDensity[iDim] = PyWrapNodalForce[iDim]/Area;
400+ for (iDim = 0 ; iDim < nDim; iDim++) {
401+ PyWrapNodalForceDensity[iDim] = PyWrapNodalForce[iDim]/Area;
419402 }
420403
421404 halo = false ;
0 commit comments