@@ -271,8 +271,12 @@ void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai
271271 shearStress = sqrt (shearStress);
272272
273273 const su2double FrictionVelocity = sqrt (shearStress/flowNodes->GetDensity (iPoint));
274- /* const su2double wall_dist = geometry->nodes->GetWall_Distance(jPoint);*/
274+ const su2double wall_dist_old = geometry->nodes ->GetWall_Distance (jPoint);
275+
275276 const su2double wall_dist = GetNearest_Neighbor (geometry,iPoint,iMarker,iVertex);
277+
278+ cout << " ************************* wall distance old = " << wall_dist_old << " , wall distance new = " << wall_dist << endl;
279+
276280 const su2double Derivative = flowNodes->GetLaminarViscosity (jPoint) * pow (nodes->GetSolution (jPoint, 0 ), 0.673 ) / wall_dist;
277281 const su2double turbulence_index = 6.1 * Derivative / pow (FrictionVelocity, 2.346 );
278282
@@ -462,21 +466,24 @@ void CTurbSSTSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont
462466 } else { // smooth wall
463467
464468 /* --- distance to closest neighbor ---*/
465- const auto jPoint = geometry->vertex [val_marker][iVertex]->GetNormal_Neighbor ();
466- const su2double wall_dist = GetNearest_Neighbor (geometry,iPoint,val_marker, iVertex);
469+ su2double wall_dist = GetNearest_Neighbor (geometry,iPoint,val_marker, iVertex);
467470
468- // su2double distance2 = GeometryToolbox::SquaredDistance(nDim,
469- // geometry->nodes->GetCoord(iPoint),
470- // geometry->nodes->GetCoord(jPoint));
471+ const auto jPoint = geometry->vertex [val_marker][iVertex]->GetNormal_Neighbor ();
472+ su2double distance2 = GeometryToolbox::SquaredDistance (nDim,
473+ geometry->nodes ->GetCoord (iPoint),
474+ geometry->nodes ->GetCoord (jPoint));
471475 /* --- Set wall values ---*/
472476
477+ if (wall_dist < 1.0e-12 ) {cout <<" setting walldist to " << sqrt (distance2) << endl; wall_dist = sqrt (distance2);}
478+
473479 su2double density = solver_container[FLOW_SOL]->GetNodes ()->GetDensity (jPoint);
474480 su2double laminar_viscosity = solver_container[FLOW_SOL]->GetNodes ()->GetLaminarViscosity (jPoint);
475481
476482 su2double beta_1 = constants[4 ];
477483 su2double solution[MAXNVAR];
478484 solution[0 ] = 0.0 ;
479- solution[1 ] = 60.0 *laminar_viscosity/(density*beta_1*wall_dist*wall_dist);
485+ // solution[1] = 60.0*laminar_viscosity/(density*beta_1*wall_dist*wall_dist);
486+ solution[1 ] = 60.0 *laminar_viscosity/(density*beta_1*distance2);
480487
481488 /* --- Set the solution values and zero the residual ---*/
482489 nodes->SetSolution_Old (iPoint,solution);
@@ -1040,26 +1047,24 @@ su2double CTurbSSTSolver::GetNearest_Neighbor(CGeometry *geometry, unsigned lon
10401047 /* --- Compute closest normal neighbor, note that the normal are oriented inwards ---*/
10411048 Point_Normal = 0 ;
10421049 // we use distance
1043- dist_min = 1.0e10 ;
1050+ dist_min = 0.0 ;
10441051 for (size_t iNeigh = 0 ; iNeigh < geometry->nodes ->GetnPoint (iPoint); iNeigh++) {
10451052 jPoint = geometry->nodes ->GetPoint (iPoint, iNeigh);
1046- const su2double* Coord_j = geometry->nodes ->GetCoord (jPoint);
1047-
1048- vector<su2double> edgeVector (nDim);
1049- for (unsigned short iDim = 0 ; iDim < nDim; iDim++) {
1050- edgeVector[iDim] = Coord_j[iDim] - Coord_i[iDim];
1051- // squared distance
1052- distance += edgeVector[iDim] * edgeVector[iDim];
1053- }
10541053
1054+ su2double distance2 = GeometryToolbox::SquaredDistance (nDim,
1055+ geometry->nodes ->GetCoord (iPoint),
1056+ geometry->nodes ->GetCoord (jPoint));
10551057 // Take the interior node that is closest to the wall node.
10561058 if ((geometry->nodes ->GetViscousBoundary (jPoint) == false ) && (distance < dist_min)) {
10571059 Point_Normal = jPoint;
1058- dist_min = distance ;
1060+ dist_min = sqrt (distance2) ;
10591061 }
10601062 }
10611063
1062- if (jPoint==0 ) {
1064+
1065+ // if (jPoint==0) {
1066+ if (Point_Normal==0 ) {
1067+ cout << " no point found at i = " << iPoint << endl;
10631068 su2double Area = 0.0 ;
10641069 su2double TwoVol = 2.0 * (geometry->nodes ->GetVolume (iPoint) + geometry->nodes ->GetPeriodicVolume (iPoint));
10651070 for (size_t iNeigh = 0 ; iNeigh < geometry->nodes ->GetnPoint (iPoint); ++iNeigh) {
@@ -1073,21 +1078,23 @@ su2double CTurbSSTSolver::GetNearest_Neighbor(CGeometry *geometry, unsigned lon
10731078 const su2double* Normal = geometry->edges ->GetNormal (iEdge);
10741079 Area = GeometryToolbox::Norm (nDim, Normal);
10751080
1076- // dist_min += weight * Area;
1077- dist_min += TwoVol * Area;
1081+ dist_min += TwoVol / Area;
1082+ cout << " distmin = " << dist_min << " , vol = " << TwoVol << " , Area= " << Area<< endl ;
10781083 }
1084+ cout << " distmin = " << dist_min << " , vol = " <<TwoVol << " , Area=" << Area<< endl;
1085+ dist_min = 0.0 ;
10791086 }
10801087
1081- // old value of yplus
1082- su2double yplus = GetYPlus (iMarker,iVertex);
1083- unsigned long iPointNormal = geometry->vertex [iMarker][iVertex]->GetNormal_Neighbor ();
1084- const su2double *Coord_Normal = geometry->nodes ->GetCoord (iPointNormal);
1085- const su2double *Coord = geometry->nodes ->GetCoord (iPoint);
1088+ // // old value of yplus
1089+ // su2double yplus = GetYPlus(iMarker,iVertex);
1090+ // unsigned long iPointNormal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor();
1091+ // const su2double *Coord_Normal = geometry->nodes->GetCoord(iPointNormal);
1092+ // const su2double *Coord = geometry->nodes->GetCoord(iPoint);
10861093
1087- su2double WallDistMod = GeometryToolbox::Distance (nDim, Coord, Coord_Normal);
1088- // new value of y+
1089- yplus = dist_min * (yplus / WallDistMod);
1090- SetYPlus (yplus,iMarker,iVertex);
1094+ // su2double WallDistMod = GeometryToolbox::Distance(nDim, Coord, Coord_Normal);
1095+ // // new value of y+
1096+ // yplus = dist_min * (yplus / WallDistMod);
1097+ // SetYPlus(yplus,iMarker,iVertex);
10911098
10921099 return (dist_min);
10931100}
0 commit comments