Commit 88f1cb50 authored by Beatrix Becker's avatar Beatrix Becker
Browse files

[2pproblem][2p2cproblem] cleanup

Make problem TypeTags a bit easier, avoid mentioning wetting/non-wetting phases
parent 06c975b2
......@@ -45,8 +45,7 @@ template <class TypeTag> class ExerciseThreeProblemTwoPTwoC;
namespace Properties {
// Create a new type tag for the problem
NEW_TYPE_TAG(ExerciseThreeTwoPTwoCTypeTag, INHERITS_FROM(TwoPTwoC));
NEW_TYPE_TAG(ExerciseThreeBoxTwoPTwoCTypeTag, INHERITS_FROM(BoxModel, ExerciseThreeTwoPTwoCTypeTag));
NEW_TYPE_TAG(ExerciseThreeTwoPTwoCTypeTag, INHERITS_FROM(TwoPTwoC, BoxModel));
// Set the "Problem" property
SET_TYPE_PROP(ExerciseThreeTwoPTwoCTypeTag, Problem, ExerciseThreeProblemTwoPTwoC<TypeTag>);
......
......@@ -65,8 +65,7 @@ template <class TypeTag> class ExerciseThreeProblemTwoP;
namespace Properties {
// Create a new type tag for the problem
NEW_TYPE_TAG(ExerciseThreeTwoPTypeTag, INHERITS_FROM(TwoP));
NEW_TYPE_TAG(ExerciseThreeBoxTwoPTypeTag, INHERITS_FROM(BoxModel, ExerciseThreeTwoPTypeTag));
NEW_TYPE_TAG(ExerciseThreeTwoPTypeTag, INHERITS_FROM(TwoP, BoxModel));
// Set the "Problem" property
SET_TYPE_PROP(ExerciseThreeTwoPTypeTag, Problem, ExerciseThreeProblemTwoP<TypeTag>);
......@@ -91,16 +90,16 @@ SET_PROP(ExerciseThreeTwoPTypeTag, FluidSystem)
private:
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using TabulatedH2O = Components::TabulatedComponent<Components::H2O<Scalar>>;
using LiquidWater = typename FluidSystems::OnePLiquid<Scalar, TabulatedH2O>;
using LiquidWaterPhase = typename FluidSystems::OnePLiquid<Scalar, TabulatedH2O>;
/*!
* 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 LiquidMyComponent = typename FluidSystems::OnePLiquid<Scalar, MyIncompressibleComponent<Scalar> >;
using LiquidMyComponentPhase = typename FluidSystems::OnePLiquid<Scalar, MyIncompressibleComponent<Scalar> >;
// using LiquidMyComponent = typename FluidSystems::OnePLiquid<Scalar, MyCompressibleComponent<Scalar> >;
public:
using type = typename FluidSystems::TwoPImmiscible<Scalar, LiquidWater, LiquidMyComponent>;
using type = typename FluidSystems::TwoPImmiscible<Scalar, LiquidWaterPhase, LiquidMyComponentPhase>;
};
}
......
......@@ -2,14 +2,14 @@
#part a: 2pproblem
dune_add_test(NAME exercise3_a
SOURCES exercise3.cc
COMPILE_DEFINITIONS TYPETAG=ExerciseThreeBoxTwoPTypeTag
COMPILE_DEFINITIONS TYPETAG=ExerciseThreeTwoPTypeTag
COMPILE_ONLY # for testing purposes, ignore for the exercise
CMD_ARGS exercise3_a.input)
#part b: 2p2cproblem
dune_add_test(NAME exercise3_b
SOURCES exercise3.cc
COMPILE_DEFINITIONS TYPETAG=ExerciseThreeBoxTwoPTwoCTypeTag
COMPILE_DEFINITIONS TYPETAG=ExerciseThreeTwoPTwoCTypeTag
COMPILE_ONLY # for testing purposes, ignore for the exercise
CMD_ARGS exercise3_b.input)
......
......@@ -11,7 +11,7 @@ The domain has a size of 60 x 60 m and contains two low-permeable lenses. Initia
## Preparing the exercise
* Navigate to the directory `dumux/tutorial/ex3`
* Navigate to the directory `dumux-course/exercises/exercise-fluidsystem`
### 1. Getting familiar with the code
......@@ -34,34 +34,39 @@ To see more components, fluidsystems and binarycoefficients implementations, hav
In the following, the basic steps required to set the desired fluid system are outlined. Here, this is done in the __problem file__, i.e. for this part of the exercise the code shown below is taken from the `2pproblem.hh` file.
In this part of the exercise we will consider a system consisting of two immiscible phases. Therefore, the _TypeTag_ for this problem (`ExerciseThreeBoxTwoPTypeTag`) derives from a base _TypeTag_ (`ExerciseThreeTwoPTypeTag`) that itself derives from the `TwoP` _TypeTag_ (immiscible two-phase model properties).
In this part of the exercise we will consider a system consisting of two immiscible phases. Therefore, the _TypeTag_ for this problem (`ExerciseThreeTwoPTypeTag`) derives from
the `TwoP` _TypeTag_ (immiscible two-phase model properties) and the `BoxModel` _TypeTag_ (specifies properties of the discretization scheme).
```c++
NEW_TYPE_TAG(ExerciseThreeTwoPTypeTag, INHERITS_FROM(TwoP));
NEW_TYPE_TAG(ExerciseThreeTwoPTypeTag, INHERITS_FROM(TwoP, BoxModel));
```
In order to be able to derive from this _TypeTag_, the declaration of the `TwoP` _TypeTag_ has to be included. It can be found in the `2p/model.hh` header:
In order to be able to derive from these _TypeTags_, the declarations of the `TwoP` _TypeTag_ and `BoxModel` _TypeTag_ have to be included.
The `TwoP` _TypeTag_ can be found in the `2p/model.hh` header:
```c++
// The numerical model
#include <dumux/porousmediumflow/2p/model.hh>
```
Additionally, the _TypeTag_ for this problem (`ExerciseThreeBoxTwoPTypeTag`) derives from the `BoxModel` _TypeTag_, to specify properties of the discretization scheme. For a cell-centered scheme, you could derive from `CCTpfaModel` or `CCMpfaModel` instead. Again the corresponding header has to be included
while the `BoxModel` _TypeTag_ can be found in the `box/properties.hh` header:
```c++
// The discretization
#include <dumux/discretization/box/properties.hh>
```
As wetting phase 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:
For a cell-centered scheme, you could derive from `CCTpfaModel` or `CCMpfaModel` instead (and, of course, include the right headers).
As one phase 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:
```c++
// The water component
#include <dumux/material/components/tabulatedcomponent.hh>
#include <dumux/material/components/h2o.hh>
```
The non-wetting phase will be our new component, where we want to implement an incompressible and a compressible 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.
The other phase will be created from our new component, where we want to implement an incompressible and a compressible 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++
// The components that will be created in this exercise
......@@ -82,7 +87,9 @@ 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 non-wetting phase is a one-phase liquid (OnePLiquid) consisting of the incompressible fictitious component and that the wetting-phase consists of tabulated water in the immiscible fluid system:
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 tabulated water, and
the other phase is liquid as well and consists of the incompressible fictitious component. Both will make up the immiscible fluid system (TwoPImmiscible):
```c++
......@@ -92,16 +99,16 @@ SET_PROP(ExerciseThreeTwoPTypeTag, FluidSystem)
private:
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using TabulatedH2O = Components::TabulatedComponent<Components::H2O<Scalar>>;
using LiquidWater = typename FluidSystems::OnePLiquid<Scalar, TabulatedH2O>;
using LiquidWaterPhase = typename FluidSystems::OnePLiquid<Scalar, TabulatedH2O>;
/*!
* 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 LiquidMyComponent = typename FluidSystems::OnePLiquid<Scalar, MyIncompressibleComponent<Scalar> >;
using LiquidMyComponentPhase = typename FluidSystems::OnePLiquid<Scalar, MyIncompressibleComponent<Scalar> >;
// using LiquidMyComponent = typename FluidSystems::OnePLiquid<Scalar, MyCompressibleComponent<Scalar> >;
public:
using type = typename FluidSystems::TwoPImmiscible<Scalar, LiquidWater, LiquidMyComponent>;
using type = typename FluidSystems::TwoPImmiscible<Scalar, LiquidWaterPhase, LiquidMyComponentPhase>;
};
```
......@@ -142,7 +149,7 @@ make exercise3_a
./exercise3_a exercise3_a.input
```
The saturation distribution of the nonwetting phase at the final simulation time should look like this:
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:
![](../extradoc/exercise3_a_solution.png)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment