mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-03 21:50:27 -06:00
Merge pull request #2327 from akva2/bump_dune
Bump required dune version to 2.6
This commit is contained in:
commit
5fe48dab8b
@ -10,4 +10,4 @@ Label: 2020.04-pre
|
||||
Maintainer: atgeirr@sintef.no
|
||||
MaintainerName: Atgeirr F. Rasmussen
|
||||
Url: http://opm-project.org
|
||||
Depends: dune-istl (>= 2.4) opm-common opm-material opm-grid opm-models
|
||||
Depends: dune-istl (>= 2.6) opm-common opm-material opm-grid opm-models
|
||||
|
@ -306,13 +306,8 @@ public:
|
||||
typedef typename Vanguard::GridView LocalGridView;
|
||||
const LocalGridView localGridView = vanguard.gridView();
|
||||
|
||||
#if DUNE_VERSION_NEWER(DUNE_GRID, 2,6)
|
||||
typedef Dune::MultipleCodimMultipleGeomTypeMapper<LocalGridView> ElementMapper;
|
||||
ElementMapper elemMapper(localGridView, Dune::mcmgElementLayout());
|
||||
#else
|
||||
typedef Dune::MultipleCodimMultipleGeomTypeMapper<LocalGridView, Dune::MCMGElementLayout> ElementMapper;
|
||||
ElementMapper elemMapper(localGridView);
|
||||
#endif
|
||||
|
||||
localIdxToGlobalIdx_.resize(localGridView.size(0), -1);
|
||||
|
||||
@ -325,13 +320,8 @@ public:
|
||||
globalCartesianIndex_.resize(globalSize, -1);
|
||||
const EquilGridView equilGridView = vanguard.equilGrid().leafGridView();
|
||||
|
||||
#if DUNE_VERSION_NEWER(DUNE_GRID, 2,6)
|
||||
typedef Dune::MultipleCodimMultipleGeomTypeMapper<EquilGridView> EquilElementMapper;
|
||||
EquilElementMapper equilElemMapper(equilGridView, Dune::mcmgElementLayout());
|
||||
#else
|
||||
typedef Dune::MultipleCodimMultipleGeomTypeMapper<EquilGridView, Dune::MCMGElementLayout> EquilElementMapper;
|
||||
EquilElementMapper equilElemMapper(equilGridView);
|
||||
#endif
|
||||
|
||||
// Scatter the global index to local index for lookup during restart
|
||||
ElementIndexScatterHandle<EquilElementMapper,ElementMapper> handle(equilElemMapper, elemMapper, localIdxToGlobalIdx_);
|
||||
|
@ -162,11 +162,7 @@ public:
|
||||
const auto& gridView = grid_->leafGridView();
|
||||
unsigned numFaces = grid_->numFaces();
|
||||
std::vector<double> faceTrans(numFaces, 0.0);
|
||||
#if DUNE_VERSION_NEWER(DUNE_GRID, 2,6)
|
||||
ElementMapper elemMapper(this->gridView(), Dune::mcmgElementLayout());
|
||||
#else
|
||||
ElementMapper elemMapper(this->gridView());
|
||||
#endif
|
||||
auto elemIt = gridView.template begin</*codim=*/0>();
|
||||
const auto& elemEndIt = gridView.template end</*codim=*/0>();
|
||||
for (; elemIt != elemEndIt; ++ elemIt) {
|
||||
|
@ -414,11 +414,7 @@ protected:
|
||||
typedef Dune::BiCGSTABSolver<TracerVector> TracerSolver;
|
||||
typedef Dune::MatrixAdapter<TracerMatrix, TracerVector , TracerVector > TracerOperator;
|
||||
typedef Dune::SeqScalarProduct< TracerVector > TracerScalarProduct ;
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2,6)
|
||||
typedef Dune::SeqILU< TracerMatrix, TracerVector, TracerVector > TracerPreconditioner;
|
||||
#else
|
||||
typedef Dune::SeqILUn< TracerMatrix, TracerVector, TracerVector > TracerPreconditioner;
|
||||
#endif
|
||||
|
||||
TracerOperator tracerOperator(M);
|
||||
TracerScalarProduct tracerScalarProduct;
|
||||
|
@ -133,11 +133,7 @@ public:
|
||||
const auto& eclGrid = eclState.getInputGrid();
|
||||
const auto& cartDims = cartMapper.cartesianDimensions();
|
||||
auto& transMult = eclState.getTransMult();
|
||||
#if DUNE_VERSION_NEWER(DUNE_GRID, 2,6)
|
||||
ElementMapper elemMapper(gridView, Dune::mcmgElementLayout());
|
||||
#else
|
||||
ElementMapper elemMapper(gridView);
|
||||
#endif
|
||||
|
||||
// get the ntg values, the ntg values are modified for the cells merged with minpv
|
||||
std::vector<double> ntg;
|
||||
@ -491,11 +487,7 @@ private:
|
||||
const auto& gridView = vanguard_.gridView();
|
||||
const auto& cartMapper = vanguard_.cartesianIndexMapper();
|
||||
const auto& cartDims = cartMapper.cartesianDimensions();
|
||||
#if DUNE_VERSION_NEWER(DUNE_GRID, 2,6)
|
||||
ElementMapper elemMapper(gridView, Dune::mcmgElementLayout());
|
||||
#else
|
||||
ElementMapper elemMapper(gridView);
|
||||
#endif
|
||||
|
||||
const auto& fp = vanguard_.eclState().fieldProps();
|
||||
const auto& inputTranxData = fp.get_global_double("TRANX");
|
||||
|
@ -496,13 +496,8 @@ private:
|
||||
|
||||
typedef typename EquilGrid :: LeafGridView GlobalGridView;
|
||||
const GlobalGridView& globalGridView = globalGrid().leafGridView();
|
||||
#if DUNE_VERSION_NEWER(DUNE_GRID, 2,6)
|
||||
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GlobalGridView> ElementMapper;
|
||||
ElementMapper globalElemMapper(globalGridView, Dune::mcmgElementLayout());
|
||||
#else
|
||||
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GlobalGridView, Dune::MCMGElementLayout> ElementMapper;
|
||||
ElementMapper globalElemMapper(globalGridView);
|
||||
#endif
|
||||
|
||||
const EclTransmissibility<TypeTag>* globalTrans;
|
||||
|
||||
@ -603,15 +598,9 @@ private:
|
||||
|
||||
typedef typename EquilGrid :: LeafGridView GlobalGridView;
|
||||
const GlobalGridView& globalGridView = globalGrid().leafGridView();
|
||||
#if DUNE_VERSION_NEWER(DUNE_GRID, 2,6)
|
||||
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GlobalGridView> ElementMapper;
|
||||
ElementMapper globalElemMapper(globalGridView, Dune::mcmgElementLayout());
|
||||
|
||||
#else
|
||||
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GlobalGridView, Dune::MCMGElementLayout> ElementMapper;
|
||||
ElementMapper globalElemMapper(globalGridView);
|
||||
#endif
|
||||
|
||||
const EclTransmissibility<TypeTag>* globalTrans;
|
||||
if (!collectToIORank_.isParallel()) {
|
||||
// in the sequential case we must use the transmissibilites defined by
|
||||
|
@ -49,21 +49,6 @@ class EntityPointer;
|
||||
// specialization of dune-fem compatiblity functions for CpGrid, since CpGrid does not use the interface classes.
|
||||
namespace Fem {
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// make_entity for CpGrid entities
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
#if ! DUNE_VERSION_NEWER(DUNE_GRID, 2, 6)
|
||||
template <int codim>
|
||||
inline Dune::cpgrid::Entity<codim> make_entity(const Dune::cpgrid::EntityPointer<codim>& entityPointer)
|
||||
{ return *entityPointer; }
|
||||
|
||||
template <int codim>
|
||||
inline Dune::cpgrid::Entity<codim> make_entity(Dune::cpgrid::Entity<codim> entity)
|
||||
{ return std::move(entity); }
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GridEntityAccess for CpGrid entities
|
||||
|
@ -21,11 +21,7 @@
|
||||
#include "config.h"
|
||||
#include "flow/flow_tag.hpp"
|
||||
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
#include <opm/simulators/linalg/ISTLSolverEbosFlexible.hpp>
|
||||
#else
|
||||
#include <opm/simulators/linalg/ISTLSolverEbosCpr.hpp>
|
||||
#endif
|
||||
|
||||
BEGIN_PROPERTIES
|
||||
NEW_TYPE_TAG(EclFlowProblemSimple, INHERITS_FROM(EclFlowProblem));
|
||||
@ -82,11 +78,7 @@ namespace Opm {
|
||||
//SET_TYPE_PROP(EclFlowProblemSimple, LinearSolverBackend, Opm::Linear::ParallelBiCGStabSolverBackend<TypeTag>);//not work
|
||||
//SET_TYPE_PROP(EclFlowProblemSimple, LinearSolverBackend, Opm::Linear::SuperLUBackend<TypeTag>)//not work
|
||||
//SET_TAG_PROP(EclFlowProblem, FluidState, Opm::BlackOilFluidState);
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
SET_TYPE_PROP(EclFlowProblemSimple, LinearSolverBackend, Opm::ISTLSolverEbosFlexible<TypeTag>);
|
||||
#else
|
||||
SET_TYPE_PROP(EclFlowProblemSimple, LinearSolverBackend, Opm::ISTLSolverEbosCpr<TypeTag>);
|
||||
#endif
|
||||
SET_BOOL_PROP(EclFlowProblemSimple, EnableStorageCache, true);
|
||||
SET_BOOL_PROP(EclFlowProblemSimple, EnableIntensiveQuantityCache, true);
|
||||
|
||||
|
@ -53,7 +53,11 @@
|
||||
#include <opm/common/data/SimulationDataContainer.hpp>
|
||||
|
||||
#include <dune/istl/owneroverlapcopy.hh>
|
||||
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 7)
|
||||
#include <dune/common/parallel/communication.hh>
|
||||
#else
|
||||
#include <dune/common/parallel/collectivecommunication.hh>
|
||||
#endif
|
||||
#include <dune/common/timer.hh>
|
||||
#include <dune/common/unused.hh>
|
||||
|
||||
|
@ -406,25 +406,18 @@ private:
|
||||
amg_->updateSolver(crit_, op_, comm_);
|
||||
}
|
||||
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
Dune::SolverCategory::Category category() const override
|
||||
{
|
||||
return std::is_same<Communication, Dune::Amg::SequentialInformation>::value ?
|
||||
Dune::SolverCategory::sequential : Dune::SolverCategory::overlapping;
|
||||
}
|
||||
#endif
|
||||
|
||||
void apply(X& x, X& b, double reduction, Dune::InverseOperatorResult& res) override
|
||||
{
|
||||
DUNE_UNUSED_PARAMETER(reduction);
|
||||
DUNE_UNUSED_PARAMETER(res);
|
||||
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
auto sp = Dune::createScalarProduct<X,Communication>(comm_, op_.category());
|
||||
#else
|
||||
using Chooser = Dune::ScalarProductChooser<X,Communication,AMGType::category>;
|
||||
auto sp = Chooser::construct(comm_);
|
||||
#endif
|
||||
Dune::Preconditioner<X,X>* prec = amg_.get();
|
||||
if ( ! amg_ )
|
||||
{
|
||||
@ -440,88 +433,27 @@ private:
|
||||
|
||||
if ( param_->cpr_ell_solvetype_ == 0)
|
||||
{
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
Dune::BiCGSTABSolver<X> solver(const_cast<typename AMGType::Operator&>(op_), *sp, *prec,
|
||||
tolerance, maxit, verbosity);
|
||||
solver.apply(x,b,res);
|
||||
#else
|
||||
// Category of preconditioner will be checked at compile time. Therefore we need
|
||||
// to cast to the derived class
|
||||
if ( !amg_ )
|
||||
{
|
||||
Dune::BiCGSTABSolver<X> solver(const_cast<typename AMGType::Operator&>(op_), *sp,
|
||||
reinterpret_cast<Smoother&>(*prec),
|
||||
tolerance, maxit, verbosity);
|
||||
solver.apply(x,b,res);
|
||||
}
|
||||
else
|
||||
{
|
||||
Dune::BiCGSTABSolver<X> solver(const_cast<typename AMGType::Operator&>(op_), *sp,
|
||||
reinterpret_cast<AMGType&>(*prec),
|
||||
tolerance, maxit, verbosity);
|
||||
solver.apply(x,b,res);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (param_->cpr_ell_solvetype_ == 1)
|
||||
{
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
Dune::CGSolver<X> solver(const_cast<typename AMGType::Operator&>(op_), *sp, *prec,
|
||||
tolerance, maxit, verbosity);
|
||||
solver.apply(x,b,res);
|
||||
#else
|
||||
// Category of preconditioner will be checked at compile time. Therefore we need
|
||||
// to cast to the derived class
|
||||
if ( !amg_ )
|
||||
{
|
||||
Dune::CGSolver<X> solver(const_cast<typename AMGType::Operator&>(op_), *sp,
|
||||
reinterpret_cast<Smoother&>(*prec),
|
||||
tolerance, maxit, verbosity);
|
||||
solver.apply(x,b,res);
|
||||
}
|
||||
else
|
||||
{
|
||||
Dune::CGSolver<X> solver(const_cast<typename AMGType::Operator&>(op_), *sp,
|
||||
reinterpret_cast<AMGType&>(*prec),
|
||||
tolerance, maxit, verbosity);
|
||||
solver.apply(x,b,res);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
Dune::LoopSolver<X> solver(const_cast<typename AMGType::Operator&>(op_), *sp, *prec,
|
||||
tolerance, maxit, verbosity);
|
||||
solver.apply(x,b,res);
|
||||
#else
|
||||
if ( !amg_ )
|
||||
{
|
||||
Dune::LoopSolver<X> solver(const_cast<typename AMGType::Operator&>(op_), *sp,
|
||||
reinterpret_cast<Smoother&>(*prec),
|
||||
tolerance, maxit, verbosity);
|
||||
solver.apply(x,b,res);
|
||||
}
|
||||
else
|
||||
{
|
||||
Dune::LoopSolver<X> solver(const_cast<typename AMGType::Operator&>(op_), *sp,
|
||||
reinterpret_cast<AMGType&>(*prec),
|
||||
tolerance, maxit, verbosity);
|
||||
solver.apply(x,b,res);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
// Warn if unknown options.
|
||||
if (param_->cpr_ell_solvetype_ > 2 && comm_.communicator().rank() == 0) {
|
||||
OpmLog::warning("cpr_ell_solver_type_unknown", "Unknown CPR elliptic solver type specification, using LoopSolver.");
|
||||
}
|
||||
|
||||
|
||||
#if ! DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
delete sp;
|
||||
#endif
|
||||
}
|
||||
|
||||
void apply(X& x, X& b, Dune::InverseOperatorResult& res) override
|
||||
@ -742,11 +674,7 @@ public:
|
||||
|
||||
if ( cpr_pressure_aggregation_ )
|
||||
{
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
typedef Dune::Amg::PropertiesGraphCreator<Operator,Communication> GraphCreator;
|
||||
#else
|
||||
typedef Dune::Amg::PropertiesGraphCreator<Operator> GraphCreator;
|
||||
#endif
|
||||
typedef typename GraphCreator::PropertiesGraph PropertiesGraph;
|
||||
typedef typename GraphCreator::GraphTuple GraphTuple;
|
||||
|
||||
@ -767,7 +695,11 @@ public:
|
||||
criterion_, true);
|
||||
|
||||
using CommunicationArgs = typename Dune::Amg::ConstructionTraits<Communication>::Arguments;
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
|
||||
CommunicationArgs commArgs(communication_->communicator(), communication_->category());
|
||||
#else
|
||||
CommunicationArgs commArgs(communication_->communicator(), communication_->getSolverCategory());
|
||||
#endif
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
|
||||
coarseLevelCommunication_ = Dune::Amg::ConstructionTraits<Communication>::construct(commArgs);
|
||||
#else
|
||||
@ -1025,19 +957,12 @@ protected:
|
||||
CoarseSolverPolicy,
|
||||
Smoother>;
|
||||
public:
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
Dune::SolverCategory::Category category() const override
|
||||
{
|
||||
return std::is_same<Communication, Dune::Amg::SequentialInformation>::value ?
|
||||
Dune::SolverCategory::sequential : Dune::SolverCategory::overlapping;
|
||||
}
|
||||
#else
|
||||
// define the category
|
||||
enum {
|
||||
//! \brief The category the precondtioner is part of.
|
||||
category = Operator::category
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Constructor.
|
||||
* \param param The parameters used for configuring the solver.
|
||||
|
@ -95,19 +95,11 @@ namespace Opm
|
||||
CoarseSolverPolicy,
|
||||
Smoother>;
|
||||
public:
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
Dune::SolverCategory::Category category() const override
|
||||
{
|
||||
return std::is_same<Communication, Dune::Amg::SequentialInformation>::value ?
|
||||
Dune::SolverCategory::sequential : Dune::SolverCategory::overlapping;
|
||||
}
|
||||
#else
|
||||
// define the category
|
||||
enum {
|
||||
//! \brief The category the precondtioner is part of.
|
||||
category = Operator::category
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Constructor.
|
||||
|
@ -305,19 +305,11 @@ createAMGPreconditionerPointer( Op& opA, const double relax, const MILU_VARIANT
|
||||
typedef typename X::field_type field_type;
|
||||
|
||||
// define the category
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
Dune::SolverCategory::Category category() const override
|
||||
{
|
||||
return std::is_same<P,Dune::Amg::SequentialInformation>::value ?
|
||||
Dune::SolverCategory::sequential : Dune::SolverCategory::overlapping;
|
||||
}
|
||||
#else
|
||||
enum {
|
||||
//! \brief The category the preconditioner is part of.
|
||||
category = std::is_same<P,Dune::Amg::SequentialInformation>::value?
|
||||
Dune::SolverCategory::sequential:Dune::SolverCategory::overlapping
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef ISTLUtility::CPRSelector<M,X,X,P> CPRSelectorType ;
|
||||
|
||||
@ -447,15 +439,7 @@ createAMGPreconditionerPointer( Op& opA, const double relax, const MILU_VARIANT
|
||||
Dune::InverseOperatorResult result;
|
||||
|
||||
// the scalar product chooser
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
auto sp = Dune::createScalarProduct<X,ParallelInformation>(commAe_, category());
|
||||
#else
|
||||
typedef Dune::ScalarProductChooser<X,ParallelInformation,category>
|
||||
ScalarProductChooser;
|
||||
// the scalar product.
|
||||
std::unique_ptr<typename ScalarProductChooser::ScalarProduct>
|
||||
sp(ScalarProductChooser::construct(commAe_));
|
||||
#endif
|
||||
|
||||
if( amg_ )
|
||||
{
|
||||
|
@ -113,20 +113,11 @@ public:
|
||||
typedef Dune::CollectiveCommunication< int > communication_type;
|
||||
#endif
|
||||
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
Dune::SolverCategory::Category category() const override
|
||||
{
|
||||
return overlapping ?
|
||||
Dune::SolverCategory::overlapping : Dune::SolverCategory::sequential;
|
||||
}
|
||||
#else
|
||||
enum {
|
||||
//! \brief The solver category.
|
||||
category = overlapping ?
|
||||
Dune::SolverCategory::overlapping :
|
||||
Dune::SolverCategory::sequential
|
||||
};
|
||||
#endif
|
||||
|
||||
//! constructor: just store a reference to a matrix
|
||||
WellModelMatrixAdapter (const M& A,
|
||||
@ -390,25 +381,15 @@ protected:
|
||||
/// \brief construct the CPR preconditioner and the solver.
|
||||
/// \tparam P The type of the parallel information.
|
||||
/// \param parallelInformation the information about the parallelization.
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
template<Dune::SolverCategory::Category category=Dune::SolverCategory::sequential,
|
||||
class LinearOperator, class POrComm>
|
||||
#else
|
||||
template<int category=Dune::SolverCategory::sequential, class LinearOperator, class POrComm>
|
||||
#endif
|
||||
void constructPreconditionerAndSolve(LinearOperator& linearOperator,
|
||||
Vector& x, Vector& istlb,
|
||||
const POrComm& parallelInformation_arg,
|
||||
Dune::InverseOperatorResult& result) const
|
||||
{
|
||||
// Construct scalar product.
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
auto sp = Dune::createScalarProduct<Vector,POrComm>(parallelInformation_arg, category);
|
||||
#else
|
||||
typedef Dune::ScalarProductChooser<Vector, POrComm, category> ScalarProductChooser;
|
||||
typedef std::unique_ptr<typename ScalarProductChooser::ScalarProduct> SPPointer;
|
||||
SPPointer sp(ScalarProductChooser::construct(parallelInformation_arg));
|
||||
#endif
|
||||
|
||||
#if FLOW_SUPPORT_AMG // activate AMG if either flow_ebos is used or UMFPack is not available
|
||||
if( parameters_.linear_solver_use_amg_ || parameters_.use_cpr_)
|
||||
@ -509,16 +490,9 @@ protected:
|
||||
|
||||
#if HAVE_MPI
|
||||
typedef Dune::OwnerOverlapCopyCommunication<int, int> Comm;
|
||||
#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
|
||||
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>
|
||||
std::unique_ptr<ParPreconditioner>
|
||||
constructPrecond(Operator& opA, const Comm& comm) const
|
||||
|
@ -149,17 +149,9 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
constexpr Dune::SolverCategory::Category category=Dune::SolverCategory::overlapping;
|
||||
auto sp = Dune::createScalarProduct<Vector,POrComm>(*comm_, category);
|
||||
sp_ = std::move(sp);
|
||||
#else
|
||||
constexpr int category = Dune::SolverCategory::overlapping;
|
||||
typedef Dune::ScalarProductChooser<Vector, POrComm, category> ScalarProductChooser;
|
||||
typedef std::unique_ptr<typename ScalarProductChooser::ScalarProduct> SPPointer;
|
||||
SPPointer sp(ScalarProductChooser::construct(*comm_));
|
||||
sp_ = std::move(sp);
|
||||
#endif
|
||||
|
||||
using AMGOperator = Dune::OverlappingSchwarzOperator<Matrix, Vector, Vector, POrComm>;
|
||||
// If clause is always execute as as Linearoperator is WellModelMatrixAdapter< Matrix, Vector, Vector, WellModel, false|true>;
|
||||
@ -183,17 +175,9 @@ namespace Opm
|
||||
POrCommType parallelInformation_arg;
|
||||
typedef OperatorSerial LinearOperator;
|
||||
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
constexpr Dune::SolverCategory::Category category=Dune::SolverCategory::sequential;
|
||||
auto sp = Dune::createScalarProduct<Vector,POrComm>(parallelInformation_arg, category);
|
||||
sp_ = std::move(sp);
|
||||
#else
|
||||
constexpr int category = Dune::SolverCategory::sequential;
|
||||
typedef Dune::ScalarProductChooser<Vector, POrCommType, category> ScalarProductChooser;
|
||||
typedef std::unique_ptr<typename ScalarProductChooser::ScalarProduct> SPPointer;
|
||||
SPPointer sp(ScalarProductChooser::construct(parallelInformation_arg));
|
||||
sp_ = std::move(sp);
|
||||
#endif
|
||||
|
||||
// If clause is always execute as as Linearoperator is WellModelMatrixAdapter< Matrix, Vector, Vector, WellModel, false|true>;
|
||||
if( ! std::is_same< LinearOperator, MatrixAdapter > :: value &&
|
||||
|
@ -605,22 +605,12 @@ protected:
|
||||
};
|
||||
|
||||
public:
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
Dune::SolverCategory::Category category() const override
|
||||
{
|
||||
return std::is_same<ParallelInfoT, Dune::Amg::SequentialInformation>::value ?
|
||||
Dune::SolverCategory::sequential : Dune::SolverCategory::overlapping;
|
||||
}
|
||||
|
||||
#else
|
||||
// define the category
|
||||
enum {
|
||||
//! \brief The category the preconditioner is part of.
|
||||
category = std::is_same<ParallelInfoT, Dune::Amg::SequentialInformation>::value ?
|
||||
Dune::SolverCategory::sequential : Dune::SolverCategory::overlapping
|
||||
};
|
||||
#endif
|
||||
|
||||
/*! \brief Constructor.
|
||||
|
||||
Constructor gets all parameters to operate the prec.
|
||||
|
@ -156,7 +156,11 @@ private:
|
||||
using C = Comm;
|
||||
doAddCreator("ILU0", [](const O& op, const P& prm, const C& comm) {
|
||||
const double w = prm.get<double>("relaxation");
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
|
||||
return wrapBlockPreconditioner<DummyUpdatePreconditioner<SeqILU<M, V, V>>>(comm, op.getmat(), w);
|
||||
#else
|
||||
return wrapBlockPreconditioner<DummyUpdatePreconditioner<SeqILU0<M, V, V>>>(comm, op.getmat(), w);
|
||||
#endif
|
||||
});
|
||||
doAddCreator("ParOverILU0", [](const O& op, const P& prm, const C& comm) {
|
||||
const double w = prm.get<double>("relaxation");
|
||||
@ -167,7 +171,11 @@ private:
|
||||
doAddCreator("ILUn", [](const O& op, const P& prm, const C& comm) {
|
||||
const int n = prm.get<int>("ilulevel");
|
||||
const double w = prm.get<double>("relaxation");
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
|
||||
return wrapBlockPreconditioner<DummyUpdatePreconditioner<SeqILU<M, V, V>>>(comm, op.getmat(), n, w);
|
||||
#else
|
||||
return wrapBlockPreconditioner<DummyUpdatePreconditioner<SeqILUn<M, V, V>>>(comm, op.getmat(), n, w);
|
||||
#endif
|
||||
});
|
||||
doAddCreator("Jac", [](const O& op, const P& prm, const C& comm) {
|
||||
const int n = prm.get<int>("repeats");
|
||||
@ -221,7 +229,11 @@ private:
|
||||
using P = boost::property_tree::ptree;
|
||||
doAddCreator("ILU0", [](const O& op, const P& prm) {
|
||||
const double w = prm.get<double>("relaxation");
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
|
||||
return wrapPreconditioner<SeqILU<M, V, V>>(op.getmat(), w);
|
||||
#else
|
||||
return wrapPreconditioner<SeqILU0<M, V, V>>(op.getmat(), w);
|
||||
#endif
|
||||
});
|
||||
doAddCreator("ParOverILU0", [](const O& op, const P& prm) {
|
||||
const double w = prm.get<double>("relaxation");
|
||||
@ -230,7 +242,11 @@ private:
|
||||
doAddCreator("ILUn", [](const O& op, const P& prm) {
|
||||
const int n = prm.get<int>("ilulevel");
|
||||
const double w = prm.get<double>("relaxation");
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
|
||||
return wrapPreconditioner<SeqILU<M, V, V>>(op.getmat(), n, w);
|
||||
#else
|
||||
return wrapPreconditioner<SeqILUn<M, V, V>>(op.getmat(), n, w);
|
||||
#endif
|
||||
});
|
||||
doAddCreator("Jac", [](const O& op, const P& prm) {
|
||||
const int n = prm.get<int>("repeats");
|
||||
@ -255,7 +271,11 @@ private:
|
||||
doAddCreator("amg", [](const O& op, const P& prm) {
|
||||
const std::string smoother = prm.get<std::string>("smoother");
|
||||
if (smoother == "ILU0") {
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
|
||||
using Smoother = SeqILU<M, V, V>;
|
||||
#else
|
||||
using Smoother = SeqILU0<M, V, V>;
|
||||
#endif
|
||||
return makeAmgPreconditioner<Smoother>(op, prm);
|
||||
} else if (smoother == "Jac") {
|
||||
using Smoother = SeqJac<M, V, V>;
|
||||
@ -267,7 +287,11 @@ private:
|
||||
using Smoother = SeqSSOR<M, V, V>;
|
||||
return makeAmgPreconditioner<Smoother>(op, prm);
|
||||
} else if (smoother == "ILUn") {
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
|
||||
using Smoother = SeqILU<M, V, V>;
|
||||
#else
|
||||
using Smoother = SeqILUn<M, V, V>;
|
||||
#endif
|
||||
return makeAmgPreconditioner<Smoother>(op, prm);
|
||||
} else {
|
||||
std::string msg("No such smoother: ");
|
||||
|
@ -26,58 +26,6 @@ namespace Dune
|
||||
{
|
||||
namespace Amg
|
||||
{
|
||||
#if !DUNE_VERSION_NEWER(DUNE_ISTL, 2, 5)
|
||||
template<class M, class V>
|
||||
struct DirectSolverSelector
|
||||
{
|
||||
#if DISABLE_AMG_DIRECTSOLVER
|
||||
static constexpr bool isDirectSolver = false;
|
||||
using type = void;
|
||||
#elif HAVE_SUITESPARSE_UMFPACK
|
||||
using field_type = typename M::field_type;
|
||||
using type = typename std::conditional<std::is_same<double, field_type>::value, UMFPack<M>,
|
||||
typename std::conditional<std::is_same<std::complex<double>, field_type>::value,
|
||||
UMFPack<M>,
|
||||
void>::type>::type;
|
||||
static constexpr bool isDirectSolver = std::is_same<UMFPack<M>, type>::value;
|
||||
#elif HAVE_SUPERLU
|
||||
static constexpr bool isDirectSolver = true;
|
||||
using type = SuperLU<M>;
|
||||
#else
|
||||
static constexpr bool isDirectSolver = false;
|
||||
using type = void;
|
||||
#endif
|
||||
|
||||
static type* create(const M& mat, bool verbose, bool reusevector )
|
||||
{
|
||||
return create(mat, verbose, reusevector, std::integral_constant<bool, isDirectSolver>());
|
||||
}
|
||||
static type* create(const M& /* mat */, bool /* verbose */, bool /* reusevector */, std::integral_constant<bool, false> )
|
||||
{
|
||||
DUNE_THROW(NotImplemented,"DirectSolver not selected");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static type* create(const M& mat, bool verbose, bool reusevector, std::integral_constant<bool, true> )
|
||||
{
|
||||
return new type(mat, verbose, reusevector);
|
||||
}
|
||||
static std::string name()
|
||||
{
|
||||
if(std::is_same<type,void>::value)
|
||||
return "None";
|
||||
#if HAVE_SUITESPARSE_UMFPACK
|
||||
if(std::is_same<type, UMFPack<M> >::value)
|
||||
return "UMFPack";
|
||||
#endif
|
||||
#if HAVE_SUPERLU
|
||||
if(std::is_same<type, SuperLU<M> >::value)
|
||||
return "SuperLU";
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if HAVE_MPI
|
||||
@ -212,19 +160,11 @@ namespace Dune
|
||||
/** \copydoc Preconditioner::apply */
|
||||
void apply(Domain& v, const Range& d);
|
||||
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
//! Category of the preconditioner (see SolverCategory::Category)
|
||||
virtual SolverCategory::Category category() const
|
||||
{
|
||||
return category_;
|
||||
}
|
||||
#else
|
||||
enum {
|
||||
//! \brief The category the preconditioner is part of.
|
||||
category = std::is_same<PI,Dune::Amg::SequentialInformation>::value?
|
||||
Dune::SolverCategory::sequential:Dune::SolverCategory::overlapping
|
||||
};
|
||||
#endif
|
||||
|
||||
/** \copydoc Preconditioner::post */
|
||||
void post(Domain& x);
|
||||
@ -441,10 +381,8 @@ namespace Dune
|
||||
bool additive;
|
||||
bool coarsesolverconverged;
|
||||
std::shared_ptr<Smoother> coarseSmoother_;
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
/** @brief The solver category. */
|
||||
SolverCategory::Category category_;
|
||||
#endif
|
||||
/** @brief The verbosity level. */
|
||||
std::size_t verbosity_;
|
||||
};
|
||||
@ -459,9 +397,7 @@ namespace Dune
|
||||
buildHierarchy_(amg.buildHierarchy_),
|
||||
additive(amg.additive), coarsesolverconverged(amg.coarsesolverconverged),
|
||||
coarseSmoother_(amg.coarseSmoother_),
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
category_(amg.category_),
|
||||
#endif
|
||||
verbosity_(amg.verbosity_)
|
||||
{
|
||||
if(amg.rhs_)
|
||||
@ -483,10 +419,8 @@ namespace Dune
|
||||
postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false),
|
||||
additive(parms.getAdditive()), coarsesolverconverged(true),
|
||||
coarseSmoother_(),
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
// #warning should category be retrieved from matrices?
|
||||
category_(SolverCategory::category(*smoothers_->coarsest())),
|
||||
#endif
|
||||
verbosity_(parms.debugLevel())
|
||||
{
|
||||
assert(matrices_->isBuilt());
|
||||
@ -508,15 +442,11 @@ namespace Dune
|
||||
postSteps_(criterion.getNoPostSmoothSteps()), buildHierarchy_(true),
|
||||
additive(criterion.getAdditive()), coarsesolverconverged(true),
|
||||
coarseSmoother_(),
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
category_(SolverCategory::category(pinfo)),
|
||||
#endif
|
||||
verbosity_(criterion.debugLevel())
|
||||
{
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
if(SolverCategory::category(matrix) != SolverCategory::category(pinfo))
|
||||
DUNE_THROW(InvalidSolverCategory, "Matrix and Communication must have the same SolverCategory!");
|
||||
#endif
|
||||
createHierarchies(criterion, const_cast<Operator&>(matrix), pinfo);
|
||||
}
|
||||
|
||||
@ -612,14 +542,7 @@ namespace Dune
|
||||
coarseSmoother_.reset(ConstructionTraits<Smoother>::construct(cargs));
|
||||
#endif
|
||||
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
scalarProduct_ = createScalarProduct<X>(cargs.getComm(),category());
|
||||
#else
|
||||
typedef Dune::ScalarProductChooser<X,ParallelInformation,category>
|
||||
ScalarProductChooser;
|
||||
// the scalar product.
|
||||
scalarProduct_.reset(ScalarProductChooser::construct(cargs.getComm()));
|
||||
#endif
|
||||
|
||||
|
||||
typedef DirectSolverSelector< typename M::matrix_type, X > SolverSelector;
|
||||
|
@ -302,12 +302,10 @@ private:
|
||||
return apply(x,b,1e-8,res);
|
||||
}
|
||||
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
virtual SolverCategory::Category category() const
|
||||
{
|
||||
return amg_.category();
|
||||
}
|
||||
#endif
|
||||
|
||||
~AMGInverseOperator()
|
||||
{
|
||||
@ -401,16 +399,6 @@ public:
|
||||
*/
|
||||
typedef S SmootherType;
|
||||
|
||||
// define the category
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
|
||||
#else
|
||||
enum {
|
||||
//! \brief The category the preconditioner is part of.
|
||||
category=SolverCategory::sequential
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Constructs a two level method.
|
||||
*
|
||||
@ -510,13 +498,12 @@ public:
|
||||
postsmooth(context, postSteps_);
|
||||
|
||||
}
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
// //! Category of the preconditioner (see SolverCategory::Category)
|
||||
virtual SolverCategory::Category category() const
|
||||
{
|
||||
return SolverCategory::sequential;
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Struct containing the level information.
|
||||
|
@ -94,13 +94,7 @@ namespace Opm {
|
||||
typedef Dune::FieldVector<Scalar, numEq > VectorBlockType;
|
||||
typedef Dune::BlockVector<VectorBlockType> BVector;
|
||||
|
||||
#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
|
||||
typedef Dune::FieldMatrix<Scalar, numEq, numEq > MatrixBlockType;
|
||||
#else
|
||||
typedef Dune::FieldMatrix<Scalar, numEq, numEq > MatrixBlockType;
|
||||
#endif
|
||||
|
||||
typedef Opm::BlackOilPolymerModule<TypeTag> PolymerModule;
|
||||
|
||||
|
@ -92,7 +92,11 @@ namespace mswellhelpers
|
||||
Dune::MatrixAdapter<MatrixType, VectorType, VectorType> linearOperator(D);
|
||||
|
||||
// Sequential incomplete LU decomposition as the preconditioner
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
|
||||
Dune::SeqILU<MatrixType, VectorType, VectorType> preconditioner(D, 1.0);
|
||||
#else
|
||||
Dune::SeqILU0<MatrixType, VectorType, VectorType> preconditioner(D, 1.0);
|
||||
#endif
|
||||
// Dune::SeqILUn<MatrixType, VectorType, VectorType> preconditioner(D, 1, 0.92);
|
||||
// Dune::SeqGS<MatrixType, VectorType, VectorType> preconditioner(D, 1, 1);
|
||||
// Dune::SeqJac<MatrixType, VectorType, VectorType> preconditioner(D, 1, 1);
|
||||
|
@ -30,8 +30,13 @@
|
||||
#endif
|
||||
|
||||
#include <dune/common/version.hh>
|
||||
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 7)
|
||||
#include <dune/common/parallel/mpicommunication.hh>
|
||||
#include <dune/common/parallel/communication.hh>
|
||||
#else
|
||||
#include <dune/common/parallel/mpicollectivecommunication.hh>
|
||||
#include <dune/common/parallel/collectivecommunication.hh>
|
||||
#endif
|
||||
|
||||
#include <dune/common/parallel/indexset.hh>
|
||||
#include <dune/common/parallel/communicator.hh>
|
||||
|
@ -28,7 +28,11 @@
|
||||
#include <dune/common/unused.hh>
|
||||
#include <dune/common/parallel/indexset.hh>
|
||||
#include <dune/common/parallel/plocalindex.hh>
|
||||
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 7)
|
||||
#include <dune/common/parallel/communication.hh>
|
||||
#else
|
||||
#include <dune/common/parallel/collectivecommunication.hh>
|
||||
#endif
|
||||
#include <dune/istl/bcrsmatrix.hh>
|
||||
#include <dune/istl/owneroverlapcopy.hh>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user