Skip to content

Commit e598597

Browse files
committed
Remove deprecated functions, fix MPI in MP preprocessing
1 parent 80027e8 commit e598597

6 files changed

Lines changed: 53 additions & 83 deletions

File tree

SU2_CFD/include/interfaces/CInterface.hpp

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -200,39 +200,6 @@ class CInterface {
200200
CGeometry *donor_geometry, CGeometry *target_geometry,
201201
const CConfig *donor_config, const CConfig *target_config) { };
202202

203-
/*!
204-
* \brief Transfer pre-processing for the mixing plane inteface.
205-
* \param[in] donor_geometry - Geometry of the donor mesh.
206-
* \param[in] target_geometry - Geometry of the target mesh.
207-
* \param[in] donor_config - Definition of the problem at the donor mesh.
208-
* \param[in] target_config - Definition of the problem at the target mesh.
209-
*/
210-
void PreprocessAverage(CGeometry *donor_geometry, CGeometry *target_geometry,
211-
const CConfig *donor_config, const CConfig *target_config, unsigned short iMarkerInt);
212-
213-
/*!
214-
* \brief Interpolate data and scatter it into different processors, for matching meshes.
215-
* \param[in] donor_solution - Solution from the donor mesh.
216-
* \param[in] target_solution - Solution from the target mesh.
217-
* \param[in] donor_geometry - Geometry of the donor mesh.
218-
* \param[in] target_geometry - Geometry of the target mesh.
219-
* \param[in] donor_config - Definition of the problem at the donor mesh.
220-
* \param[in] target_config - Definition of the problem at the target mesh.
221-
*/
222-
void AllgatherAverage(CSolver *donor_solution, CSolver *target_solution,
223-
CGeometry *donor_geometry, CGeometry *target_geometry,
224-
const CConfig *donor_config, const CConfig *target_config, unsigned short iMarkerInt);
225-
226-
/*!
227-
* \brief Interpolate data and scatter it into different processors, for matching meshes.
228-
* \param[in] donor_solution - Solution from the donor mesh.
229-
* \param[in] target_solution - Solution from the target mesh.
230-
* \param[in] donor_geometry - Geometry of the donor mesh.
231-
* \param[in] target_geometry - Geometry of the target mesh.
232-
* \param[in] donor_config - Definition of the problem at the donor mesh.
233-
* \param[in] target_config - Definition of the problem at the target mesh.
234-
*/
235-
void GatherAverageValues(CSolver *donor_solution, CSolver *target_solution, unsigned short donorZone);
236203

237204
/*!
238205
* \brief Set the contact resistance value for the solid-to-solid heat transfer interface.

SU2_CFD/src/drivers/CDriver.cpp

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2666,8 +2666,8 @@ void CDriver::PreprocessTurbomachinery(CConfig** config, CGeometry**** geometry,
26662666
geometry[iZone][INST_0][MESH_0]->GatherInOutAverageValues(config[iZone], true);
26672667
}
26682668

2669-
if (rank == MASTER_NODE && !dummy) {
2670-
cout<<"Initialize solver containers for average quantities." << endl;
2669+
if (rank == MASTER_NODE) cout<<"Initialize solver containers for average quantities." << endl;
2670+
if (!dummy){
26712671
for (iZone = 0; iZone < nZone; iZone++) {
26722672
solver[iZone][INST_0][MESH_0][FLOW_SOL]->InitTurboContainers(geometry[iZone][INST_0][MESH_0],config, iZone);
26732673
}
@@ -2708,25 +2708,23 @@ void CDriver::PreprocessTurbomachinery(CConfig** config, CGeometry**** geometry,
27082708
}
27092709
}
27102710

2711-
if (rank == MASTER_NODE && !dummy){
2712-
cout<<"Initialize inflow and outflow average solution quantities." << endl;
2713-
for(iZone = 0; iZone < nZone; iZone++) {
2714-
solver[iZone][INST_0][MESH_0][FLOW_SOL]->PreprocessAverage(solver[iZone][INST_0][MESH_0], geometry[iZone][INST_0][MESH_0],config[iZone],INFLOW);
2715-
solver[iZone][INST_0][MESH_0][FLOW_SOL]->PreprocessAverage(solver[iZone][INST_0][MESH_0], geometry[iZone][INST_0][MESH_0],config[iZone],OUTFLOW);
2716-
solver[iZone][INST_0][MESH_0][FLOW_SOL]->TurboAverageProcess(solver[iZone][INST_0][MESH_0], geometry[iZone][INST_0][MESH_0],config[iZone],INFLOW);
2717-
solver[iZone][INST_0][MESH_0][FLOW_SOL]->TurboAverageProcess(solver[iZone][INST_0][MESH_0], geometry[iZone][INST_0][MESH_0],config[iZone],OUTFLOW);
2718-
solver[iZone][INST_0][MESH_0][FLOW_SOL]->GatherInOutAverageValues(config[iZone], geometry[iZone][INST_0][MESH_0]);
2719-
if (rank == MASTER_NODE){
2720-
flowAngleIn = solver[iZone][INST_0][MESH_0][FLOW_SOL]->GetTurboVelocityIn(iZone, config[iZone]->GetnSpanWiseSections())[1];
2721-
flowAngleIn /= solver[iZone][INST_0][MESH_0][FLOW_SOL]->GetTurboVelocityIn(iZone, config[iZone]->GetnSpanWiseSections())[0];
2722-
flowAngleIn = atan(flowAngleIn)*180.0/PI_NUMBER;
2723-
cout << "Inlet flow angle for Row "<< iZone + 1<< ": "<< flowAngleIn <<"°." <<endl;
2724-
flowAngleOut = solver[iZone][INST_0][MESH_0][FLOW_SOL]->GetTurboVelocityOut(iZone, config[iZone]->GetnSpanWiseSections())[1];
2725-
flowAngleOut /= solver[iZone][INST_0][MESH_0][FLOW_SOL]->GetTurboVelocityOut(iZone, config[iZone]->GetnSpanWiseSections())[0];
2726-
flowAngleOut = atan(flowAngleOut)*180.0/PI_NUMBER;
2727-
cout << "Outlet flow angle for Row "<< iZone + 1<< ": "<< flowAngleOut <<"°." <<endl;
2728-
2729-
}
2711+
if (dummy) return; // No need to go further for a dummy run
2712+
if (rank == MASTER_NODE) cout<<"Initialize inflow and outflow average solution quantities." << endl;
2713+
for(iZone = 0; iZone < nZone; iZone++) {
2714+
solver[iZone][INST_0][MESH_0][FLOW_SOL]->PreprocessAverage(solver[iZone][INST_0][MESH_0], geometry[iZone][INST_0][MESH_0],config[iZone],INFLOW);
2715+
solver[iZone][INST_0][MESH_0][FLOW_SOL]->PreprocessAverage(solver[iZone][INST_0][MESH_0], geometry[iZone][INST_0][MESH_0],config[iZone],OUTFLOW);
2716+
solver[iZone][INST_0][MESH_0][FLOW_SOL]->TurboAverageProcess(solver[iZone][INST_0][MESH_0], geometry[iZone][INST_0][MESH_0],config[iZone],INFLOW);
2717+
solver[iZone][INST_0][MESH_0][FLOW_SOL]->TurboAverageProcess(solver[iZone][INST_0][MESH_0], geometry[iZone][INST_0][MESH_0],config[iZone],OUTFLOW);
2718+
solver[iZone][INST_0][MESH_0][FLOW_SOL]->GatherInOutAverageValues(config[iZone], geometry[iZone][INST_0][MESH_0]);
2719+
if (rank == MASTER_NODE){
2720+
flowAngleIn = solver[iZone][INST_0][MESH_0][FLOW_SOL]->GetTurboVelocityIn(iZone, config[iZone]->GetnSpanWiseSections())[1];
2721+
flowAngleIn /= solver[iZone][INST_0][MESH_0][FLOW_SOL]->GetTurboVelocityIn(iZone, config[iZone]->GetnSpanWiseSections())[0];
2722+
flowAngleIn = atan(flowAngleIn)*180.0/PI_NUMBER;
2723+
cout << "Inlet flow angle for Row "<< iZone + 1<< ": "<< flowAngleIn <<"°." <<endl;
2724+
flowAngleOut = solver[iZone][INST_0][MESH_0][FLOW_SOL]->GetTurboVelocityOut(iZone, config[iZone]->GetnSpanWiseSections())[1];
2725+
flowAngleOut /= solver[iZone][INST_0][MESH_0][FLOW_SOL]->GetTurboVelocityOut(iZone, config[iZone]->GetnSpanWiseSections())[0];
2726+
flowAngleOut = atan(flowAngleOut)*180.0/PI_NUMBER;
2727+
cout << "Outlet flow angle for Row "<< iZone + 1<< ": "<< flowAngleOut <<"°." <<endl;
27302728
}
27312729
}
27322730
}

SU2_CFD/src/numerics/flow/convection/roe.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ CNumerics::ResidualType<> CUpwRoeBase_Flow::ComputeResidual(const CConfig* confi
244244
}
245245

246246
AD::SetPreaccOut(Flux, nVar);
247+
AD::SetPreaccOut(Jacobian_i, nVar, nVar);
248+
AD::SetPreaccOut(Jacobian_j, nVar, nVar);
247249
AD::EndPreacc();
248250

249251
return ResidualType<>(Flux, Jacobian_i, Jacobian_j);

SU2_CFD/src/output/CFlowCompOutput.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ void CFlowCompOutput::SetTurboPerformance_Output(std::vector<std::shared_ptr<CTu
542542
TurboInOut << "Mass Flow " << BladePerf->GetInletState().GetMassFlow() << BladePerf->GetOutletState().GetMassFlow();
543543
TurboInOut << "Mach " << BladePerf->GetInletState().GetMachValue() << BladePerf->GetOutletState().GetMachValue();
544544
TurboInOut << "Abs Flow Angle " << BladePerf->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER << BladePerf->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER;
545+
TurboInOut << "Rel Flow Angle " << BladePerf->GetInletState().GetFlowAngle()*180/PI_NUMBER << BladePerf->GetOutletState().GetFlowAngle()*180/PI_NUMBER;
545546
TurboInOut.PrintFooter();
546547
}
547548
cout<<TurboInOutTable.str();
@@ -609,6 +610,8 @@ void CFlowCompOutput::LoadTurboHistoryData(std::shared_ptr<CTurbomachineryStageP
609610
SetHistoryOutputValue("MachOut_" + tag.str(), BladePerf->GetOutletState().GetMachValue());
610611
SetHistoryOutputValue("AbsFlowAngleIn_" + tag.str(), BladePerf->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER);
611612
SetHistoryOutputValue("AbsFlowAngleOut_" + tag.str(), BladePerf->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER);
613+
SetHistoryOutputValue("RelFlowAngleIn_" + tag.str(), BladePerf->GetInletState().GetFlowAngle()*180/PI_NUMBER);
614+
SetHistoryOutputValue("RelFlowAngleOut_" + tag.str(), BladePerf->GetOutletState().GetFlowAngle()*180/PI_NUMBER);
612615
SetHistoryOutputValue("KineticEnergyLoss_" + tag.str(), BladePerf->GetKineticEnergyLoss());
613616
SetHistoryOutputValue("TotPressureLoss_" + tag.str(), BladePerf->GetTotalPressureLoss());
614617
}

SU2_CFD/src/output/CFlowOutput.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4096,6 +4096,8 @@ void CFlowOutput::AddTurboOutput(unsigned short nZone){
40964096
AddHistoryOutput("MachOut_" + tag, "MachOut_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag, HistoryFieldType::DEFAULT);
40974097
AddHistoryOutput("AbsFlowAngleIn_" + tag, "AbsFlowAngleIn_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle in " + tag, HistoryFieldType::DEFAULT);
40984098
AddHistoryOutput("AbsFlowAngleOut_" + tag, "AbsFlowAngleOut_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle out " + tag, HistoryFieldType::DEFAULT);
4099+
AddHistoryOutput("RelFlowAngleIn_" + tag, "RelFlowAngleIn_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Relative flow angle in " + tag, HistoryFieldType::DEFAULT);
4100+
AddHistoryOutput("RelFlowAngleOut_" + tag, "RelFlowAngleOut_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Relative flow angle out " + tag, HistoryFieldType::DEFAULT);
40994101
AddHistoryOutput("KineticEnergyLoss_" + tag, "KELC_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Blade Kinetic Energy Loss Coefficient", HistoryFieldType::DEFAULT);
41004102
AddHistoryOutput("TotPressureLoss_" + tag, "TPLC_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Blade Pressure Loss Coefficient", HistoryFieldType::DEFAULT);
41014103
}

SU2_CFD/src/solvers/CEulerSolver.cpp

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -462,15 +462,14 @@ void CEulerSolver::InitTurboContainers(CGeometry *geometry, CConfig **config_con
462462
ExtAverageTurboVelocity.resize(nDim);
463463
for (auto iDim = 0u; iDim < nDim; iDim++) ExtAverageTurboVelocity[iDim] = su2double(0.0);
464464

465-
auto nMarkerInterface = config->GetnMarker_ZoneInterface();
466-
467-
MixingState.resize(nMarkerInterface);
468-
MixingStateNodes.resize(nMarkerInterface);
469-
470-
for (unsigned long iMarker = 0; iMarker < nMarkerInterface; iMarker++) {
471-
if (config->GetMarker_All_KindBC(iMarker) == GILES_BOUNDARY) {
472-
MixingState[iMarker].resize(nSpanWiseSections+1);
473-
MixingStateNodes[iMarker].resize(nSpanWiseSections+1);
465+
MixingState.resize(nMarker);
466+
MixingStateNodes.resize(nMarker);
467+
468+
for (auto iMarkerInt = 1u; iMarkerInt < config->GetnMarker_MixingPlaneInterface()/2 + 1; iMarkerInt++) {
469+
auto iMarkerMP = config->FindMixingPlaneInterfaceMarker(geometry->GetnMarker(), iMarkerInt);
470+
if (iMarkerMP != -1) {
471+
MixingState[iMarkerMP].resize(nSpanWiseSections+1);
472+
MixingStateNodes[iMarkerMP].resize(nSpanWiseSections+1);
474473
}
475474
}
476475

@@ -8919,35 +8918,34 @@ void CEulerSolver::PreprocessAverage(CSolver **solver, CGeometry *geometry, CCon
89198918

89208919
#ifdef HAVE_MPI
89218920

8922-
/*--- Add information using all the nodes ---*/
8923-
8924-
su2double MyTotalAreaDensity = TotalAreaDensity;
8925-
su2double MyTotalAreaPressure = TotalAreaPressure;
8926-
su2double MyTotalAreaNu = TotalAreaNu;
8927-
su2double MyTotalAreaKine = TotalAreaKine;
8928-
su2double MyTotalAreaOmega = TotalAreaOmega;
8921+
auto Allreduce = [](su2double x) {
8922+
su2double tmp = x; x = 0.0;
8923+
SU2_MPI::Allreduce(&tmp, &x, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm());
8924+
return x;
8925+
};
89298926

8930-
SU2_MPI::Allreduce(&MyTotalAreaDensity, &TotalAreaDensity, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm());
8931-
SU2_MPI::Allreduce(&MyTotalAreaPressure, &TotalAreaPressure, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm());
8932-
SU2_MPI::Allreduce(&MyTotalAreaNu, &TotalAreaNu, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm());
8933-
SU2_MPI::Allreduce(&MyTotalAreaKine, &TotalAreaKine, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm());
8934-
SU2_MPI::Allreduce(&MyTotalAreaOmega, &TotalAreaOmega, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm());
8927+
/*--- Add information using all the nodes ---*/
89358928

8936-
auto* MyTotalAreaVelocity = new su2double[nDim];
8929+
TotalAreaDensity = Allreduce(TotalAreaDensity);
8930+
TotalAreaPressure = Allreduce(TotalAreaPressure);
8931+
TotalAreaNu = Allreduce(TotalAreaNu);
8932+
TotalAreaKine = Allreduce(TotalAreaKine);
8933+
TotalAreaOmega = Allreduce(TotalAreaOmega);
89378934

8938-
for (auto iDim = 0u; iDim < nDim; iDim++) {
8939-
MyTotalAreaVelocity[iDim] = TotalAreaVelocity[iDim];
8940-
}
8935+
auto* buffer = new su2double[nDim];
89418936

8942-
SU2_MPI::Allreduce(MyTotalAreaVelocity, TotalAreaVelocity, nDim, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm());
8937+
auto Allreduce_inplace = [buffer](int size, su2double* x) {
8938+
SU2_MPI::Allreduce(x, buffer, size, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm());
8939+
for(int i=0; i<size; ++i) x[i] = buffer[i];
8940+
};
89438941

8944-
delete [] MyTotalAreaVelocity;
8942+
Allreduce_inplace(nDim, TotalAreaVelocity);
89458943

8944+
delete [] buffer;
8945+
89468946
#endif
89478947

89488948
/*--- initialize spanwise average quantities ---*/
8949-
8950-
89518949
for (auto iMarker = 0u; iMarker < config->GetnMarker_All(); iMarker++){
89528950
for (auto iMarkerTP=1; iMarkerTP < config->GetnMarker_Turbomachinery()+1; iMarkerTP++){
89538951
if (config->GetMarker_All_Turbomachinery(iMarker) == iMarkerTP){

0 commit comments

Comments
 (0)