added: StandardWellEquations::invert()

this inverts the D matrix.
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 033718f027
commit 83c41e3f9c
3 changed files with 23 additions and 8 deletions

View File

@@ -22,6 +22,10 @@
#include <config.h>
#include <opm/simulators/wells/StandardWellEquations.hpp>
#include <opm/common/Exceptions.hpp>
#include <opm/simulators/linalg/matrixblock.hh>
namespace Opm
{
@@ -141,6 +145,21 @@ void StandardWellEquations<Scalar,numEq>::apply(BVector& r) const
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) \
template class StandardWellEquations<double,N>;