Commit 36aa1820 by Ned Coltman

Fluidsystem Exercise with separate properties header

See merge request !96
parents 05735f09 f1febd5d
Pipeline #1826 passed with stage
in 32 seconds
 ... ... @@ -24,65 +24,11 @@ #ifndef DUMUX_EXERCISE_FLUIDSYSTEM_B_PROBLEM_HH #define DUMUX_EXERCISE_FLUIDSYSTEM_B_PROBLEM_HH // The grid manager #include // The numerical model #include // The box discretization #include // The base porous media box problem #include #include // 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 ExerciseFluidsystemProblemTwoPTwoC; namespace Properties { // Create a new type tag for the problem // Create new type tags namespace TTag { struct ExerciseFluidsystemTwoPTwoC { using InheritsFrom = std::tuple; }; } // end namespace TTag // Set the "Problem" property template struct Problem { using type = ExerciseFluidsystemProblemTwoPTwoC; }; // Set the spatial parameters template struct SpatialParams { private: using FVGridGeometry = GetPropType; using Scalar = GetPropType; public: using type = ExerciseFluidsystemSpatialParams; }; // Set grid and the grid creator to be used template struct Grid { using type = Dune::YaspGrid<2>; }; // The fluid system property template struct FluidSystem { private: using Scalar = GetPropType; public: using type = FluidSystems::H2OMyCompressibleComponent; }; } namespace Dumux { /*! * \ingroup TwoPBoxModel ... ...
 // -*- 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 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 // The numerical model #include // The box discretization #include // 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; }; } // end namespace TTag // Set the "Problem" property template struct Problem { using type = ExerciseFluidsystemProblemTwoPTwoC; }; // Set the spatial parameters template struct SpatialParams { private: using FVGridGeometry = GetPropType; using Scalar = GetPropType; public: using type = ExerciseFluidsystemSpatialParams; }; // Set grid and the grid creator to be used template struct Grid { using type = Dune::YaspGrid<2>; }; // The fluid system property template struct FluidSystem { private: using Scalar = GetPropType; public: using type = FluidSystems::H2OMyCompressibleComponent; }; } // end namespace Dumux::Properties #endif
 ... ... @@ -24,90 +24,18 @@ #ifndef DUMUX_EXERCISE_FLUIDSYSTEM_A_PROBLEM_HH #define DUMUX_EXERCISE_FLUIDSYSTEM_A_PROBLEM_HH // The grid manager #include // The numerical model #include // The box discretization #include // The porous media base problem #include // Spatially dependent parameters #include "spatialparams.hh" #include // The water component #include #include // The components that will be created in this exercise // TODO: dumux-course-task 2.2 //****** Include the corresponding header for the task *****// #include "components/myincompressiblecomponent.hh" // #include "components/mycompressiblecomponent.hh" // We will only have liquid phases here #include // The two-phase immiscible fluid system #include // The interface to create plots during simulation #include namespace Dumux{ // Forward declaration of the problem class template class ExerciseFluidsystemProblemTwoP; namespace Properties { // Create a new type tag for the problem // Create new type tags namespace TTag { struct ExerciseFluidsystemTwoP { using InheritsFrom = std::tuple; }; } // end namespace TTag // Set the "Problem" property template struct Problem { using type = ExerciseFluidsystemProblemTwoP; }; // Set the spatial parameters template struct SpatialParams { private: using FVGridGeometry = GetPropType; using Scalar = GetPropType; public: using type = ExerciseFluidsystemSpatialParams; }; // Set grid to be used template struct Grid { using type = Dune::YaspGrid<2>; }; // we use the immiscible fluid system here template struct FluidSystem { private: using Scalar = GetPropType; using TabulatedH2O = Components::TabulatedComponent>; using LiquidWaterPhase = typename FluidSystems::OnePLiquid; // TODO: dumux-course-task 2.2 //****** Select the corresponding component for the task *****// // Uncomment first line and comment second line for using the compressible component using LiquidMyComponentPhase = typename FluidSystems::OnePLiquid >; // using LiquidMyComponentPhase = typename FluidSystems::OnePLiquid >; public: using type = typename FluidSystems::TwoPImmiscible; }; } namespace Dumux { /*! * \ingroup TwoPBoxModel ... ... @@ -317,6 +245,7 @@ private: Scalar depthBOR_; //! depth at the bottom of the reservoir Dumux::GnuplotInterface gnuplot_; //! collects data for plotting }; } } // end namespace Dumux #endif
 ... ... @@ -19,8 +19,10 @@ Locate all the files you will need for this exercise * The shared __main file__ : main.cc * The __input file__ for part a: aparams.input * The __problem file__ for part a: 2pproblem.hh * The __properties file__ for part a: 2pproperties.hh * The __input file__ for part b: bparams.input * The __problem file__ for part b: 2p2cproblem.hh * The __properties file__ for part b: 2p2cproperties.hh * The __spatial parameters file__: spatialparams.hh Furthermore you will find the following folders: ... ... @@ -32,7 +34,7 @@ To see more components, fluidsystems and binarycoefficients implementations, hav ### 2. Implement a new component 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 the following, the basic steps required to set the desired fluid system are outlined. Here, this is done in the __properties file__, i.e. for this part of the exercise the codes shown below is taken from the 2pproperties.hh file. 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). ... ... @@ -61,7 +63,7 @@ while the BoxModel _TypeTag_ can be found in the discretization/box.hh heade For a cell-centered scheme, you could derive from CCTpfaModel or CCMpfaModel instead (and, of course, include the right headers). As one of the two phases we want to use water and we want to precompute tables on which the properties are then interpolated in order to save computational time. Thus, in a first step we have to include the following headers: As one of the two phases we want to use water and we want to precompute tables on which the properties are then interpolated in order to save computational time. Since we need this part in both problem file and properties file, we have to include the following two headers in our problem file, i.e. 2pproblem.hh file, and the properties file has access to them through problem file. c++ // The water component ... ... @@ -162,7 +164,7 @@ We now want to implement a pressure-dependent density for our component. Open th $\displaystyle \rho_{MyComp} = \rho_{min} + \frac{ \rho_{max} - \rho_{min} }{ 1 + \rho_{min}*e^{-1.0*k*(\rho_{max} - \rho_{min})*p} } $ where $p$ is the pressure and $\rho_{min} = 1440 $, $\rho_{max} = 1480 $ and $k = 5 \cdot 10^{-7} $. Also, make sure the header is included in the 2pproblem.hh file by uncommenting the corresponding line. Furthermore, the new component has to be set as a liquid phase in the fluid system. To do so, search for TODO: dumux-course-task 2.2. Comment out the corresponding line and uncomment the other. The density distribution of this phase (rhoN) at the final simulation time should look like this: where $p$ is the pressure and $\rho_{min} = 1440 $, $\rho_{max} = 1480 $ and $k = 5 \cdot 10^{-7} $. Also, make sure the header is included in the 2pproperties.hh file by uncommenting the corresponding line. Furthermore, the new component has to be set as a liquid phase in the fluid system. To do so, search for TODO: dumux-course-task 2.2. Comment out the corresponding line and uncomment the other. The density distribution of this phase (rhoN) at the final simulation time should look like this: ![](../extradoc/exercise-fluidsystem_a_solution2.png) ... ... @@ -173,8 +175,9 @@ 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_ (ExerciseFluidsystemTwoPTwoC) from a _TypeTag_ (TwoPTwoC) that holds the miscible two-phase two-component model properties: The problem file and properties file for this part of the exercise are 2p2cproblem.hh and 2p2cproperties.hh, respectively. 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++ // The numerical model ... ...