diff --git a/dumux/decoupled/common/decoupledproperties.hh b/dumux/decoupled/common/decoupledproperties.hh index 8e5b93526371b339b3946eb8bcf8c333562670a5..3f8d764e7375c2d560d3c507addf23ce68c72e71 100644 --- a/dumux/decoupled/common/decoupledproperties.hh +++ b/dumux/decoupled/common/decoupledproperties.hh @@ -24,7 +24,6 @@ #include <dumux/common/propertysystem.hh> #include <dumux/common/basicproperties.hh> -#include <dumux/linear/linearsolverproperties.hh> #include <dumux/decoupled/common/gridadaptproperties.hh> /*! @@ -45,7 +44,7 @@ namespace Properties ////////////////////////////////////////////////////////////////// //! Create a type tag for all decoupled models -NEW_TYPE_TAG(DecoupledModel, INHERITS_FROM(ExplicitModel, LinearSolverTypeTag, GridAdaptTypeTag)); +NEW_TYPE_TAG(DecoupledModel, INHERITS_FROM(NumericModel, GridAdaptTypeTag)); ////////////////////////////////////////////////////////////////// // Property tags @@ -55,7 +54,6 @@ NEW_TYPE_TAG(DecoupledModel, INHERITS_FROM(ExplicitModel, LinearSolverTypeTag, G //! This means vectors of primary variables, solution functions on the //! grid, and elements, and shape functions. NEW_PROP_TAG( SolutionTypes); -NEW_PROP_TAG( TransportSolutionType); NEW_PROP_TAG( PrimaryVariables); NEW_PROP_TAG( Indices); @@ -71,10 +69,10 @@ NEW_PROP_TAG( NumEq ); //!< Number of equations in the system of PDEs NEW_PROP_TAG( NumPhases); //!< Number of phases in the system NEW_PROP_TAG( NumComponents); //!< Number of components in the system NEW_PROP_TAG( Variables); //!< The type of the container of global variables +NEW_PROP_TAG( CellData );//!< Defines data object to be stored NEW_PROP_TAG( TimeManager ); //!< Manages the simulation time NEW_PROP_TAG( BoundaryTypes ); //!< Stores the boundary types of a single degree of freedom -NEW_PROP_TAG( CellData );//!< Defines data object to be stored -NEW_PROP_TAG( VisitFacesOnlyOnce); //!< Indicates if faces are only regarded from one side +NEW_PROP_TAG( MaxIntersections ); //!< Gives maximum number of intersections of an element and neighboring elements } } @@ -84,6 +82,7 @@ NEW_PROP_TAG( VisitFacesOnlyOnce); //!< Indicates if faces are only regarded fro #include <dumux/common/timemanager.hh> #include <dumux/common/boundarytypes.hh> #include<dumux/common/boundaryconditions.hh> +#include "variableclass.hh" namespace Dumux { @@ -103,20 +102,16 @@ public: typedef typename Grid::LeafGridView type; }; -//! Disables Grid Adaptivity as standard -SET_BOOL_PROP(DecoupledModel, AdaptiveGrid, false); - -//! Faces are only regarded from one side and not from both cells -SET_BOOL_PROP(DecoupledModel, VisitFacesOnlyOnce, true); - -NEW_PROP_TAG(MaxIntersections); //!< maximum number of intersections per element +//! Default number of intersections for quadrilaterals SET_PROP(DecoupledModel, MaxIntersections) { private: - typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid; - static const int dim = Grid::dimension; + typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; + enum + { + dim = GridView::dimension + }; public: - typedef int type; static const int value = 2*dim; }; @@ -181,23 +176,9 @@ public: typedef Dune::BlockVector<Dune::FieldVector<Dune::FieldVector<Scalar, dim>, maxIntersections > > DimVecElemFace;//!<type for vector of vectors (of size 2 x dimension) of vector (of size dimension) of scalars }; -SET_TYPE_PROP(DecoupledModel, PrimaryVariables, typename GET_PROP(TypeTag, SolutionTypes)::PrimaryVariables); +SET_TYPE_PROP(DecoupledModel, Variables, VariableClass<TypeTag>); -/*! - * \brief Default implementation for the Vector of the transportet quantity - * - * This type defines the data type of the transportet quantity. In case of a - * immiscible 2p system, this would represent a vector holding the saturation - * of one phase. - */ -SET_PROP(DecoupledModel, TransportSolutionType) -{ - private: - typedef typename GET_PROP(TypeTag, SolutionTypes) SolutionType; - - public: - typedef typename SolutionType::ScalarSolution type;//!<type for vector of scalar properties -}; +SET_TYPE_PROP(DecoupledModel, PrimaryVariables, typename GET_PROP(TypeTag, SolutionTypes)::PrimaryVariables); //! Set the default type for the time manager SET_TYPE_PROP(DecoupledModel, TimeManager, Dumux::TimeManager<TypeTag>); @@ -212,24 +193,6 @@ public: typedef Dumux::BoundaryTypes<numEq> type; }; -//! set the default for the reduction of the initial residual -SET_PROP(DecoupledModel, LinearSolverResidualReduction) -{public: - static constexpr double value = 1e-13; -}; - -//! set the default number of maximum iterations for the linear solver -SET_PROP(DecoupledModel, LinearSolverMaxIterations) -{public: - static constexpr int value = 500; -}; - -//! set the default number of maximum iterations for the linear solver -SET_PROP(DecoupledModel, LinearSolverBlockSize) -{public: - static constexpr int value = 1; -}; - // \} } diff --git a/dumux/decoupled/common/fv/fvvelocity.hh b/dumux/decoupled/common/fv/fvvelocity.hh index 0052989883e90f126e54ab933820ef1b481388a5..dfeb98717d8ec32a8961b68a3b60d3deaa7b14cd 100644 --- a/dumux/decoupled/common/fv/fvvelocity.hh +++ b/dumux/decoupled/common/fv/fvvelocity.hh @@ -24,8 +24,8 @@ // dumux environment #include "dumux/common/math.hh" -#include <dumux/decoupled/common/impetproperties.hh> -#include "fvvelocitydefault.hh" +#include <dumux/decoupled/common/pressureproperties.hh> +#include "velocitydefault.hh" /** * @file @@ -41,7 +41,7 @@ namespace Dumux * TODO: * \tparam TypeTag The Type Tag */ -template<class TypeTag> class FVVelocity +template<class TypeTag, class Velocity> class FVVelocity { typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView; typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar; @@ -49,8 +49,6 @@ template<class TypeTag> class FVVelocity typedef typename GET_PROP_TYPE(TypeTag, PTAG(CellData)) CellData; - typedef typename GET_PROP_TYPE(TypeTag, Velocity) Velocity; - enum { dim = GridView::dimension, dimWorld = GridView::dimensionworld @@ -93,8 +91,8 @@ private: //! function which reconstructs a global velocity field -template<class TypeTag> -void FVVelocity<TypeTag>::calculateVelocity() +template<class TypeTag, class Velocity> +void FVVelocity<TypeTag, Velocity>::calculateVelocity() { Dune::FieldVector<Scalar, dim> vel(0.); diff --git a/dumux/decoupled/common/fv/fvvelocitydefault.hh b/dumux/decoupled/common/fv/velocitydefault.hh similarity index 93% rename from dumux/decoupled/common/fv/fvvelocitydefault.hh rename to dumux/decoupled/common/fv/velocitydefault.hh index 01271a968cf201e3ac19b08fc83a0247e47c9ec5..3853abd9104cb9975e409642e81e8aaf4632afcf 100644 --- a/dumux/decoupled/common/fv/fvvelocitydefault.hh +++ b/dumux/decoupled/common/fv/velocitydefault.hh @@ -19,8 +19,8 @@ * You should have received a copy of the GNU General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ -#ifndef DUMUX_FVVELOCITYDEFAULT_HH -#define DUMUX_FVVELOCITYDEFAULT_HH +#ifndef DUMUX_VELOCITYDEFAULT_HH +#define DUMUX_VELOCITYDEFAULT_HH /** * @file @@ -39,7 +39,7 @@ namespace Dumux */ template<class TypeTag> -class FVVelocityDefault +class VelocityDefault { typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; @@ -53,7 +53,7 @@ public: /*! * \param problem a problem class object */ - FVVelocityDefault(Problem& problem) + VelocityDefault(Problem& problem) {} //! Empty functions! @@ -65,6 +65,11 @@ public: void calculateVelocityOnBoundary(const Intersection& intersection, CellData& cellData) {} + bool calculateVelocityInTransport() + { + return false; + } + //! \brief Write data files /* \param name file name */ template<class MultiWriter> diff --git a/dumux/decoupled/common/gridadaptproperties.hh b/dumux/decoupled/common/gridadaptproperties.hh index d9449305a067e367604780b0f56014caaa23eae5..d1175ff0caca58d0da72f3b633eba8e7352314b5 100644 --- a/dumux/decoupled/common/gridadaptproperties.hh +++ b/dumux/decoupled/common/gridadaptproperties.hh @@ -59,6 +59,7 @@ NEW_PROP_TAG(CoarsenTolerance); //no adaptive grid SET_BOOL_PROP(GridAdaptTypeTag, AdaptiveGrid, false); + //standard setting SET_INT_PROP(GridAdaptTypeTag, MinLevel, 0); SET_INT_PROP(GridAdaptTypeTag, MaxLevel, 1); diff --git a/dumux/decoupled/common/impetproperties.hh b/dumux/decoupled/common/impetproperties.hh index ef70e697d7780537cf01b0618b7ca9876c056b13..363ff2d0f38510822e94be269e648e93a49562c7 100644 --- a/dumux/decoupled/common/impetproperties.hh +++ b/dumux/decoupled/common/impetproperties.hh @@ -22,13 +22,9 @@ #ifndef DUMUX_IMPET_PROPERTIES_HH #define DUMUX_IMPET_PROPERTIES_HH -//Dune-includes -#include <dune/istl/operators.hh> -#include <dune/istl/solvers.hh> -#include <dune/istl/preconditioners.hh> - #include <dumux/decoupled/common/decoupledproperties.hh> -#include <dumux/linear/seqsolverbackend.hh> +#include <dumux/decoupled/common/pressureproperties.hh> +#include <dumux/decoupled/common/transportproperties.hh> /*! * \ingroup IMPET @@ -70,40 +66,26 @@ NEW_PROP_TAG(IterationNumber); //!< Number of iterations if IMPET iterations are NEW_PROP_TAG(MaximumDefect); //!< Maximum Defect if IMPET iterations are enabled by the IterationFlags NEW_PROP_TAG(RelaxationFactor); //!< Used for IMPET iterations -SET_TYPE_PROP(IMPET, Model, IMPET<TypeTag>); +//forward declaration! +NEW_PROP_TAG( Model );//! The model of the specific problem +} +} -//Properties for linear solvers -NEW_PROP_TAG(PressureCoefficientMatrix);//!< Type of the coefficient matrix given to the linear solver -NEW_PROP_TAG(PressureRHSVector);//!< Type of the right hand side vector given to the linear solver +#include <dumux/decoupled/common/impet.hh> + +namespace Dumux +{ +namespace Properties +{ +//set impet model +SET_TYPE_PROP(IMPET, Model, IMPET<TypeTag>); //Set defaults -SET_SCALAR_PROP(IMPET, CFLFactor, 1); +SET_SCALAR_PROP(IMPET, CFLFactor, 1.0); SET_INT_PROP(IMPET, IterationFlag, 0); //!< 0 = no iterations, 1 = iterate IterationNumber iterations, 2 = iterate until converged or IterationNumber is reached SET_INT_PROP(IMPET, IterationNumber, 2); SET_SCALAR_PROP(IMPET, MaximumDefect, 1e-5); -SET_SCALAR_PROP(IMPET, RelaxationFactor, 1);//!< 1 = new solution is new solution, 0 = old solution is new solution - -SET_PROP(IMPET, PressureCoefficientMatrix) -{ -private: - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - typedef Dune::FieldMatrix<Scalar, 1, 1> MB; - -public: - typedef Dune::BCRSMatrix<MB> type; -}; -SET_PROP(IMPET, PressureRHSVector) -{ -private: - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - -public: - typedef Dune::BlockVector<Dune::FieldVector<Scalar, 1> > type; -}; - -// use the stabilized BiCG solver preconditioned by the ILU-0 by default -SET_TYPE_PROP(IMPET, LinearSolver, Dumux::ILU0BiCGSTABBackend<TypeTag> ); - +SET_SCALAR_PROP(IMPET, RelaxationFactor, 1.0);//!< 1 = new solution is new solution, 0 = old solution is new solution } } diff --git a/dumux/decoupled/common/pressureproperties.hh b/dumux/decoupled/common/pressureproperties.hh new file mode 100644 index 0000000000000000000000000000000000000000..b9b182cb6e55b1ad493856c6f57a5d53cc7a1436 --- /dev/null +++ b/dumux/decoupled/common/pressureproperties.hh @@ -0,0 +1,128 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * Copyright (C) 2011 by Markus Wolff * + * Institute of Hydraulic Engineering * + * University of Stuttgart, Germany * + * email: <givenname>.<name>@iws.uni-stuttgart.de * + * * + * 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/>. * + *****************************************************************************/ +#ifndef DUMUX_PRESSURE_PROPERTIES_HH +#define DUMUX_PRESSURE_PROPERTIES_HH + +//Dune-includes +#include <dune/istl/bcrsmatrix.hh> +#include <dune/istl/bvector.hh> + +#include "decoupledproperties.hh" +#include <dumux/linear/linearsolverproperties.hh> +#include <dumux/linear/seqsolverbackend.hh> + + +/*! + * \ingroup IMPET + * \ingroup Properties + */ +/*! + * \file + * \brief Base file for properties related to sequential IMPET algorithms + */ +namespace Dumux +{ + +template<class TypeTag> +class IMPET; + +namespace Properties +{ +/*! + * + * \brief General properties for sequential IMPET algorithms + * + * This class holds properties necessary for the sequential IMPET solution. + */ + +////////////////////////////////////////////////////////////////// +// Type tags tags +////////////////////////////////////////////////////////////////// + +//! The type tag for models based on the diffusion-scheme +NEW_TYPE_TAG(Pressure, INHERITS_FROM(LinearSolverTypeTag, DecoupledModel)); + +////////////////////////////////////////////////////////////////// +// Property tags +////////////////////////////////////////////////////////////////// +//Properties for linear solvers +NEW_PROP_TAG(PressureCoefficientMatrix);//!< Type of the coefficient matrix given to the linear solver +NEW_PROP_TAG(PressureRHSVector);//!< Type of the right hand side vector given to the linear solver +NEW_PROP_TAG( VisitFacesOnlyOnce); //!< Indicates if faces are only regarded from one side +} +} + +#include <dumux/decoupled/common/fv/velocitydefault.hh> + +namespace Dumux +{ +namespace Properties +{ +//! Faces are only regarded from one side and not from both cells +SET_BOOL_PROP(Pressure, VisitFacesOnlyOnce, false); + +//Set defaults +SET_PROP(Pressure, PressureCoefficientMatrix) +{ +private: + typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; + typedef Dune::FieldMatrix<Scalar, 1, 1> MB; + +public: + typedef Dune::BCRSMatrix<MB> type; +}; +SET_PROP(Pressure, PressureRHSVector) +{ +private: + typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; + +public: + typedef Dune::BlockVector<Dune::FieldVector<Scalar, 1> > type; +}; + +// use the stabilized BiCG solver preconditioned by the ILU-0 by default +SET_TYPE_PROP(Pressure, LinearSolver, Dumux::ILU0BiCGSTABBackend<TypeTag> ); + +//! set the default for the reduction of the initial residual +SET_PROP(Pressure, LinearSolverResidualReduction) +{public: + static constexpr double value = 1e-13; +}; + +//! set the default number of maximum iterations for the linear solver +SET_PROP(Pressure, LinearSolverMaxIterations) +{public: + static constexpr int value = 500; +}; + +//! set the default number of maximum iterations for the linear solver +SET_PROP(Pressure, LinearSolverBlockSize) +{public: + static constexpr int value = 1; +}; + +SET_TYPE_PROP( Pressure, Velocity, VelocityDefault<TypeTag>); + +} +} + +#endif diff --git a/dumux/decoupled/common/transportproperties.hh b/dumux/decoupled/common/transportproperties.hh index 1979e5d483eabd1785e28d8be2f63ef5f1125d17..7b06e868aae65f28a07cac73e248cebb02c719f7 100644 --- a/dumux/decoupled/common/transportproperties.hh +++ b/dumux/decoupled/common/transportproperties.hh @@ -22,7 +22,7 @@ #ifndef DUMUX_TRANSPORT_PROPERTIES_HH #define DUMUX_TRANSPORT_PROPERTIES_HH -#include <dumux/common/basicproperties.hh> +#include "decoupledproperties.hh" /*! * \ingroup Saturation2p @@ -44,18 +44,34 @@ namespace Properties ////////////////////////////////////////////////////////////////// //! The type tag for models based on the diffusion-scheme -NEW_TYPE_TAG(Transport); +NEW_TYPE_TAG(Transport, INHERITS_FROM(DecoupledModel)); ////////////////////////////////////////////////////////////////// // Property tags ////////////////////////////////////////////////////////////////// - +NEW_PROP_TAG( TransportSolutionType); NEW_PROP_TAG( EvalCflFluxFunction ); //!< Type of the evaluation of the CFL-condition NEW_PROP_TAG( CFLFactor ); NEW_PROP_TAG( SwitchNormals ); SET_SCALAR_PROP(Transport, CFLFactor, 1.0); SET_BOOL_PROP(Transport, SwitchNormals, false); + +/*! + * \brief Default implementation for the Vector of the transportet quantity + * + * This type defines the data type of the transportet quantity. In case of a + * immiscible 2p system, this would represent a vector holding the saturation + * of one phase. + */ +SET_PROP(Transport, TransportSolutionType) +{ + private: + typedef typename GET_PROP(TypeTag, SolutionTypes) SolutionType; + + public: + typedef typename SolutionType::ScalarSolution type;//!<type for vector of scalar properties +}; } } diff --git a/dumux/decoupled/common/variableclass.hh b/dumux/decoupled/common/variableclass.hh index 7c6ad56cfb4f9a6ed62cc5027b70997194ba5848..76f692940d75e811e45e1fb7ca6aa9c138711fdf 100644 --- a/dumux/decoupled/common/variableclass.hh +++ b/dumux/decoupled/common/variableclass.hh @@ -71,8 +71,6 @@ private: typedef typename SolutionTypes::ElementMapper ElementMapper; public: - typedef typename SolutionTypes::ScalarSolution ScalarSolutionType;//!<type for vector of scalars - typedef typename GET_PROP_TYPE(TypeTag, TransportSolutionType) TransportSolutionType; typedef typename std::vector <CellData> CellDataVector; private: