added: MultisegmentWellEquations::apply(r)

this applies the equation system to a vector.
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 f2acbccc1a
commit abf5f94561
3 changed files with 17 additions and 7 deletions

View File

@ -130,6 +130,16 @@ apply(const BVector& x, BVector& Ax) const
duneC_.mmtv(invDBx,Ax); duneC_.mmtv(invDBx,Ax);
} }
template<class Scalar, int numWellEq, int numEq>
void MultisegmentWellEquations<Scalar,numWellEq,numEq>::
apply(BVector& r) const
{
// invDrw_ = duneD^-1 * resWell_
const BVectorWell invDrw = mswellhelpers::applyUMFPack(duneD_, duneDSolver_, resWell_);
// r = r - duneC_^T * invDrw
duneC_.mmtv(invDrw, r);
}
#define INSTANCE(numWellEq, numEq) \ #define INSTANCE(numWellEq, numEq) \
template class MultisegmentWellEquations<double,numWellEq,numEq>; template class MultisegmentWellEquations<double,numWellEq,numEq>;

View File

@ -77,6 +77,9 @@ public:
//! \brief Apply linear operator to vector. //! \brief Apply linear operator to vector.
void apply(const BVector& x, BVector& Ax) const; void apply(const BVector& x, BVector& Ax) const;
//! \brief Apply linear operator to vector.
void apply(BVector& r) const;
// two off-diagonal matrices // two off-diagonal matrices
OffDiagMatWell duneB_; OffDiagMatWell duneB_;
OffDiagMatWell duneC_; OffDiagMatWell duneC_;

View File

@ -217,14 +217,11 @@ namespace Opm
MultisegmentWell<TypeTag>:: MultisegmentWell<TypeTag>::
apply(BVector& r) const apply(BVector& r) const
{ {
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return; if (!this->isOperableAndSolvable() && !this->wellIsStopped()) {
return;
}
// invDrw_ = duneD^-1 * resWell_ this->linSys_.apply(r);
const BVectorWell invDrw = mswellhelpers::applyUMFPack(this->linSys_.duneD_,
this->linSys_.duneDSolver_,
this->linSys_.resWell_);
// r = r - duneC_^T * invDrw
this->linSys_.duneC_.mmtv(invDrw, r);
} }