Use Dune::FMatrixHelp::invertMatrix for inversion

Thus we always take advantage of the specializations in ISTLSolver.hpp
and do need to take care about the type of the matrix block.
This commit is contained in:
Markus Blatt 2018-02-26 12:16:04 +01:00
parent b5d55b9fb2
commit 8e78f02230
2 changed files with 5 additions and 8 deletions

View File

@ -27,6 +27,7 @@
#include <opm/autodiff/WellInterface.hpp> #include <opm/autodiff/WellInterface.hpp>
#include <opm/autodiff/ISTLSolver.hpp> #include <opm/autodiff/ISTLSolver.hpp>
#include <opm/autodiff/RateConverter.hpp> #include <opm/autodiff/RateConverter.hpp>
#include <opm/autodiff/ISTLSolver.hpp>
namespace Opm namespace Opm
{ {
@ -88,15 +89,8 @@ namespace Opm
typedef Dune::FieldVector<Scalar, numWellEq> VectorBlockWellType; typedef Dune::FieldVector<Scalar, numWellEq> VectorBlockWellType;
typedef Dune::BlockVector<VectorBlockWellType> BVectorWell; typedef Dune::BlockVector<VectorBlockWellType> BVectorWell;
#if DUNE_VERSION_NEWER_REV(DUNE_ISTL, 2 , 5, 1)
// 3x3 matrix block inversion was unstable from at least 2.3 until and
// including 2.5.0
// the matrix type for the diagonal matrix D // the matrix type for the diagonal matrix D
typedef Dune::FieldMatrix<Scalar, numWellEq, numWellEq > DiagMatrixBlockWellType; typedef Dune::FieldMatrix<Scalar, numWellEq, numWellEq > DiagMatrixBlockWellType;
#else
// the matrix type for the diagonal matrix D
typedef Dune::MatrixBlock<Scalar, numWellEq, numWellEq > DiagMatrixBlockWellType;
#endif
typedef Dune::BCRSMatrix <DiagMatrixBlockWellType> DiagMatWell; typedef Dune::BCRSMatrix <DiagMatrixBlockWellType> DiagMatWell;

View File

@ -688,7 +688,10 @@ namespace Detail
} }
// do the local inversion of D. // do the local inversion of D.
invDuneD_[0][0].invert(); // we do this manually with invertMatrix to always get our
// specializations in for 3x3 and 4x4 matrices.
auto original = invDuneD_[0][0];
Dune::FMatrixHelp::invertMatrix(original, invDuneD_[0][0]);
if ( param_.matrix_add_well_contributions_ ) if ( param_.matrix_add_well_contributions_ )
{ {