Add pw_info_ to the MultisegmentWellEquations and use it to fill the matrices B and C correctly

This commit is contained in:
Lisa Julia Nebel
2024-10-16 12:27:29 +02:00
parent 97953887e4
commit 6ce3f7a385
3 changed files with 15 additions and 5 deletions

View File

@@ -48,8 +48,9 @@ namespace Opm {
template<class Scalar, int numWellEq, int numEq> template<class Scalar, int numWellEq, int numEq>
MultisegmentWellEquations<Scalar,numWellEq,numEq>:: MultisegmentWellEquations<Scalar,numWellEq,numEq>::
MultisegmentWellEquations(const MultisegmentWellGeneric<Scalar>& well) MultisegmentWellEquations(const MultisegmentWellGeneric<Scalar>& well, const ParallelWellInfo<Scalar>& pw_info)
: well_(well) : well_(well)
, pw_info_(pw_info)
{ {
} }
@@ -107,7 +108,10 @@ init(const int numPerfs,
end = duneC_.createend(); row != end; ++row) { end = duneC_.createend(); row != end; ++row) {
// the number of the row corresponds to the segment number now. // the number of the row corresponds to the segment number now.
for (const int& perf : perforations[row.index()]) { for (const int& perf : perforations[row.index()]) {
row.insert(perf); const int local_perf_index = pw_info_.globalToLocal(perf);
if (local_perf_index < 0) // then the perforation is not on this process
continue;
row.insert(local_perf_index);
} }
} }
@@ -116,7 +120,10 @@ init(const int numPerfs,
end = duneB_.createend(); row != end; ++row) { end = duneB_.createend(); row != end; ++row) {
// the number of the row corresponds to the segment number now. // the number of the row corresponds to the segment number now.
for (const int& perf : perforations[row.index()]) { for (const int& perf : perforations[row.index()]) {
row.insert(perf); const int local_perf_index = pw_info_.globalToLocal(perf);
if (local_perf_index < 0) // then the perforation is not on this process
continue;
row.insert(local_perf_index);
} }
} }

View File

@@ -22,6 +22,7 @@
#ifndef OPM_MULTISEGMENTWELL_EQUATIONS_HEADER_INCLUDED #ifndef OPM_MULTISEGMENTWELL_EQUATIONS_HEADER_INCLUDED
#define OPM_MULTISEGMENTWELL_EQUATIONS_HEADER_INCLUDED #define OPM_MULTISEGMENTWELL_EQUATIONS_HEADER_INCLUDED
#include <opm/simulators/wells/ParallelWellInfo.hpp>
#include <dune/common/fmatrix.hh> #include <dune/common/fmatrix.hh>
#include <dune/common/fvector.hh> #include <dune/common/fvector.hh>
#include <dune/istl/bcrsmatrix.hh> #include <dune/istl/bcrsmatrix.hh>
@@ -67,7 +68,7 @@ public:
using OffDiagMatrixBlockWellType = Dune::FieldMatrix<Scalar,numWellEq,numEq>; using OffDiagMatrixBlockWellType = Dune::FieldMatrix<Scalar,numWellEq,numEq>;
using OffDiagMatWell = Dune::BCRSMatrix<OffDiagMatrixBlockWellType>; using OffDiagMatWell = Dune::BCRSMatrix<OffDiagMatrixBlockWellType>;
MultisegmentWellEquations(const MultisegmentWellGeneric<Scalar>& well); MultisegmentWellEquations(const MultisegmentWellGeneric<Scalar>& well, const ParallelWellInfo<Scalar>& pw_info);
//! \brief Setup sparsity pattern for the matrices. //! \brief Setup sparsity pattern for the matrices.
//! \param numPerfs Number of perforations //! \param numPerfs Number of perforations
@@ -146,6 +147,8 @@ public:
// Store the global index of well perforated cells // Store the global index of well perforated cells
std::vector<int> cells_; std::vector<int> cells_;
const ParallelWellInfo<Scalar>& pw_info_;
}; };
} }

View File

@@ -57,7 +57,7 @@ MultisegmentWellEval(WellInterfaceIndices<FluidSystem,Indices>& baseif, const Pa
: MultisegmentWellGeneric<Scalar>(baseif) : MultisegmentWellGeneric<Scalar>(baseif)
, pw_info_(pw_info) , pw_info_(pw_info)
, baseif_(baseif) , baseif_(baseif)
, linSys_(*this) , linSys_(*this, pw_info)
, primary_variables_(baseif) , primary_variables_(baseif)
, segments_(this->numberOfSegments(), pw_info.communication().sum(baseif.numPerfs()), baseif) , segments_(this->numberOfSegments(), pw_info.communication().sum(baseif.numPerfs()), baseif)
, cell_perforation_depth_diffs_(baseif_.numPerfs(), 0.0) , cell_perforation_depth_diffs_(baseif_.numPerfs(), 0.0)