Skip to content

Commit 3150c51

Browse files
committed
MPI fixes
1 parent 771c098 commit 3150c51

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

SU2_CFD/src/interfaces/cfd/CMixingPlaneInterface.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ void CMixingPlaneInterface::BroadcastData_MixingPlane(const CInterpolator& inter
9090
}
9191
#ifdef HAVE_MPI
9292
/*--- Gather data. ---*/
93-
const auto nTotalDonors = nSpanDonor * size;
94-
const auto nSpanDonorVars = nSpanDonor * nMixingVars;
93+
const auto nTotalDonors = nSpanDonor * size; // Number of donor spans across all ranks
94+
const auto nSpanDonorVars = nSpanDonor * nMixingVars; // Number of variables to be transferred on each rank
9595
vector<unsigned long> buffDonorMarker(nTotalDonors);
96-
vector<su2double> buffDonorVar(static_cast<unsigned long>(nTotalDonors) * nMixingVars);
96+
vector<su2double> buffDonorVar(static_cast<unsigned long>(nTotalDonors) * nMixingVars); // Total number of variables to be transferred on all ranks
9797

9898
SU2_MPI::Allgather(sendDonorMarker.data(), nSpanDonor, MPI_UNSIGNED_SHORT,
9999
buffDonorMarker.data(), nSpanDonor, MPI_UNSIGNED_SHORT,
@@ -106,7 +106,7 @@ void CMixingPlaneInterface::BroadcastData_MixingPlane(const CInterpolator& inter
106106
for (auto iSize = 0; iSize < size; iSize++){
107107
if (buffDonorVar[static_cast<size_t>(nSpanDonorVars) * iSize] > 0.0) {
108108
for (auto iSpan = 0ul; iSpan < nSpanDonor; iSpan++){
109-
for (auto iVar = 0u; iVar < nMixingVars; iVar++) sendDonorVar[iSpan * nMixingVars + iVar] = buffDonorVar[static_cast<size_t>(iSize) * nSpanDonorVars + iVar]; // This could be wrong in 3D
109+
for (auto iVar = 0u; iVar < nMixingVars; iVar++) sendDonorVar[iSpan * nMixingVars + iVar] = buffDonorVar[static_cast<size_t>(iSize) * nSpanDonorVars + iSpan * nMixingVars + iVar];
110110
}
111111
markDonor = buffDonorMarker[static_cast<unsigned long>(iSize) * static_cast<unsigned long>(nSpanDonor)];
112112
}
@@ -197,8 +197,9 @@ void CMixingPlaneInterface::SetTarget_Variable(CSolver *target_solution, CGeomet
197197

198198
iDonorSpan = target_solution->GetnMixingStates(Marker_Target, Span_Target);
199199

200-
for (iVar = 0; iVar < nMixingVars; iVar++)
200+
for (iVar = 0; iVar < nMixingVars; iVar++) {
201201
target_solution->SetMixingState(Marker_Target, Span_Target, iVar, Target_Variable[iVar]);
202+
}
202203

203204
target_solution->SetnMixingStates( Marker_Target, Span_Target, iDonorSpan + 1 );
204205
}

0 commit comments

Comments
 (0)