diff --git a/dumux/linear/amgbackend.hh b/dumux/linear/amgbackend.hh index fd864d446c7366dd9f756a078baa823766c6f057..7f02a331008bf194a2fdaa8e694d233213dd0c0b 100644 --- a/dumux/linear/amgbackend.hh +++ b/dumux/linear/amgbackend.hh @@ -189,154 +189,6 @@ private: bool firstCall_; }; -/*! - * \brief Provides a linear solver using the sequential ISTL AMG. - */ -template <class TypeTag> -class SeqAMGBackend -{ - typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem; - typedef typename GET_PROP_TYPE(TypeTag, JacobianMatrix) JacobianMatrix; - enum { numEq = JacobianMatrix::block_type::rows}; - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - typedef Dune::BCRSMatrix<Dune::FieldMatrix<Scalar,numEq,numEq> > MType; - typedef Dune::BlockVector<Dune::FieldVector<Scalar,numEq> > VType; - typedef Dune::Amg::SequentialInformation Comm; - typedef Dune::AssembledLinearOperator<MType,VType, VType> LinearOperator; - typedef Dune::SeqSSOR<MType,VType, VType> Smoother; - typedef Dune::Amg::AMG<LinearOperator,VType,Smoother> AMGType; -public: - - /*! - * \brief Construct the backend. - * - * \param problem the problem at hand - */ - SeqAMGBackend(const Problem& problem) - DUNE_DEPRECATED_MSG("use the AMGBackend (without 'Seq') instead") - : problem_(problem) - {} - - /*! - * \brief Solve a linear system. - * - * \param A the matrix - * \param x the seeked solution vector, containing the initial solution upon entry - * \param b the right hand side vector - */ - template<class Matrix, class Vector> - bool solve(Matrix& A, Vector& x, Vector& b) - { - int maxIt = GET_PARAM_FROM_GROUP(TypeTag, double, LinearSolver, MaxIterations); - int verbosity = GET_PARAM_FROM_GROUP(TypeTag, int, LinearSolver, Verbosity); - static const double residReduction = GET_PARAM_FROM_GROUP(TypeTag, double, LinearSolver, ResidualReduction); - LinearOperator fop(A); - typedef Dune::Amg::CoarsenCriterion<Dune::Amg::SymmetricCriterion<typename LinearOperator::matrix_type, - Dune::Amg::FirstDiagonal> > - Criterion; - Criterion criterion(15,2000); - criterion.setDefaultValuesIsotropic(2); - typedef typename Dune::Amg::SmootherTraits<Smoother>::Arguments SmootherArgs; - SmootherArgs smootherArgs; - smootherArgs.iterations = 1; - smootherArgs.relaxationFactor = 1; - - AMGType amg(fop, criterion, smootherArgs, 1, 1, 1); - Dune::BiCGSTABSolver<VType> solver(fop, amg, residReduction, maxIt, - verbosity); - solver.apply(x, b, result_); - return result_.converged; - } - - /*! - * \brief The result containing the convergence history. - */ - const Dune::InverseOperatorResult& result() const - { - return result_; - } - -private: - const Problem& problem_; - Dune::InverseOperatorResult result_; -}; - -/*! - * \brief Provides a linear solver using the sequential ISTL AMG. - * - * The linear system is scaled beforehand, possibly improving the - * convergence behavior of the iterative solver. - */ -template <class TypeTag> -class ScaledSeqAMGBackend -{ - typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem; - typedef typename GET_PROP_TYPE(TypeTag, JacobianMatrix) JacobianMatrix; - enum { numEq = JacobianMatrix::block_type::rows}; - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - typedef Dune::BCRSMatrix<Dune::FieldMatrix<Scalar,numEq,numEq> > MType; - typedef Dune::BlockVector<Dune::FieldVector<Scalar,numEq> > VType; - typedef Dune::Amg::SequentialInformation Comm; - typedef Dune::MatrixAdapter<MType,VType, VType> LinearOperator; - typedef Dune::SeqSSOR<MType,VType, VType> Smoother; - typedef Dune::Amg::AMG<LinearOperator,VType,Smoother> AMGType; -public: - - /*! - * \brief Construct the backend. - * - * \param problem the problem at hand - */ - ScaledSeqAMGBackend(const Problem& problem) - DUNE_DEPRECATED_MSG("use the AMGBackend (without 'ScaledSeq') instead") - : problem_(problem) - {} - - /*! - * \brief Solve a linear system. - * - * \param A the matrix - * \param x the seeked solution vector, containing the initial solution upon entry - * \param b the right hand side vector - */ - template<class Matrix, class Vector> - bool solve(Matrix& A, Vector& x, Vector& b) - { - scaleLinearSystem(A, b); - - int maxIt = GET_PARAM_FROM_GROUP(TypeTag, double, LinearSolver, MaxIterations); - int verbosity = GET_PARAM_FROM_GROUP(TypeTag, int, LinearSolver, Verbosity); - static const double residReduction = GET_PARAM_FROM_GROUP(TypeTag, double, LinearSolver, ResidualReduction); - LinearOperator fop(A); - typedef Dune::Amg::CoarsenCriterion<Dune::Amg::SymmetricCriterion<MType, - Dune::Amg::FirstDiagonal> > - Criterion; - Criterion criterion(15,2000); - criterion.setDefaultValuesIsotropic(2); - typedef typename Dune::Amg::SmootherTraits<Smoother>::Arguments SmootherArgs; - SmootherArgs smootherArgs; - smootherArgs.iterations = 1; - smootherArgs.relaxationFactor = 1; - AMGType amg(fop, criterion, smootherArgs, 1, 1, 1); - Dune::BiCGSTABSolver<VType> solver(fop, amg, residReduction, maxIt, - verbosity); - - return result_.converged; - } - - /*! - * \brief The result containing the convergence history. - */ - const Dune::InverseOperatorResult& result() const - { - return result_; - } - -private: - const Problem& problem_; - Dune::InverseOperatorResult result_; -}; - } // namespace Dumux #endif // DUMUX_AMGBACKEND_HH diff --git a/dumux/linear/p0fem.hh b/dumux/linear/p0fem.hh deleted file mode 100644 index ed3d2d15b56ecf283417e34d4a8272d88a908bba..0000000000000000000000000000000000000000 --- a/dumux/linear/p0fem.hh +++ /dev/null @@ -1,56 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * - * \brief Finite element map for P0 elements - */ - -#ifndef DUMUX_P0FEM_HH -#define DUMUX_P0FEM_HH - -#if HAVE_DUNE_PDELAB - -#include <dune/geometry/type.hh> -#include <dune/common/deprecated.hh> -#include <dune/localfunctions/lagrange/p0.hh> -#include <dune/pdelab/finiteelementmap/finiteelementmap.hh> - -namespace Dumux { - -/*! - * \brief Finite element map for P0 elements - */ -template<class D, class R, int d, bool isCube = true> -class P0LocalFiniteElementMap -: public Dune::PDELab::SimpleLocalFiniteElementMap< Dune::P0LocalFiniteElement<D,R,d> > -{ - typedef Dune::PDELab::SimpleLocalFiniteElementMap< Dune::P0LocalFiniteElement<D,R,d> > ParentType; -public: - P0LocalFiniteElementMap () - DUNE_DEPRECATED_MSG("should not be needed anymore") - : ParentType (Dune::P0LocalFiniteElement<D,R,d>(isCube ? Dune::GeometryType(Dune::GeometryType::cube, d) - : Dune::GeometryType(Dune::GeometryType::simplex, d))) - {} -}; - -} // namespace Dumux - -#endif // HAVE_DUNE_PDELAB -#endif // DUMUX_P0FEM_HH diff --git a/dumux/multidomain/common/pdelablocaloperator.hh b/dumux/multidomain/common/pdelablocaloperator.hh deleted file mode 100644 index e6af9bd660f2f4a5b9230899344c128a26f9e56e..0000000000000000000000000000000000000000 --- a/dumux/multidomain/common/pdelablocaloperator.hh +++ /dev/null @@ -1,152 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * \brief A local operator for PDELab which wraps the box models. - */ - -#ifndef DUMUX_PDELAB_LOCAL_OPERATOR_HH -#define DUMUX_PDELAB_LOCAL_OPERATOR_HH - -#warning This header is deprecated and will be removed after DuMuX 2.7. - -#if ! HAVE_DUNE_PDELAB -#error "DUNE-PDELab must be available in order to include this file!" -#endif - -#include<dune/pdelab/localoperator/pattern.hh> -#include<dune/pdelab/localoperator/flags.hh> -#include<dune/pdelab/gridoperator/common/localmatrix.hh> - -#include <dumux/implicit/box/boxproperties.hh> - -namespace Dumux { - -namespace PDELab { - -/*! - * \ingroup MultidomainModel - * \brief A local operator for PDELab which wraps the box models. - */ -template<class TypeTag> -class BoxLocalOperator - : -// : public Dune::PDELab::NumericalJacobianApplyVolume<BoxLocalOperatorPDELab<TypeTag> >, -//public Dune::PDELab::NumericalJacobianVolume<BoxLocalOperatorPDELab<TypeTag> >, - public Dune::PDELab::FullVolumePattern, - public Dune::PDELab::LocalOperatorDefaultFlags -{ - // copying the local operator for PDELab is not a good idea - BoxLocalOperator(const BoxLocalOperator &); - - typedef typename GET_PROP_TYPE(TypeTag, Model) Model; - enum{numEq = GET_PROP_VALUE(TypeTag, NumEq)}; - -public: - // pattern assembly flags - enum { doPatternVolume = true }; - - // residual assembly flags - enum { doAlphaVolume = true }; - - - /*! - * \brief Constructor - * - * \param model The physical model for the box scheme. - */ - BoxLocalOperator(Model &model) - : model_(model) - {} - - /*! - * \brief Volume integral depending on test and ansatz functions - * - * \tparam EG The entity geometry type from PDELab - * \tparam LFSU The type of the local function space of the ansatz functions - * \tparam X The type of the container for the coefficients for the ansatz functions - * \tparam LFSV The type of the local function space of the test functions - * \tparam R The range type (usually FieldVector<double>) - * - * \param eg The entity geometry object - * \param lfsu The local function space object of the ansatz functions - * \param x The object of the container for the coefficients for the ansatz functions - * \param lfsv The local function space object of the test functions - * \param r The object storing the volume integral - */ - template<typename EG, typename LFSU, typename X, typename LFSV, typename R> - void alpha_volume (const EG& eg, const LFSU& lfsu, const X& x, - const LFSV& lfsv, R& r) const - { - typedef typename LFSU::Traits::SizeType size_type; - - //enum { Green = JacobianAssembler::Green }; - //if (model_.jacobianAssembler().elementColor(eg.entity()) == Green) - // Green elements don't need to be reassembled - // return; - - model_.localResidual().eval(eg.entity()); - - int numVertices = x.size()/numEq; - for (size_type comp = 0; comp < r.size(); comp++) - r[comp] = model_.localResidual().residual(comp%numVertices)[comp/numVertices]; - } - - /*! - * \brief Jacobian of volume term - * - * \tparam EG The entity geometry type from PDELab - * \tparam LFSU The type of the local function space of the ansatz functions - * \tparam X The type of the container for the coefficients for the ansatz functions - * \tparam LFSV The type of the local function space of the test functions - * \tparam R The range type (usually FieldVector<double>) - * - * \param eg The entity geometry object - * \param lfsu The local function space object of the ansatz functions - * \param x The object of the container for the coefficients for the ansatz functions - * \param lfsv The local function space object of the test functions - * \param mat The object containing the local jacobian matrix - */ - template<typename EG, typename LFSU, typename X, typename LFSV, typename R> - void jacobian_volume (const EG& eg, - const LFSU& lfsu, - const X& x, - const LFSV& lfsv, - Dune::PDELab::LocalMatrix<R>& mat) const - { - typedef typename LFSU::Traits::SizeType size_type; - - model_.localJacobian().assemble(eg.entity()); - - int numVertices = x.size()/numEq; - for (size_type j=0; j<lfsu.size(); j++) { - for (size_type i=0; i<lfsu.size(); i++) { - mat(i,j) = (model_.localJacobian().mat(i%numVertices,j%numVertices))[i/numVertices][j/numVertices]; - } - } - } - -private: - Model& model_; -}; - -} // namespace PDELab -} // namespace Dumux - -#endif // DUMUX_PDELAB_LOCAL_OPERATOR_HH