Fixes for Dune < 2.6.

The PreconditionerFactory requires 2.6, so this is addressed by
simply not using that code at all for Dune < 2.6. No FlexibleSolver
etc.
This commit is contained in:
Atgeirr Flø Rasmussen 2019-06-05 22:00:30 +02:00
parent 38a61fa0c0
commit 72ae444566
6 changed files with 47 additions and 12 deletions

View File

@ -164,7 +164,6 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/linalg/ExtractParallelGridInformationToISTL.hpp
opm/simulators/linalg/FlexibleSolver.hpp
opm/simulators/linalg/FlowLinearSolverParameters.hpp
opm/simulators/linalg/GetQuasiImpesWeights.hpp
opm/simulators/linalg/GraphColoring.hpp
opm/simulators/linalg/ISTLSolverEbos.hpp
opm/simulators/linalg/ISTLSolverEbosCpr.hpp
@ -172,7 +171,7 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/linalg/MatrixBlock.hpp
opm/simulators/linalg/MatrixMarketUtils.hpp
opm/simulators/linalg/OwningBlockPreconditioner.hpp
opm/simulators/linalg/OwningTwolevelPreconditioner.hpp
opm/simulators/linalg/OwningTwoLevelPreconditioner.hpp
opm/simulators/linalg/ParallelOverlappingILU0.hpp
opm/simulators/linalg/ParallelRestrictedAdditiveSchwarz.hpp
opm/simulators/linalg/ParallelIstlInformation.hpp
@ -180,6 +179,7 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/linalg/PressureTransferPolicy.hpp
opm/simulators/linalg/PreconditionerFactory.hpp
opm/simulators/linalg/PreconditionerWithUpdate.hpp
opm/simulators/linalg/getQuasiImpesWeights.hpp
opm/simulators/linalg/setupPropertyTree.hpp
opm/simulators/timestepping/AdaptiveSimulatorTimer.hpp
opm/simulators/timestepping/AdaptiveTimeSteppingEbos.hpp

View File

@ -20,9 +20,12 @@
*/
#include "config.h"
#include "flow/flow_tag.hpp"
//#include <opm/linearsolvers/amgclsolverbackend.hh>
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
#include <opm/simulators/linalg/ISTLSolverEbosFlexible.hpp>
//#include <ewoms/linear/superlubackend.hh>
#else
#include <opm/simulators/linalg/ISTLSolverEbosCpr.hpp>
#endif
BEGIN_PROPERTIES
NEW_TYPE_TAG(EclFlowProblemSimple, INHERITS_FROM(EclFlowProblem));
@ -46,8 +49,8 @@ SET_PROP(EclFlowProblemSimple, FluidState)
typedef Opm::BlackOilFluidState<Evaluation, FluidSystem, enableTemperature, enableEnergy, compositionSwitchEnabled, Indices::numPhases > type;
};
SET_BOOL_PROP(EclFlowProblemSimple,MatrixAddWellContributions,true);
SET_INT_PROP(EclFlowProblemSimple,LinearSolverVerbosity,0);
SET_BOOL_PROP(EclFlowProblemSimple, MatrixAddWellContributions, true);
SET_INT_PROP(EclFlowProblemSimple, LinearSolverVerbosity,0);
SET_SCALAR_PROP(EclFlowProblemSimple, LinearSolverReduction, 1e-2);
SET_INT_PROP(EclFlowProblemSimple, LinearSolverMaxIter, 100);
SET_BOOL_PROP(EclFlowProblemSimple, UseAmg, true);//probably not used
@ -79,7 +82,11 @@ namespace Ewoms {
//SET_TYPE_PROP(EclFlowProblemSimple, LinearSolverBackend, Ewoms::Linear::ParallelBiCGStabSolverBackend<TypeTag>);//not work
//SET_TYPE_PROP(EclFlowProblemSimple, LinearSolverBackend, Ewoms::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);

View File

@ -395,9 +395,9 @@ private:
}
}
void updatePreconditioner(typename AMGType::Operator& op)
void updatePreconditioner()
{
amg_->updateSolver(crit_, op, comm_);
amg_->updateSolver(crit_, op_, comm_);
}
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)

View File

@ -50,9 +50,9 @@ namespace Dune
static type* create(const M& mat, bool verbose, bool reusevector )
{
create(mat, verbose, reusevector, std::integral_constant<bool, isDirectSolver>());
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> )
static type* create(const M& /* mat */, bool /* verbose */, bool /* reusevector */, std::integral_constant<bool, false> )
{
DUNE_THROW(NotImplemented,"DirectSolver not selected");
return nullptr;
@ -294,7 +294,7 @@ namespace Dune
* @brief Update the coarse solver and the hierarchies.
*/
template<class C>
void updateSolver(C& criterion, Operator& /* matrix */, const PI& pinfo);
void updateSolver(C& criterion, const Operator& /* matrix */, const PI& pinfo);
/**
* @brief Update the coarse solver and the hierarchies.
@ -533,7 +533,7 @@ namespace Dune
template<class M, class X, class S, class PI, class A>
template<class C>
void AMGCPR<M,X,S,PI,A>::updateSolver(C& /* criterion */, Operator& /* matrix */, const PI& /* pinfo */)
void AMGCPR<M,X,S,PI,A>::updateSolver(C& /* criterion */, const Operator& /* matrix */, const PI& /* pinfo */)
{
update();
}

View File

@ -22,6 +22,10 @@
#define BOOST_TEST_MODULE OPM_test_FlexibleSolver
#include <boost/test/unit_test.hpp>
#include <dune/common/version.hh>
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
#include <opm/simulators/linalg/FlexibleSolver.hpp>
#include <boost/property_tree/json_parser.hpp>
@ -107,3 +111,13 @@ BOOST_AUTO_TEST_CASE(TestFlexibleSolver)
}
}
}
#else
// Do nothing if we do not have at least Dune 2.6.
BOOST_AUTO_TEST_CASE(DummyTest)
{
BOOST_REQUIRE(true);
}
#endif

View File

@ -22,6 +22,10 @@
#define BOOST_TEST_MODULE OPM_test_PreconditionerFactory
#include <boost/test/unit_test.hpp>
#include <dune/common/version.hh>
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
#include <opm/simulators/linalg/PreconditionerFactory.hpp>
#include <opm/simulators/linalg/FlexibleSolver.hpp>
@ -213,3 +217,13 @@ BOOST_AUTO_TEST_CASE(TestAddingPreconditioner)
// Test with 3x3 block solvers.
test3(prm);
}
#else
// Do nothing if we do not have at least Dune 2.6.
BOOST_AUTO_TEST_CASE(DummyTest)
{
BOOST_REQUIRE(true);
}
#endif