Skip to content
Snippets Groups Projects
Commit 5258d96d authored by Ned Coltman's avatar Ned Coltman
Browse files

Merge branch 'temp/uzawa_cpick' into 'releases/3.2'

[linear] Fix istlsolverfactory for dune-2.7 and dumux-3.2

See merge request !2013
parents a5266c26 7e13c0fd
No related branches found
No related tags found
2 merge requests!2152WIP add default fluxcache properties,!2013[linear] Fix istlsolverfactory for dune-2.7 and dumux-3.2
......@@ -26,9 +26,11 @@
#ifndef DUMUX_LINEAR_ISTL_SOLVERFACTORYBACKEND_HH
#define DUMUX_LINEAR_ISTL_SOLVERFACTORYBACKEND_HH
#include <memory>
#include <dune/common/version.hh>
#if DUNE_VERSION_NEWER_REV(DUNE_ISTL,2,7,1)
#if DUNE_VERSION_GTE(DUNE_ISTL,2,7)
#include <dune/common/version.hh>
#include <dune/common/parallel/mpihelper.hh>
#include <dune/common/parametertree.hh>
......@@ -70,7 +72,11 @@ int initSolverFactoriesForMultiTypeBlockMatrix()
using TL = Dune::TypeList<M,X,Y>;
auto& dsfac = Dune::DirectSolverFactory<M,X,Y>::instance();
Dune::addRegistryToFactory<TL>(dsfac, Dumux::MultiTypeBlockMatrixDirectSolverTag{});
#if DUNE_VERSION_GT(DUNE_ISTL,2,7)
auto& pfac = Dune::PreconditionerFactory<LinearOperator,X,Y>::instance();
#else
auto& pfac = Dune::PreconditionerFactory<M,X,Y>::instance();
#endif
Dune::addRegistryToFactory<TL>(pfac, Dumux::MultiTypeBlockMatrixPreconditionerTag{});
using TLS = Dune::TypeList<X,Y>;
auto& isfac = Dune::IterativeSolverFactory<X,Y>::instance();
......@@ -293,6 +299,6 @@ private:
} // end namespace Dumux
#else
#warning "Generic dune-istl solver factory backend needs dune-istl >= 2.7.1!"
#warning "Generic dune-istl solver factory backend needs dune-istl >= 2.7!"
#endif // DUNE version check
#endif // header guard
......@@ -25,11 +25,8 @@
#ifndef DUMUX_LINEAR_ISTL_SOLVER_REGISTRY_HH
#define DUMUX_LINEAR_ISTL_SOLVER_REGISTRY_HH
#include <dune/common/version.hh>
#if DUNE_VERSION_NEWER_REV(DUNE_ISTL,2,7,1)
#include <dune/istl/common/registry.hh>
#include <dune/istl/solverregistry.hh>
/*!
* \brief Register a Dumux preconditioner
......@@ -52,5 +49,4 @@ struct MultiTypeBlockMatrixDirectSolverTag {};
} // end namespace
} // end namespace Dumux
#endif // DUNE version check
#endif // DUMUX_LINEAR_ISTL_SOLVER_REGISTRY_HH
......@@ -63,6 +63,7 @@ public:
params["preconditioner.verbosity"] = "0";
params["preconditioner.defaultAggregationSizeMode"] = "isotropic";
params["preconditioner.defaultAggregationDimension"] = std::to_string(LinearSolverTraits::GridView::dimension);
params["preconditioner.maxLevel"] = "100";
params["ParameterGroup"] = paramGroup;
params["preconditioner.ParameterGroup"] = paramGroup;
}
......
......@@ -38,7 +38,7 @@
#include <dumux/common/parameters.hh>
#include <dumux/common/typetraits/matrix.hh>
#if DUNE_VERSION_NEWER_REV(DUNE_ISTL,2,7,1)
#if DUNE_VERSION_GTE(DUNE_ISTL,2,7)
#include <dumux/linear/istlsolverregistry.hh>
#endif
......@@ -111,8 +111,13 @@ public:
* \param mat The matrix to operate on.
* \param params Collection of paramters.
*/
SeqUzawa(const std::shared_ptr<const Dune::AssembledLinearOperator<M,X,Y>>& mat, const Dune::ParameterTree& params)
: matrix_(mat->getmat())
#if DUNE_VERSION_GT(DUNE_ISTL,2,7)
SeqUzawa(const std::shared_ptr<const Dune::AssembledLinearOperator<M,X,Y>>& op, const Dune::ParameterTree& params)
: matrix_(op->getmat())
#else
SeqUzawa(const M& mat, const Dune::ParameterTree& params)
: matrix_(mat)
#endif
, numIterations_(params.get<std::size_t>("iterations"))
, relaxationFactor_(params.get<scalar_field_type>("relaxation"))
, verbosity_(params.get<int>("verbosity"))
......@@ -331,7 +336,7 @@ private:
};
#endif // DUNE_VERSION_GTE(DUNE_ISTL,2,7)
#if DUNE_VERSION_NEWER_REV(DUNE_ISTL,2,7,1)
#if DUNE_VERSION_GTE(DUNE_ISTL,2,7)
DUMUX_REGISTER_PRECONDITIONER("uzawa", Dumux::MultiTypeBlockMatrixPreconditionerTag, Dune::defaultPreconditionerBlockLevelCreator<Dumux::SeqUzawa, 1>());
#endif
......
......@@ -35,7 +35,7 @@ dumux_add_test(NAME test_ff_navierstokes_sincos_uzawapreconditioner_factory
SOURCES main.cc
LABELS freeflow
TIMEOUT 5000
CMAKE_GUARD "( HAVE_UMFPACK AND DUNE_ISTL_VERSION GREATER_EQUAL 2.7 )"
CMAKE_GUARD "( HAVE_UMFPACK AND ( ( DUNE_ISTL_VERSION VERSION_GREATER 2.7 ) OR ( DUNE_ISTL_VERSION VERSION_EQUAL 2.7 ) ) )"
COMPILE_DEFINITIONS LINEARSOLVER=IstlSolverFactoryBackend<LinearSolverTraits<GridGeometry>>
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
......
......@@ -47,7 +47,7 @@
#include <dumux/nonlinear/newtonsolver.hh>
#include <dune/common/version.hh>
#if DUNE_VERSION_NEWER_REV(DUNE_ISTL,2,7,1)
#if DUNE_VERSION_GTE(DUNE_ISTL,2,7)
#include <dumux/linear/istlsolverfactorybackend.hh>
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment