added: StandardWellEquations::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 21bb4dc955
commit 033718f027
3 changed files with 15 additions and 6 deletions

View File

@ -130,6 +130,17 @@ void StandardWellEquations<Scalar,numEq>::apply(const BVector& x, BVector& Ax) c
duneC_.mmtv(invDBx, Ax); duneC_.mmtv(invDBx, Ax);
} }
template<class Scalar, int numEq>
void StandardWellEquations<Scalar,numEq>::apply(BVector& r) const
{
assert(invDrw_.size() == invDuneD_.N());
// invDrw_ = invDuneD_ * resWell_
invDuneD_.mv(resWell_, invDrw_);
// r = r - duneC_^T * invDrw_
duneC_.mmtv(invDrw_, r);
}
#define INSTANCE(N) \ #define INSTANCE(N) \
template class StandardWellEquations<double,N>; template class StandardWellEquations<double,N>;

View File

@ -76,6 +76,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

@ -1736,12 +1736,7 @@ namespace Opm
{ {
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return; if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
assert(this->linSys_.invDrw_.size() == this->linSys_.invDuneD_.N()); this->linSys_.apply(r);
// invDrw_ = invDuneD_ * resWell_
this->linSys_.invDuneD_.mv(this->linSys_.resWell_, this->linSys_.invDrw_);
// r = r - duneC_^T * invDrw_
this->linSys_.duneC_.mmtv(this->linSys_.invDrw_, r);
} }
template<typename TypeTag> template<typename TypeTag>