diff --git a/opm/autodiff/StandardWell.hpp b/opm/autodiff/StandardWell.hpp index 8378b6b63..ac1e18502 100644 --- a/opm/autodiff/StandardWell.hpp +++ b/opm/autodiff/StandardWell.hpp @@ -27,6 +27,7 @@ #include #include #include +#include namespace Opm { @@ -88,15 +89,8 @@ namespace Opm typedef Dune::FieldVector VectorBlockWellType; typedef Dune::BlockVector 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 typedef Dune::FieldMatrix DiagMatrixBlockWellType; -#else - // the matrix type for the diagonal matrix D - typedef Dune::MatrixBlock DiagMatrixBlockWellType; -#endif typedef Dune::BCRSMatrix DiagMatWell; diff --git a/opm/autodiff/StandardWell_impl.hpp b/opm/autodiff/StandardWell_impl.hpp index 18b71e3f1..8d82980d8 100644 --- a/opm/autodiff/StandardWell_impl.hpp +++ b/opm/autodiff/StandardWell_impl.hpp @@ -688,7 +688,10 @@ namespace Detail } // 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_ ) {