diff --git a/exercises/exercise-fluidsystem/2p2cproblem.hh b/exercises/exercise-fluidsystem/2p2cproblem.hh index a89f4dae9c96dc618d76718eed070ce8781b8a7b..d6f89ad9907ac229ce22e6fcf6b434e8d4f890fc 100644 --- a/exercises/exercise-fluidsystem/2p2cproblem.hh +++ b/exercises/exercise-fluidsystem/2p2cproblem.hh @@ -47,33 +47,33 @@ namespace Properties { // Create a new type tag for the problem // Create new type tags namespace TTag { -struct ExerciseFluidsystemTwoPTwoCTypeTag { using InheritsFrom = std::tuple<BoxModel, TwoPTwoC>; }; +struct ExerciseFluidsystemTwoPTwoC { using InheritsFrom = std::tuple<BoxModel, TwoPTwoC>; }; } // end namespace TTag // Set the "Problem" property template<class TypeTag> -struct Problem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> { using type = ExerciseFluidsystemProblemTwoPTwoC<TypeTag>; }; +struct Problem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = ExerciseFluidsystemProblemTwoPTwoC<TypeTag>; }; // Set the spatial parameters -SET_TYPE_PROP(ExerciseFluidsystemTwoPTwoCTypeTag, SpatialParams, +SET_TYPE_PROP(ExerciseFluidsystemTwoPTwoC, SpatialParams, ExerciseFluidsystemSpatialParams<GetPropType<TypeTag, Properties::FVGridGeometry>, GetPropType<TypeTag, Properties::Scalar>>); // Set grid and the grid creator to be used #if HAVE_DUNE_ALUGRID template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> { using type = Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>; }; #elif HAVE_UG template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> { using type = Dune::UGGrid<2>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = Dune::UGGrid<2>; }; #else template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> { using type = Dune::YaspGrid<2>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = Dune::YaspGrid<2>; }; #endif // HAVE_DUNE_ALUGRID // The fluid system property template<class TypeTag> -struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> +struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { private: using Scalar = GetPropType<TypeTag, Properties::Scalar>; diff --git a/exercises/exercise-fluidsystem/2pproblem.hh b/exercises/exercise-fluidsystem/2pproblem.hh index 33950b28e6a080b8e7a31a6a632760c388a80725..2f945fab700c09d57162f1481440acee23a72492 100644 --- a/exercises/exercise-fluidsystem/2pproblem.hh +++ b/exercises/exercise-fluidsystem/2pproblem.hh @@ -70,33 +70,33 @@ namespace Properties { // Create a new type tag for the problem // Create new type tags namespace TTag { -struct ExerciseFluidsystemTwoPTypeTag { using InheritsFrom = std::tuple<BoxModel, TwoP>; }; +struct ExerciseFluidsystemTwoP { using InheritsFrom = std::tuple<BoxModel, TwoP>; }; } // end namespace TTag // Set the "Problem" property template<class TypeTag> -struct Problem<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> { using type = ExerciseFluidsystemProblemTwoP<TypeTag>; }; +struct Problem<TypeTag, TTag::ExerciseFluidsystemTwoP> { using type = ExerciseFluidsystemProblemTwoP<TypeTag>; }; // Set the spatial parameters -SET_TYPE_PROP(ExerciseFluidsystemTwoPTypeTag, SpatialParams, +SET_TYPE_PROP(ExerciseFluidsystemTwoP, SpatialParams, ExerciseFluidsystemSpatialParams<GetPropType<TypeTag, Properties::FVGridGeometry>, GetPropType<TypeTag, Properties::Scalar>>); // Set grid to be used #if HAVE_DUNE_ALUGRID template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> { using type = Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoP> { using type = Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>; }; #elif HAVE_UG template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> { using type = Dune::UGGrid<2>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoP> { using type = Dune::UGGrid<2>; }; #else template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> { using type = Dune::YaspGrid<2>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoP> { using type = Dune::YaspGrid<2>; }; #endif // HAVE_DUNE_ALUGRID // we use the immiscible fluid system here template<class TypeTag> -struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> +struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoP> { private: using Scalar = GetPropType<TypeTag, Properties::Scalar>; diff --git a/exercises/exercise-fluidsystem/CMakeLists.txt b/exercises/exercise-fluidsystem/CMakeLists.txt index b8bcc17dd2a5a9b44edb0f5560b1893e88b2529d..4e310fabea996abc6ab7bd9207f545c4e27935a4 100644 --- a/exercises/exercise-fluidsystem/CMakeLists.txt +++ b/exercises/exercise-fluidsystem/CMakeLists.txt @@ -2,14 +2,14 @@ #part a: 2pproblem dune_add_test(NAME exercise-fluidsystem_a SOURCES exercise-fluidsystem.cc - COMPILE_DEFINITIONS TYPETAG=ExerciseFluidsystemTwoPTypeTag + COMPILE_DEFINITIONS TYPETAG=ExerciseFluidsystemTwoP COMPILE_ONLY # for testing purposes, ignore for the exercise CMD_ARGS exercise-fluidsystem_a.input) #part b: 2p2cproblem dune_add_test(NAME exercise-fluidsystem_b SOURCES exercise-fluidsystem.cc - COMPILE_DEFINITIONS TYPETAG=ExerciseFluidsystemTwoPTwoCTypeTag + COMPILE_DEFINITIONS TYPETAG=ExerciseFluidsystemTwoPTwoC COMPILE_ONLY # for testing purposes, ignore for the exercise CMD_ARGS exercise-fluidsystem_b.input) diff --git a/exercises/exercise-fluidsystem/README.md b/exercises/exercise-fluidsystem/README.md index 3cfe4bacafa1667607ce061713a0dfc77b8cac9f..2f9591f61686df7f9ce1de11fcd2c5fee63fcdbe 100644 --- a/exercises/exercise-fluidsystem/README.md +++ b/exercises/exercise-fluidsystem/README.md @@ -35,13 +35,13 @@ To see more components, fluidsystems and binarycoefficients implementations, hav In the following, the basic steps required to set the desired fluid system are outlined. Here, this is done in the __problem file__, i.e. for this part of the exercise the code shown below is taken from the `2pproblem.hh` file. -In this part of the exercise we will consider a system consisting of two immiscible phases. Therefore, the _TypeTag_ for this problem (`ExerciseFluidsystemTwoPTypeTag`) derives from +In this part of the exercise we will consider a system consisting of two immiscible phases. Therefore, the _TypeTag_ for this problem (`ExerciseFluidsystemTwoP`) derives from the `TwoP` _TypeTag_ (immiscible two-phase model properties) and the `BoxModel` _TypeTag_ (specifies properties of the discretization scheme). ```c++ // Create new type tags namespace TTag { -struct ExerciseFluidsystemTwoPTypeTag { using InheritsFrom = std::tuple<BoxModel, TwoP>; }; +struct ExerciseFluidsystemTwoP { using InheritsFrom = std::tuple<BoxModel, TwoP>; }; } // end namespace TTag ``` @@ -99,7 +99,7 @@ the other phase is liquid as well and consists of the incompressible fictitious ```c++ // we use the immiscible fluid system here template<class TypeTag> -struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> +struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoP> { private: using Scalar = GetPropType<TypeTag, Properties::Scalar>; @@ -175,7 +175,7 @@ Compare the gnuplot output to the following plot of the density function from ab ### 3. Implement a new fluid system -The problem file for this part of the exercise is `2p2cproblem.hh`. We now want to implement a new fluid system consisting of two liquid phases, which are water and the previously implemented compressible component. We will consider compositional effects, which is why we now have to derive our _TypeTag_ (`ExerciseFluidsystemTwoPTwoCTypeTag`) from a _TypeTag_ (`TwoPTwoC`) that holds the miscible two-phase +The problem file for this part of the exercise is `2p2cproblem.hh`. We now want to implement a new fluid system consisting of two liquid phases, which are water and the previously implemented compressible component. We will consider compositional effects, which is why we now have to derive our _TypeTag_ (`ExerciseFluidsystemTwoPTwoC`) from a _TypeTag_ (`TwoPTwoC`) that holds the miscible two-phase two-component model properties: ```c++ @@ -185,7 +185,7 @@ two-component model properties: ```c++ // Create a new type tag for the problem -struct ExerciseFluidsystemTwoPTwoCTypeTag { using InheritsFrom = std::tuple<BoxModel, TwoPTwoC>; }; +struct ExerciseFluidsystemTwoPTwoC { using InheritsFrom = std::tuple<BoxModel, TwoPTwoC>; }; } // end namespace TTag ``` @@ -199,7 +199,7 @@ The new fluid system is to be implemented in the file `fluidsystems/h2omycompres ```c++ // The fluid system property template<class TypeTag> -struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> +struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { private: using Scalar = GetPropType<TypeTag, Properties::Scalar>; diff --git a/exercises/exercise-fluidsystem/exercise-fluidsystem.cc b/exercises/exercise-fluidsystem/exercise-fluidsystem.cc index 184814d6ef3cc3f5112ec20d85228405b7d4b7f9..7241485ca3eba14e9a28f9991f389b87f546c185 100644 --- a/exercises/exercise-fluidsystem/exercise-fluidsystem.cc +++ b/exercises/exercise-fluidsystem/exercise-fluidsystem.cc @@ -62,8 +62,8 @@ int main(int argc, char** argv) try // define the type tag for this problem // TYPETAG is set in CMakeLists.txt as compile time definition - // alternatively you could write `using TypeTag = Properties::TTag::ExerciseFluidsystemBoxTwoPTypeTag;` - // then, for the 2p2c problem you have to change this line to `using TypeTag = Properties::TTag::ExerciseFluidsystemBoxTwoPTypeTag;` + // alternatively you could write `using TypeTag = Properties::TTag::ExerciseFluidsystemBoxTwoP;` + // then, for the 2p2c problem you have to change this line to `using TypeTag = Properties::TTag::ExerciseFluidsystemBoxTwoP;` // and recompile the executable using TypeTag = Properties::TTag::TYPETAG; diff --git a/exercises/solution/exercise-fluidsystem/2p2cproblem.hh b/exercises/solution/exercise-fluidsystem/2p2cproblem.hh index 35eca3501a634d0a02561f12c3f5631c7fe659c0..c53e9e53118c81828ef845f1dcd18d5eb8773639 100644 --- a/exercises/solution/exercise-fluidsystem/2p2cproblem.hh +++ b/exercises/solution/exercise-fluidsystem/2p2cproblem.hh @@ -47,33 +47,33 @@ namespace Properties { // Create a new type tag for the problem // Create new type tags namespace TTag { -struct ExerciseFluidsystemTwoPTwoCTypeTag { using InheritsFrom = std::tuple<BoxModel, TwoPTwoC>; }; +struct ExerciseFluidsystemTwoPTwoC { using InheritsFrom = std::tuple<BoxModel, TwoPTwoC>; }; } // end namespace TTag // Set the "Problem" property template<class TypeTag> -struct Problem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> { using type = ExerciseFluidsystemProblemTwoPTwoC<TypeTag>; }; +struct Problem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = ExerciseFluidsystemProblemTwoPTwoC<TypeTag>; }; // Set the spatial parameters -SET_TYPE_PROP(ExerciseFluidsystemTwoPTwoCTypeTag, SpatialParams, +SET_TYPE_PROP(ExerciseFluidsystemTwoPTwoC, SpatialParams, ExerciseFluidsystemSpatialParams<GetPropType<TypeTag, Properties::FVGridGeometry>, GetPropType<TypeTag, Properties::Scalar>>); // Set grid and the grid creator to be used #if HAVE_DUNE_ALUGRID template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> { using type = Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>; }; #elif HAVE_UG template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> { using type = Dune::UGGrid<2>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = Dune::UGGrid<2>; }; #else template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> { using type = Dune::YaspGrid<2>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = Dune::YaspGrid<2>; }; #endif // HAVE_DUNE_ALUGRID // The fluid system property template<class TypeTag> -struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> +struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { private: using Scalar = GetPropType<TypeTag, Properties::Scalar>; diff --git a/exercises/solution/exercise-fluidsystem/2pproblem.hh b/exercises/solution/exercise-fluidsystem/2pproblem.hh index d97bba89f2840c75ff08e55975c69a74b39f1b8a..b30010a2dfc58781d89c9ec025e08929ce761149 100644 --- a/exercises/solution/exercise-fluidsystem/2pproblem.hh +++ b/exercises/solution/exercise-fluidsystem/2pproblem.hh @@ -70,33 +70,33 @@ namespace Properties { // Create a new type tag for the problem // Create new type tags namespace TTag { -struct ExerciseFluidsystemTwoPTypeTag { using InheritsFrom = std::tuple<BoxModel, TwoP>; }; +struct ExerciseFluidsystemTwoP { using InheritsFrom = std::tuple<BoxModel, TwoP>; }; } // end namespace TTag // Set the "Problem" property template<class TypeTag> -struct Problem<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> { using type = ExerciseFluidsystemProblemTwoP<TypeTag>; }; +struct Problem<TypeTag, TTag::ExerciseFluidsystemTwoP> { using type = ExerciseFluidsystemProblemTwoP<TypeTag>; }; // Set the spatial parameters -SET_TYPE_PROP(ExerciseFluidsystemTwoPTypeTag, SpatialParams, +SET_TYPE_PROP(ExerciseFluidsystemTwoP, SpatialParams, ExerciseFluidsystemSpatialParams<GetPropType<TypeTag, Properties::FVGridGeometry>, GetPropType<TypeTag, Properties::Scalar>>); // Set grid to be used #if HAVE_DUNE_ALUGRID template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> { using type = Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoP> { using type = Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>; }; #elif HAVE_UG template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> { using type = Dune::UGGrid<2>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoP> { using type = Dune::UGGrid<2>; }; #else template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> { using type = Dune::YaspGrid<2>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoP> { using type = Dune::YaspGrid<2>; }; #endif // HAVE_DUNE_ALUGRID // we use the immiscible fluid system here template<class TypeTag> -struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> +struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoP> { private: using Scalar = GetPropType<TypeTag, Properties::Scalar>; diff --git a/exercises/solution/exercise-fluidsystem/CMakeLists.txt b/exercises/solution/exercise-fluidsystem/CMakeLists.txt index caccfb65baafc120fa7d628146be2de715749afa..939a343303b7a8b6bfc8647933c3b64aa328919a 100644 --- a/exercises/solution/exercise-fluidsystem/CMakeLists.txt +++ b/exercises/solution/exercise-fluidsystem/CMakeLists.txt @@ -2,13 +2,13 @@ #part a: 2pproblem dune_add_test(NAME exercise-fluidsystem_a_solution SOURCES exercise-fluidsystem.cc - COMPILE_DEFINITIONS TYPETAG=ExerciseFluidsystemTwoPTypeTag + COMPILE_DEFINITIONS TYPETAG=ExerciseFluidsystemTwoP CMD_ARGS exercise-fluidsystem_a_solution.input) #part b: 2p2cproblem dune_add_test(NAME exercise-fluidsystem_b_solution SOURCES exercise-fluidsystem.cc - COMPILE_DEFINITIONS TYPETAG=ExerciseFluidsystemTwoPTwoCTypeTag + COMPILE_DEFINITIONS TYPETAG=ExerciseFluidsystemTwoPTwoC CMD_ARGS exercise-fluidsystem_b_solution.input) # add exercises to the common target diff --git a/exercises/solution/exercise-fluidsystem/exercise-fluidsystem.cc b/exercises/solution/exercise-fluidsystem/exercise-fluidsystem.cc index 723a640bc5756c99cb03a500358bf9af3f712d18..c90d22abb24024985e3bb5501aecad37cc059a34 100644 --- a/exercises/solution/exercise-fluidsystem/exercise-fluidsystem.cc +++ b/exercises/solution/exercise-fluidsystem/exercise-fluidsystem.cc @@ -61,8 +61,8 @@ int main(int argc, char** argv) try // define the type tag for this problem // TYPETAG is set in CMakeLists.txt as compile time definition - // alternatively you could write `using TypeTag = Properties::TTag::ExerciseFluidsystemTwoPTypeTag;` - // then, for the 2p2c problem you have to change this line to `using TypeTag = Properties::TTag::ExerciseFluidsystemTwoPTwoCTypeTag;` + // alternatively you could write `using TypeTag = Properties::TTag::ExerciseFluidsystemTwoP;` + // then, for the 2p2c problem you have to change this line to `using TypeTag = Properties::TTag::ExerciseFluidsystemTwoPTwoC;` // and recompile the executable using TypeTag = Properties::TTag::TYPETAG;