Add communication when multiplying with the matrix duneB_ in recoverSolutionWell

Here we go from cells to segments, and everything concerning segments is stored globally.
This commit is contained in:
Lisa Julia Nebel 2024-10-17 14:01:55 +02:00
parent 81a5da8b63
commit 627b9c98ba

View File

@ -212,9 +212,20 @@ template<class Scalar, int numWellEq, int numEq>
void MultisegmentWellEquations<Scalar,numWellEq,numEq>::
recoverSolutionWell(const BVector& x, BVectorWell& xw) const
{
BVectorWell resWell = resWell_;
// resWell = resWell - B * x
duneB_.mmv(x, resWell);
BVectorWell resWell = resWell_;
if (this->pw_info_.communication().size() == 1) {
duneB_.mmv(x, resWell);
} else {
BVectorWell Bx(duneB_.N());
duneB_.mv(x, Bx);
// We need to communicate here to get the contributions from all segments
this->pw_info_.communication().sum(Bx.data(), Bx.size());
resWell -= Bx;
}
// xw = D^-1 * resWell
xw = mswellhelpers::applyUMFPack(*duneDSolver_, resWell);
}