@@ -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