mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
added: StandardWellEquations::invert()
this inverts the D matrix. use the new method in the well implementation.
This commit is contained in:
@@ -22,6 +22,10 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <opm/simulators/wells/StandardWellEquations.hpp>
|
#include <opm/simulators/wells/StandardWellEquations.hpp>
|
||||||
|
|
||||||
|
#include <opm/common/Exceptions.hpp>
|
||||||
|
|
||||||
|
#include <opm/simulators/linalg/matrixblock.hh>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -141,6 +145,21 @@ void StandardWellEquations<Scalar,numEq>::apply(BVector& r) const
|
|||||||
duneC_.mmtv(invDrw_, r);
|
duneC_.mmtv(invDrw_, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Scalar, int numEq>
|
||||||
|
void StandardWellEquations<Scalar,numEq>::invert()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
invDuneD_ = duneD_; // Not strictly need if not cpr with well contributions is used
|
||||||
|
detail::invertMatrix(invDuneD_[0][0]);
|
||||||
|
} catch (NumericalProblem&) {
|
||||||
|
// for singular matrices, use identity as the inverse
|
||||||
|
invDuneD_[0][0] = 0.0;
|
||||||
|
for (size_t i = 0; i < invDuneD_[0][0].rows(); ++i) {
|
||||||
|
invDuneD_[0][0][i][i] = 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define INSTANCE(N) \
|
#define INSTANCE(N) \
|
||||||
template class StandardWellEquations<double,N>;
|
template class StandardWellEquations<double,N>;
|
||||||
|
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ public:
|
|||||||
//! \brief Apply linear operator to vector.
|
//! \brief Apply linear operator to vector.
|
||||||
void apply(BVector& r) const;
|
void apply(BVector& r) const;
|
||||||
|
|
||||||
|
//! \brief Invert D matrix.
|
||||||
|
void invert();
|
||||||
|
|
||||||
// two off-diagonal matrices
|
// two off-diagonal matrices
|
||||||
OffDiagMatWell duneB_;
|
OffDiagMatWell duneB_;
|
||||||
OffDiagMatWell duneC_;
|
OffDiagMatWell duneC_;
|
||||||
|
|||||||
@@ -551,14 +551,7 @@ namespace Opm
|
|||||||
|
|
||||||
// do the local inversion of D.
|
// do the local inversion of D.
|
||||||
try {
|
try {
|
||||||
this->linSys_.invDuneD_ = this->linSys_.duneD_; // Not strictly need if not cpr with well contributions is used
|
this->linSys_.invert();
|
||||||
detail::invertMatrix(this->linSys_.invDuneD_[0][0]);
|
|
||||||
} catch (NumericalProblem&) {
|
|
||||||
// for singular matrices, use identity as the inverse
|
|
||||||
this->linSys_.invDuneD_[0][0] = 0.0;
|
|
||||||
for (size_t i = 0; i < this->linSys_.invDuneD_[0][0].rows(); ++i) {
|
|
||||||
this->linSys_.invDuneD_[0][0][i][i] = 1.0;
|
|
||||||
}
|
|
||||||
} catch( ... ) {
|
} catch( ... ) {
|
||||||
OPM_DEFLOG_THROW(NumericalIssue,"Error when inverting local well equations for well " + name(), deferred_logger);
|
OPM_DEFLOG_THROW(NumericalIssue,"Error when inverting local well equations for well " + name(), deferred_logger);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user