added: StandardWellEquations::getNumBlocks()

this returns the number of blocks in in B/C matrices.
use the new method in the well implementation.
This commit is contained in:
Arne Morten Kvarving 2022-11-11 21:41:24 +01:00
parent f2d8a073f9
commit b24f22312e
4 changed files with 11 additions and 8 deletions

View File

@ -1203,7 +1203,7 @@ namespace Opm {
auto& well = well_container_[i];
std::shared_ptr<StandardWell<TypeTag> > derived = std::dynamic_pointer_cast<StandardWell<TypeTag> >(well);
if (derived) {
wellContribs.addNumBlocks(derived->getNumBlocks());
wellContribs.addNumBlocks(derived->linSys().getNumBlocks());
}
}

View File

@ -262,6 +262,13 @@ extract(SparseMatrixAdapter& jacobian) const
}
}
template<class Scalar, int numEq>
unsigned int StandardWellEquations<Scalar,numEq>::
getNumBlocks() const
{
return duneB_.nonzeroes();
}
#define INSTANCE(N) \
template class StandardWellEquations<double,N>; \
template void StandardWellEquations<double,N>::extract(Linear::IstlSparseMatrixAdapter<MatrixBlock<double,N,N>>&) const;

View File

@ -98,6 +98,9 @@ public:
template<class SparseMatrixAdapter>
void extract(SparseMatrixAdapter& jacobian) const;
//! \brief Get the number of blocks of the C and B matrices.
unsigned int getNumBlocks() const;
// two off-diagonal matrices
OffDiagMatWell duneB_;
OffDiagMatWell duneC_;

View File

@ -1044,13 +1044,6 @@ init(std::vector<double>& perf_depth,
baseif_.numPerfs(), baseif_.cells());
}
template<class FluidSystem, class Indices, class Scalar>
unsigned int StandardWellEval<FluidSystem,Indices,Scalar>::
getNumBlocks() const
{
return linSys_.duneB_.nonzeroes();
}
#define INSTANCE(...) \
template class StandardWellEval<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;