mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #1240 from blattms/work-around-unstable-matrix-inversion
Work around unstable matrix block inversion in DUNE 2.3 und 2.4
This commit is contained in:
commit
44c02a262e
@ -289,7 +289,14 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2 , 5)
|
||||||
typedef ParallelOverlappingILU0<Matrix,Vector,Vector> SeqPreconditioner;
|
typedef ParallelOverlappingILU0<Matrix,Vector,Vector> SeqPreconditioner;
|
||||||
|
#else
|
||||||
|
typedef ParallelOverlappingILU0<Dune::BCRSMatrix<Dune::MatrixBlock<typename Matrix::field_type,
|
||||||
|
Matrix::block_type::rows,
|
||||||
|
Matrix::block_type::cols> >,
|
||||||
|
Vector, Vector> SeqPreconditioner;
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class Operator>
|
template <class Operator>
|
||||||
std::unique_ptr<SeqPreconditioner> constructPrecond(Operator& opA, const Dune::Amg::SequentialInformation&) const
|
std::unique_ptr<SeqPreconditioner> constructPrecond(Operator& opA, const Dune::Amg::SequentialInformation&) const
|
||||||
@ -302,7 +309,14 @@ namespace Opm
|
|||||||
|
|
||||||
#if HAVE_MPI
|
#if HAVE_MPI
|
||||||
typedef Dune::OwnerOverlapCopyCommunication<int, int> Comm;
|
typedef Dune::OwnerOverlapCopyCommunication<int, int> Comm;
|
||||||
|
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2 , 5)
|
||||||
typedef ParallelOverlappingILU0<Matrix,Vector,Vector,Comm> ParPreconditioner;
|
typedef ParallelOverlappingILU0<Matrix,Vector,Vector,Comm> ParPreconditioner;
|
||||||
|
#else
|
||||||
|
typedef ParallelOverlappingILU0<Dune::BCRSMatrix<Dune::MatrixBlock<typename Matrix::field_type,
|
||||||
|
Matrix::block_type::rows,
|
||||||
|
Matrix::block_type::cols> >,
|
||||||
|
Vector, Vector, Comm> ParPreconditioner;
|
||||||
|
#endif
|
||||||
template <class Operator>
|
template <class Operator>
|
||||||
std::unique_ptr<ParPreconditioner>
|
std::unique_ptr<ParPreconditioner>
|
||||||
constructPrecond(Operator& opA, const Comm& comm) const
|
constructPrecond(Operator& opA, const Comm& comm) const
|
||||||
|
@ -165,6 +165,7 @@ class ParallelOverlappingILU0
|
|||||||
{
|
{
|
||||||
typedef ParallelInfoT ParallelInfo;
|
typedef ParallelInfoT ParallelInfo;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! \brief The matrix type the preconditioner is for.
|
//! \brief The matrix type the preconditioner is for.
|
||||||
typedef typename Dune::remove_const<Matrix>::type matrix_type;
|
typedef typename Dune::remove_const<Matrix>::type matrix_type;
|
||||||
@ -238,14 +239,18 @@ public:
|
|||||||
\param n ILU fill in level (for testing). This does not work in parallel.
|
\param n ILU fill in level (for testing). This does not work in parallel.
|
||||||
\param w The relaxation factor.
|
\param w The relaxation factor.
|
||||||
*/
|
*/
|
||||||
ParallelOverlappingILU0 (const Matrix& A, const int n, const field_type w )
|
template<class BlockType, class Alloc>
|
||||||
|
ParallelOverlappingILU0 (const Dune::BCRSMatrix<BlockType,Alloc>& A,
|
||||||
|
const int n, const field_type w )
|
||||||
: lower_(),
|
: lower_(),
|
||||||
upper_(),
|
upper_(),
|
||||||
inv_(),
|
inv_(),
|
||||||
comm_(nullptr), w_(w),
|
comm_(nullptr), w_(w),
|
||||||
relaxation_( std::abs( w - 1.0 ) > 1e-15 )
|
relaxation_( std::abs( w - 1.0 ) > 1e-15 )
|
||||||
{
|
{
|
||||||
init( A, n );
|
// BlockMatrix is a Subclass of FieldMatrix that just adds
|
||||||
|
// methods. Therefore this cast should be safe.
|
||||||
|
init( reinterpret_cast<const Matrix&>(A), n );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Constructor.
|
/*! \brief Constructor.
|
||||||
@ -254,7 +259,9 @@ public:
|
|||||||
\param A The matrix to operate on.
|
\param A The matrix to operate on.
|
||||||
\param w The relaxation factor.
|
\param w The relaxation factor.
|
||||||
*/
|
*/
|
||||||
ParallelOverlappingILU0 (const Matrix& A, const field_type w)
|
template<class BlockType, class Alloc>
|
||||||
|
ParallelOverlappingILU0 (const Dune::BCRSMatrix<BlockType,Alloc>& A,
|
||||||
|
const field_type w)
|
||||||
: ParallelOverlappingILU0( A, 0, w )
|
: ParallelOverlappingILU0( A, 0, w )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -266,14 +273,18 @@ public:
|
|||||||
\param comm communication object, e.g. Dune::OwnerOverlapCopyCommunication
|
\param comm communication object, e.g. Dune::OwnerOverlapCopyCommunication
|
||||||
\param w The relaxation factor.
|
\param w The relaxation factor.
|
||||||
*/
|
*/
|
||||||
ParallelOverlappingILU0 (const Matrix& A, const ParallelInfo& comm, const field_type w)
|
template<class BlockType, class Alloc>
|
||||||
|
ParallelOverlappingILU0 (const Dune::BCRSMatrix<BlockType,Alloc>& A,
|
||||||
|
const ParallelInfo& comm, const field_type w)
|
||||||
: lower_(),
|
: lower_(),
|
||||||
upper_(),
|
upper_(),
|
||||||
inv_(),
|
inv_(),
|
||||||
comm_(&comm), w_(w),
|
comm_(&comm), w_(w),
|
||||||
relaxation_( std::abs( w - 1.0 ) > 1e-15 )
|
relaxation_( std::abs( w - 1.0 ) > 1e-15 )
|
||||||
{
|
{
|
||||||
init( A, 0 );
|
// BlockMatrix is a Subclass of FieldMatrix that just adds
|
||||||
|
// methods. Therefore this cast should be safe.
|
||||||
|
init( reinterpret_cast<const Matrix&>(A), 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
Loading…
Reference in New Issue
Block a user