From f56b6ed35f19059c33c2402d6449759ae7a1454f Mon Sep 17 00:00:00 2001 From: Ned Coltman <edward.coltman@iws.uni-stuttgart.de> Date: Thu, 2 Apr 2020 09:05:33 +0200 Subject: [PATCH] [ex-runtime][propertiesheader] move properties to separate header --- exercises/exercise-runtimeparams/main.cc | 4 +- exercises/exercise-runtimeparams/problem.hh | 45 +---------- .../exercise-runtimeparams/properties.hh | 75 +++++++++++++++++++ 3 files changed, 78 insertions(+), 46 deletions(-) create mode 100644 exercises/exercise-runtimeparams/properties.hh diff --git a/exercises/exercise-runtimeparams/main.cc b/exercises/exercise-runtimeparams/main.cc index 30fa1f8b..21cff5b3 100644 --- a/exercises/exercise-runtimeparams/main.cc +++ b/exercises/exercise-runtimeparams/main.cc @@ -47,8 +47,8 @@ #include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/grid/gridmanager.hh> -// The problem file, where setup-specific boundary and initial conditions are defined. -#include "problem.hh" +// The properties file, where compile time definitions are made +#include "properties.hh" //////////////////////// // the main function diff --git a/exercises/exercise-runtimeparams/problem.hh b/exercises/exercise-runtimeparams/problem.hh index 922e375d..e5f2746a 100644 --- a/exercises/exercise-runtimeparams/problem.hh +++ b/exercises/exercise-runtimeparams/problem.hh @@ -25,53 +25,11 @@ #ifndef DUMUX_EXRUNTIMEPARAMS_INJECTION_PROBLEM_2P_HH #define DUMUX_EXRUNTIMEPARAMS_INJECTION_PROBLEM_2P_HH -#include <dune/grid/yaspgrid.hh> - -#include <dumux/discretization/cctpfa.hh> -#include <dumux/porousmediumflow/2p/model.hh> +#include <dumux/common/properties.hh> #include <dumux/porousmediumflow/problem.hh> -#include <dumux/material/fluidsystems/h2on2.hh> - -#include "spatialparams.hh" namespace Dumux { -// forward declare problem -template <class TypeTag> -class InjectionProblem2P; - -namespace Properties { -// define the TypeTag for this problem with a cell-centered two-point flux approximation spatial discretization. -// Create new type tags -namespace TTag { -struct Injection2p { using InheritsFrom = std::tuple<TwoP>; }; -struct Injection2pCC { using InheritsFrom = std::tuple<Injection2p, CCTpfaModel>; }; -} // end namespace TTag - -// Set the grid type -template<class TypeTag> -struct Grid<TypeTag, TTag::Injection2p> { using type = Dune::YaspGrid<2>; }; - -// Set the problem property -template<class TypeTag> -struct Problem<TypeTag, TTag::Injection2p> { using type = InjectionProblem2P<TypeTag>; }; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::Injection2p> -{ -private: - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; -public: - using type = InjectionSpatialParams<FVGridGeometry, Scalar>; -}; - -// Set fluid configuration -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::Injection2p> { using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/ true> >; }; -} // end namespace Properties - /*! * \ingroup TwoPModel * \ingroup ImplicitTestProblems @@ -229,7 +187,6 @@ public: // \} - /*! * \name Volume terms */ diff --git a/exercises/exercise-runtimeparams/properties.hh b/exercises/exercise-runtimeparams/properties.hh new file mode 100644 index 00000000..6b3f3110 --- /dev/null +++ b/exercises/exercise-runtimeparams/properties.hh @@ -0,0 +1,75 @@ +// -*- 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 two-phase porousmediumflow properties file for exercise runtime parameters + */ + +#ifndef DUMUX_EXRUNTIMEPARAMS_PROPERTIES_HH +#define DUMUX_EXRUNTIMEPARAMS_PROPERTIES_HH + +#include <dune/grid/yaspgrid.hh> + +#include <dumux/discretization/cctpfa.hh> +#include <dumux/porousmediumflow/2p/model.hh> +#include <dumux/material/fluidsystems/h2on2.hh> + +#include "spatialparams.hh" +#include "problem.hh" + +namespace Dumux::Properties { + +// Define the TypeTag for this problem +// with a cell-centered two-point flux approximation spatial discretization. +namespace TTag { +struct Injection2p { using InheritsFrom = std::tuple<TwoP>; }; +struct Injection2pCC { using InheritsFrom = std::tuple<Injection2p, CCTpfaModel>; }; +} // end namespace TTag + +// Set the grid type +template<class TypeTag> +struct Grid<TypeTag, TTag::Injection2p> { using type = Dune::YaspGrid<2>; }; + +// Set the problem property +template<class TypeTag> +struct Problem<TypeTag, TTag::Injection2p> { using type = InjectionProblem2P<TypeTag>; }; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::Injection2p> +{ +private: + using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; +public: + using type = InjectionSpatialParams<FVGridGeometry, Scalar>; +}; + +// Set fluid configuration +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::Injection2p> +{ + using type = FluidSystems::H2ON2< GetPropType<TypeTag, Properties::Scalar>, + FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/ true> >; +}; + +} //end namespace Dumux::Properties + +#endif -- GitLab