Exercise Properties (DuMuX course)
Problem set-up
The problem setup is identical to the two-phase incompressible test from DuMux.
Preparing the exercise
- Navigate to the directory
exercise-properties
Exercise Properties deals with a two-phase immiscible incompressible problem (2p). The goal is to learn how to adapt compile-time parameters by employing the DuMux property system.
Task 1: Getting familiar with the code
Locate all the files you will need for this exercise
- The main file:
main.cc
- The problem file:
problem.hh
- The properties file:
properties.hh
- The spatial parameters file:
spatialparams.hh
- The input file:
params.input
- One header file containing:
- a custom local residual in:
mylocalresidual.hh
- a custom local residual in:
Task 2: Compiling and running the program
- Change to the build-directory
cd ../build-cmake/exercises/exercise_properties
- Compile the executable
exercise_properties
make exercise_properties
- Run the problem and inspect the result
./exercise_properties
Note: Because the input file has the same name as the executable, DuMux will find it automatically.
Task 3: Implement a custom local residual
Types that are properties can be changed on the problem level by using the property system. In the following task, we implement our own 2p local residual, i.e. the class that computes the element residual in every Newton iteration. The file mylocalresidual.hh
contains a copy of the original local residual class used for all immiscible models renamed to template<class TypeTag> class MyLocalResidual
.
- Make DuMux use this new local residual by including the header
mylocalresidual.hh
and setting the corresponding property in theProperty
namespace in the fileproperties.hh
template<class TypeTag>
struct LocalResidual<TypeTag, TTag::TwoPIncompressible>
{
using type = MyLocalResidual<TypeTag>;
};
Simplify the original local residual by using the assumption that only incompressible fluid phases are present. As a consequence, one can balance phase volume instead of phase mass:
-
Eliminate the density from the
computeStorage
and thecomputeFlux
methods. -
Adapt the relevant routine in the problem file such that volume instead of mass is injected. The density of the employed NAPL is 1460 kg/m3 . For a first try, you can use the hardcoded value.
-
Generalize your approach by using the component's
liquidDensity(t, p)
function instead of the hardcoded value.