diff --git a/dumux/common/properties.hh b/dumux/common/properties.hh index ca9b5c443d63cca5184e0e87b6fb27ce10ef43f3..4f592b4853f8e1d7dfa31153b28533e12c7088be 100644 --- a/dumux/common/properties.hh +++ b/dumux/common/properties.hh @@ -65,7 +65,6 @@ NEW_PROP_TAG(LocalResidual); //! TODO: Remove this property as soon as the decoupled models are integrated NEW_PROP_TAG(LinearSolver); -NEW_PROP_TAG(LinearSolverPreconditionerBlockLevel); //!< Block level depth for the preconditioner //////////////////////////////////////////////// // Basic properties regarding balance equations @@ -147,8 +146,6 @@ NEW_PROP_TAG(NumSPhases); NEW_PROP_TAG(NonMineralizationVtkOutputFields); NEW_PROP_TAG(NonMineralizationVolumeVariables); -NEW_PROP_TAG(UseConstraintSolver); //!< Determines whether the constraint solver should be used# - ///////////////////////////////////////////////////////////// // non-isothermal porous medium flow models ///////////////////////////////////////////////////////////// diff --git a/dumux/discretization/fvproperties.hh b/dumux/discretization/fvproperties.hh index 56e2e5fe3b3ff4406cfd495ae7859c31b7924fd7..c0596dc4ec66c83d07790ef612a5acee76b02252 100644 --- a/dumux/discretization/fvproperties.hh +++ b/dumux/discretization/fvproperties.hh @@ -59,7 +59,7 @@ SET_BOOL_PROP(FiniteVolumeModel, EnableGridFluxVariablesCache, false); //! Boundary types at a single degree of freedom SET_TYPE_PROP(FiniteVolumeModel, BoundaryTypes, BoundaryTypes<GET_PROP_VALUE(TypeTag, NumEq)>); -// TODO: bundle SolutionVector, JacobianMatrix and LinearSolverPreconditionerBlockLevel +// TODO: bundle SolutionVector, JacobianMatrix // in LinearAlgebra traits //! The type of a solution for the whole grid at a fixed time TODO: move to LinearAlgebra traits @@ -76,11 +76,6 @@ public: using type = typename Dune::BCRSMatrix<MatrixBlock>; }; -//! set the block level to 1, suitable for e.g. a simple Dune::BCRSMatrix. -//! Set this to more than one if the matrix to solve is nested multiple times -//! e.g. for Dune::MultiTypeBlockMatrix'es. TODO: move to LinearAlgebra traits -SET_INT_PROP(FiniteVolumeModel, LinearSolverPreconditionerBlockLevel, 1); - } // namespace Properties } // namespace Dumux diff --git a/dumux/discretization/staggered/properties.hh b/dumux/discretization/staggered/properties.hh index 4385fc018d3631409d4682bf90ee4cfb9eecf11d..2b7ce7c9dc652812525a257a092f6da1a90e1f0e 100644 --- a/dumux/discretization/staggered/properties.hh +++ b/dumux/discretization/staggered/properties.hh @@ -208,7 +208,7 @@ public: } }; -// TODO: bundle SolutionVector, JacobianMatrix and LinearSolverPreconditionerBlockLevel +// TODO: bundle SolutionVector, JacobianMatrix // in LinearAlgebra traits //! The type of a solution for the whole grid at a fixed time TODO: move to LinearAlgebra traits @@ -263,9 +263,6 @@ public: using type = typename Dune::MultiTypeBlockMatrix<RowCellCenter, RowFace>; }; -// set the block level to 2 (nested multiple times) TODO: move to LinearAlgebra traits -SET_INT_PROP(StaggeredModel, LinearSolverPreconditionerBlockLevel, 2); - } // namespace Properties } // namespace Dumux diff --git a/dumux/linear/amgbackend.hh b/dumux/linear/amgbackend.hh index 1ac88cc1938f09322502a8bff34418be1ddb59f4..6a835f7c25f8fe12eca49b34edf5b0bb0594d4b1 100644 --- a/dumux/linear/amgbackend.hh +++ b/dumux/linear/amgbackend.hh @@ -19,21 +19,23 @@ /*! * \file * \ingroup Linear - * \brief Provides a linear solver based on the ISTL AMG preconditioner + * \brief Provides a parallel linear solver based on the ISTL AMG preconditioner * and the ISTL BiCGSTAB solver. */ -#ifndef DUMUX_AMGBACKEND_HH -#define DUMUX_AMGBACKEND_HH +#ifndef DUMUX_PARALLEL_AMGBACKEND_HH +#define DUMUX_PARALLEL_AMGBACKEND_HH +#include <memory> + +#include <dune/common/exceptions.hh> #include <dune/common/parallel/indexset.hh> #include <dune/common/parallel/mpicollectivecommunication.hh> +#include <dune/grid/common/capabilities.hh> #include <dune/istl/paamg/amg.hh> #include <dune/istl/paamg/pinfo.hh> #include <dune/istl/solvers.hh> -#include <dumux/common/properties.hh> #include <dumux/linear/solver.hh> -#include <dumux/linear/amgtraits.hh> #include <dumux/linear/amgparallelhelpers.hh> namespace Dumux { @@ -74,12 +76,10 @@ void scaleLinearSystem(Matrix& matrix, Vector& rhs) * \brief A linear solver based on the ISTL AMG preconditioner * and the ISTL BiCGSTAB solver. */ -template <class TypeTag> -class AMGBackend : public LinearSolver<TypeTag> +template <class GridView, class AmgTraits> +class ParallelAMGBackend : public LinearSolver { - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using Grid = typename GET_PROP_TYPE(TypeTag, Grid); - using AmgTraits = Dumux::AmgTraits<TypeTag>; + using Grid = typename GridView::Grid; enum { numEq = AmgTraits::numEq }; using LinearOperator = typename AmgTraits::LinearOperator; using ScalarProduct = typename AmgTraits::ScalarProduct; @@ -91,15 +91,32 @@ class AMGBackend : public LinearSolver<TypeTag> using DofMapper = typename AmgTraits::DofMapper; public: /*! - * \brief Construct the backend. + * \brief Construct the backend for the sequential case only * * \param gridView the grid view on which we are performing the multi-grid * \param dofMapper an index mapper for dof entities + * \param paramGroup the parameter group for parameter lookup */ - AMGBackend(const GridView& gridView, const DofMapper& dofMapper) - : gridView_(gridView) - , dofMapper_(dofMapper) - , phelper_(gridView, dofMapper) + ParallelAMGBackend(const std::string& paramGroup = "") + : LinearSolver(paramGroup) + , firstCall_(true) + { + if (Dune::MPIHelper::getCollectiveCommunication().size() > 1) + DUNE_THROW(Dune::InvalidStateException, "Using sequential constructor for parallel run. Use signature with gridView and dofMapper!"); + } + + /*! + * \brief Construct the backend for parallel or sequential runs + * + * \param gridView the grid view on which we are performing the multi-grid + * \param dofMapper an index mapper for dof entities + * \param paramGroup the parameter group for parameter lookup + */ + ParallelAMGBackend(const GridView& gridView, + const DofMapper& dofMapper, + const std::string& paramGroup = "") + : LinearSolver(paramGroup) + , phelper_(std::make_shared<ParallelISTLHelper<GridView, AmgTraits>>(gridView, dofMapper)) , firstCall_(true) {} @@ -184,19 +201,32 @@ private: std::shared_ptr<LinearOperator>& fop, std::shared_ptr<ScalarProduct>& sp) { - LinearAlgebraPreparator<TypeTag, isParallel> + LinearAlgebraPreparator<GridView, AmgTraits, isParallel> ::prepareLinearAlgebra(A, b, rank, comm, fop, sp, - gridView_, dofMapper_, phelper_, firstCall_); + *phelper_, firstCall_); } - GridView gridView_; - DofMapper dofMapper_; - - ParallelISTLHelper<TypeTag> phelper_; + std::shared_ptr<ParallelISTLHelper<GridView, AmgTraits>> phelper_; Dune::InverseOperatorResult result_; bool firstCall_; }; } // namespace Dumux +#include <dumux/common/properties.hh> +#include <dumux/linear/amgtraits.hh> + +namespace Dumux { + +/*! + * \ingroup Linear + * \brief A linear solver based on the ISTL AMG preconditioner + * and the ISTL BiCGSTAB solver. + * \note This is an adaptor using a TypeTag + */ +template<class TypeTag> +using AMGBackend = ParallelAMGBackend<typename GET_PROP_TYPE(TypeTag, GridView), AmgTraits<TypeTag>>; + +} // namespace Dumux + #endif // DUMUX_AMGBACKEND_HH diff --git a/dumux/linear/amgparallelhelpers.hh b/dumux/linear/amgparallelhelpers.hh index 3d2b41727ba9339e9e5c11f3da630246e574c6b1..20fe263a340be417b6e506c80c15a257a2818199 100644 --- a/dumux/linear/amgparallelhelpers.hh +++ b/dumux/linear/amgparallelhelpers.hh @@ -30,8 +30,6 @@ #include <dune/grid/common/partitionset.hh> #include <dune/istl/owneroverlapcopy.hh> #include <dune/istl/paamg/pinfo.hh> -#include <dumux/common/properties.hh> -#include <dumux/linear/amgtraits.hh> namespace Dumux { @@ -41,13 +39,10 @@ namespace Dumux { * decomposition of all degrees of freedom */ // operator that resets result to zero at constrained DOFS -template<class TypeTag> +template<class GridView, class AmgTraits> class ParallelISTLHelper { - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using AmgTraits = Dumux::AmgTraits<TypeTag>; using DofMapper = typename AmgTraits::DofMapper; - enum { dofCodim = AmgTraits::dofCodim }; class BaseGatherScatter @@ -462,6 +457,14 @@ public: void createIndexSetAndProjectForAMG(MatrixType& m, Comm& c); #endif + //! Return the dofMapper + const DofMapper& dofMapper() const + { return mapper_; } + + //! Return the gridView + const GridView& gridView() const + { return gridView_; } + private: const GridView gridView_; //!< the grid view const DofMapper& mapper_; //!< the dof mapper @@ -475,17 +478,13 @@ private: /*! * \ingroup Linear * \brief Helper class for adding up matrix entries on border. - * \tparam GridOperator The grid operator to work on. - * \tparam MatrixType The MatrixType. + * \tparam GridView The grid view to work on + * \tparam AmgTraits traits class */ -template<class TypeTag> +template<class GridView, class AmgTraits> class EntityExchanger { - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using AmgTraits = Dumux::AmgTraits<TypeTag>; - enum { numEq = AmgTraits::numEq }; - using Matrix = Dune::BCRSMatrix<Dune::FieldMatrix<Scalar,numEq,numEq> >; - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using Matrix = typename AmgTraits::MType; enum { dim = GridView::dimension }; enum { dofCodim = AmgTraits::dofCodim }; using Grid = typename GridView::Traits::Grid; @@ -563,7 +562,7 @@ public: MatPatternExchange (const DofMapper& mapper, const std::map<IdType,int>& g2i, const std::map<int,IdType>& i2g, Matrix& A, - const ParallelISTLHelper<TypeTag>& helper) + const ParallelISTLHelper<GridView, AmgTraits>& helper) : mapper_(mapper), gid2Index_(g2i), index2GID_(i2g), sparsity_(A.N()), A_(A), helper_(helper) {} @@ -648,7 +647,7 @@ public: const std::map<int,IdType>& index2GID_; std::vector<std::set<int> > sparsity_; Matrix& A_; - const ParallelISTLHelper<TypeTag>& helper_; + const ParallelISTLHelper<GridView, AmgTraits>& helper_; }; // class MatPatternExchange @@ -759,7 +758,7 @@ public: \param A Matrix to operate on. \param helper ParallelelISTLHelper. */ - void getExtendedMatrix (Matrix& A, const ParallelISTLHelper<TypeTag>& helper) + void getExtendedMatrix (Matrix& A, const ParallelISTLHelper<GridView, AmgTraits>& helper) { if (gridView_.comm().size() > 1) { @@ -833,8 +832,8 @@ private: // methods that only exist if MPI is available #if HAVE_MPI -template<class TypeTag> -void EntityExchanger<TypeTag>::getExtendedMatrix (Matrix& A) const +template<class GridView, class AmgTraits> +void EntityExchanger<GridView, AmgTraits>::getExtendedMatrix (Matrix& A) const { if (gridView_.comm().size() > 1) { @@ -878,9 +877,9 @@ void EntityExchanger<TypeTag>::getExtendedMatrix (Matrix& A) const } // EntityExchanger::getExtendedMatrix -template<class TypeTag> +template<class GridView, class AmgTraits> template<typename MatrixType, typename Comm> -void ParallelISTLHelper<TypeTag>::createIndexSetAndProjectForAMG(MatrixType& m, Comm& comm) +void ParallelISTLHelper<GridView, AmgTraits>::createIndexSetAndProjectForAMG(MatrixType& m, Comm& comm) { if(!initialized_) { @@ -1002,13 +1001,11 @@ void ParallelISTLHelper<TypeTag>::createIndexSetAndProjectForAMG(MatrixType& m, * * \tparam isParallel decides if the setting is parallel or sequential */ -template<class TypeTag, bool isParallel> +template<class GridView, class AmgTraits, bool isParallel> struct LinearAlgebraPreparator { - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using AmgTraits = Dumux::AmgTraits<TypeTag>; using DofMapper = typename AmgTraits::DofMapper; - using ParallelHelper = ParallelISTLHelper<TypeTag>; + using ParallelHelper = ParallelISTLHelper<GridView, AmgTraits>; using Comm = typename AmgTraits::Comm; using LinearOperator = typename AmgTraits::LinearOperator; using ScalarProduct = typename AmgTraits::ScalarProduct; @@ -1019,8 +1016,6 @@ struct LinearAlgebraPreparator std::shared_ptr<Comm>& comm, std::shared_ptr<LinearOperator>& fop, std::shared_ptr<ScalarProduct>& sp, - const GridView& gridView, - const DofMapper& mapper, ParallelHelper& pHelper, const bool firstCall) { @@ -1034,13 +1029,11 @@ struct LinearAlgebraPreparator /*! * \brief Specialization for the parallel case. */ -template<class TypeTag> -struct LinearAlgebraPreparator<TypeTag, true> +template<class GridView, class AmgTraits> +struct LinearAlgebraPreparator<GridView, AmgTraits, true> { - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using AmgTraits = Dumux::AmgTraits<TypeTag>; using DofMapper = typename AmgTraits::DofMapper; - using ParallelHelper = ParallelISTLHelper<TypeTag>; + using ParallelHelper = ParallelISTLHelper<GridView, AmgTraits>; using Comm = typename AmgTraits::Comm; using LinearOperator = typename AmgTraits::LinearOperator; using ScalarProduct = typename AmgTraits::ScalarProduct; @@ -1051,8 +1044,6 @@ struct LinearAlgebraPreparator<TypeTag, true> std::shared_ptr<Comm>& comm, std::shared_ptr<LinearOperator>& fop, std::shared_ptr<ScalarProduct>& sp, - const GridView& gridView, - const DofMapper& mapper, ParallelHelper& pHelper, const bool firstCall) { @@ -1064,12 +1055,12 @@ struct LinearAlgebraPreparator<TypeTag, true> pHelper.initGhostsAndOwners(); } - comm = std::make_shared<Comm>(gridView.comm(), category); + comm = std::make_shared<Comm>(pHelper.gridView().comm(), category); if(AmgTraits::isNonOverlapping) { // extend the matrix pattern such that it is usable for AMG - EntityExchanger<TypeTag> exchanger(gridView, mapper); + EntityExchanger<GridView, AmgTraits> exchanger(pHelper.gridView(), pHelper.dofMapper()); exchanger.getExtendedMatrix(A, pHelper); exchanger.sumEntries(A); } diff --git a/dumux/linear/amgtraits.hh b/dumux/linear/amgtraits.hh index 26ef8eb7e9c21e45effef702f1e89195e7e2db1c..72e95a441e251cf3654bb6a4d5c442592d2488ee 100644 --- a/dumux/linear/amgtraits.hh +++ b/dumux/linear/amgtraits.hh @@ -37,9 +37,6 @@ namespace Dumux { -// Forward declaration for the property definitions -template <class TypeTag> class AMGBackend; - //! The implementation is specialized for the different discretizations template<class TypeTag, DiscretizationMethods DM> struct AmgTraitsImpl; diff --git a/dumux/linear/linearsolveracceptsmultitypematrix.hh b/dumux/linear/linearsolveracceptsmultitypematrix.hh index fa4778d0cfc17ab1757eed5aecd61466f12e5bbb..a45a4d6a77954e077a13d7d0ff8567a57c6db45b 100644 --- a/dumux/linear/linearsolveracceptsmultitypematrix.hh +++ b/dumux/linear/linearsolveracceptsmultitypematrix.hh @@ -45,38 +45,38 @@ using LinearSolverAcceptsMultiTypeMatrix = LinearSolverAcceptsMultiTypeMatrixImp //! And the direct solvers that have BCRS Matrix hardcoded template<typename TypeTag> -struct LinearSolverAcceptsMultiTypeMatrixImpl<TypeTag, ILUnBiCGSTABBackend<TypeTag>> +struct LinearSolverAcceptsMultiTypeMatrixImpl<TypeTag, ILUnBiCGSTABBackend> { static constexpr bool value = false; }; template<typename TypeTag> -struct LinearSolverAcceptsMultiTypeMatrixImpl<TypeTag, ILUnCGBackend<TypeTag>> +struct LinearSolverAcceptsMultiTypeMatrixImpl<TypeTag, ILUnCGBackend> { static constexpr bool value = false; }; template<typename TypeTag> -struct LinearSolverAcceptsMultiTypeMatrixImpl<TypeTag, ILU0BiCGSTABBackend<TypeTag>> +struct LinearSolverAcceptsMultiTypeMatrixImpl<TypeTag, ILU0BiCGSTABBackend> { static constexpr bool value = false; }; template<typename TypeTag> -struct LinearSolverAcceptsMultiTypeMatrixImpl<TypeTag, ILU0CGBackend<TypeTag>> +struct LinearSolverAcceptsMultiTypeMatrixImpl<TypeTag, ILU0CGBackend> { static constexpr bool value = false; }; template<typename TypeTag> -struct LinearSolverAcceptsMultiTypeMatrixImpl<TypeTag, ILU0RestartedGMResBackend<TypeTag>> +struct LinearSolverAcceptsMultiTypeMatrixImpl<TypeTag, ILU0RestartedGMResBackend> { static constexpr bool value = false; }; template<typename TypeTag> -struct LinearSolverAcceptsMultiTypeMatrixImpl<TypeTag, ILUnRestartedGMResBackend<TypeTag>> +struct LinearSolverAcceptsMultiTypeMatrixImpl<TypeTag, ILUnRestartedGMResBackend> { static constexpr bool value = false; }; #if HAVE_SUPERLU template<typename TypeTag> -struct LinearSolverAcceptsMultiTypeMatrixImpl<TypeTag, SuperLUBackend<TypeTag>> +struct LinearSolverAcceptsMultiTypeMatrixImpl<TypeTag, SuperLUBackend> { static constexpr bool value = false; }; #endif // HAVE_SUPERLU #if HAVE_UMFPACK template<typename TypeTag> -struct LinearSolverAcceptsMultiTypeMatrixImpl<TypeTag, UMFPackBackend<TypeTag>> +struct LinearSolverAcceptsMultiTypeMatrixImpl<TypeTag, UMFPackBackend> { static constexpr bool value = false; }; #endif // HAVE_UMFPACK diff --git a/dumux/linear/seqsolverbackend.hh b/dumux/linear/seqsolverbackend.hh index b4d1ebac297bcc154dc7df8a1f443fba1b84cd53..659b893c9675318c0247cee5b2ff185bf230a692 100644 --- a/dumux/linear/seqsolverbackend.hh +++ b/dumux/linear/seqsolverbackend.hh @@ -168,20 +168,19 @@ public: * LinearSolver.PreconditionerRelaxation.\n * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ -template <class TypeTag> -class ILUnBiCGSTABBackend : public LinearSolver<TypeTag> +class ILUnBiCGSTABBackend : public LinearSolver { public: + using LinearSolver::LinearSolver; - template<class Matrix, class Vector> + // precondBlockLevel: set this to more than one if the matrix to solve is nested multiple times + template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { - static const std::string paramGroup = GET_PROP_VALUE(TypeTag, ModelParameterGroup); - constexpr auto blockLevel = GET_PROP_VALUE(TypeTag, LinearSolverPreconditionerBlockLevel); - using Preconditioner = Dune::SeqILUn<Matrix, Vector, Vector, blockLevel>; + using Preconditioner = Dune::SeqILUn<Matrix, Vector, Vector, precondBlockLevel>; using Solver = Dune::BiCGSTABSolver<Vector>; - return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, paramGroup); + return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); } std::string name() const @@ -207,20 +206,19 @@ public: * LinearSolver.PreconditionerIterations.\n * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ -template <class TypeTag> -class SORBiCGSTABBackend : public LinearSolver<TypeTag> +class SORBiCGSTABBackend : public LinearSolver { public: + using LinearSolver::LinearSolver; - template<class Matrix, class Vector> + // precondBlockLevel: set this to more than one if the matrix to solve is nested multiple times + template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { - static const std::string paramGroup = GET_PROP_VALUE(TypeTag, ModelParameterGroup); - constexpr auto blockLevel = GET_PROP_VALUE(TypeTag, LinearSolverPreconditionerBlockLevel); - using Preconditioner = Dune::SeqSOR<Matrix, Vector, Vector, blockLevel>; + using Preconditioner = Dune::SeqSOR<Matrix, Vector, Vector, precondBlockLevel>; using Solver = Dune::BiCGSTABSolver<Vector>; - return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, paramGroup); + return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); } std::string name() const @@ -246,20 +244,19 @@ public: * LinearSolver.PreconditionerIterations.\n * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ -template <class TypeTag> -class SSORBiCGSTABBackend : public LinearSolver<TypeTag> +class SSORBiCGSTABBackend : public LinearSolver { public: + using LinearSolver::LinearSolver; - template<class Matrix, class Vector> + // precondBlockLevel: set this to more than one if the matrix to solve is nested multiple times + template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { - static const std::string paramGroup = GET_PROP_VALUE(TypeTag, ModelParameterGroup); - constexpr auto blockLevel = GET_PROP_VALUE(TypeTag, LinearSolverPreconditionerBlockLevel); - using Preconditioner = Dune::SeqSSOR<Matrix, Vector, Vector, blockLevel>; + using Preconditioner = Dune::SeqSSOR<Matrix, Vector, Vector, precondBlockLevel>; using Solver = Dune::BiCGSTABSolver<Vector>; - return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, paramGroup); + return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); } std::string name() const @@ -285,20 +282,19 @@ public: * LinearSolver.PreconditionerIterations.\n * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ -template <class TypeTag> -class GSBiCGSTABBackend : public LinearSolver<TypeTag> +class GSBiCGSTABBackend : public LinearSolver { public: + using LinearSolver::LinearSolver; - template<class Matrix, class Vector> + // precondBlockLevel: set this to more than one if the matrix to solve is nested multiple times + template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { - static const std::string paramGroup = GET_PROP_VALUE(TypeTag, ModelParameterGroup); - constexpr auto blockLevel = GET_PROP_VALUE(TypeTag, LinearSolverPreconditionerBlockLevel); - using Preconditioner = Dune::SeqGS<Matrix, Vector, Vector, blockLevel>; + using Preconditioner = Dune::SeqGS<Matrix, Vector, Vector, precondBlockLevel>; using Solver = Dune::BiCGSTABSolver<Vector>; - return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, paramGroup); + return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); } std::string name() const @@ -323,20 +319,19 @@ public: * applied as often as given by the parameter LinearSolver.PreconditionerIterations.\n * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ -template <class TypeTag> -class JacBiCGSTABBackend : public LinearSolver<TypeTag> +class JacBiCGSTABBackend : public LinearSolver { public: + using LinearSolver::LinearSolver; - template<class Matrix, class Vector> + // precondBlockLevel: set this to more than one if the matrix to solve is nested multiple times + template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { - static const std::string paramGroup = GET_PROP_VALUE(TypeTag, ModelParameterGroup); - constexpr auto blockLevel = GET_PROP_VALUE(TypeTag, LinearSolverPreconditionerBlockLevel); - using Preconditioner = Dune::SeqJac<Matrix, Vector, Vector, blockLevel>; + using Preconditioner = Dune::SeqJac<Matrix, Vector, Vector, precondBlockLevel>; using Solver = Dune::BiCGSTABSolver<Vector>; - return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, paramGroup); + return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); } std::string name() const @@ -361,20 +356,19 @@ public: * LinearSolver.PreconditionerRelaxation.\n * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ -template <class TypeTag> -class ILUnCGBackend : public LinearSolver<TypeTag> +class ILUnCGBackend : public LinearSolver { public: + using LinearSolver::LinearSolver; - template<class Matrix, class Vector> + // precondBlockLevel: set this to more than one if the matrix to solve is nested multiple times + template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { - static const std::string paramGroup = GET_PROP_VALUE(TypeTag, ModelParameterGroup); - constexpr auto blockLevel = GET_PROP_VALUE(TypeTag, LinearSolverPreconditionerBlockLevel); - using Preconditioner = Dune::SeqILUn<Matrix, Vector, Vector, blockLevel>; + using Preconditioner = Dune::SeqILUn<Matrix, Vector, Vector, precondBlockLevel>; using Solver = Dune::CGSolver<Vector>; - return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, paramGroup); + return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); } std::string name() const @@ -399,20 +393,19 @@ public: * LinearSolver.PreconditionerIterations.\n * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ -template <class TypeTag> -class SORCGBackend : public LinearSolver<TypeTag> +class SORCGBackend : public LinearSolver { public: + using LinearSolver::LinearSolver; - template<class Matrix, class Vector> + // precondBlockLevel: set this to more than one if the matrix to solve is nested multiple times + template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { - static const std::string paramGroup = GET_PROP_VALUE(TypeTag, ModelParameterGroup); - constexpr auto blockLevel = GET_PROP_VALUE(TypeTag, LinearSolverPreconditionerBlockLevel); - using Preconditioner = Dune::SeqSOR<Matrix, Vector, Vector, blockLevel>; + using Preconditioner = Dune::SeqSOR<Matrix, Vector, Vector, precondBlockLevel>; using Solver = Dune::CGSolver<Vector>; - return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, paramGroup); + return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); } std::string name() const @@ -437,20 +430,19 @@ public: * LinearSolver.PreconditionerIterations.\n * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ -template <class TypeTag> -class SSORCGBackend : public LinearSolver<TypeTag> +class SSORCGBackend : public LinearSolver { public: + using LinearSolver::LinearSolver; - template<class Matrix, class Vector> + // precondBlockLevel: set this to more than one if the matrix to solve is nested multiple times + template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { - static const std::string paramGroup = GET_PROP_VALUE(TypeTag, ModelParameterGroup); - constexpr auto blockLevel = GET_PROP_VALUE(TypeTag, LinearSolverPreconditionerBlockLevel); - using Preconditioner = Dune::SeqSSOR<Matrix, Vector, Vector, blockLevel>; + using Preconditioner = Dune::SeqSSOR<Matrix, Vector, Vector, precondBlockLevel>; using Solver = Dune::CGSolver<Vector>; - return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, paramGroup); + return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); } std::string name() const @@ -475,20 +467,19 @@ public: * LinearSolver.PreconditionerIterations.\n * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ -template <class TypeTag> -class GSCGBackend : public LinearSolver<TypeTag> +class GSCGBackend : public LinearSolver { public: + using LinearSolver::LinearSolver; - template<class Matrix, class Vector> + // precondBlockLevel: set this to more than one if the matrix to solve is nested multiple times + template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { - static const std::string paramGroup = GET_PROP_VALUE(TypeTag, ModelParameterGroup); - constexpr auto blockLevel = GET_PROP_VALUE(TypeTag, LinearSolverPreconditionerBlockLevel); - using Preconditioner = Dune::SeqGS<Matrix, Vector, Vector, blockLevel>; + using Preconditioner = Dune::SeqGS<Matrix, Vector, Vector, precondBlockLevel>; using Solver = Dune::CGSolver<Vector>; - return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, paramGroup); + return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); } std::string name() const @@ -512,20 +503,19 @@ public: * applied as often as given by the parameter LinearSolver.PreconditionerIterations.\n * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ -template <class TypeTag> -class JacCGBackend : public LinearSolver<TypeTag> +class JacCGBackend : public LinearSolver { public: + using LinearSolver::LinearSolver; - template<class Matrix, class Vector> + // precondBlockLevel: set this to more than one if the matrix to solve is nested multiple times + template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { - static const std::string paramGroup = GET_PROP_VALUE(TypeTag, ModelParameterGroup); - constexpr auto blockLevel = GET_PROP_VALUE(TypeTag, LinearSolverPreconditionerBlockLevel); - using Preconditioner = Dune::SeqJac<Matrix, Vector, Vector, blockLevel>; + using Preconditioner = Dune::SeqJac<Matrix, Vector, Vector, precondBlockLevel>; using Solver = Dune::CGSolver<Vector>; - return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, paramGroup); + return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); } std::string name() const @@ -551,20 +541,19 @@ public: * LinearSolver.PreconditionerIterations.\n * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ -template <class TypeTag> -class SSORRestartedGMResBackend : public LinearSolver<TypeTag> +class SSORRestartedGMResBackend : public LinearSolver { public: + using LinearSolver::LinearSolver; - template<class Matrix, class Vector> + // precondBlockLevel: set this to more than one if the matrix to solve is nested multiple times + template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { - static const std::string paramGroup = GET_PROP_VALUE(TypeTag, ModelParameterGroup); - constexpr auto blockLevel = GET_PROP_VALUE(TypeTag, LinearSolverPreconditionerBlockLevel); - using Preconditioner = Dune::SeqSSOR<Matrix, Vector, Vector, blockLevel>; + using Preconditioner = Dune::SeqSSOR<Matrix, Vector, Vector, precondBlockLevel>; using Solver = Dune::RestartedGMResSolver<Vector>; - return IterativePreconditionedSolverImpl::template solveWithGMRes<Preconditioner, Solver>(*this, A, x, b, paramGroup); + return IterativePreconditionedSolverImpl::template solveWithGMRes<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); } std::string name() const @@ -589,20 +578,19 @@ public: * LinearSolver.PreconditionerRelaxation.\n * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ -template <class TypeTag> -class ILU0BiCGSTABBackend : public LinearSolver<TypeTag> +class ILU0BiCGSTABBackend : public LinearSolver { public: + using LinearSolver::LinearSolver; - template<class Matrix, class Vector> + // precondBlockLevel: set this to more than one if the matrix to solve is nested multiple times + template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { - static const std::string paramGroup = GET_PROP_VALUE(TypeTag, ModelParameterGroup); - constexpr auto blockLevel = GET_PROP_VALUE(TypeTag, LinearSolverPreconditionerBlockLevel); - using Preconditioner = Dune::SeqILU0<Matrix, Vector, Vector, blockLevel>; + using Preconditioner = Dune::SeqILU0<Matrix, Vector, Vector, precondBlockLevel>; using Solver = Dune::BiCGSTABSolver<Vector>; - return IterativePreconditionedSolverImpl::template solveWithILU0Prec<Preconditioner, Solver>(*this, A, x, b, paramGroup); + return IterativePreconditionedSolverImpl::template solveWithILU0Prec<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); } std::string name() const @@ -626,20 +614,19 @@ public: * LinearSolver.PreconditionerRelaxation.\n * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ -template <class TypeTag> -class ILU0CGBackend : public LinearSolver<TypeTag> +class ILU0CGBackend : public LinearSolver { public: + using LinearSolver::LinearSolver; - template<class Matrix, class Vector> + // precondBlockLevel: set this to more than one if the matrix to solve is nested multiple times + template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { - static const std::string paramGroup = GET_PROP_VALUE(TypeTag, ModelParameterGroup); - constexpr auto blockLevel = GET_PROP_VALUE(TypeTag, LinearSolverPreconditionerBlockLevel); - using Preconditioner = Dune::SeqILU0<Matrix, Vector, Vector, blockLevel>; + using Preconditioner = Dune::SeqILU0<Matrix, Vector, Vector, precondBlockLevel>; using Solver = Dune::CGSolver<Vector>; - return IterativePreconditionedSolverImpl::template solveWithILU0Prec<Preconditioner, Solver>(*this, A, x, b, paramGroup); + return IterativePreconditionedSolverImpl::template solveWithILU0Prec<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); } std::string name() const @@ -664,20 +651,19 @@ public: * LinearSolver.PreconditionerRelaxation.\n * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ -template <class TypeTag> -class ILU0RestartedGMResBackend : public LinearSolver<TypeTag> +class ILU0RestartedGMResBackend : public LinearSolver { public: + using LinearSolver::LinearSolver; - template<class Matrix, class Vector> + // precondBlockLevel: set this to more than one if the matrix to solve is nested multiple times + template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { - static const std::string paramGroup = GET_PROP_VALUE(TypeTag, ModelParameterGroup); - constexpr auto blockLevel = GET_PROP_VALUE(TypeTag, LinearSolverPreconditionerBlockLevel); - using Preconditioner = Dune::SeqILU0<Matrix, Vector, Vector, blockLevel>; + using Preconditioner = Dune::SeqILU0<Matrix, Vector, Vector, precondBlockLevel>; using Solver = Dune::RestartedGMResSolver<Vector>; - return IterativePreconditionedSolverImpl::template solveWithILU0PrecGMRes<Preconditioner, Solver>(*this, A, x, b, paramGroup); + return IterativePreconditionedSolverImpl::template solveWithILU0PrecGMRes<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); } std::string name() const @@ -703,20 +689,19 @@ public: * LinearSolver.PreconditionerRelaxation.\n * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ -template <class TypeTag> -class ILUnRestartedGMResBackend : public LinearSolver<TypeTag> +class ILUnRestartedGMResBackend : public LinearSolver { public: + using LinearSolver::LinearSolver; - template<class Matrix, class Vector> + // precondBlockLevel: set this to more than one if the matrix to solve is nested multiple times + template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { - static const std::string paramGroup = GET_PROP_VALUE(TypeTag, ModelParameterGroup); - constexpr auto blockLevel = GET_PROP_VALUE(TypeTag, LinearSolverPreconditionerBlockLevel); - using Preconditioner = Dune::SeqILUn<Matrix, Vector, Vector, blockLevel>; + using Preconditioner = Dune::SeqILUn<Matrix, Vector, Vector, precondBlockLevel>; using Solver = Dune::RestartedGMResSolver<Vector>; - return IterativePreconditionedSolverImpl::template solveWithGMRes<Preconditioner, Solver>(*this, A, x, b, paramGroup); + return IterativePreconditionedSolverImpl::template solveWithGMRes<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); } }; @@ -729,12 +714,13 @@ public: * and user interface." ACM Transactions on Mathematical Software (TOMS) 31(3): 302-325. * http://crd-legacy.lbl.gov/~xiaoye/SuperLU/ */ -template <class TypeTag> -class SuperLUBackend : public LinearSolver<TypeTag> +class SuperLUBackend : public LinearSolver { public: + using LinearSolver::LinearSolver; - template<class Matrix, class Vector> + // precondBlockLevel is unused and just here for compatibility with iterative solvers + template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { static_assert(isBCRSMatrix<Matrix>::value, "SuperLU only works with BCRS matrices!"); @@ -789,12 +775,13 @@ private: * Mathematical Software 30 (2): 196–199. doi:10.1145/992200.992206. * http://faculty.cse.tamu.edu/davis/suitesparse.html */ -template <class TypeTag> -class UMFPackBackend : public LinearSolver<TypeTag> +class UMFPackBackend : public LinearSolver { public: + using LinearSolver::LinearSolver; - template<class Matrix, class Vector> + // precondBlockLevel is unused and just here for compatibility with iterative solvers + template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { static_assert(isBCRSMatrix<Matrix>::value, "UMFPack only works with BCRS matrices!"); diff --git a/dumux/linear/solver.hh b/dumux/linear/solver.hh index f1332dd45cf73bfd55bb80a4c8c5e99d3379d8c3..262eebfc566d2f461950a3427ac0a861b61003d0 100644 --- a/dumux/linear/solver.hh +++ b/dumux/linear/solver.hh @@ -26,7 +26,6 @@ #include <dune/common/exceptions.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/properties.hh> namespace Dumux { @@ -35,12 +34,12 @@ namespace Dumux * \ingroup Linear * \brief Base class for linear solvers */ -template <class TypeTag> class LinearSolver { public: - //! export scalar type (might be needed to set parameters from output) - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); + //! export Scalar type (might be needed to set parameters from output) + //! TODO: Do we need this? + using Scalar = double; /*! * \brief Contruct the solver @@ -51,14 +50,14 @@ public: * - LinearSolver.PreconditionerRelaxation precondition relaxation * - LinearSolver.PreconditionerIterations the number of preconditioner iterations */ - LinearSolver() + LinearSolver(const std::string& paramGroup = "") + : paramGroup_(paramGroup) { - static const std::string modelParamGroup = GET_PROP_VALUE(TypeTag, ModelParameterGroup); - verbosity_ = getParamFromGroup<int>(modelParamGroup, "LinearSolver.Verbosity"); - maxIter_ = getParamFromGroup<int>(modelParamGroup, "LinearSolver.MaxIterations"); - residReduction_ = getParamFromGroup<Scalar>(modelParamGroup, "LinearSolver.ResidualReduction"); - relaxation_ = getParamFromGroup<Scalar>(modelParamGroup, "LinearSolver.PreconditionerRelaxation"); - precondIter_ = getParamFromGroup<int>(modelParamGroup, "LinearSolver.PreconditionerIterations"); + verbosity_ = getParamFromGroup<int>(paramGroup, "LinearSolver.Verbosity"); + maxIter_ = getParamFromGroup<int>(paramGroup, "LinearSolver.MaxIterations"); + residReduction_ = getParamFromGroup<double>(paramGroup, "LinearSolver.ResidualReduction"); + relaxation_ = getParamFromGroup<double>(paramGroup, "LinearSolver.PreconditionerRelaxation"); + precondIter_ = getParamFromGroup<int>(paramGroup, "LinearSolver.PreconditionerIterations"); } /*! @@ -75,6 +74,10 @@ public: std::string name() const { return "unknown solver"; } + //! the parameter group for getting parameter from the parameter tree + const std::string& paramGroup() const + { return paramGroup_; } + //! the verbosity level int verbosity() const { return verbosity_; } @@ -92,19 +95,19 @@ public: { maxIter_ = i; } //! the linear solver residual reduction - Scalar residReduction() const + double residReduction() const { return residReduction_; } //! set the linear solver residual reduction - void setResidualReduction(Scalar r) + void setResidualReduction(double r) { residReduction_ = r; } //! the linear solver relaxation factor - Scalar relaxation() const + double relaxation() const { return relaxation_; } //! set the linear solver relaxation factor - void setRelaxation(Scalar r) + void setRelaxation(double r) { relaxation_ = r; } //! the number of preconditioner iterations @@ -118,9 +121,10 @@ public: private: int verbosity_; int maxIter_; - Scalar residReduction_; - Scalar relaxation_; + double residReduction_; + double relaxation_; int precondIter_; + const std::string paramGroup_; }; } // end namespace Dumux diff --git a/dumux/nonlinear/staggerednewtoncontroller.hh b/dumux/nonlinear/staggerednewtoncontroller.hh index c063044b7a8e83b02d7a86883d833670fcf58377..0e58420b2ee043f74b55bad0f0997e207d6d2a3c 100644 --- a/dumux/nonlinear/staggerednewtoncontroller.hh +++ b/dumux/nonlinear/staggerednewtoncontroller.hh @@ -99,7 +99,7 @@ public: BlockVector y(numRows); // solve - const bool converged = ls.solve(M, y, bTmp); + const bool converged = ls.template solve</*precondBlockLevel=*/2>(M, y, bTmp); // copy back the result y into x VectorConverter<SolutionVector>::retrieveValues(x, y); diff --git a/dumux/porousmediumflow/sequential/pressureproperties.hh b/dumux/porousmediumflow/sequential/pressureproperties.hh index 699bf0653147e46ada366a0658eb3f40bb0f4f5e..188af27f6d5607ddcebc817542adea24018299e3 100644 --- a/dumux/porousmediumflow/sequential/pressureproperties.hh +++ b/dumux/porousmediumflow/sequential/pressureproperties.hh @@ -96,7 +96,7 @@ public: SET_TYPE_PROP(Pressure, PressureSolutionVector, typename GET_PROP(TypeTag, SolutionTypes)::ScalarSolution); // use the stabilized BiCG solver preconditioned by the ILU-0 by default -SET_TYPE_PROP(Pressure, LinearSolver, ILU0BiCGSTABBackend<TypeTag> ); +SET_TYPE_PROP(Pressure, LinearSolver, ILU0BiCGSTABBackend ); SET_TYPE_PROP( Pressure, Velocity, FVVelocityDefault<TypeTag>); diff --git a/dumux/porousmediumflow/sequential/properties.hh b/dumux/porousmediumflow/sequential/properties.hh index e78968427957d84f4090663f2705007b558f2cf3..28e1cb65eaacc1a34aa55565e296491ce4c76c14 100644 --- a/dumux/porousmediumflow/sequential/properties.hh +++ b/dumux/porousmediumflow/sequential/properties.hh @@ -104,13 +104,9 @@ SET_PROP(SequentialModel, DiscretizationMethod) static const DiscretizationMethods value = DiscretizationMethods::CCTpfa; }; -//!< Type of the jacobian matrix needed for compatibility with implicit models for the amg backend +//! Type of the jacobian matrix needed for compatibility with implicit models for the amg backend SET_TYPE_PROP(SequentialModel, JacobianMatrix, typename GET_PROP_TYPE(TypeTag, PressureCoefficientMatrix)); - -//!< Block level on which the preconditioner is supposed to work. -SET_INT_PROP(SequentialModel, LinearSolverPreconditionerBlockLevel, 1); - //! Use the leaf grid view if not defined otherwise SET_PROP(SequentialModel, GridView) { diff --git a/test/freeflow/navierstokes/test_angeli.cc b/test/freeflow/navierstokes/test_angeli.cc index 2681f699f42a6b4cd84855a278b93687117ce218..7ed802fe19e04e6ae076e06ed05d3ea17d8737f7 100644 --- a/test/freeflow/navierstokes/test_angeli.cc +++ b/test/freeflow/navierstokes/test_angeli.cc @@ -172,7 +172,7 @@ int main(int argc, char** argv) try auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver - using LinearSolver = Dumux::UMFPackBackend<TypeTag>; + using LinearSolver = Dumux::UMFPackBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/freeflow/navierstokes/test_channel.cc b/test/freeflow/navierstokes/test_channel.cc index 965489f3caab839aa9dfdff96491eea8e504996a..d35ebcb8ef307e1cfa3a4908c300cd39089e961d 100644 --- a/test/freeflow/navierstokes/test_channel.cc +++ b/test/freeflow/navierstokes/test_channel.cc @@ -170,7 +170,7 @@ int main(int argc, char** argv) try auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver - using LinearSolver = Dumux::UMFPackBackend<TypeTag>; + using LinearSolver = Dumux::UMFPackBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/freeflow/navierstokes/test_closedsystem.cc b/test/freeflow/navierstokes/test_closedsystem.cc index 7fab6850523e725c0404c7b3f691879fc0d82071..b5ae119dcb1b864b1bb6740ab5b148173c92f431 100644 --- a/test/freeflow/navierstokes/test_closedsystem.cc +++ b/test/freeflow/navierstokes/test_closedsystem.cc @@ -167,7 +167,7 @@ int main(int argc, char** argv) try auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver - using LinearSolver = Dumux::UMFPackBackend<TypeTag>; + using LinearSolver = Dumux::UMFPackBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/freeflow/navierstokes/test_donea.cc b/test/freeflow/navierstokes/test_donea.cc index ad38c89e5f02d3e0557ae6848149c6fc0c8cb659..1b918b6344987e9dd9277c7a52a2d5b801118c08 100644 --- a/test/freeflow/navierstokes/test_donea.cc +++ b/test/freeflow/navierstokes/test_donea.cc @@ -154,7 +154,7 @@ int main(int argc, char** argv) try auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables); // the linear solver - using LinearSolver = Dumux::UMFPackBackend<TypeTag>; + using LinearSolver = Dumux::UMFPackBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/freeflow/navierstokes/test_kovasznay.cc b/test/freeflow/navierstokes/test_kovasznay.cc index eb9da8a9ea446401be612f45d576350608d5b19e..b8204a95d2f22b16dd5f61229be8d901d8dca81d 100644 --- a/test/freeflow/navierstokes/test_kovasznay.cc +++ b/test/freeflow/navierstokes/test_kovasznay.cc @@ -153,7 +153,7 @@ int main(int argc, char** argv) try auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables); // the linear solver - using LinearSolver = Dumux::UMFPackBackend<TypeTag>; + using LinearSolver = Dumux::UMFPackBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/freeflow/navierstokesnc/test_channel.cc b/test/freeflow/navierstokesnc/test_channel.cc index efd6b5752ecdd99600a6e2d2e6687ea9ca7d500b..6f888cd15e2309a8db97160bb45b4aba127531e8 100644 --- a/test/freeflow/navierstokesnc/test_channel.cc +++ b/test/freeflow/navierstokesnc/test_channel.cc @@ -169,7 +169,7 @@ int main(int argc, char** argv) try auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver - using LinearSolver = Dumux::UMFPackBackend<TypeTag>; + using LinearSolver = Dumux::UMFPackBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/freeflow/navierstokesnc/test_densitydrivenflow.cc b/test/freeflow/navierstokesnc/test_densitydrivenflow.cc index d18532777d215d00bb74ad75f542e7a7e0f1361f..843f5cc76bae6688dcb4be2f22ca5cdf75a69739 100644 --- a/test/freeflow/navierstokesnc/test_densitydrivenflow.cc +++ b/test/freeflow/navierstokesnc/test_densitydrivenflow.cc @@ -168,7 +168,7 @@ int main(int argc, char** argv) try auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver - using LinearSolver = Dumux::UMFPackBackend<TypeTag>; + using LinearSolver = Dumux::UMFPackBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/freeflow/navierstokesnc/test_msfreeflow.cc b/test/freeflow/navierstokesnc/test_msfreeflow.cc index e65afdc07b12c51489bb0b98b21d377a19593691..3546b5a5bf1b2ff991c9337ed7ccc6b527563b7e 100644 --- a/test/freeflow/navierstokesnc/test_msfreeflow.cc +++ b/test/freeflow/navierstokesnc/test_msfreeflow.cc @@ -167,7 +167,7 @@ int main(int argc, char** argv) try auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver - using LinearSolver = Dumux::UMFPackBackend<TypeTag>; + using LinearSolver = Dumux::UMFPackBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/porousmediumflow/1p/implicit/compressible/test_1p.cc b/test/porousmediumflow/1p/implicit/compressible/test_1p.cc index f04896d35ef91871e3389cacbbc20aa7b49a4282..82c70f15ca2d9fb8f5a8f182ee010447b7889cd8 100644 --- a/test/porousmediumflow/1p/implicit/compressible/test_1p.cc +++ b/test/porousmediumflow/1p/implicit/compressible/test_1p.cc @@ -126,7 +126,7 @@ int main(int argc, char** argv) try auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver - using LinearSolver = ILU0BiCGSTABBackend<TypeTag>; + using LinearSolver = ILU0BiCGSTABBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/porousmediumflow/1p/implicit/compressible/test_1p_stationary.cc b/test/porousmediumflow/1p/implicit/compressible/test_1p_stationary.cc index ca5a0d328a71c870d041db3b33dc17dc63409020..9426c67764dc989e797914962751d606603d0e8c 100644 --- a/test/porousmediumflow/1p/implicit/compressible/test_1p_stationary.cc +++ b/test/porousmediumflow/1p/implicit/compressible/test_1p_stationary.cc @@ -111,7 +111,7 @@ int main(int argc, char** argv) try auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables); // the linear solver - using LinearSolver = ILU0BiCGSTABBackend<TypeTag>; + using LinearSolver = ILU0BiCGSTABBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/porousmediumflow/1p/implicit/incompressible/test_1pfv.cc b/test/porousmediumflow/1p/implicit/incompressible/test_1pfv.cc index ec15de9b663f5d11ae9290e4cf0f3d40512e84eb..70d729ffad88c16365945e406cf90e2c4a936d0f 100644 --- a/test/porousmediumflow/1p/implicit/incompressible/test_1pfv.cc +++ b/test/porousmediumflow/1p/implicit/incompressible/test_1pfv.cc @@ -120,7 +120,7 @@ int main(int argc, char** argv) try // solve the linear system Dune::Timer solverTimer; - using LinearSolver = SSORCGBackend<TypeTag>; + using LinearSolver = SSORCGBackend; auto linearSolver = std::make_shared<LinearSolver>(); if (mpiHelper.rank() == 0) std::cout << "Solving linear system using " + linearSolver->name() + "..." << std::flush; diff --git a/test/porousmediumflow/1p/sequential/test_diffusionproblem.hh b/test/porousmediumflow/1p/sequential/test_diffusionproblem.hh index e796916345ea0a7b4a412b26901d8f139d5d1438..dbf1d7d5c30ef8b5ed0dd230f822d40c1d83873a 100644 --- a/test/porousmediumflow/1p/sequential/test_diffusionproblem.hh +++ b/test/porousmediumflow/1p/sequential/test_diffusionproblem.hh @@ -99,8 +99,8 @@ SET_PROP(FVVelocity2PTestProblem, FluidSystem) // set the types for the MPFA-O FV method NEW_TYPE_TAG(FVMPFAOVelocity2PTestProblem, INHERITS_FROM(FvMpfaO2dPressureTwoP, TestDiffusionSpatialParams)); -//SET_TYPE_PROP(FVMPFAOVelocity2PTestProblem, LinearSolver, ILUnBiCGSTABBackend<TypeTag>); -SET_TYPE_PROP(FVMPFAOVelocity2PTestProblem, LinearSolver, SSORBiCGSTABBackend<TypeTag>); +//SET_TYPE_PROP(FVMPFAOVelocity2PTestProblem, LinearSolver, ILUnBiCGSTABBackend); +SET_TYPE_PROP(FVMPFAOVelocity2PTestProblem, LinearSolver, SSORBiCGSTABBackend); SET_TYPE_PROP(FVMPFAOVelocity2PTestProblem, Problem, TestDiffusionProblem<TypeTag>); // Set the grid type SET_TYPE_PROP(FVMPFAOVelocity2PTestProblem, Grid, Dune::YaspGrid<2>); diff --git a/test/porousmediumflow/1p/sequential/test_diffusionproblem3d.hh b/test/porousmediumflow/1p/sequential/test_diffusionproblem3d.hh index b1e275aaf218dce08f8c07d1bb0324f2fc45a610..a1bf40154f0f8959c4c379839c9d000da796ae6e 100644 --- a/test/porousmediumflow/1p/sequential/test_diffusionproblem3d.hh +++ b/test/porousmediumflow/1p/sequential/test_diffusionproblem3d.hh @@ -69,9 +69,9 @@ SET_PROP(DiffusionTestProblem, FluidSystem) }; #if HAVE_SUPERLU -SET_TYPE_PROP(DiffusionTestProblem, LinearSolver, SuperLUBackend<TypeTag>); +SET_TYPE_PROP(DiffusionTestProblem, LinearSolver, SuperLUBackend); #else -SET_TYPE_PROP(DiffusionTestProblem, LinearSolver, ILUnRestartedGMResBackend<TypeTag>); +SET_TYPE_PROP(DiffusionTestProblem, LinearSolver, ILUnRestartedGMResBackend); SET_INT_PROP(DiffusionTestProblem, LinearSolverGMResRestart, 80); SET_INT_PROP(DiffusionTestProblem, LinearSolverMaxIterations, 1000); SET_SCALAR_PROP(DiffusionTestProblem, LinearSolverResidualReduction, 1e-8); diff --git a/test/porousmediumflow/1pnc/implicit/test_1p2c_fv.cc b/test/porousmediumflow/1pnc/implicit/test_1p2c_fv.cc index 769d29c1846bfa4944b63fb74766fb6b9958c622..50fd7f1ce8030df546cd9aba3f30751279b14b4f 100644 --- a/test/porousmediumflow/1pnc/implicit/test_1p2c_fv.cc +++ b/test/porousmediumflow/1pnc/implicit/test_1p2c_fv.cc @@ -126,7 +126,7 @@ auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver - using LinearSolver = ILU0BiCGSTABBackend<TypeTag>; + using LinearSolver = ILU0BiCGSTABBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/porousmediumflow/1pnc/implicit/test_1p2cni_conduction_fv.cc b/test/porousmediumflow/1pnc/implicit/test_1p2cni_conduction_fv.cc index 4e6ad962d22f42852b21617347069499d5f4e751..2a199fdfb1909b62d637b24e1a89b54a9010297b 100644 --- a/test/porousmediumflow/1pnc/implicit/test_1p2cni_conduction_fv.cc +++ b/test/porousmediumflow/1pnc/implicit/test_1p2cni_conduction_fv.cc @@ -129,8 +129,8 @@ auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver - // using LinearSolver = UMFPackBackend<TypeTag>; - using LinearSolver = ILU0BiCGSTABBackend<TypeTag>; + // using LinearSolver = UMFPackBackend; + using LinearSolver = ILU0BiCGSTABBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/porousmediumflow/1pnc/implicit/test_1p2cni_convection_fv.cc b/test/porousmediumflow/1pnc/implicit/test_1p2cni_convection_fv.cc index 7af83c6beaa454c04d3ec7c4d69fa0889342cbfb..bf39ec4efb78458d77dbffad9b47d8ae79c1aa53 100644 --- a/test/porousmediumflow/1pnc/implicit/test_1p2cni_convection_fv.cc +++ b/test/porousmediumflow/1pnc/implicit/test_1p2cni_convection_fv.cc @@ -129,8 +129,8 @@ auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver - // using LinearSolver = UMFPackBackend<TypeTag>; - using LinearSolver = ILU0BiCGSTABBackend<TypeTag>; + // using LinearSolver = UMFPackBackend; + using LinearSolver = ILU0BiCGSTABBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/porousmediumflow/1pncmin/implicit/test_1pncminni_fv.cc b/test/porousmediumflow/1pncmin/implicit/test_1pncminni_fv.cc index 10c78fa35cb2698f354bd00a1135e6ba9f3e22f1..5889470dae7b650551d01a69145555fdb817d7a6 100644 --- a/test/porousmediumflow/1pncmin/implicit/test_1pncminni_fv.cc +++ b/test/porousmediumflow/1pncmin/implicit/test_1pncminni_fv.cc @@ -160,7 +160,7 @@ int main(int argc, char** argv) try auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver - using LinearSolver = ILU0BiCGSTABBackend<TypeTag>; + using LinearSolver = ILU0BiCGSTABBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/porousmediumflow/2p/implicit/nonisothermal/test_2pni_fv.cc b/test/porousmediumflow/2p/implicit/nonisothermal/test_2pni_fv.cc index 570cbd1f02dec84c496d38769c15d2ad0334db1f..1354069095ea056847819ea48ed8c4844015ddc8 100644 --- a/test/porousmediumflow/2p/implicit/nonisothermal/test_2pni_fv.cc +++ b/test/porousmediumflow/2p/implicit/nonisothermal/test_2pni_fv.cc @@ -152,7 +152,7 @@ int main(int argc, char** argv) try auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver - using LinearSolver = Dumux::ILU0BiCGSTABBackend<TypeTag>; + using LinearSolver = Dumux::ILU0BiCGSTABBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/porousmediumflow/2p1c/implicit/test_2p1c_fv.cc b/test/porousmediumflow/2p1c/implicit/test_2p1c_fv.cc index 9f469eacf93f42fe7091684f5cf6c07b68535a8a..d87098fa99b663dc78a2a9b57440d73ef4746785 100644 --- a/test/porousmediumflow/2p1c/implicit/test_2p1c_fv.cc +++ b/test/porousmediumflow/2p1c/implicit/test_2p1c_fv.cc @@ -126,7 +126,7 @@ auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver - using LinearSolver = ILU0BiCGSTABBackend<TypeTag>; + using LinearSolver = ILU0BiCGSTABBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/porousmediumflow/richards/implicit/test_ccrichardsanalytical.cc b/test/porousmediumflow/richards/implicit/test_ccrichardsanalytical.cc index eb0a02a23208c8ca5c669dcd2296b85edccda61d..0c8fdd55f15f392387aecac12e53f5879d5ca6d4 100644 --- a/test/porousmediumflow/richards/implicit/test_ccrichardsanalytical.cc +++ b/test/porousmediumflow/richards/implicit/test_ccrichardsanalytical.cc @@ -153,7 +153,7 @@ int main(int argc, char** argv) try auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver - using LinearSolver = Dumux::ILU0BiCGSTABBackend<TypeTag>; + using LinearSolver = Dumux::ILU0BiCGSTABBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/porousmediumflow/richards/implicit/test_richardsniconduction_fv.cc b/test/porousmediumflow/richards/implicit/test_richardsniconduction_fv.cc index ef788a8587a4e02188541f1c506408582d49eb84..49a276444d79b79d33169bc0f6f612719710a844 100644 --- a/test/porousmediumflow/richards/implicit/test_richardsniconduction_fv.cc +++ b/test/porousmediumflow/richards/implicit/test_richardsniconduction_fv.cc @@ -154,7 +154,7 @@ int main(int argc, char** argv) try auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver - using LinearSolver = Dumux::ILU0BiCGSTABBackend<TypeTag>; + using LinearSolver = Dumux::ILU0BiCGSTABBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/porousmediumflow/richards/implicit/test_richardsniconvection_fv.cc b/test/porousmediumflow/richards/implicit/test_richardsniconvection_fv.cc index e072b660efa2e2361efe7d203966188df88c08c2..4b549054c9e408daa33d16c83ede5219fec8f69c 100644 --- a/test/porousmediumflow/richards/implicit/test_richardsniconvection_fv.cc +++ b/test/porousmediumflow/richards/implicit/test_richardsniconvection_fv.cc @@ -154,7 +154,7 @@ int main(int argc, char** argv) try auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver - using LinearSolver = Dumux::ILU0BiCGSTABBackend<TypeTag>; + using LinearSolver = Dumux::ILU0BiCGSTABBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/porousmediumflow/richardsnc/implicit/test_richardsnc_fv.cc b/test/porousmediumflow/richardsnc/implicit/test_richardsnc_fv.cc index cc7d35d4036cec1988cb4f930a5e74258b51ef2f..9088719fc50e58fba2b4f73957cae9a9cc987bb4 100644 --- a/test/porousmediumflow/richardsnc/implicit/test_richardsnc_fv.cc +++ b/test/porousmediumflow/richardsnc/implicit/test_richardsnc_fv.cc @@ -153,7 +153,7 @@ int main(int argc, char** argv) try auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver - using LinearSolver = Dumux::ILU0BiCGSTABBackend<TypeTag>; + using LinearSolver = Dumux::ILU0BiCGSTABBackend; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver diff --git a/test/porousmediumflow/tracer/1ptracer/test_cctracer.cc b/test/porousmediumflow/tracer/1ptracer/test_cctracer.cc index 179895a4e7c110a5740aa753df657f6929566465..3d31d2283989c6cf1e2a0d782850c2c3189b0e1e 100644 --- a/test/porousmediumflow/tracer/1ptracer/test_cctracer.cc +++ b/test/porousmediumflow/tracer/1ptracer/test_cctracer.cc @@ -129,7 +129,7 @@ int main(int argc, char** argv) (*r) *= -1.0; //! solve the 1p problem - using LinearSolver = UMFPackBackend<OnePTypeTag>; + using LinearSolver = UMFPackBackend; Dune::Timer solverTimer; std::cout << "Solving linear system ..." << std::flush; auto linearSolver = std::make_shared<LinearSolver>(); linearSolver->solve(*A, p, *r); diff --git a/test/porousmediumflow/tracer/constvel/test_tracer.cc b/test/porousmediumflow/tracer/constvel/test_tracer.cc index 7a789b011e5ab1895319d52fb6ab86b1c16d4937..f75e2b5a3ab7aac04746c0dad413066b3e2947e1 100644 --- a/test/porousmediumflow/tracer/constvel/test_tracer.cc +++ b/test/porousmediumflow/tracer/constvel/test_tracer.cc @@ -121,7 +121,7 @@ int main(int argc, char** argv) try assembler->setLinearSystem(A, r); //! the linear solver - using LinearSolver = UMFPackBackend<TypeTag>; + using LinearSolver = UMFPackBackend; auto linearSolver = std::make_shared<LinearSolver>(); //! intialize the vtk output module