From 425ddbc0bdbb39bb7ae743982bf1181dc10ef52e Mon Sep 17 00:00:00 2001 From: Maziar Veyskarami <maziar.veyskarami@iws.uni-stuttgart.de> Date: Fri, 3 Apr 2020 15:32:20 +0200 Subject: [PATCH] [ex-fluidsystem][propertiesheader] move properties to property header for 2p2c case --- exercises/exercise-fluidsystem/2p2cproblem.hh | 58 +------------ .../exercise-fluidsystem/2p2cproperties.hh | 84 +++++++++++++++++++ exercises/exercise-fluidsystem/main.cc | 2 +- 3 files changed, 87 insertions(+), 57 deletions(-) create mode 100644 exercises/exercise-fluidsystem/2p2cproperties.hh diff --git a/exercises/exercise-fluidsystem/2p2cproblem.hh b/exercises/exercise-fluidsystem/2p2cproblem.hh index 5fbb6c7d..76a5f58d 100644 --- a/exercises/exercise-fluidsystem/2p2cproblem.hh +++ b/exercises/exercise-fluidsystem/2p2cproblem.hh @@ -24,65 +24,11 @@ #ifndef DUMUX_EXERCISE_FLUIDSYSTEM_B_PROBLEM_HH #define DUMUX_EXERCISE_FLUIDSYSTEM_B_PROBLEM_HH -// The grid manager -#include <dune/grid/yaspgrid.hh> - -// The numerical model -#include <dumux/porousmediumflow/2p2c/model.hh> - -// The box discretization -#include <dumux/discretization/box.hh> - // The base porous media box problem #include <dumux/porousmediumflow/problem.hh> +#include <dumux/common/properties.hh> -// Spatially dependent parameters -#include "spatialparams.hh" - -// The fluid system that is created in this exercise -#include "fluidsystems/h2omycompressiblecomponent.hh" - -namespace Dumux{ -// Forward declaration of the problem class -template <class TypeTag> class ExerciseFluidsystemProblemTwoPTwoC; - -namespace Properties { -// Create a new type tag for the problem -// Create new type tags -namespace TTag { -struct ExerciseFluidsystemTwoPTwoC { using InheritsFrom = std::tuple<TwoPTwoC, BoxModel>; }; -} // end namespace TTag - -// Set the "Problem" property -template<class TypeTag> -struct Problem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = ExerciseFluidsystemProblemTwoPTwoC<TypeTag>; }; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> -{ -private: - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; -public: - using type = ExerciseFluidsystemSpatialParams<FVGridGeometry, Scalar>; -}; - -// Set grid and the grid creator to be used -template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = Dune::YaspGrid<2>; }; - - // The fluid system property -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> -{ -private: - using Scalar = GetPropType<TypeTag, Properties::Scalar>; -public: - using type = FluidSystems::H2OMyCompressibleComponent<Scalar>; -}; - -} +namespace Dumux { /*! * \ingroup TwoPBoxModel diff --git a/exercises/exercise-fluidsystem/2p2cproperties.hh b/exercises/exercise-fluidsystem/2p2cproperties.hh new file mode 100644 index 00000000..e39bf9b3 --- /dev/null +++ b/exercises/exercise-fluidsystem/2p2cproperties.hh @@ -0,0 +1,84 @@ +// -*- 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 The properties file for two phase-two component exercise-fluidsystem. + */ +#ifndef DUMUX_EXERCISE_FLUIDSYSTEM_B_PROPERTIES_HH +#define DUMUX_EXERCISE_FLUIDSYSTEM_B_PROPERTIES_HH + +// The grid manager +#include <dune/grid/yaspgrid.hh> + +// The numerical model +#include <dumux/porousmediumflow/2p2c/model.hh> + +// The box discretization +#include <dumux/discretization/box.hh> + +// Spatially dependent parameters +#include "spatialparams.hh" + +// The fluid system that is created in this exercise +#include "fluidsystems/h2omycompressiblecomponent.hh" + +// The problem file, where setup-specific boundary and initial conditions are defined. +#include"2p2cproblem.hh" + +namespace Dumux::Properties { + +// Create a new type tag for the problem +// Create new type tags +namespace TTag { +struct ExerciseFluidsystemTwoPTwoC { using InheritsFrom = std::tuple<TwoPTwoC, BoxModel>; }; +} // end namespace TTag + +// Set the "Problem" property +template<class TypeTag> +struct Problem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = ExerciseFluidsystemProblemTwoPTwoC<TypeTag>; }; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> +{ +private: + using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; +public: + using type = ExerciseFluidsystemSpatialParams<FVGridGeometry, Scalar>; +}; + +// Set grid and the grid creator to be used +template<class TypeTag> +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = Dune::YaspGrid<2>; }; + + // The fluid system property +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> +{ +private: + using Scalar = GetPropType<TypeTag, Properties::Scalar>; +public: + using type = FluidSystems::H2OMyCompressibleComponent<Scalar>; +}; + +} // end namespace Dumux::Properties + +#endif diff --git a/exercises/exercise-fluidsystem/main.cc b/exercises/exercise-fluidsystem/main.cc index a17f5c61..42796831 100644 --- a/exercises/exercise-fluidsystem/main.cc +++ b/exercises/exercise-fluidsystem/main.cc @@ -33,7 +33,7 @@ #include <dune/istl/io.hh> #include "2pproperties.hh" -#include "2p2cproblem.hh" +#include "2p2cproperties.hh" #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -- GitLab