Add function sumDistributed to MultisegmentWellEquations

This functions sums all contributions of a multisegment well for the diagonal of D and the residual.
This commit is contained in:
Lisa Julia Nebel
2024-11-12 15:16:11 +01:00
parent 6ce3f7a385
commit 4c59df5594
2 changed files with 15 additions and 0 deletions

View File

@@ -37,6 +37,7 @@
#include <opm/simulators/linalg/matrixblock.hh>
#include <opm/simulators/linalg/SmallDenseMatrixUtils.hpp>
#include <opm/simulators/wells/WellHelpers.hpp>
#include <opm/simulators/wells/MSWellHelpers.hpp>
#include <opm/simulators/wells/MultisegmentWellGeneric.hpp>
#include <opm/simulators/wells/WellInterfaceGeneric.hpp>
@@ -409,6 +410,16 @@ extractCPRPressureMatrix(PressureMatrix& jacobian,
}
}
template<class Scalar, int numWellEq, int numEq>
void MultisegmentWellEquations<Scalar,numWellEq,numEq>::
sumDistributed(Parallel::Communication comm)
{
// accumulate resWell_ and duneD_ in parallel to get effects of all perforations (might be distributed)
// we need to do this for all segments in the residual and on the diagonal of D
for (int seg = 0; seg < well_.numberOfSegments(); ++seg)
Opm::wellhelpers::sumDistributedWellEntries(duneD_[seg][seg], resWell_[seg], comm);
}
#define INSTANTIATE(T, numWellEq, numEq) \
template class MultisegmentWellEquations<T,numWellEq,numEq>; \
template void MultisegmentWellEquations<T,numWellEq,numEq>:: \

View File

@@ -22,6 +22,7 @@
#ifndef OPM_MULTISEGMENTWELL_EQUATIONS_HEADER_INCLUDED
#define OPM_MULTISEGMENTWELL_EQUATIONS_HEADER_INCLUDED
#include <opm/simulators/utils/ParallelCommunication.hpp>
#include <opm/simulators/wells/ParallelWellInfo.hpp>
#include <dune/common/fmatrix.hh>
#include <dune/common/fvector.hh>
@@ -121,6 +122,9 @@ public:
const int seg_pressure_var_ind,
const WellState<Scalar>& well_state) const;
//! \brief Sum with off-process contribution.
void sumDistributed(Parallel::Communication comm);
//! \brief Returns a const reference to the residual.
const BVectorWell& residual() const
{