@@ -799,11 +799,11 @@ void CFlowOutput::Set_NearfieldInverseDesign(CSolver *solver, const CGeometry *g
799799 unsigned long iPoint, auxPoint, auxDomain;
800800 ofstream NearFieldEA_file; ifstream TargetEA_file;
801801
802- su2double XCoordBegin_OF = config->GetEA_IntLimit (0 );
803- su2double XCoordEnd_OF = config->GetEA_IntLimit (1 );
802+ const su2double XCoordBegin_OF = config->GetEA_IntLimit (0 );
803+ const su2double XCoordEnd_OF = config->GetEA_IntLimit (1 );
804804
805- su2double AoA = -(config->GetAoA ()*PI_NUMBER/180.0 );
806- su2double EAScaleFactor = config->GetEA_ScaleFactor (); // The EA Obj. Func. should be ~ force based Obj. Func.
805+ const su2double AoA = -(config->GetAoA ()*PI_NUMBER/180.0 );
806+ const su2double EAScaleFactor = config->GetEA_ScaleFactor (); // The EA Obj. Func. should be ~ force based Obj. Func.
807807
808808 const su2double Mach = config->GetMach ();
809809 const su2double Gamma = config->GetGamma ();
@@ -823,7 +823,7 @@ void CFlowOutput::Set_NearfieldInverseDesign(CSolver *solver, const CGeometry *g
823823 /* --- Compute the total number of points of the near-field ghost nodes ---*/
824824
825825 unsigned long nLocalVertex_NearField = 0 ;
826- for (unsignde short iMarker = 0 ; iMarker < config->GetnMarker_All (); iMarker++)
826+ for (unsigned short iMarker = 0 ; iMarker < config->GetnMarker_All (); iMarker++)
827827 if (config->GetMarker_All_KindBC (iMarker) == NEARFIELD_BOUNDARY)
828828 for (unsigned long iVertex = 0 ; iVertex < geometry->GetnVertex (iMarker); iVertex++) {
829829 iPoint = geometry->vertex [iMarker][iVertex]->GetNode ();
@@ -888,7 +888,9 @@ void CFlowOutput::Set_NearfieldInverseDesign(CSolver *solver, const CGeometry *g
888888 Buffer_Send_IdPoint[nLocalVertex_NearField] = iPoint;
889889 Buffer_Send_Xcoord[nLocalVertex_NearField] = geometry->nodes ->GetCoord (iPoint, 0 );
890890 Buffer_Send_Ycoord[nLocalVertex_NearField] = geometry->nodes ->GetCoord (iPoint, 1 );
891- Buffer_Send_Zcoord[nLocalVertex_NearField] = geometry->nodes ->GetCoord (iPoint, 2 );
891+ if (nDim == 3 ) {
892+ Buffer_Send_Zcoord[nLocalVertex_NearField] = geometry->nodes ->GetCoord (iPoint, 2 );
893+ }
892894 Buffer_Send_Pressure[nLocalVertex_NearField] = solver->GetNodes ()->GetPressure (iPoint);
893895 Buffer_Send_FaceArea[nLocalVertex_NearField] = fabs (Face_Normal[nDim-1 ]);
894896 nLocalVertex_NearField++;
@@ -920,7 +922,7 @@ void CFlowOutput::Set_NearfieldInverseDesign(CSolver *solver, const CGeometry *g
920922 vector<su2double> Weight (nVertex_NearField);
921923
922924 nVertex_NearField = 0 ;
923- for (int iProcessor = 0 ; iProcessor < size; iProcessor++)
925+ for (int iProcessor = 0 ; iProcessor < size; iProcessor++) {
924926 for (unsigned long iVertex = 0 ; iVertex < Buffer_Receive_nVertex[iProcessor]; iVertex++) {
925927 Xcoord[nVertex_NearField] = Buffer_Receive_Xcoord[iProcessor*MaxLocalVertex_NearField+iVertex];
926928 Ycoord[nVertex_NearField] = Buffer_Receive_Ycoord[iProcessor*MaxLocalVertex_NearField+iVertex];
@@ -939,8 +941,7 @@ void CFlowOutput::Set_NearfieldInverseDesign(CSolver *solver, const CGeometry *g
939941
940942 /* --- Compute the Azimuthal angle ---*/
941943
942- su2double AngleDouble; short AngleInt;
943- AngleDouble = fabs (atan (-YcoordRot/ZcoordRot)*180.0 /PI_NUMBER);
944+ const su2double AngleDouble = fabs (atan (-YcoordRot/ZcoordRot)*180.0 /PI_NUMBER);
944945
945946 /* --- Fix an azimuthal line due to misalignments of the near-field ---*/
946947
@@ -949,7 +950,7 @@ void CFlowOutput::Set_NearfieldInverseDesign(CSolver *solver, const CGeometry *g
949950 if ((AngleDouble >= FixAzimuthalLine - 0.1 ) && (AngleDouble <= FixAzimuthalLine + 0.1 ))
950951 AngleDouble = FixAzimuthalLine - 0.1 ;
951952
952- AngleInt = SU2_TYPE::Short (floor (AngleDouble + 0.5 ));
953+ const auto AngleInt = SU2_TYPE::Short (floor (AngleDouble + 0.5 ));
953954
954955 if (AngleInt >= 0 ) AzimuthalAngle[nVertex_NearField] = AngleInt;
955956 else AzimuthalAngle[nVertex_NearField] = 180 + AngleInt;
@@ -962,8 +963,8 @@ void CFlowOutput::Set_NearfieldInverseDesign(CSolver *solver, const CGeometry *g
962963 IdDomain[nVertex_NearField] = iProcessor;
963964 nVertex_NearField++;
964965 }
965-
966966 }
967+ }
967968
968969
969970 vector<short > PhiAngleList;
@@ -1010,7 +1011,7 @@ void CFlowOutput::Set_NearfieldInverseDesign(CSolver *solver, const CGeometry *g
10101011
10111012 /* --- Order the arrays (x Coordinate, Pressure, Point, and Domain) ---*/
10121013
1013- for (unsigned short iPhiAngle = 0 ; iPhiAngle < PhiAngleList.size (); iPhiAngle++)
1014+ for (unsigned long iPhiAngle = 0 ; iPhiAngle < PhiAngleList.size (); iPhiAngle++)
10141015 for (unsigned long iVertex = 0 ; iVertex < Xcoord_PhiAngle[iPhiAngle].size (); iVertex++)
10151016 for (unsigned long jVertex = 0 ; jVertex < Xcoord_PhiAngle[iPhiAngle].size () - 1 - iVertex; jVertex++)
10161017 if (Xcoord_PhiAngle[iPhiAngle][jVertex] > Xcoord_PhiAngle[iPhiAngle][jVertex+1 ]) {
@@ -1027,15 +1028,15 @@ void CFlowOutput::Set_NearfieldInverseDesign(CSolver *solver, const CGeometry *g
10271028 /* --- Check that all the azimuth lists have the same size ---*/
10281029
10291030 auto nVertex = Xcoord_PhiAngle[0 ].size ();
1030- for (unsigned short iPhiAngle = 0 ; iPhiAngle < PhiAngleList.size (); iPhiAngle++) {
1031+ for (unsigned long iPhiAngle = 0 ; iPhiAngle < PhiAngleList.size (); iPhiAngle++) {
10311032 auto nVertex_aux = Xcoord_PhiAngle[iPhiAngle].size ();
10321033 if (nVertex_aux != nVertex) cout <<" Be careful! One azimuth list is shorter than the other.\n " ;
10331034 nVertex = min (nVertex, nVertex_aux);
10341035 }
10351036
10361037 /* --- Compute equivalent area distribution at each azimuth angle ---*/
10371038
1038- for (unsigned short iPhiAngle = 0 ; iPhiAngle < PhiAngleList.size (); iPhiAngle++) {
1039+ for (unsigned long iPhiAngle = 0 ; iPhiAngle < PhiAngleList.size (); iPhiAngle++) {
10391040 EquivArea_PhiAngle[iPhiAngle][0 ] = 0.0 ;
10401041 for (unsigned long iVertex = 1 ; iVertex < EquivArea_PhiAngle[iPhiAngle].size (); iVertex++) {
10411042 EquivArea_PhiAngle[iPhiAngle][iVertex] = 0.0 ;
@@ -1106,7 +1107,7 @@ void CFlowOutput::Set_NearfieldInverseDesign(CSolver *solver, const CGeometry *g
11061107
11071108 if (TargetEA_file.fail ()) {
11081109 /* --- Set the table to 0 ---*/
1109- for (unsigned short iPhiAngle = 0 ; iPhiAngle < PhiAngleList.size (); iPhiAngle++)
1110+ for (unsigned long iPhiAngle = 0 ; iPhiAngle < PhiAngleList.size (); iPhiAngle++)
11101111 for (unsigned long iVertex = 0 ; iVertex < TargetArea_PhiAngle[iPhiAngle].size (); iVertex++)
11111112 TargetArea_PhiAngle[iPhiAngle][iVertex] = 0.0 ;
11121113 }
@@ -1144,7 +1145,7 @@ void CFlowOutput::Set_NearfieldInverseDesign(CSolver *solver, const CGeometry *g
11441145 TargetArea_PhiAngle_Trans.push_back (row);
11451146 }
11461147
1147- for (unsigned short iPhiAngle = 0 ; iPhiAngle < PhiAngleList.size (); iPhiAngle++)
1148+ for (unsigned long iPhiAngle = 0 ; iPhiAngle < PhiAngleList.size (); iPhiAngle++)
11481149 for (unsigned long iVertex = 0 ; iVertex < EquivArea_PhiAngle[iPhiAngle].size (); iVertex++)
11491150 TargetArea_PhiAngle[iPhiAngle][iVertex] = TargetArea_PhiAngle_Trans[iVertex][iPhiAngle];
11501151
@@ -1157,7 +1158,7 @@ void CFlowOutput::Set_NearfieldInverseDesign(CSolver *solver, const CGeometry *g
11571158 /* --- Evaluate the objective function ---*/
11581159
11591160 InverseDesign = 0 ;
1160- for (unsigned short iPhiAngle = 0 ; iPhiAngle < PhiAngleList.size (); iPhiAngle++)
1161+ for (unsigned long iPhiAngle = 0 ; iPhiAngle < PhiAngleList.size (); iPhiAngle++)
11611162 for (unsigned long iVertex = 0 ; iVertex < EquivArea_PhiAngle[iPhiAngle].size (); iVertex++) {
11621163 Weight_PhiAngle[iPhiAngle][iVertex] = 1.0 ;
11631164 Coord_i = Xcoord_PhiAngle[iPhiAngle][iVertex];
0 commit comments