diff --git a/exercises/exercise-runtimeparams/main.cc b/exercises/exercise-runtimeparams/main.cc index 30fa1f8bf9ae21311d904584af63ea03d4a49be4..21cff5b3f65d66d5a72134918ad0e83d98fc8944 100644 --- a/exercises/exercise-runtimeparams/main.cc +++ b/exercises/exercise-runtimeparams/main.cc @@ -47,8 +47,8 @@ #include #include -// 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 922e375d7608963f839c65d9f4b8a18a15203ffd..e5f2746aa7d6e49cbeafb019153ffc5217b9fb8a 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 - -#include -#include +#include #include -#include - -#include "spatialparams.hh" namespace Dumux { -// forward declare problem -template -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; }; -struct Injection2pCC { using InheritsFrom = std::tuple; }; -} // end namespace TTag - -// Set the grid type -template -struct Grid { using type = Dune::YaspGrid<2>; }; - -// Set the problem property -template -struct Problem { using type = InjectionProblem2P; }; - -// Set the spatial parameters -template -struct SpatialParams -{ -private: - using FVGridGeometry = GetPropType; - using Scalar = GetPropType; -public: - using type = InjectionSpatialParams; -}; - -// Set fluid configuration -template -struct FluidSystem { using type = FluidSystems::H2ON2, FluidSystems::H2ON2DefaultPolicy >; }; -} // 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 0000000000000000000000000000000000000000..6b3f3110124242fdf6af128515f0bb059efe7404 --- /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 . * + *****************************************************************************/ +/*! + * \file + * + * \brief The two-phase porousmediumflow properties file for exercise runtime parameters + */ + +#ifndef DUMUX_EXRUNTIMEPARAMS_PROPERTIES_HH +#define DUMUX_EXRUNTIMEPARAMS_PROPERTIES_HH + +#include + +#include +#include +#include + +#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; }; +struct Injection2pCC { using InheritsFrom = std::tuple; }; +} // end namespace TTag + +// Set the grid type +template +struct Grid { using type = Dune::YaspGrid<2>; }; + +// Set the problem property +template +struct Problem { using type = InjectionProblem2P; }; + +// Set the spatial parameters +template +struct SpatialParams +{ +private: + using FVGridGeometry = GetPropType; + using Scalar = GetPropType; +public: + using type = InjectionSpatialParams; +}; + +// Set fluid configuration +template +struct FluidSystem +{ + using type = FluidSystems::H2ON2< GetPropType, + FluidSystems::H2ON2DefaultPolicy >; +}; + +} //end namespace Dumux::Properties + +#endif diff --git a/exercises/solution/exercise-runtimeparams/main.cc b/exercises/solution/exercise-runtimeparams/main.cc index 30fa1f8bf9ae21311d904584af63ea03d4a49be4..21cff5b3f65d66d5a72134918ad0e83d98fc8944 100644 --- a/exercises/solution/exercise-runtimeparams/main.cc +++ b/exercises/solution/exercise-runtimeparams/main.cc @@ -47,8 +47,8 @@ #include #include -// 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/solution/exercise-runtimeparams/problem.hh b/exercises/solution/exercise-runtimeparams/problem.hh index fee8ff30d029bd91aa5b095bc3216b16eb6eab2e..327637f8a2fdb703b7eaf882448a59c474ef7efd 100644 --- a/exercises/solution/exercise-runtimeparams/problem.hh +++ b/exercises/solution/exercise-runtimeparams/problem.hh @@ -25,53 +25,11 @@ #ifndef DUMUX_EXRUNTIMEPARAMS_INJECTION_PROBLEM_2P_HH #define DUMUX_EXRUNTIMEPARAMS_INJECTION_PROBLEM_2P_HH -#include - -#include -#include +#include #include -#include - -#include "spatialparams.hh" namespace Dumux { -// forward declare problem -template -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; }; -struct Injection2pCC { using InheritsFrom = std::tuple; }; -} // end namespace TTag - -// Set the grid type -template -struct Grid { using type = Dune::YaspGrid<2>; }; - -// Set the problem property -template -struct Problem { using type = InjectionProblem2P; }; - -// Set the spatial parameters -template -struct SpatialParams -{ -private: - using FVGridGeometry = GetPropType; - using Scalar = GetPropType; -public: - using type = InjectionSpatialParams; -}; - -// Set fluid configuration -template -struct FluidSystem { using type = FluidSystems::H2ON2, FluidSystems::H2ON2DefaultPolicy>; }; -} // end namespace Properties - /*! * \ingroup TwoPModel * \ingroup ImplicitTestProblems @@ -229,7 +187,6 @@ public: // \} - /*! * \name Volume terms */ diff --git a/exercises/solution/exercise-runtimeparams/properties.hh b/exercises/solution/exercise-runtimeparams/properties.hh new file mode 100644 index 0000000000000000000000000000000000000000..4c4524d85263c23fac311051e9ddd0ecac2e1e13 --- /dev/null +++ b/exercises/solution/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 . * + *****************************************************************************/ +/*! + * \file + * + * \brief The two-phase porousmediumflow properties file for exercise runtime parameters + */ + +#ifndef DUMUX_EXRUNTIMEPARAMS_PROPERTIES_HH +#define DUMUX_EXRUNTIMEPARAMS_PROPERTIES_HH + +#include + +#include +#include +#include + +#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; }; +struct Injection2pCC { using InheritsFrom = std::tuple; }; +} // end namespace TTag + +// Set the grid type +template +struct Grid { using type = Dune::YaspGrid<2>; }; + +// Set the problem property +template +struct Problem { using type = InjectionProblem2P; }; + +// Set the spatial parameters +template +struct SpatialParams +{ +private: + using FVGridGeometry = GetPropType; + using Scalar = GetPropType; +public: + using type = InjectionSpatialParams; +}; + +// Set fluid configuration +template +struct FluidSystem +{ + using type = FluidSystems::H2ON2< GetPropType, + FluidSystems::H2ON2DefaultPolicy >; +}; + +} // end namespace Dumux::Properties + +#endif