Skip to content

Commit e4dc3aa

Browse files
committed
remove a few HAVE_MPI's, address more than a few compiler warnings
1 parent bfa204d commit e4dc3aa

13 files changed

Lines changed: 30 additions & 69 deletions

File tree

Common/src/grid_movement/CVolumetricMovement.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ void CVolumetricMovement::ComputenNonconvexElements(CGeometry *geometry, bool Sc
353353
nNonconvexElements++;
354354
}
355355
}
356-
} else {
356+
} else if (false) {
357357

358358
/*--- 3D elements ---*/
359359
unsigned short iNode, iFace, nFaceNodes;
@@ -371,6 +371,8 @@ void CVolumetricMovement::ComputenNonconvexElements(CGeometry *geometry, bool Sc
371371

372372
face_point_i = geometry->elem[iElem]->GetNode(geometry->elem[iElem]->GetFaces(iFace, iNode));
373373

374+
/// TODO: Faces may have up to 4 nodes, not all posibilities are covered
375+
374376
if (iNode == 0) {
375377
face_point_j = geometry->elem[iElem]->GetNode(geometry->elem[iElem]->GetFaces(iFace, nFaceNodes-1));
376378
face_point_k = geometry->elem[iElem]->GetNode(geometry->elem[iElem]->GetFaces(iFace, iNode+1));
@@ -391,6 +393,9 @@ void CVolumetricMovement::ComputenNonconvexElements(CGeometry *geometry, bool Sc
391393
/*--- Calculate cross product of edge vectors and its length---*/
392394
su2double crossProduct[3];
393395
GeometryToolbox::CrossProduct(edgeVector_i, edgeVector_j, crossProduct);
396+
397+
/// TODO: This logic is incorrect, the norm will never be less than 0
398+
394399
crossProductLength = GeometryToolbox::Norm(nDim, crossProduct);
395400

396401
/*--- Check if length is minimum or maximum ---*/

SU2_CFD/include/numerics/NEMO/NEMO_diffusion.hpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
*/
3939
class CAvgGrad_NEMO : public CNEMONumerics {
4040
private:
41-
unsigned short iDim, iVar; /*!< \brief Iterators in dimension an variable. */
42-
su2double *Mean_PrimVar, /*!< \brief Mean primitive variables. */
41+
unsigned short iVar; /*!< \brief Iterators in dimension an variable. */
42+
su2double *Mean_PrimVar, /*!< \brief Mean primitive variables. */
4343
*Mean_U,
4444
**Mean_GU,
4545
*Mean_dTdU,
@@ -54,9 +54,8 @@ class CAvgGrad_NEMO : public CNEMONumerics {
5454
Mean_Eddy_Viscosity, /*!< \brief Mean value of the eddy viscosity. */
5555
Mean_Thermal_Conductivity, /*!< \brief Mean value of the thermal conductivity. */
5656
Mean_Thermal_Conductivity_ve, /*!< \brief Mean value of the vib-el. thermal conductivity. */
57-
*ProjFlux, /*!< \brief Projection of the viscous fluxes. */
5857
dist_ij; /*!< \brief Length of the edge and face. */
59-
58+
6059
public:
6160

6261
/*!
@@ -109,13 +108,11 @@ class CAvgGradCorrected_NEMO : public CNEMONumerics {
109108
Mean_Eddy_Viscosity, /*!< \brief Mean value of the eddy viscosity. */
110109
Mean_Thermal_Conductivity, /*!< \brief Mean value of the thermal conductivity. */
111110
Mean_Thermal_Conductivity_ve, /*!< \brief Mean value of the vib-el. thermal conductivity. */
112-
113-
*ProjFlux, /*!< \brief Projection of the viscous fluxes. */
114111
dist_ij; /*!< \brief Length of the edge and face. */
115112
bool implicit; /*!< \brief Implicit calculus. */
116113

117114
su2double* Flux = nullptr; /*!< \brief The flux / residual across the edge. */
118-
115+
119116
public:
120117

121118
/*!
@@ -142,5 +139,5 @@ class CAvgGradCorrected_NEMO : public CNEMONumerics {
142139
* \param[in] config - Definition of the particular problem.
143140
*/
144141
ResidualType<> ComputeResidual(const CConfig* config) final;
145-
142+
146143
};

SU2_CFD/include/solvers/CDiscAdjFEASolver.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ class CDiscAdjFEASolver final : public CSolver {
4848
su2double *Solution_Vel = nullptr, /*!< \brief Velocity componenent of the solution. */
4949
*Solution_Accel = nullptr; /*!< \brief Acceleration componenent of the solution. */
5050

51-
su2double ObjFunc_Value = 0.0; /*!< \brief Value of the objective function. */
5251
su2double *normalLoads = nullptr; /*!< \brief Values of the normal loads for each marker iMarker_nL. */
5352

5453
unsigned short nMPROP = 0; /*!< \brief Number of material properties */

SU2_CFD/include/solvers/CDiscAdjMeshSolver.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
*/
4040
class CDiscAdjMeshSolver final : public CSolver {
4141
private:
42-
unsigned short KindDirect_Solver = 0;
4342
CSolver *direct_solver = nullptr;
4443

4544
CDiscAdjMeshBoundVariable* nodes = nullptr; /*!< \brief Variables of the discrete adjoint mesh solver. */

SU2_CFD/include/solvers/CDiscAdjSolver.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ class CDiscAdjSolver final : public CSolver {
4949
su2double Total_Sens_BPress; /*!< \brief Total sensitivity to outlet pressure. */
5050
su2double Total_Sens_Density; /*!< \brief Total sensitivity to initial density (incompressible). */
5151
su2double Total_Sens_ModVel; /*!< \brief Total sensitivity to inlet velocity (incompressible). */
52-
su2double ObjFunc_Value; /*!< \brief Value of the objective function. */
5352
su2double Mach, Alpha, Beta, Pressure, Temperature, BPressure, ModVel;
5453
su2double TemperatureRad, Total_Sens_Temp_Rad;
5554

SU2_CFD/include/variables/CNEMOEulerVariable.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,23 @@ class CNEMOEulerVariable : public CVariable {
4545

4646
bool ionization; /*!< \brief Presence of charged species in gas mixture. */
4747
bool monoatomic = false; /*!< \brief Presence of single species gas. */
48-
48+
4949
VectorType Velocity2; /*!< \brief Square of the velocity vector. */
5050
MatrixType Precond_Beta; /*!< \brief Low Mach number preconditioner value, Beta. */
5151

5252
CVectorOfMatrix& Gradient_Reconstruction; /*!< \brief Reference to the gradient of the conservative variables for MUSCL reconstruction for the convective term */
5353
CVectorOfMatrix Gradient_Aux; /*!< \brief Auxiliary structure to store a second gradient for reconstruction, if required. */
54-
54+
5555
/*--- Primitive variable definition ---*/
5656
MatrixType Primitive; /*!< \brief Primitive variables (rhos_s, T, Tve, ...) in compressible flows. */
5757
MatrixType Primitive_Aux; /*!< \brief Primitive auxiliary variables (Y_s, T, Tve, ...) in compressible flows. */
5858
CVectorOfMatrix Gradient_Primitive; /*!< \brief Gradient of the primitive variables (rhos_s, T, Tve, ...). */
5959
MatrixType Limiter_Primitive; /*!< \brief Limiter of the primitive variables (rhos_s, T, Tve, ...). */
60-
60+
6161
/*--- Secondary variable definition ---*/
6262
MatrixType Secondary; /*!< \brief Primitive variables (T, vx, vy, vz, P, rho, h, c) in compressible flows. */
6363
CVectorOfMatrix Gradient_Secondary; /*!< \brief Gradient of the primitive variables (T, vx, vy, vz, P, rho). */
64-
64+
6565
/*--- New solution container for Classical RK4 ---*/
6666
MatrixType Solution_New; /*!< \brief New solution container for Classical RK4. */
6767

@@ -72,11 +72,11 @@ class CNEMOEulerVariable : public CVariable {
7272
MatrixType eves; /*!< \brief energy of vib-el mode w.r.t. species. */
7373
MatrixType Cvves; /*!< \brief Specific heat of vib-el mode w.r.t. species. */
7474
VectorType Gamma; /*!< \brief Ratio of specific heats. */
75-
75+
7676
CNEMOGas *fluidmodel;
7777

7878
/*!< \brief Index definition for NEMO pritimive variables. */
79-
unsigned long RHOS_INDEX, T_INDEX, TVE_INDEX, VEL_INDEX, P_INDEX,
79+
unsigned long RHOS_INDEX, T_INDEX, TVE_INDEX, VEL_INDEX, P_INDEX,
8080
RHO_INDEX, H_INDEX, A_INDEX, RHOCVTR_INDEX, RHOCVVE_INDEX,
8181
LAM_VISC_INDEX, EDDY_VISC_INDEX, nSpecies;
8282

@@ -513,7 +513,7 @@ class CNEMOEulerVariable : public CVariable {
513513
* \param[in] val_Species - Index of species s.
514514
* \return Value of the mass fraction of species s.
515515
*/
516-
inline su2double GetMassFraction(unsigned long iPoint, unsigned short val_Species) const {
516+
inline su2double GetMassFraction(unsigned long iPoint, unsigned long val_Species) const override {
517517
return Primitive(iPoint,RHOS_INDEX+val_Species) / Primitive(iPoint,RHO_INDEX);
518518
}
519519

@@ -575,5 +575,5 @@ class CNEMOEulerVariable : public CVariable {
575575
* \brief Retrieves the value of the RhoCvve in the primitive variable vector.
576576
*/
577577
inline unsigned short GetRhoCvveIndex(void) { return RHOCVVE_INDEX; }
578-
578+
579579
};

SU2_CFD/src/SU2_CFD.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ int main(int argc, char *argv[]) {
6060

6161
/*--- MPI initialization, and buffer setting ---*/
6262

63-
#ifdef HAVE_MPI
6463
#ifdef HAVE_OMP
6564
int required = use_thread_mult? MPI_THREAD_MULTIPLE : MPI_THREAD_FUNNELED;
6665
int provided;
@@ -69,9 +68,6 @@ int main(int argc, char *argv[]) {
6968
SU2_MPI::Init(&argc, &argv);
7069
#endif
7170
SU2_Comm MPICommunicator(MPI_COMM_WORLD);
72-
#else
73-
SU2_Comm MPICommunicator(0);
74-
#endif
7571

7672
/*--- Uncomment the following line if runtime NaN catching is desired. ---*/
7773
// feenableexcept(FE_INVALID | FE_OVERFLOW);

SU2_CFD/src/solvers/CNEMOEulerSolver.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,22 +219,22 @@ CNEMOEulerSolver::CNEMOEulerSolver(CGeometry *geometry, CConfig *config,
219219
counter_local = 0;
220220

221221
for (iPoint = 0; iPoint < nPoint; iPoint++) {
222-
222+
223223
nonPhys = nodes->SetPrimVar(iPoint, FluidModel);
224-
224+
225225
/*--- Set mixture state ---*/
226-
FluidModel->SetTDStatePTTv(Pressure_Inf, MassFrac_Inf, Temperature_Inf, Temperature_ve_Inf);
226+
FluidModel->SetTDStatePTTv(Pressure_Inf, MassFrac_Inf, Temperature_Inf, Temperature_ve_Inf);
227227

228228
/*--- Compute other freestream quantities ---*/
229229
Density_Inf = FluidModel->GetDensity();
230230
Soundspeed_Inf = FluidModel->GetSoundSpeed();
231-
231+
232232
sqvel = 0.0;
233233
for (iDim = 0; iDim < nDim; iDim++){
234234
sqvel += Mvec_Inf[iDim]*Soundspeed_Inf * Mvec_Inf[iDim]*Soundspeed_Inf;
235235
}
236236
const auto& Energies_Inf = FluidModel->ComputeMixtureEnergies();
237-
237+
238238
/*--- Initialize Solution & Solution_Old vectors ---*/
239239
for (iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
240240
Solution[iSpecies] = Density_Inf*MassFrac_Inf[iSpecies];
@@ -246,9 +246,9 @@ CNEMOEulerSolver::CNEMOEulerSolver(CGeometry *geometry, CConfig *config,
246246
Solution[nSpecies+nDim+1] = Density_Inf*Energies_Inf[1];
247247
nodes->SetSolution(iPoint,Solution);
248248
nodes->SetSolution_Old(iPoint,Solution);
249-
249+
250250
if(nonPhys)
251-
counter_local++;
251+
counter_local++;
252252
}
253253

254254
/*--- Warning message about non-physical points ---*/
@@ -614,6 +614,7 @@ void CNEMOEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_contai
614614
SU2_OMP_MASTER
615615
if (config->GetComm_Level() == COMM_FULL) {
616616
su2double rbuf_time;
617+
SU2_MPI::Allreduce(&Min_Delta_Time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
617618
Min_Delta_Time = rbuf_time;
618619

619620
SU2_MPI::Allreduce(&Max_Delta_Time, &rbuf_time, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
@@ -1501,7 +1502,7 @@ void CNEMOEulerSolver::SetNondimensionalization(CConfig *config, unsigned short
15011502
#else
15021503
SU2_MPI::Error(string("Either 1) Mutation++ has not been configured/compiled (add '-Denable-mpp=true' to your meson string) or 2) CODI must be deactivated since it is not compatible with Mutation++."),
15031504
CURRENT_FUNCTION);
1504-
#endif
1505+
#endif
15051506
break;
15061507
case SU2_NONEQ:
15071508
FluidModel = new CSU2TCLib(config, nDim, viscous);

SU2_DEF/src/SU2_DEF.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,13 @@ int main(int argc, char *argv[]) {
3939

4040
/*--- MPI initialization ---*/
4141

42-
#ifdef HAVE_MPI
4342
#ifdef HAVE_OMP
4443
int provided;
4544
SU2_MPI::Init_thread(&argc, &argv, MPI_THREAD_FUNNELED, &provided);
4645
#else
4746
SU2_MPI::Init(&argc, &argv);
4847
#endif
4948
SU2_MPI::Comm MPICommunicator(MPI_COMM_WORLD);
50-
#else
51-
SU2_Comm MPICommunicator(0);
52-
#endif
5349

5450
rank = SU2_MPI::GetRank();
5551
size = SU2_MPI::GetSize();
@@ -502,10 +498,7 @@ int main(int argc, char *argv[]) {
502498
cout << endl << "------------------------- Exit Success (SU2_DEF) ------------------------" << endl << endl;
503499

504500
/*--- Finalize MPI parallelization ---*/
505-
506-
#ifdef HAVE_MPI
507501
SU2_MPI::Finalize();
508-
#endif
509502

510503
return EXIT_SUCCESS;
511504

SU2_DOT/src/SU2_DOT.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,13 @@ int main(int argc, char *argv[]) {
3838

3939
/*--- MPI initialization, and buffer setting ---*/
4040

41-
#ifdef HAVE_MPI
4241
#ifdef HAVE_OMP
4342
int provided;
4443
SU2_MPI::Init_thread(&argc, &argv, MPI_THREAD_FUNNELED, &provided);
4544
#else
4645
SU2_MPI::Init(&argc, &argv);
4746
#endif
4847
SU2_MPI::Comm MPICommunicator(MPI_COMM_WORLD);
49-
#else
50-
SU2_Comm MPICommunicator(0);
51-
#endif
5248

5349
const int rank = SU2_MPI::GetRank();
5450
const int size = SU2_MPI::GetSize();
@@ -407,10 +403,7 @@ int main(int argc, char *argv[]) {
407403
cout << "\n------------------------- Exit Success (SU2_DOT) ------------------------\n" << endl;
408404

409405
/*--- Finalize MPI parallelization ---*/
410-
411-
#ifdef HAVE_MPI
412406
SU2_MPI::Finalize();
413-
#endif
414407

415408
return EXIT_SUCCESS;
416409

@@ -777,11 +770,8 @@ void SetProjection_AD(CGeometry *geometry, CConfig *config, CSurfaceMovement *su
777770
for (iDV_Value = 0; iDV_Value < nDV_Value; iDV_Value++){
778771
DV_Value = config->GetDV_Value(iDV, iDV_Value);
779772
my_Gradient = SU2_TYPE::GetDerivative(DV_Value);
780-
#ifdef HAVE_MPI
781-
SU2_MPI::Allreduce(&my_Gradient, &localGradient, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
782-
#else
783-
localGradient = my_Gradient;
784-
#endif
773+
SU2_MPI::Allreduce(&my_Gradient, &localGradient, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
774+
785775
/*--- Angle of Attack design variable (this is different,
786776
the value comes form the input file) ---*/
787777

0 commit comments

Comments
 (0)