added: StandardWellEquations::recoverSolutionWell()

this recovers the well solution from a solution 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 daf0f90fe5
commit 40640e9da6
4 changed files with 17 additions and 19 deletions

View File

@ -253,9 +253,6 @@ namespace Opm
protected:
bool regularize_;
// xw = inv(D)*(rw - C*x)
void recoverSolutionWell(const BVector& x, BVectorWell& xw) const;
// updating the well_state based on well solution dwells
void updateWellState(const BVectorWell& dwells,
WellState& well_state,

View File

@ -166,6 +166,18 @@ void StandardWellEquations<Scalar,numEq>::solve(BVectorWell& dx_well) const
invDuneD_.mv(resWell_, dx_well);
}
template<class Scalar, int numEq>
void StandardWellEquations<Scalar,numEq>::
recoverSolutionWell(const BVector& x, BVectorWell& xw) const
{
BVectorWell resWell = resWell_;
// resWell = resWell - B * x
parallelB_.mmv(x, resWell);
// xw = D^-1 * resWell
invDuneD_.mv(resWell, xw);
}
#define INSTANCE(N) \
template class StandardWellEquations<double,N>;

View File

@ -85,6 +85,10 @@ public:
//! \brief Invert D matrix.
void invert();
//! \brief Recover well solution.
//! \details xw = inv(D)*(rw - C*x)
void recoverSolutionWell(const BVector& x, BVectorWell& xw) const;
// two off-diagonal matrices
OffDiagMatWell duneB_;
OffDiagMatWell duneC_;

View File

@ -1732,21 +1732,6 @@ namespace Opm
this->linSys_.apply(r);
}
template<typename TypeTag>
void
StandardWell<TypeTag>::
recoverSolutionWell(const BVector& x, BVectorWell& xw) const
{
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
BVectorWell resWell = this->linSys_.resWell_;
// resWell = resWell - B * x
this->linSys_.parallelB_.mmv(x, resWell);
// xw = D^-1 * resWell
this->linSys_.invDuneD_.mv(resWell, xw);
}
@ -1762,7 +1747,7 @@ namespace Opm
BVectorWell xw(1);
xw[0].resize(this->numWellEq_);
recoverSolutionWell(x, xw);
this->linSys_.recoverSolutionWell(x, xw);
updateWellState(xw, well_state, deferred_logger);
}