Skip to content
Snippets Groups Projects
Commit 10c15821 authored by Martin Schneider's avatar Martin Schneider Committed by Hanchuan Wu
Browse files

Cleanup/exercise fluidsystem

parent 16e97266
No related branches found
No related tags found
1 merge request!276Cleanup/exercise fluidsystem
Showing
with 326 additions and 343 deletions
diff -ruN exercises/exercise-fluidsystem/2p2cproblem.hh exercises/solution/exercise-fluidsystem/2p2cproblem.hh
--- exercises/exercise-fluidsystem/2p2cproblem.hh 2024-07-17 15:44:09.856489072 +0200
+++ exercises/solution/exercise-fluidsystem/2p2cproblem.hh 2024-07-17 15:44:09.860489129 +0200
@@ -12,7 +12,7 @@
#ifndef DUMUX_EXERCISE_FLUIDSYSTEM_B_PROBLEM_HH
#define DUMUX_EXERCISE_FLUIDSYSTEM_B_PROBLEM_HH
-// The base porous media box problem.
+// The base porous media box problem.
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/common/boundarytypes.hh>
#include <dumux/common/properties.hh>
diff -ruN exercises/exercise-fluidsystem/2pproperties.hh exercises/solution/exercise-fluidsystem/2pproperties.hh
--- exercises/exercise-fluidsystem/2pproperties.hh 2024-07-17 11:27:28.874349112 +0200
+++ exercises/solution/exercise-fluidsystem/2pproperties.hh 2024-07-17 11:27:28.882349286 +0200
@@ -25,10 +25,8 @@
--- exercises/exercise-fluidsystem/2pproperties.hh 2024-07-17 15:44:09.856489072 +0200
+++ exercises/solution/exercise-fluidsystem/2pproperties.hh 2024-07-17 15:44:09.864489185 +0200
@@ -25,15 +25,13 @@
#include "spatialparams.hh"
// The components that will be created in this exercise
-// TODO: dumux-course-task 2.2
-//****** Include the corresponding header for the task *****//
-// TODO: dumux-course-task 2.2:
-// Include the corresponding header for the task
#include "components/myincompressiblecomponent.hh"
-// #include "components/mycompressiblecomponent.hh"
+#include "components/mycompressiblecomponent.hh"
// We will only have liquid phases here
#include <dumux/material/fluidsystems/1pliquid.hh>
@@ -77,10 +75,10 @@
-// The two-phase immiscible fluidsystem
+// The two-phase immiscible fluid system
#include <dumux/material/fluidsystems/2pimmiscible.hh>
// The interface to create plots during simulation
@@ -76,12 +74,13 @@
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using TabulatedH2O = Components::TabulatedComponent<Components::H2O<Scalar>>;
using LiquidWaterPhase = typename FluidSystems::OnePLiquid<Scalar, TabulatedH2O>;
-
- // TODO: dumux-course-task 2.2
- //****** Select the corresponding component for the task *****//
- // 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<Scalar, MyIncompressibleComponent<Scalar> >;
- // using LiquidMyComponentPhase = typename FluidSystems::OnePLiquid<Scalar, MyCompressibleComponent<Scalar> >;
+ /*!
+ * TODO: dumux-course-task 2.2:
+ * Uncomment first line and comment second line for using the incompressible component
+ * Uncomment second line and comment first line for using the compressible component
+ */
using LiquidMyComponentPhase = typename FluidSystems::OnePLiquid<Scalar, MyIncompressibleComponent<Scalar> >;
// using LiquidMyComponentPhase = typename FluidSystems::OnePLiquid<Scalar, MyCompressibleComponent<Scalar> >;
+ using LiquidMyComponentPhase = typename FluidSystems::OnePLiquid<Scalar, MyIncompressibleComponent<Scalar> >;
+ //using LiquidMyComponentPhase = typename FluidSystems::OnePLiquid<Scalar, MyCompressibleComponent<Scalar> >;
public:
using type = typename FluidSystems::TwoPImmiscible<Scalar, LiquidWaterPhase, LiquidMyComponentPhase>;
diff -ruN exercises/exercise-fluidsystem/aparams.input exercises/solution/exercise-fluidsystem/aparams.input
--- exercises/exercise-fluidsystem/aparams.input 2023-10-13 18:08:54.714521020 +0200
+++ exercises/solution/exercise-fluidsystem/aparams.input 2020-11-12 12:07:04.129814352 +0100
--- exercises/exercise-fluidsystem/aparams.input 2024-07-17 15:44:09.856489072 +0200
+++ exercises/solution/exercise-fluidsystem/aparams.input 2024-07-17 15:44:09.864489185 +0200
@@ -3,7 +3,7 @@
DtInitial = 10 # initial time step size [s]
......@@ -39,7 +62,7 @@ diff -ruN exercises/exercise-fluidsystem/aparams.input exercises/solution/exerci
+Name = exercise-fluidsystem_a_solution # name will be given to e.g. to the vtk result files
[SpatialParams]
BrooksCoreyPcEntry = 5.0e2 # Pa
BrooksCoreyPcEntry = 5.0e2 # [Pa]
@@ -20,4 +20,4 @@
Cells = 60 60 # x-/y-resolution of the grid
......@@ -47,8 +70,8 @@ diff -ruN exercises/exercise-fluidsystem/aparams.input exercises/solution/exerci
-PlotDensity = false # plot density over pressure for your component
+PlotDensity = true # plot density over pressure for your component
diff -ruN exercises/exercise-fluidsystem/bparams.input exercises/solution/exercise-fluidsystem/bparams.input
--- exercises/exercise-fluidsystem/bparams.input 2023-10-13 18:08:54.714521020 +0200
+++ exercises/solution/exercise-fluidsystem/bparams.input 2020-11-12 12:07:04.129814352 +0100
--- exercises/exercise-fluidsystem/bparams.input 2024-07-17 15:44:09.856489072 +0200
+++ exercises/solution/exercise-fluidsystem/bparams.input 2024-07-17 15:44:09.864489185 +0200
@@ -3,7 +3,7 @@
DtInitial = 10 # initial time step size [s]
......@@ -57,10 +80,10 @@ diff -ruN exercises/exercise-fluidsystem/bparams.input exercises/solution/exerci
+Name = exercise-fluidsystem_b_solution # name will be given to e.g. to the vtk result files
[SpatialParams]
BrooksCoreyPcEntry = 5.0e2 # Pa
BrooksCoreyPcEntry = 5.0e2 # [Pa]
diff -ruN exercises/exercise-fluidsystem/CMakeLists.txt exercises/solution/exercise-fluidsystem/CMakeLists.txt
--- exercises/exercise-fluidsystem/CMakeLists.txt 2024-07-17 11:27:28.798347462 +0200
+++ exercises/solution/exercise-fluidsystem/CMakeLists.txt 2024-07-17 11:27:28.798347462 +0200
--- exercises/exercise-fluidsystem/CMakeLists.txt 2024-07-17 14:23:53.007057346 +0200
+++ exercises/solution/exercise-fluidsystem/CMakeLists.txt 2024-07-17 14:23:53.011057409 +0200
@@ -3,18 +3,16 @@
# executables for exercise part a & b
......@@ -87,25 +110,25 @@ diff -ruN exercises/exercise-fluidsystem/CMakeLists.txt exercises/solution/exerc
-# add a symlink for the grids folder
-dune_symlink_to_source_files(FILES grids)
diff -ruN exercises/exercise-fluidsystem/components/mycompressiblecomponent.hh exercises/solution/exercise-fluidsystem/components/mycompressiblecomponent.hh
--- exercises/exercise-fluidsystem/components/mycompressiblecomponent.hh 2024-07-17 11:27:28.874349112 +0200
+++ exercises/solution/exercise-fluidsystem/components/mycompressiblecomponent.hh 2024-07-17 11:27:28.882349286 +0200
--- exercises/exercise-fluidsystem/components/mycompressiblecomponent.hh 2024-07-17 15:44:09.856489072 +0200
+++ exercises/solution/exercise-fluidsystem/components/mycompressiblecomponent.hh 2024-07-17 15:44:09.864489185 +0200
@@ -38,7 +38,7 @@
static std::string name()
{ return "MyCompressibleComponent"; }
- /*!
+ /*!
* \brief Returns true if the liquid phase is assumed to be compressible
* \brief Returns true if the liquid phase is assumed to be compressible.
*/
static constexpr bool liquidIsCompressible()
@@ -49,11 +49,7 @@
*/
static Scalar molarMass()
{
- // TODO: dumux-course-task 2.2
- // TODO: dumux-course-task 2.2:
- // Copy the methods implemented in MyIncompressibleComponent and substitute
- // the density calculation by the expression given in the exercise description.
- // Replace the line below by a meaningful return statement
- // Replace the line below by a meaningful return statement.
- DUNE_THROW(Dune::NotImplemented, "Todo: implement molar mass");
+ return 131.39e-3; // [kg/mol]
}
......@@ -116,11 +139,11 @@ diff -ruN exercises/exercise-fluidsystem/components/mycompressiblecomponent.hh e
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
{
- // TODO: dumux-course-task 2.2:
- // Replace the line below by a meaningful return statement
- // Replace the line below by a meaningful return statement.
- DUNE_THROW(Dune::NotImplemented, "Todo: implement liquid density");
+ static const Scalar rho_min = 1440;
+ static const Scalar rho_max = 1480;
+ static const Scalar k = 5e-7;
+ static const Scalar rho_min = 1440.0;
+ static const Scalar rho_max = 1480.0;
+ static const Scalar k = 5.0e-7;
+
+ using std::exp;
+ return rho_min + (rho_max - rho_min)/(1 + rho_min*exp(-1.0*k*(rho_max - rho_min)*pressure)); // [kg/m^3]
......@@ -132,7 +155,7 @@ diff -ruN exercises/exercise-fluidsystem/components/mycompressiblecomponent.hh e
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
{
- // TODO: dumux-course-task 2.2:
- // Replace the line below by a meaningful return statement
- // Replace the line below by a meaningful return statement.
- DUNE_THROW(Dune::NotImplemented, "Todo: implement liquid viscosity");
+ return 5.7e-4;// [Pa*s]
}
......@@ -142,41 +165,23 @@ diff -ruN exercises/exercise-fluidsystem/components/mycompressiblecomponent.hh e
*/
static Scalar vaporPressure(Scalar t)
{
- // TODO: dumux-course-task 3
- // Replace the line below by a meaningful return statement
- // TODO: dumux-course-task 3:
- // Replace the line below by a meaningful return statement.
- DUNE_THROW(Dune::NotImplemented, "Todo: implement vapour pressure");
+ return 3900; // [Pa] (at 20C)
+ return 3900.0; // [Pa] (at 20°C)
}
};
diff -ruN exercises/exercise-fluidsystem/components/myincompressiblecomponent.hh exercises/solution/exercise-fluidsystem/components/myincompressiblecomponent.hh
--- exercises/exercise-fluidsystem/components/myincompressiblecomponent.hh 2024-07-17 11:27:28.874349112 +0200
+++ exercises/solution/exercise-fluidsystem/components/myincompressiblecomponent.hh 2024-07-17 11:27:28.882349286 +0200
@@ -7,7 +7,7 @@
/*!
* \file
* \ingroup Components
- * \brief A fictitious component to be implemented in exercise-fluidsystem.
+ * \brief A fictitious component to be implemented in exercise-fluidsystem a.
*/
#ifndef DUMUX_MYINCOMPRESSIBLECOMPONENT_HH
#define DUMUX_MYINCOMPRESSIBLECOMPONENT_HH
@@ -21,7 +21,7 @@
{
/*!
* \ingroup Components
- * \brief A fictitious component to be implemented in exercise-fluidsystem.
+ * \brief A fictitious component to be implemented in exercise-fluidsystem a.
*
* \tparam Scalar The type used for scalar values
*/
--- exercises/exercise-fluidsystem/components/myincompressiblecomponent.hh 2024-07-17 15:44:09.856489072 +0200
+++ exercises/solution/exercise-fluidsystem/components/myincompressiblecomponent.hh 2024-07-17 15:44:09.864489185 +0200
@@ -48,10 +48,7 @@
*/
static Scalar molarMass()
{
- // TODO: dumux-course-task 2.1
- // TODO: dumux-course-task 2.1:
- // Implement the methods for the component data given in the exercise description.
- // Replace the line below by a meaningful return statement
- // Replace the line below by a meaningful return statement.
- DUNE_THROW(Dune::NotImplemented, "Todo: implement molarMass()");
+ return 131.39e-3; // [kg/mol]
}
......@@ -186,9 +191,9 @@ diff -ruN exercises/exercise-fluidsystem/components/myincompressiblecomponent.hh
*/
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
{
- // TODO: dumux-course-task 2.1
- // TODO: dumux-course-task 2.1:
- // Implement the methods for the component data given in the exercise description.
- // Replace the line below by a meaningful return statement
- // Replace the line below by a meaningful return statement.
- DUNE_THROW(Dune::NotImplemented, "Todo: implement liquidDensity()");
+ return 1460.0; // [kg/m^3]
}
......@@ -198,9 +203,9 @@ diff -ruN exercises/exercise-fluidsystem/components/myincompressiblecomponent.hh
*/
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
{
- // TODO: dumux-course-task 2.1
- // TODO: dumux-course-task 2.1:
- // Implement the methods for the component data given in the exercise description.
- // Replace the line below by a meaningful return statement
- // Replace the line below by a meaningful return statement.
- DUNE_THROW(Dune::NotImplemented, "Todo: implement liquidViscosity()");
+ return 5.7e-4;// [Pa*s]
}
......@@ -208,7 +213,7 @@ diff -ruN exercises/exercise-fluidsystem/components/myincompressiblecomponent.hh
diff -ruN exercises/exercise-fluidsystem/components/plotdensityfunction.py exercises/solution/exercise-fluidsystem/components/plotdensityfunction.py
--- exercises/exercise-fluidsystem/components/plotdensityfunction.py 1970-01-01 01:00:00.000000000 +0100
+++ exercises/solution/exercise-fluidsystem/components/plotdensityfunction.py 2024-07-17 11:27:28.842348417 +0200
+++ exercises/solution/exercise-fluidsystem/components/plotdensityfunction.py 2024-07-17 15:44:09.864489185 +0200
@@ -0,0 +1,22 @@
+#!usr/bin/env python
+# SPDX-FileCopyrightInfo: Copyright © DuMux-Course contributors, see AUTHORS.md in root folder
......@@ -217,84 +222,52 @@ diff -ruN exercises/exercise-fluidsystem/components/plotdensityfunction.py exerc
+import numpy as np
+import matplotlib.pyplot as plt
+
+# function to calculate rho dependent on pressure
+rho_min = 1440;
+rho_max = 1480;
+k = 5e-7;
+# Function to calculate rho dependent on pressure.
+rho_min = 1440.0;
+rho_max = 1480.0;
+k = 5.0e-7;
+
+def rho(p):
+ return rho_min + (rho_max - rho_min)/(1 + rho_min*np.exp(-1.0*k*(rho_max - rho_min)*p));
+
+# sample pressure in range (1e4, 1e7) and compute corresponding densities
+# Sample pressure in range (1e4, 1e7) and compute corresponding densities.
+p = np.logspace(4, 7, 100)
+r = rho(p)
+
+# plot density vs. pressure
+# Plot density vs. pressure.
+plt.semilogx(p, r)
+plt.show()
diff -ruN exercises/exercise-fluidsystem/fluidsystems/h2omycompressiblecomponent.hh exercises/solution/exercise-fluidsystem/fluidsystems/h2omycompressiblecomponent.hh
--- exercises/exercise-fluidsystem/fluidsystems/h2omycompressiblecomponent.hh 2024-07-17 11:27:28.874349112 +0200
+++ exercises/solution/exercise-fluidsystem/fluidsystems/h2omycompressiblecomponent.hh 2024-07-17 11:27:28.882349286 +0200
@@ -19,15 +19,15 @@
--- exercises/exercise-fluidsystem/fluidsystems/h2omycompressiblecomponent.hh 2024-07-17 17:00:18.522719081 +0200
+++ exercises/solution/exercise-fluidsystem/fluidsystems/h2omycompressiblecomponent.hh 2024-07-17 17:06:06.331393948 +0200
@@ -20,10 +20,10 @@
#include <dumux/material/fluidsystems/base.hh>
-// the fictitious component that was created in exercise-fluidsystem a
// The fictitious component that was created in exercise-fluidsystem 2.2
-#include <exercises/exercise-fluidsystem/components/mycompressiblecomponent.hh>
+// the fictitious component that was created in exercise 3a
+#include <exercises/solution/exercise-fluidsystem/components/mycompressiblecomponent.hh>
// the binary coefficients corresponding to this fluid system
// The binary coefficients corresponding to this fluid system
-#include <exercises/exercise-fluidsystem/binarycoefficients/h2omycompressiblecomponent.hh>
+#include <exercises/solution/exercise-fluidsystem/binarycoefficients/h2omycompressiblecomponent.hh>
namespace Dumux {
namespace FluidSystems {
-
+
/*!
* \brief A compositional fluid consisting of two liquid phases,
* which are water and a fictitious component from exercise-fluidsystem a.
@@ -39,7 +39,7 @@
{
using ThisType = H2OMyCompressibleComponent<Scalar, H2OType>;
using Base = Dumux::FluidSystems::Base<Scalar, ThisType>;
-
+
public:
using H2O = H2OType;
using MyCompressibleComponent = Dumux::MyCompressibleComponent<Scalar>;
@@ -109,11 +109,13 @@
assert(0 <= phaseIdx && phaseIdx < numPhases);
return true;
}
- static constexpr bool isGas(int phaseIdx)
+
+ static constexpr bool isGas(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
return phaseIdx == phase1Idx;
}
+
static constexpr bool isIdealGas(int phaseIdx)
{ return H2O::gasIsIdeal() && MyCompressibleComponent::gasIsIdeal(); }
@@ -211,16 +213,13 @@
// See: doctoral thesis of Steffen Ochs 2007
@@ -211,15 +211,13 @@
// Steam injection into saturated porous media : process analysis including experimental and numerical investigations
// http://elib.uni-stuttgart.de/bitstream/11682/271/1/Diss_Ochs_OPUS.pdf
+ Scalar rholH2O = H2O::liquidDensity(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx));
+ Scalar clH2O = rholH2O/H2O::molarMass();
+ Scalar x_H2O = fluidState.moleFraction(phase0Idx, H2OIdx);
+ Scalar x_myComp = fluidState.moleFraction(phase0Idx, NAPLIdx);
- // Scalar rholH2O = H2O::liquidDensity(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx));
- // Scalar clH2O = rholH2O/H2O::molarMass();
- // Scalar x_H2O = fluidState.moleFraction(phase0Idx, H2OIdx);
- // Scalar x_myComp = fluidState.moleFraction(phase0Idx, NAPLIdx);
-
- // TODO: dumux-course-task 3
- // Implement the composition-dependent water density from the exercise sheet.
+ Scalar rholH2O = H2O::liquidDensity(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx));
+ Scalar clH2O = rholH2O/H2O::molarMass();
+ Scalar x_H2O = fluidState.moleFraction(phase0Idx, H2OIdx);
+ Scalar x_myComp = fluidState.moleFraction(phase0Idx, NAPLIdx);
- // TODO: dumux-course-task 3:
- // implement the composition-dependent water density from the exercise sheet.
-
- DUNE_THROW(Dune::NotImplemented, "Todo: implement composition-dependent density");
+ // return composition-dependent water phase density
......@@ -303,20 +276,18 @@ diff -ruN exercises/exercise-fluidsystem/fluidsystems/h2omycompressiblecomponent
else
{
diff -ruN exercises/exercise-fluidsystem/main.cc exercises/solution/exercise-fluidsystem/main.cc
--- exercises/exercise-fluidsystem/main.cc 2024-07-17 11:27:28.874349112 +0200
+++ exercises/solution/exercise-fluidsystem/main.cc 2024-07-17 11:27:28.882349286 +0200
@@ -39,8 +39,8 @@
// 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::ExerciseFluidsystemBoxTwoP;`
- // then, for the 2p2c problem you have to change this line to `using TypeTag = Properties::TTag::ExerciseFluidsystemBoxTwoPTwoC;`
+ // 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;
@@ -80,13 +80,11 @@
--- exercises/exercise-fluidsystem/main.cc 2024-07-17 15:44:09.860489129 +0200
+++ exercises/solution/exercise-fluidsystem/main.cc 2024-07-17 15:44:09.864489185 +0200
@@ -36,7 +36,7 @@
int main(int argc, char** argv)
{
using namespace Dumux;
-
+
// TODO: dumux-course-task 3:
// TYPETAG is set in CMakeLists.txt as compile time definition.
// Alternatively, you could write `using TypeTag = Properties::TTag::ExerciseFluidsystemTwoP;`
@@ -80,13 +80,12 @@
auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry);
gridVariables->init(x);
......@@ -327,29 +298,28 @@ diff -ruN exercises/exercise-fluidsystem/main.cc exercises/solution/exercise-flu
const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize");
auto dt = getParam<Scalar>("TimeLoop.DtInitial");
-
+
// initialize the vtk output module
using IOFields = GetPropType<TypeTag, Properties::IOFields>;
VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name());
diff -ruN exercises/exercise-fluidsystem/README.md exercises/solution/exercise-fluidsystem/README.md
--- exercises/exercise-fluidsystem/README.md 2023-10-13 18:08:54.714521020 +0200
--- exercises/exercise-fluidsystem/README.md 2024-07-17 15:44:09.856489072 +0200
+++ exercises/solution/exercise-fluidsystem/README.md 1970-01-01 01:00:00.000000000 +0100
@@ -1,266 +0,0 @@
@@ -1,265 +0,0 @@
-# Exercise Fluidsystem (DuMuX Course)
-
-The aim of this exercise is to get familiar with the _DuMu<sup>x</sup>_ way of implementing new components and using them in fluid systems (immiscible/mixture). In the scope of this exercise, different two-phase (liquid-liquid) fluid systems are implemented. A new fictitious component is implemented and used to describe a immiscible liquid phase. The second phase will only consist of water (Section 2). Furthermore, the mixture of the two components is implemented as two miscible phases (Section 3).
-
-## Problem set-up
-
-The domain has a size of 60 x 60 m and contains two low-permeable lenses. Initially, the domain is fully water saturated and the fictitious component is injected through the middle portion of the upper boundary by means of a Neumann boundary condition. The remaining parts of the upper and the entire lower boundary are Neumann no-flow while on the two lateral sides Dirichlet boundary conditions are applied (hydrostatic conditions for the pressure and zero saturation).
-
-![](../extradoc/exercise-fluidsystem_setup.png)
-The domain has a size of 60 m x 60 m and contains two low-permeable lenses. Initially, the domain is fully water saturated and the fictitious component is injected through the middle portion of the upper boundary by means of a Neumann boundary condition. The remaining parts of the upper and the entire lower boundary are Neumann no-flow while on the two lateral sides Dirichlet boundary conditions are applied (hydrostatic conditions for the pressure and zero saturation).
-
-<img src="https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course/raw/master/exercises/extradoc/exercise-fluidsystem_setup.png" width="700">
-
-## Preparing the exercise
-
-* Navigate to the directory `dumux-course/exercises/exercise-fluidsystem`
-## Task 1: Getting familiar with the code
-
-### 1. Getting familiar with the code
-* Navigate to the directory `dumux-course/exercises/exercise-fluidsystem`.
-
-Locate all the files you will need for this exercise
-* The shared __main file__ : `main.cc`
......@@ -362,13 +332,13 @@ diff -ruN exercises/exercise-fluidsystem/README.md exercises/solution/exercise-f
-* The __spatial parameters file__: `spatialparams.hh`
-
-Furthermore you will find the following folders:
-* `binarycoefficients`: Stores headers containing data/methods on binary mixtures
-* `components`: Stores headers containing data/methods on pure components
-* `binarycoefficients`: Stores headers containing data/methods on binary mixtures.
-* `components`: Stores headers containing data/methods on pure components.
-* `fluidsystems`: Stores headers containing data/methods on mixtures of pure components. Uses methods from `binarycoefficients`.
-
-To see more components, fluidsystems and binarycoefficients implementations, have a look at the folder `dumux/material`.
-To see more components, fluid systems and binarycoefficients implementations, have a look at the folder `dumux/material`.
-
-### 2. Implement a new component
-## Task 2: Implement a new component - Part a
-
-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 code shown below is taken from the `2pproperties.hh` file.
-
......@@ -399,14 +369,14 @@ diff -ruN exercises/exercise-fluidsystem/README.md exercises/solution/exercise-f
-
-For a cell-centered scheme, you could derive from `CCTpfaModel` or `CCMpfaModel` instead (and, of course, include the right headers).
-
-One of the two phases should only contain the component water. 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.
-One of the two phases should only contain the component water. We want to precompute tables on which the properties are then interpolated in order to save computational time. We need the properties of the component water in the properties file and in the problem file. We include the following two headers in our problem file, i.e. `2pproblem.hh` file. By including the problem file in the properties file, it can be accessed through it.
-
-```c++
-// The water component
-#include <dumux/material/components/tabulatedcomponent.hh>
-#include <dumux/material/components/h2o.hh>
-```
-The other phase that will be created only contains our new component, where we want to implement an incompressible and a compressible variant.
-The other phase that will be created only contains our new component, where we want to implement an incompressible (Section 2.1) and a compressible (Section 2.2) variant.
-The respective headers are prepared, but still incomplete. The compressible variant is still commented so that compilation does not fail when finishing the incompressible variant.
-
-```c++
......@@ -428,9 +398,7 @@ diff -ruN exercises/exercise-fluidsystem/README.md exercises/solution/exercise-f
-#include <dumux/material/fluidsystems/1pliquid.hh>
-```
-
-which creates a _liquid phase_ from a given component. Finally, using all of the included classes we set the fluid system property by choosing that the water phase is liquid (`OnePLiquid`) and consists of the tabulated water component, and
-the other phase is liquid as well and consists of the incompressible fictitious component. Both will make up the immiscible fluid system (`TwoPImmiscible`), consisting of two liquids each consisting of one component:
-
-which creates a _liquid phase_ from a given component. Finally, using all of the included classes, we set the fluid system property. The fluid system consists of two liquids, water (derived from the tabulated water component) and the new incompressible fictitious component. Both components need to be defined as liquid (`OnePLiquid`). The two liquid components are then form an immiscible fluid system (`TwoPImmiscible`).
-
-```c++
-// we use the immiscible fluid system here
......@@ -442,8 +410,8 @@ diff -ruN exercises/exercise-fluidsystem/README.md exercises/solution/exercise-f
- using TabulatedH2O = Components::TabulatedComponent<Components::H2O<Scalar>>;
- using LiquidWaterPhase = typename FluidSystems::OnePLiquid<Scalar, TabulatedH2O>;
-
- // TODO: dumux-course-task 2.2
- //****** Select the corresponding component for the task *****//
- // 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<Scalar, MyIncompressibleComponent<Scalar> >;
- // using LiquidMyComponentPhase = typename FluidSystems::OnePLiquid<Scalar, MyCompressibleComponent<Scalar> >;
......@@ -453,16 +421,16 @@ diff -ruN exercises/exercise-fluidsystem/README.md exercises/solution/exercise-f
-};
-```
-
-### 2.1. Incompressible component
-### Task 2.1: Incompressible component
-
-Open the file `myincompressiblecomponent.hh`. A component should always derive from the _Base_ class - thus we include `dumux/material/components/base.hh`-, which defines the interface of a _DuMuX_ component with possibly required functions to be overloaded by the actual implementation. Additionally it is required for liquids to derive from the _Liquid_ class (see `dumux/material/components/liquid.hh`), for gases to derive from the _Gas_ class (see `dumux/material/components/gas.hh`) and for solids to derive from the _Solid_ class (see `dumux/material/components/solid.hh`), with functions specific to liquid, gas or solid.
-Open the file `myincompressiblecomponent.hh`. A component should always derive from the _Base_ class - thus we include `dumux/material/components/base.hh`-, which defines the interface of a _DuMuX_ component with the possibly required functions to be overloaded by the actual implementation. Additionally, it is required that liquids are derived from the _Liquid_ class (see `dumux/material/components/liquid.hh`), gases from the _Gas_ class (see `dumux/material/components/gas.hh`) and solids from the _Solid_ class (see `dumux/material/components/solid.hh`), with functions specific to liquid, gas or solid.
-
-```c++
-/*!
- * \ingroup Components
- * \brief A ficitious component to be implemented in exercise 3.
- * \brief A ficitious component to be implemented in exercise-fluidsystem 2.1.
- *
- * \tparam Scalar The type used for scalar values
- * \tparam Scalar The type used for scalar values.
- */
-template <class Scalar>
-class MyIncompressibleComponent
......@@ -477,7 +445,7 @@ diff -ruN exercises/exercise-fluidsystem/README.md exercises/solution/exercise-f
-| Parameter | unit | value |
-| -----| --------| -------- |
-| $`M`$ | $`kg/mol`$ | $`131.39 \cdot 10^{-3}`$ |
-| $`\rho_{liquid}`$ | $`kg/m^3`$ | $`1460`$ |
-| $`\rho_{liquid}`$ | $`kg/m^3`$ | $`1460.0`$ |
-| $`\mu_{liquid}`$ | $`Pa \cdot s`$ | $`5.7 \cdot 10^{-4}`$ |
-
-In order to do so, have a look at the files `dumux/material/components/base.hh` and `dumux/material/components/liquid.hh` to see how the interfaces are defined and overload them accordingly.
......@@ -490,30 +458,29 @@ diff -ruN exercises/exercise-fluidsystem/README.md exercises/solution/exercise-f
-./exercise_fluidsystem_a aparams.input
-```
-
-The saturation distribution of the nonwetting phase S$`_n`$ (the phase consisting of our fictitious incompressible component) at the final simulation time should look like this:
-The saturation distribution of the nonwetting phase, here S$`_{napl}`$ (the phase consisting of our fictitious incompressible component), at the final simulation time should look like this:
-
-![](../extradoc/exercise-fluidsystem_a_solution.png)
-
-### 2.2. Compressible component
-### Task 2.2: Compressible component
-
-We now want to implement a pressure-dependent density for our component. Open the file `mycompressiblecomponent.hh` and copy in the functions you implemented for the incompressible variant. Now substitute the method that returns the density by the following expression:
-
-$`\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 `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:
-where $`p`$ is the pressure and $`\rho_{min} = 1440.0 \, kg/m^3`$, $`\rho_{max} = 1480.0 \, kg/m^3`$ 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 (rho$`_{napl}`$) at the final simulation time should look like this:
-
-![](../extradoc/exercise-fluidsystem_a_solution2.png)
-
-You can plot the density of the phase consisting of your compressible component by setting `PlotDensity` in `aparams.input` to `true` and starting the simulation again.
-Compare the gnuplot output to the following plot of the density function from above:
-
-![](../extradoc/exercise-fluidsystem_a_densityfunction.png)
-<img src="https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course/raw/master/exercises/extradoc/exercise-fluidsystem_a_densityfunction.png" width="500">
-
-### 3. Implement a new fluid system
-## Task 3: Implement a new fluid system - Part b
-
-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, which still consists of two liquid phases. However, one phase consists mainly of water and the other consists mainly of the previously implemented compressible component. We will now consider compositional effects, which is why we have to derive our _TypeTag_ (`ExerciseFluidsystemTwoPTwoC`) from a _TypeTag_ (`TwoPTwoC`) that holds the miscible two-phase
- two-component model properties:
-We now want to implement a new fluid system, which still consists of two liquid phases. However, one phase consists mainly of water and the other consists mainly of the previously implemented compressible component. We will now consider compositional effects, which is why we have to derive our _TypeTag_ (`ExerciseFluidsystemTwoPTwoC`) from a _TypeTag_ (`TwoPTwoC`) that holds the miscible two-phase two-component model properties:
-
-```c++
-// The numerical model
......@@ -521,7 +488,7 @@ diff -ruN exercises/exercise-fluidsystem/README.md exercises/solution/exercise-f
-```
-
-```c++
-// 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
......@@ -549,10 +516,10 @@ diff -ruN exercises/exercise-fluidsystem/README.md exercises/solution/exercise-f
-In the `fluidsystems/h2omycompressiblecomponent.hh` file, your implemented compressible component and the binary coefficient files are already included.
-
-```c++
-// the ficitious component that was created in exercise-fluidsystem a
-// The ficitious component that was created in exercise-fluidsystem 2.2
-#include <exercises/exercise-fluidsystem/components/mycompressiblecomponent.hh>
-
-// the binary coefficients corresponding to this fluid system
-// The binary coefficients corresponding to this fluid system
-#include <exercises/exercise-fluidsystem/binarycoefficients/h2omycompressiblecomponent.hh>
-```
-
......@@ -570,9 +537,9 @@ diff -ruN exercises/exercise-fluidsystem/README.md exercises/solution/exercise-f
-./exercise_fluidsystem_b bparams.input
-```
-
-You will observe an error message and an abortion of the program. This is due to the fact that in order for the constraint solver and other mechanisms in the two-phase two-component model to work, an additional functionality in the component has to be implemented: the model has to know the vapour pressure. As in the previous exercise, check the `dumux/material/components/base.hh` file for this function and implement it into `mycompressiblecomponent.hh`. For the vapour pressure, use a value of $`3900`$ Pa.
-You will observe an error message and an abortion of the program. This is due to the fact that in order for the constraint solver and other mechanisms in the two-phase two-component model to work, an additional functionality in the component has to be implemented: the model has to know the vapour pressure. As in the previous exercise, check the `dumux/material/components/base.hh` file for this function and implement it into `mycompressiblecomponent.hh`. For the vapour pressure, use a value of $`3900.0 \, Pa`$.
-
-### 4. Change wettability of the porous medium
-## Task 4: Change wettability of the porous medium - Part b
-
-In the `spatialparams.hh` file, we can find the following function, with which we can specify which phase of the fluid system is to be considered as the wetting phase at a given position within the domain:
-
......@@ -586,9 +553,13 @@ diff -ruN exercises/exercise-fluidsystem/README.md exercises/solution/exercise-f
-template<class FluidSystem>
-int wettingPhaseAtPos(const GlobalPosition& globalPos) const
-{
- // Our fluid system is H2OMyCompressibleComponent
- // Our fluid system is H2OMyCompressibleComponent.
- // We want to define water as the wetting phase in
- // the entire domain (see fluid system for the phase indices)
- // the entire domain (see fluid system for the phase indices).
-
- // TODO: dumux-course-task 4:
- // Adapt the following line so that the phase of our new component is
- // the wetting phase, only within the lenses.
- return FluidSystem::phase0Idx;
-}
-```
......@@ -601,21 +572,37 @@ diff -ruN exercises/exercise-fluidsystem/README.md exercises/solution/exercise-f
-./exercise_fluidsystem_b exercise_fluidsystem_b.input
-```
diff -ruN exercises/exercise-fluidsystem/spatialparams.hh exercises/solution/exercise-fluidsystem/spatialparams.hh
--- exercises/exercise-fluidsystem/spatialparams.hh 2024-07-17 11:27:28.874349112 +0200
+++ exercises/solution/exercise-fluidsystem/spatialparams.hh 2024-07-17 11:27:28.882349286 +0200
@@ -117,9 +117,12 @@
--- exercises/exercise-fluidsystem/spatialparams.hh 2024-07-17 15:44:09.860489129 +0200
+++ exercises/solution/exercise-fluidsystem/spatialparams.hh 2024-07-17 15:44:09.864489185 +0200
@@ -113,13 +113,17 @@
template<class FluidSystem>
int wettingPhaseAtPos(const GlobalPosition& globalPos) const
{
- // Our fluid system is H2OMyCompressibleComponent.
+ // Our fluid system is H2OMyCompressibleComponent.
// We want to define water as the wetting phase in
// the entire domain (see fluid system for the phase indices)
- // TODO: dumux-course-task 4
- // Adapt the following line so that the phase of our new component is
- // the wetting phase, only within the lenses.
+ // For the last task (change of wettability), uncomment
+ // the two commented lines below
- // the entire domain (see fluid system for the phase indices).
+ // the entire domain (see fluidsystem for the phase indices).
+
+ // TODO: dumux-course-task 4:
+ // For task 4 (change of wettability), uncomment
+ // the two commented lines below:
+
+ //if (isInLens(globalPos))
+ // return FluidSystem::phase1Idx;
+
- // TODO: dumux-course-task 4:
- // Adapt the following line so that the phase of our new component is
- // the wetting phase, only within the lenses.
return FluidSystem::phase0Idx;
}
@@ -147,7 +151,7 @@
Dune::FieldMatrix<Scalar, dim, dim> K_;
Dune::FieldMatrix<Scalar, dim, dim> KLens_;
- // Object that holds the values/parameters of the selected fluid matrix interaction relationship.
+ // Object that holds the values/parameters of the selected fluid-matrix interaction relationship.
const PcKrSwCurve pcKrSwCurve_;
const PcKrSwCurve lensPcKrSwCurve_;
};
......@@ -7,12 +7,12 @@
/*!
* \file
*
* \brief Tutorial problem for a fully coupled two phase-two component box model.
* \brief Tutorial problem for a fully coupled two-phase two-component box model.
*/
#ifndef DUMUX_EXERCISE_FLUIDSYSTEM_B_PROBLEM_HH
#define DUMUX_EXERCISE_FLUIDSYSTEM_B_PROBLEM_HH
// The base porous media box problem
// The base porous media box problem.
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/common/boundarytypes.hh>
#include <dumux/common/properties.hh>
......@@ -23,7 +23,7 @@ namespace Dumux {
/*!
* \ingroup TwoPBoxModel
*
* \brief Tutorial problem for a fully coupled two phase-two component box model.
* \brief Tutorial problem for a fully coupled two-phase two-component box model.
*/
template <class TypeTag>
class ExerciseFluidsystemProblemTwoPTwoC : public PorousMediumFlowProblem<TypeTag>
......@@ -64,7 +64,7 @@ public:
* \brief Specifies which kind of boundary condition should be
* used for which equation on a given boundary segment.
*
* \param globalPos The position for which the bc type should be evaluated
* \param globalPos The position for which the bc type should be evaluated.
*/
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
{
......@@ -80,9 +80,9 @@ public:
/*!
* \brief Evaluates the boundary conditions for a Dirichlet
* boundary segment
* boundary segment.
*
* \param globalPos The global position
* \param globalPos The global position.
*/
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
{
......@@ -113,7 +113,7 @@ public:
}
else
{
// no-flow on the remaining Neumann-boundaries.
// no-flow on the remaining Neumann-boundaries
values[Indices::conti0EqIdx + FluidSystem::H2OIdx] = 0;
values[Indices::conti0EqIdx + FluidSystem::NAPLIdx] = 0;
}
......@@ -125,7 +125,7 @@ public:
/*!
* \brief Evaluate the initial value for a control volume.
*
* \param globalPos The position for which the initial condition should be evaluated
* \param globalPos The position for which the initial condition should be evaluated.
*
* For this method, the \a values parameter stores primary
* variables.
......@@ -149,9 +149,9 @@ public:
/*!
* \brief Returns the source term
* \brief Returns the source term.
*
* \param globalPos The global position
* \param globalPos The global position.
*/
NumEqVector sourceAtPos(const GlobalPosition &globalPos) const
{
......@@ -162,8 +162,8 @@ public:
private:
Scalar eps_; //! small epsilon value
Scalar depthBOR_; //! depth at the bottom of the reservoir
Scalar eps_; //! Small epsilon value
Scalar depthBOR_; //! Depth at the bottom of the reservoir
};
} // end namespace Dumux
......
......@@ -27,12 +27,11 @@
// 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.
// 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>; };
......
......@@ -7,7 +7,7 @@
/*!
* \file
*
* \brief Tutorial problem for a fully coupled twophase box model.
* \brief Tutorial problem for a fully coupled two-phase box model.
*/
#ifndef DUMUX_EXERCISE_FLUIDSYSTEM_A_PROBLEM_HH
#define DUMUX_EXERCISE_FLUIDSYSTEM_A_PROBLEM_HH
......@@ -29,7 +29,7 @@ namespace Dumux {
/*!
* \ingroup TwoPBoxModel
* \brief Tutorial problem for a fully coupled twophase box model.
* \brief Tutorial problem for a fully coupled two-phase box model.
*/
template <class TypeTag>
class ExerciseFluidsystemProblemTwoP : public PorousMediumFlowProblem<TypeTag>
......@@ -86,7 +86,7 @@ public:
* \brief Specifies which kind of boundary condition should be
* used for which equation on a given boundary segment.
*
* \param globalPos The position for which the bc type should be evaluated
* \param globalPos The position for which the bc type should be evaluated.
*/
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
{
......@@ -102,9 +102,9 @@ public:
/*!
* \brief Evaluates the boundary conditions for a Dirichlet
* boundary segment
* boundary segment.
*
* \param globalPos The global position
* \param globalPos The global position.
*/
PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const
{
......@@ -136,7 +136,7 @@ public:
}
else
{
// no-flow on the remaining Neumann-boundaries.
// no-flow on the remaining Neumann-boundaries
values[contiWEqIdx] = 0;
values[contiNEqIdx] = 0;
}
......@@ -148,7 +148,7 @@ public:
/*!
* \brief Evaluate the initial value for a control volume.
*
* \param globalPos The position for which the initial condition should be evaluated
* \param globalPos The position for which the initial condition should be evaluated.
*
* For this method, the \a values parameter stores primary
* variables.
......@@ -167,9 +167,9 @@ public:
/*!
* \brief Returns the source term
* \brief Returns the source term.
*
* \param globalPos The global position
* \param globalPos The global position.
*/
NumEqVector sourceAtPos(const GlobalPosition& globalPos) const
{
......@@ -207,9 +207,9 @@ private:
gnuplot_.plot("YourComponentPhase_density");
}
Scalar eps_; //! small epsilon value
Scalar depthBOR_; //! depth at the bottom of the reservoir
Dumux::GnuplotInterface<double> gnuplot_; //! collects data for plotting
Scalar eps_; //! Small epsilon value
Scalar depthBOR_; //! Depth at the bottom of the reservoir
Dumux::GnuplotInterface<double> gnuplot_; //! Collects data for plotting
};
} // end namespace Dumux
......
......@@ -7,7 +7,7 @@
/*!
* \file
*
* \brief The properties file for two phase exercise-fluidsystem.
* \brief The properties file for two-phase exercise-fluidsystem.
*/
#ifndef DUMUX_EXERCISE_FLUIDSYSTEM_A_PROPERTIES_HH
#define DUMUX_EXERCISE_FLUIDSYSTEM_A_PROPERTIES_HH
......@@ -25,26 +25,25 @@
#include "spatialparams.hh"
// The components that will be created in this exercise
// TODO: dumux-course-task 2.2
//****** Include the corresponding header for the task *****//
// 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 <dumux/material/fluidsystems/1pliquid.hh>
// The two-phase immiscible fluid system
// The two-phase immiscible fluidsystem
#include <dumux/material/fluidsystems/2pimmiscible.hh>
// The interface to create plots during simulation
#include <dumux/io/gnuplotinterface.hh>
// The problem file, where setup-specific boundary and initial conditions are defined.
// The problem file, where setup-specific boundary and initial conditions are defined
#include"2pproblem.hh"
namespace Dumux::Properties {
// Create a new type tag for the problem
// Create new type tags
namespace TTag {
struct ExerciseFluidsystemTwoP { using InheritsFrom = std::tuple<TwoP, BoxModel>; };
......@@ -69,7 +68,7 @@ public:
template<class TypeTag>
struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoP> { using type = Dune::YaspGrid<2>; };
// we use the immiscible fluid system here
// We use the immiscible fluid system here
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoP>
{
......@@ -78,8 +77,8 @@ private:
using TabulatedH2O = Components::TabulatedComponent<Components::H2O<Scalar>>;
using LiquidWaterPhase = typename FluidSystems::OnePLiquid<Scalar, TabulatedH2O>;
// TODO: dumux-course-task 2.2
//****** Select the corresponding component for the task *****//
// 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<Scalar, MyIncompressibleComponent<Scalar> >;
// using LiquidMyComponentPhase = typename FluidSystems::OnePLiquid<Scalar, MyCompressibleComponent<Scalar> >;
......
......@@ -4,16 +4,14 @@ The aim of this exercise is to get familiar with the _DuMu<sup>x</sup>_ way of i
## Problem set-up
The domain has a size of 60 x 60 m and contains two low-permeable lenses. Initially, the domain is fully water saturated and the fictitious component is injected through the middle portion of the upper boundary by means of a Neumann boundary condition. The remaining parts of the upper and the entire lower boundary are Neumann no-flow while on the two lateral sides Dirichlet boundary conditions are applied (hydrostatic conditions for the pressure and zero saturation).
The domain has a size of 60 m x 60 m and contains two low-permeable lenses. Initially, the domain is fully water saturated and the fictitious component is injected through the middle portion of the upper boundary by means of a Neumann boundary condition. The remaining parts of the upper and the entire lower boundary are Neumann no-flow while on the two lateral sides Dirichlet boundary conditions are applied (hydrostatic conditions for the pressure and zero saturation).
![](../extradoc/exercise-fluidsystem_setup.png)
<img src="https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course/raw/master/exercises/extradoc/exercise-fluidsystem_setup.png" width="700">
## Preparing the exercise
## Task 1: Getting familiar with the code
* Navigate to the directory `dumux-course/exercises/exercise-fluidsystem`
### 1. Getting familiar with the code
* Navigate to the directory `dumux-course/exercises/exercise-fluidsystem`.
Locate all the files you will need for this exercise
* The shared __main file__ : `main.cc`
......@@ -26,13 +24,13 @@ Locate all the files you will need for this exercise
* The __spatial parameters file__: `spatialparams.hh`
Furthermore you will find the following folders:
* `binarycoefficients`: Stores headers containing data/methods on binary mixtures
* `components`: Stores headers containing data/methods on pure components
* `binarycoefficients`: Stores headers containing data/methods on binary mixtures.
* `components`: Stores headers containing data/methods on pure components.
* `fluidsystems`: Stores headers containing data/methods on mixtures of pure components. Uses methods from `binarycoefficients`.
To see more components, fluidsystems and binarycoefficients implementations, have a look at the folder `dumux/material`.
To see more components, fluid systems and binarycoefficients implementations, have a look at the folder `dumux/material`.
### 2. Implement a new component
## Task 2: Implement a new component - Part a
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 code shown below is taken from the `2pproperties.hh` file.
......@@ -63,14 +61,14 @@ 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).
One of the two phases should only contain the component water. 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.
One of the two phases should only contain the component water. We want to precompute tables on which the properties are then interpolated in order to save computational time. We need the properties of the component water in the properties file and in the problem file. We include the following two headers in our problem file, i.e. `2pproblem.hh` file. By including the problem file in the properties file, it can be accessed through it.
```c++
// The water component
#include <dumux/material/components/tabulatedcomponent.hh>
#include <dumux/material/components/h2o.hh>
```
The other phase that will be created only contains our new component, where we want to implement an incompressible and a compressible variant.
The other phase that will be created only contains our new component, where we want to implement an incompressible (Section 2.1) and a compressible (Section 2.2) variant.
The respective headers are prepared, but still incomplete. The compressible variant is still commented so that compilation does not fail when finishing the incompressible variant.
```c++
......@@ -92,9 +90,7 @@ This fluid system expects __phases__ as input and so far we have only included t
#include <dumux/material/fluidsystems/1pliquid.hh>
```
which creates a _liquid phase_ from a given component. Finally, using all of the included classes we set the fluid system property by choosing that the water phase is liquid (`OnePLiquid`) and consists of the tabulated water component, and
the other phase is liquid as well and consists of the incompressible fictitious component. Both will make up the immiscible fluid system (`TwoPImmiscible`), consisting of two liquids each consisting of one component:
which creates a _liquid phase_ from a given component. Finally, using all of the included classes, we set the fluid system property. The fluid system consists of two liquids, water (derived from the tabulated water component) and the new incompressible fictitious component. Both components need to be defined as liquid (`OnePLiquid`). The two liquid components are then form an immiscible fluid system (`TwoPImmiscible`).
```c++
// we use the immiscible fluid system here
......@@ -106,8 +102,8 @@ private:
using TabulatedH2O = Components::TabulatedComponent<Components::H2O<Scalar>>;
using LiquidWaterPhase = typename FluidSystems::OnePLiquid<Scalar, TabulatedH2O>;
// TODO: dumux-course-task 2.2
//****** Select the corresponding component for the task *****//
// 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<Scalar, MyIncompressibleComponent<Scalar> >;
// using LiquidMyComponentPhase = typename FluidSystems::OnePLiquid<Scalar, MyCompressibleComponent<Scalar> >;
......@@ -117,16 +113,16 @@ public:
};
```
### 2.1. Incompressible component
### Task 2.1: Incompressible component
Open the file `myincompressiblecomponent.hh`. A component should always derive from the _Base_ class - thus we include `dumux/material/components/base.hh`-, which defines the interface of a _DuMuX_ component with possibly required functions to be overloaded by the actual implementation. Additionally it is required for liquids to derive from the _Liquid_ class (see `dumux/material/components/liquid.hh`), for gases to derive from the _Gas_ class (see `dumux/material/components/gas.hh`) and for solids to derive from the _Solid_ class (see `dumux/material/components/solid.hh`), with functions specific to liquid, gas or solid.
Open the file `myincompressiblecomponent.hh`. A component should always derive from the _Base_ class - thus we include `dumux/material/components/base.hh`-, which defines the interface of a _DuMuX_ component with the possibly required functions to be overloaded by the actual implementation. Additionally, it is required that liquids are derived from the _Liquid_ class (see `dumux/material/components/liquid.hh`), gases from the _Gas_ class (see `dumux/material/components/gas.hh`) and solids from the _Solid_ class (see `dumux/material/components/solid.hh`), with functions specific to liquid, gas or solid.
```c++
/*!
* \ingroup Components
* \brief A ficitious component to be implemented in exercise 3.
* \brief A ficitious component to be implemented in exercise-fluidsystem 2.1.
*
* \tparam Scalar The type used for scalar values
* \tparam Scalar The type used for scalar values.
*/
template <class Scalar>
class MyIncompressibleComponent
......@@ -141,7 +137,7 @@ Implement an incompressible component into the file `myincompressiblecomponent.h
| Parameter | unit | value |
| -----| --------| -------- |
| $`M`$ | $`kg/mol`$ | $`131.39 \cdot 10^{-3}`$ |
| $`\rho_{liquid}`$ | $`kg/m^3`$ | $`1460`$ |
| $`\rho_{liquid}`$ | $`kg/m^3`$ | $`1460.0`$ |
| $`\mu_{liquid}`$ | $`Pa \cdot s`$ | $`5.7 \cdot 10^{-4}`$ |
In order to do so, have a look at the files `dumux/material/components/base.hh` and `dumux/material/components/liquid.hh` to see how the interfaces are defined and overload them accordingly.
......@@ -154,30 +150,29 @@ make exercise_fluidsystem_a
./exercise_fluidsystem_a aparams.input
```
The saturation distribution of the nonwetting phase S$`_n`$ (the phase consisting of our fictitious incompressible component) at the final simulation time should look like this:
The saturation distribution of the nonwetting phase, here S$`_{napl}`$ (the phase consisting of our fictitious incompressible component), at the final simulation time should look like this:
![](../extradoc/exercise-fluidsystem_a_solution.png)
### 2.2. Compressible component
### Task 2.2: Compressible component
We now want to implement a pressure-dependent density for our component. Open the file `mycompressiblecomponent.hh` and copy in the functions you implemented for the incompressible variant. Now substitute the method that returns the density by the following expression:
$`\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 `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:
where $`p`$ is the pressure and $`\rho_{min} = 1440.0 \, kg/m^3`$, $`\rho_{max} = 1480.0 \, kg/m^3`$ 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 (rho$`_{napl}`$) at the final simulation time should look like this:
![](../extradoc/exercise-fluidsystem_a_solution2.png)
You can plot the density of the phase consisting of your compressible component by setting `PlotDensity` in `aparams.input` to `true` and starting the simulation again.
Compare the gnuplot output to the following plot of the density function from above:
![](../extradoc/exercise-fluidsystem_a_densityfunction.png)
<img src="https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course/raw/master/exercises/extradoc/exercise-fluidsystem_a_densityfunction.png" width="500">
### 3. Implement a new fluid system
## Task 3: Implement a new fluid system - Part b
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, which still consists of two liquid phases. However, one phase consists mainly of water and the other consists mainly of the previously implemented compressible component. We will now consider compositional effects, which is why we have to derive our _TypeTag_ (`ExerciseFluidsystemTwoPTwoC`) from a _TypeTag_ (`TwoPTwoC`) that holds the miscible two-phase
two-component model properties:
We now want to implement a new fluid system, which still consists of two liquid phases. However, one phase consists mainly of water and the other consists mainly of the previously implemented compressible component. We will now consider compositional effects, which is why we have to derive our _TypeTag_ (`ExerciseFluidsystemTwoPTwoC`) from a _TypeTag_ (`TwoPTwoC`) that holds the miscible two-phase two-component model properties:
```c++
// The numerical model
......@@ -185,7 +180,7 @@ We now want to implement a new fluid system, which still consists of two liquid
```
```c++
// 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
......@@ -213,10 +208,10 @@ public:
In the `fluidsystems/h2omycompressiblecomponent.hh` file, your implemented compressible component and the binary coefficient files are already included.
```c++
// the ficitious component that was created in exercise-fluidsystem a
// The ficitious component that was created in exercise-fluidsystem 2.2
#include <exercises/exercise-fluidsystem/components/mycompressiblecomponent.hh>
// the binary coefficients corresponding to this fluid system
// The binary coefficients corresponding to this fluid system
#include <exercises/exercise-fluidsystem/binarycoefficients/h2omycompressiblecomponent.hh>
```
......@@ -234,9 +229,9 @@ make exercise_fluidsystem_b
./exercise_fluidsystem_b bparams.input
```
You will observe an error message and an abortion of the program. This is due to the fact that in order for the constraint solver and other mechanisms in the two-phase two-component model to work, an additional functionality in the component has to be implemented: the model has to know the vapour pressure. As in the previous exercise, check the `dumux/material/components/base.hh` file for this function and implement it into `mycompressiblecomponent.hh`. For the vapour pressure, use a value of $`3900`$ Pa.
You will observe an error message and an abortion of the program. This is due to the fact that in order for the constraint solver and other mechanisms in the two-phase two-component model to work, an additional functionality in the component has to be implemented: the model has to know the vapour pressure. As in the previous exercise, check the `dumux/material/components/base.hh` file for this function and implement it into `mycompressiblecomponent.hh`. For the vapour pressure, use a value of $`3900.0 \, Pa`$.
### 4. Change wettability of the porous medium
## Task 4: Change wettability of the porous medium - Part b
In the `spatialparams.hh` file, we can find the following function, with which we can specify which phase of the fluid system is to be considered as the wetting phase at a given position within the domain:
......@@ -250,9 +245,13 @@ In the `spatialparams.hh` file, we can find the following function, with which w
template<class FluidSystem>
int wettingPhaseAtPos(const GlobalPosition& globalPos) const
{
// Our fluid system is H2OMyCompressibleComponent
// Our fluid system is H2OMyCompressibleComponent.
// We want to define water as the wetting phase in
// the entire domain (see fluid system for the phase indices)
// the entire domain (see fluid system for the phase indices).
// TODO: dumux-course-task 4:
// Adapt the following line so that the phase of our new component is
// the wetting phase, only within the lenses.
return FluidSystem::phase0Idx;
}
```
......
......@@ -6,11 +6,11 @@ DtInitial = 10 # initial time step size [s]
Name = exercise-fluidsystem_a # name will be given to e.g. to the vtk result files
[SpatialParams]
BrooksCoreyPcEntry = 5.0e2 # Pa
BrooksCoreyPcEntry = 5.0e2 # [Pa]
BrooksCoreyLambda = 2.0
Swr = 0.1
Snr = 0.0
Lens.BrooksCoreyPcEntry = 1e3 # Pa
Lens.BrooksCoreyPcEntry = 1e3 # [Pa]
Lens.BrooksCoreyLambda = 2.0
Lens.Swr = 0.1
Lens.Snr = 0.0
......
......@@ -7,7 +7,7 @@
/*!
* \file
*
* \brief Binary coefficients for water and a fictitious component implemented in exercise-fluidsystem a.
* \brief Binary coefficients for water and a fictitious component implemented in exercise-fluidsystem 2.1.
*/
#ifndef DUMUX_BINARY_COEFF_H2O_MYCOMPRESSIBLECOMPONENT_HH
#define DUMUX_BINARY_COEFF_H2O_MYCOMPRESSIBLECOMPONENT_HH
......@@ -18,8 +18,7 @@ namespace BinaryCoeff
{
/*!
* \brief Binary coefficients for water and a fictitious component implemented in exercise-fluidsystem a
* The implementation of the missing methods in this file is part of exercise-fluidsystem b.
* \brief Binary coefficients for water and a fictitious component implemented in exercise-fluidsystem 2.1.
*/
class H2O_MyCompressibleComponent
{
......@@ -30,7 +29,7 @@ public:
template <class Scalar>
static Scalar henryMyCompressibleComponentInWater(Scalar temperature)
{
Scalar dumuxH = 1.5e-1 / 101.325; // unit [(mol/m^3)/Pa]
Scalar dumuxH = 1.5e-1 / 101.325; // [(mol/m^3)/Pa]
dumuxH *= 18.02e-6; //multiplied by molar volume of reference phase = water
return 1.0/dumuxH; // [Pa]
}
......@@ -52,7 +51,7 @@ public:
static Scalar liquidDiffCoeff(Scalar temperature, Scalar pressure)
{
// arbitrary
return 1.e-9;
return 1.e-9; // [m^2/s]
}
};
......
......@@ -6,11 +6,11 @@ DtInitial = 10 # initial time step size [s]
Name = exercise-fluidsystem_b # name will be given to e.g. to the vtk result files
[SpatialParams]
BrooksCoreyPcEntry = 5.0e2 # Pa
BrooksCoreyPcEntry = 5.0e2 # [Pa]
BrooksCoreyLambda = 2.0
Swr = 0.1
Snr = 0.0
Lens.BrooksCoreyPcEntry = 1e3 # Pa
Lens.BrooksCoreyPcEntry = 1e3 # [Pa]
Lens.BrooksCoreyLambda = 2.0
Lens.Swr = 0.1
Lens.Snr = 0.0
......
......@@ -7,7 +7,7 @@
/*!
* \file
* \ingroup Components
* \brief A fictitious component to be implemented in exercise 3.
* \brief A fictitious component to be implemented in exercise 2.2.
*/
#ifndef DUMUX_MYCOMPRESSIBLECOMPONENT_HH
#define DUMUX_MYCOMPRESSIBLECOMPONENT_HH
......@@ -21,7 +21,7 @@ namespace Dumux
{
/*!
* \ingroup Components
* \brief A fictitious component to be implemented in exercise 3.
* \brief A fictitious component to be implemented in exercise 2.2.
*
* \tparam Scalar The type used for scalar values
*/
......@@ -39,7 +39,7 @@ public:
{ return "MyCompressibleComponent"; }
/*!
* \brief Returns true if the liquid phase is assumed to be compressible
* \brief Returns true if the liquid phase is assumed to be compressible.
*/
static constexpr bool liquidIsCompressible()
{ return true; }
......@@ -49,10 +49,10 @@ public:
*/
static Scalar molarMass()
{
// TODO: dumux-course-task 2.2
// TODO: dumux-course-task 2.2:
// Copy the methods implemented in MyIncompressibleComponent and substitute
// the density calculation by the expression given in the exercise description.
// Replace the line below by a meaningful return statement
// Replace the line below by a meaningful return statement.
DUNE_THROW(Dune::NotImplemented, "Todo: implement molar mass");
}
......@@ -66,7 +66,7 @@ public:
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
{
// TODO: dumux-course-task 2.2:
// Replace the line below by a meaningful return statement
// Replace the line below by a meaningful return statement.
DUNE_THROW(Dune::NotImplemented, "Todo: implement liquid density");
}
......@@ -92,7 +92,7 @@ public:
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
{
// TODO: dumux-course-task 2.2:
// Replace the line below by a meaningful return statement
// Replace the line below by a meaningful return statement.
DUNE_THROW(Dune::NotImplemented, "Todo: implement liquid viscosity");
}
......@@ -104,8 +104,8 @@ public:
*/
static Scalar vaporPressure(Scalar t)
{
// TODO: dumux-course-task 3
// Replace the line below by a meaningful return statement
// TODO: dumux-course-task 3:
// Replace the line below by a meaningful return statement.
DUNE_THROW(Dune::NotImplemented, "Todo: implement vapour pressure");
}
};
......
......@@ -7,7 +7,7 @@
/*!
* \file
* \ingroup Components
* \brief A fictitious component to be implemented in exercise-fluidsystem.
* \brief A fictitious component to be implemented in exercise-fluidsystem 2.1.
*/
#ifndef DUMUX_MYINCOMPRESSIBLECOMPONENT_HH
#define DUMUX_MYINCOMPRESSIBLECOMPONENT_HH
......@@ -21,9 +21,9 @@ namespace Dumux
{
/*!
* \ingroup Components
* \brief A fictitious component to be implemented in exercise-fluidsystem.
* \brief A fictitious component to be implemented in exercise-fluidsystem 2.1.
*
* \tparam Scalar The type used for scalar values
* \tparam Scalar The type used for scalar values.
*/
template <class Scalar>
class MyIncompressibleComponent
......@@ -38,7 +38,7 @@ public:
{ return "MyIncompressibleComponent"; }
/*!
* \brief Returns true if the liquid phase is assumed to be compressible
* \brief Returns true if the liquid phase is assumed to be compressible.
*/
static constexpr bool liquidIsCompressible()
{ return false; }
......@@ -48,9 +48,9 @@ public:
*/
static Scalar molarMass()
{
// TODO: dumux-course-task 2.1
// TODO: dumux-course-task 2.1:
// Implement the methods for the component data given in the exercise description.
// Replace the line below by a meaningful return statement
// Replace the line below by a meaningful return statement.
DUNE_THROW(Dune::NotImplemented, "Todo: implement molarMass()");
}
......@@ -63,9 +63,9 @@ public:
*/
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
{
// TODO: dumux-course-task 2.1
// TODO: dumux-course-task 2.1:
// Implement the methods for the component data given in the exercise description.
// Replace the line below by a meaningful return statement
// Replace the line below by a meaningful return statement.
DUNE_THROW(Dune::NotImplemented, "Todo: implement liquidDensity()");
}
......@@ -90,9 +90,9 @@ public:
*/
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
{
// TODO: dumux-course-task 2.1
// TODO: dumux-course-task 2.1:
// Implement the methods for the component data given in the exercise description.
// Replace the line below by a meaningful return statement
// Replace the line below by a meaningful return statement.
DUNE_THROW(Dune::NotImplemented, "Todo: implement liquidViscosity()");
}
};
......
......@@ -8,8 +8,8 @@
* \file
*
* \brief A fluid system with water and a fictitious component, which is to be
* implemented in exercise-fluidsystem a, as phases and components. This
* fluid system is to be implemented in exercise-fluidsystem b.
* implemented in exercise-fluidsystem 2.2, as phases and components. This
* fluid system is to be implemented in exercise-fluidsystem 3.
*/
#ifndef DUMUX_H2O_MYCOMPRESSIBLECOMPONENT_FLUID_SYSTEM_HH
#define DUMUX_H2O_MYCOMPRESSIBLECOMPONENT_FLUID_SYSTEM_HH
......@@ -19,18 +19,17 @@
#include <dumux/material/fluidsystems/base.hh>
// the fictitious component that was created in exercise-fluidsystem a
// The fictitious component that was created in exercise-fluidsystem 2.2
#include <exercises/exercise-fluidsystem/components/mycompressiblecomponent.hh>
// the binary coefficients corresponding to this fluid system
// The binary coefficients corresponding to this fluid system
#include <exercises/exercise-fluidsystem/binarycoefficients/h2omycompressiblecomponent.hh>
namespace Dumux {
namespace FluidSystems {
/*!
* \brief A compositional fluid consisting of two liquid phases,
* which are water and a fictitious component from exercise-fluidsystem a.
* which are water and a fictitious component from exercise-fluidsystem 2.2.
*/
template <class Scalar,
class H2OType = Dumux::Components::TabulatedComponent<Dumux::Components::H2O<Scalar> > >
......@@ -47,12 +46,12 @@ public:
static constexpr int numPhases = 2;
static constexpr int numComponents = 2;
static constexpr int phase0Idx = 0; // index of the first phase
static constexpr int phase1Idx = 1; // index of the second phase
static constexpr int phase0Idx = 0; // Index of the first phase
static constexpr int phase1Idx = 1; // Index of the second phase
static constexpr int H2OIdx = 0;
static constexpr int NAPLIdx = 1;
// export component indices to indicate the main component
// Export component indices to indicate the main component
// of the corresponding phase at atmospheric pressure 1 bar
// and room temperature 20°C:
static constexpr int comp0Idx = H2OIdx;
......@@ -208,7 +207,7 @@ public:
if (phaseIdx == phase0Idx)
{
// See: doctoral thesis of Steffen Ochs 2007
// see: doctoral thesis of Steffen Ochs 2007
// Steam injection into saturated porous media : process analysis including experimental and numerical investigations
// http://elib.uni-stuttgart.de/bitstream/11682/271/1/Diss_Ochs_OPUS.pdf
......@@ -217,8 +216,8 @@ public:
// Scalar x_H2O = fluidState.moleFraction(phase0Idx, H2OIdx);
// Scalar x_myComp = fluidState.moleFraction(phase0Idx, NAPLIdx);
// TODO: dumux-course-task 3
// Implement the composition-dependent water density from the exercise sheet.
// TODO: dumux-course-task 3:
// implement the composition-dependent water density from the exercise sheet.
DUNE_THROW(Dune::NotImplemented, "Todo: implement composition-dependent density");
}
......@@ -237,7 +236,7 @@ public:
* The molar density for the simple relation is defined by the
* mass density \f$\rho_\alpha\f$ and the molar mass of the main component
*
* The molar density for the complrex relation is defined by the
* The molar density for the complex relation is defined by the
* mass density \f$\rho_\alpha\f$ and the mean molar mass \f$\overline M_\alpha\f$:
*
* \f[\rho_{mol,\alpha} = \frac{\rho_\alpha}{\overline M_\alpha} \;.\f]
......@@ -395,7 +394,8 @@ public:
DUNE_THROW(Dune::NotImplemented, "FluidSystems::H2OMyCompressibleComponent::kelvinVaporPressure()");
}
/* partial pressures in the gas phase, taken from saturation vapor pressures
/*!
* \brief Partial pressures in the gas phase, taken from saturation vapor pressures.
*/
template <class FluidState>
static Scalar partialPressureGas(const FluidState &fluidState, int phaseIdx,
......@@ -412,7 +412,8 @@ public:
DUNE_THROW(Dune::InvalidStateException, "non-existent component index " << compIdx);
}
/* inverse vapor pressures, taken from inverse saturation vapor pressures
/*!
* \brief Inverse vapor pressures, taken from inverse saturation vapor pressures.
*/
template <class FluidState>
static Scalar inverseVaporPressureCurve(const FluidState &fluidState,
......
......@@ -6,7 +6,7 @@
//
/*!
* \file
* \brief The main file for exercise 3. This solves an instationary problem
* \brief The main file for exercise-fluidsystem. This solves an instationary problem
* with an implicit time discretization.
*/
#include <config.h>
......@@ -37,11 +37,11 @@ int main(int argc, char** argv)
{
using namespace Dumux;
// 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::ExerciseFluidsystemBoxTwoP;`
// then, for the 2p2c problem you have to change this line to `using TypeTag = Properties::TTag::ExerciseFluidsystemBoxTwoPTwoC;`
// and recompile the executable
// TODO: dumux-course-task 3:
// TYPETAG is set in CMakeLists.txt as compile time definition.
// 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;
// initialize MPI+x, finalize is done automatically on exit
......
......@@ -13,10 +13,10 @@
#ifndef DUMUX_EXERCISE_FLUIDSYSTEM_SPATIAL_PARAMS_HH
#define DUMUX_EXERCISE_FLUIDSYSTEM_SPATIAL_PARAMS_HH
// include parent spatialparameters
// Include parent spatial parameters
#include <dumux/porousmediumflow/fvspatialparamsmp.hh>
//include fluid matrix interaction relationship
// Include fluid-matrix interaction relationship
#include <dumux/material/fluidmatrixinteractions/2p/brookscorey.hh>
#include <dumux/material/fluidmatrixinteractions/2p/linearmaterial.hh>
......@@ -44,13 +44,13 @@ class ExerciseFluidsystemSpatialParams
using PcKrSwCurve = FluidMatrix::BrooksCoreyDefault<Scalar>;
public:
// export permeability type
// Export permeability type
using PermeabilityType = Dune::FieldMatrix<Scalar, dim, dim>;
/*!
* \brief The constructor
* \brief The constructor.
*
* \param gridGeometry The finite volume grid geometry
* \param gridGeometry The finite volume grid geometry.
*/
ExerciseFluidsystemSpatialParams(std::shared_ptr<const GridGeometry>& gridGeometry)
: ParentType(gridGeometry)
......@@ -59,8 +59,8 @@ public:
, pcKrSwCurve_("SpatialParams")
, lensPcKrSwCurve_("SpatialParams.Lens")
{
//set main diagonal entries of the permeability tensor to a value
//setting to one value means: isotropic, homogeneous
// set main diagonal entries of the permeability tensor to a value
// setting to one value means: isotropic, homogeneous
for (int i = 0; i < dim; i++)
{
K_[i][i] = 1e-7;
......@@ -71,7 +71,7 @@ public:
/*!
* \brief Define the intrinsic permeability \f$\mathrm{[m^2]}\f$.
*
* \param globalPos The global position
* \param globalPos The global position.
*/
PermeabilityType permeabilityAtPos(const GlobalPosition& globalPos) const
......@@ -84,7 +84,7 @@ public:
/*!
* \brief Define the porosity \f$\mathrm{[-]}\f$.
*
* \param globalPos The global position
* \param globalPos The global position.
*/
Scalar porosityAtPos(const GlobalPosition& globalPos) const
{
......@@ -94,8 +94,8 @@ public:
}
/*!
* \brief Returns the fluid-matrix interaction law at a given location
* \param globalPos The global coordinates for the given location
* \brief Returns the fluid-matrix interaction law at a given location.
* \param globalPos The global coordinates for the given location.
*/
auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const
{
......@@ -107,17 +107,17 @@ public:
/*!
* \brief Function for defining which phase is to be considered as the wetting phase.
*
* \return the wetting phase index
* \param globalPos The position of the center of the element
* \return The wetting phase index.
* \param globalPos The position of the center of the element.
*/
template<class FluidSystem>
int wettingPhaseAtPos(const GlobalPosition& globalPos) const
{
// Our fluid system is H2OMyCompressibleComponent
// Our fluid system is H2OMyCompressibleComponent.
// We want to define water as the wetting phase in
// the entire domain (see fluid system for the phase indices)
// the entire domain (see fluid system for the phase indices).
// TODO: dumux-course-task 4
// TODO: dumux-course-task 4:
// Adapt the following line so that the phase of our new component is
// the wetting phase, only within the lenses.
return FluidSystem::phase0Idx;
......@@ -133,8 +133,8 @@ public:
}
/*!
* \brief Returns the temperature at the domain at the given position
* \param globalPos The position in global coordinates where the temperature should be specified
* \brief Returns the temperature at the domain at the given position.
* \param globalPos The position in global coordinates where the temperature should be specified.
*/
Scalar temperatureAtPos(const GlobalPosition& globalPos) const
{
......@@ -147,7 +147,7 @@ private:
Dune::FieldMatrix<Scalar, dim, dim> K_;
Dune::FieldMatrix<Scalar, dim, dim> KLens_;
// Object that holds the values/parameters of the selected fluid matrix interaction relationship
// Object that holds the values/parameters of the selected fluid matrix interaction relationship.
const PcKrSwCurve pcKrSwCurve_;
const PcKrSwCurve lensPcKrSwCurve_;
};
......
exercises/extradoc/exercise-fluidsystem_a_solution.png

139 KiB | W: | H:

exercises/extradoc/exercise-fluidsystem_a_solution.png

36 KiB | W: | H:

exercises/extradoc/exercise-fluidsystem_a_solution.png
exercises/extradoc/exercise-fluidsystem_a_solution.png
exercises/extradoc/exercise-fluidsystem_a_solution.png
exercises/extradoc/exercise-fluidsystem_a_solution.png
  • 2-up
  • Swipe
  • Onion skin
exercises/extradoc/exercise-fluidsystem_a_solution2.png

59.4 KiB | W: | H:

exercises/extradoc/exercise-fluidsystem_a_solution2.png

25 KiB | W: | H:

exercises/extradoc/exercise-fluidsystem_a_solution2.png
exercises/extradoc/exercise-fluidsystem_a_solution2.png
exercises/extradoc/exercise-fluidsystem_a_solution2.png
exercises/extradoc/exercise-fluidsystem_a_solution2.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -7,12 +7,12 @@
/*!
* \file
*
* \brief Tutorial problem for a fully coupled two phase-two component box model.
* \brief Tutorial problem for a fully coupled two-phase two-component box model.
*/
#ifndef DUMUX_EXERCISE_FLUIDSYSTEM_B_PROBLEM_HH
#define DUMUX_EXERCISE_FLUIDSYSTEM_B_PROBLEM_HH
// The base porous media box problem
// The base porous media box problem.
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/common/boundarytypes.hh>
#include <dumux/common/properties.hh>
......@@ -23,7 +23,7 @@ namespace Dumux {
/*!
* \ingroup TwoPBoxModel
*
* \brief Tutorial problem for a fully coupled two phase-two component box model.
* \brief Tutorial problem for a fully coupled two-phase two-component box model.
*/
template <class TypeTag>
class ExerciseFluidsystemProblemTwoPTwoC : public PorousMediumFlowProblem<TypeTag>
......@@ -64,7 +64,7 @@ public:
* \brief Specifies which kind of boundary condition should be
* used for which equation on a given boundary segment.
*
* \param globalPos The position for which the bc type should be evaluated
* \param globalPos The position for which the bc type should be evaluated.
*/
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
{
......@@ -80,9 +80,9 @@ public:
/*!
* \brief Evaluates the boundary conditions for a Dirichlet
* boundary segment
* boundary segment.
*
* \param globalPos The global position
* \param globalPos The global position.
*/
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
{
......@@ -113,7 +113,7 @@ public:
}
else
{
// no-flow on the remaining Neumann-boundaries.
// no-flow on the remaining Neumann-boundaries
values[Indices::conti0EqIdx + FluidSystem::H2OIdx] = 0;
values[Indices::conti0EqIdx + FluidSystem::NAPLIdx] = 0;
}
......@@ -125,7 +125,7 @@ public:
/*!
* \brief Evaluate the initial value for a control volume.
*
* \param globalPos The position for which the initial condition should be evaluated
* \param globalPos The position for which the initial condition should be evaluated.
*
* For this method, the \a values parameter stores primary
* variables.
......@@ -149,9 +149,9 @@ public:
/*!
* \brief Returns the source term
* \brief Returns the source term.
*
* \param globalPos The global position
* \param globalPos The global position.
*/
NumEqVector sourceAtPos(const GlobalPosition &globalPos) const
{
......@@ -162,8 +162,8 @@ public:
private:
Scalar eps_; //! small epsilon value
Scalar depthBOR_; //! depth at the bottom of the reservoir
Scalar eps_; //! Small epsilon value
Scalar depthBOR_; //! Depth at the bottom of the reservoir
};
} // end namespace Dumux
......
......@@ -27,12 +27,11 @@
// 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.
// 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>; };
......
......@@ -7,7 +7,7 @@
/*!
* \file
*
* \brief Tutorial problem for a fully coupled twophase box model.
* \brief Tutorial problem for a fully coupled two-phase box model.
*/
#ifndef DUMUX_EXERCISE_FLUIDSYSTEM_A_PROBLEM_HH
#define DUMUX_EXERCISE_FLUIDSYSTEM_A_PROBLEM_HH
......@@ -29,7 +29,7 @@ namespace Dumux {
/*!
* \ingroup TwoPBoxModel
* \brief Tutorial problem for a fully coupled twophase box model.
* \brief Tutorial problem for a fully coupled two-phase box model.
*/
template <class TypeTag>
class ExerciseFluidsystemProblemTwoP : public PorousMediumFlowProblem<TypeTag>
......@@ -86,7 +86,7 @@ public:
* \brief Specifies which kind of boundary condition should be
* used for which equation on a given boundary segment.
*
* \param globalPos The position for which the bc type should be evaluated
* \param globalPos The position for which the bc type should be evaluated.
*/
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
{
......@@ -102,9 +102,9 @@ public:
/*!
* \brief Evaluates the boundary conditions for a Dirichlet
* boundary segment
* boundary segment.
*
* \param globalPos The global position
* \param globalPos The global position.
*/
PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const
{
......@@ -136,7 +136,7 @@ public:
}
else
{
// no-flow on the remaining Neumann-boundaries.
// no-flow on the remaining Neumann-boundaries
values[contiWEqIdx] = 0;
values[contiNEqIdx] = 0;
}
......@@ -148,7 +148,7 @@ public:
/*!
* \brief Evaluate the initial value for a control volume.
*
* \param globalPos The position for which the initial condition should be evaluated
* \param globalPos The position for which the initial condition should be evaluated.
*
* For this method, the \a values parameter stores primary
* variables.
......@@ -167,9 +167,9 @@ public:
/*!
* \brief Returns the source term
* \brief Returns the source term.
*
* \param globalPos The global position
* \param globalPos The global position.
*/
NumEqVector sourceAtPos(const GlobalPosition& globalPos) const
{
......@@ -207,9 +207,9 @@ private:
gnuplot_.plot("YourComponentPhase_density");
}
Scalar eps_; //! small epsilon value
Scalar depthBOR_; //! depth at the bottom of the reservoir
Dumux::GnuplotInterface<double> gnuplot_; //! collects data for plotting
Scalar eps_; //! Small epsilon value
Scalar depthBOR_; //! Depth at the bottom of the reservoir
Dumux::GnuplotInterface<double> gnuplot_; //! Collects data for plotting
};
} // end namespace Dumux
......
......@@ -7,7 +7,7 @@
/*!
* \file
*
* \brief The properties file for two phase exercise-fluidsystem.
* \brief The properties file for two-phase exercise-fluidsystem.
*/
#ifndef DUMUX_EXERCISE_FLUIDSYSTEM_A_PROPERTIES_HH
#define DUMUX_EXERCISE_FLUIDSYSTEM_A_PROPERTIES_HH
......@@ -37,12 +37,11 @@
// The interface to create plots during simulation
#include <dumux/io/gnuplotinterface.hh>
// The problem file, where setup-specific boundary and initial conditions are defined.
// The problem file, where setup-specific boundary and initial conditions are defined
#include"2pproblem.hh"
namespace Dumux::Properties {
// Create a new type tag for the problem
// Create new type tags
namespace TTag {
struct ExerciseFluidsystemTwoP { using InheritsFrom = std::tuple<TwoP, BoxModel>; };
......@@ -67,7 +66,7 @@ public:
template<class TypeTag>
struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoP> { using type = Dune::YaspGrid<2>; };
// we use the immiscible fluid system here
// We use the immiscible fluid system here
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoP>
{
......@@ -76,11 +75,12 @@ private:
using TabulatedH2O = Components::TabulatedComponent<Components::H2O<Scalar>>;
using LiquidWaterPhase = typename FluidSystems::OnePLiquid<Scalar, TabulatedH2O>;
/*!
* TODO: dumux-course-task 2.2:
* Uncomment first line and comment second line for using the incompressible component
* Uncomment second line and comment first line for using the compressible component
*/
using LiquidMyComponentPhase = typename FluidSystems::OnePLiquid<Scalar, MyIncompressibleComponent<Scalar> >;
// using LiquidMyComponentPhase = typename FluidSystems::OnePLiquid<Scalar, MyCompressibleComponent<Scalar> >;
using LiquidMyComponentPhase = typename FluidSystems::OnePLiquid<Scalar, MyIncompressibleComponent<Scalar> >;
//using LiquidMyComponentPhase = typename FluidSystems::OnePLiquid<Scalar, MyCompressibleComponent<Scalar> >;
public:
using type = typename FluidSystems::TwoPImmiscible<Scalar, LiquidWaterPhase, LiquidMyComponentPhase>;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment