From 302f571d91cd29549003e3e1cd690ff8fba6cf1b Mon Sep 17 00:00:00 2001 From: Theresa Kurz Date: Thu, 12 Jul 2018 15:40:49 +0200 Subject: [PATCH 1/4] [exercise-basic] Insert source function in problem --- .../exercise-basic/injection2p2cproblem.hh | 17 +++++++++++++++++ .../exercise-basic/injection2pniproblem.hh | 17 +++++++++++++++++ exercises/exercise-basic/injection2pproblem.hh | 17 +++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/exercises/exercise-basic/injection2p2cproblem.hh b/exercises/exercise-basic/injection2p2cproblem.hh index 3c30c2a..26e1110 100644 --- a/exercises/exercise-basic/injection2p2cproblem.hh +++ b/exercises/exercise-basic/injection2p2cproblem.hh @@ -92,6 +92,7 @@ class Injection2p2cProblem : public PorousMediumFlowProblem using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); + using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); enum { dimWorld = GridView::dimensionworld }; using Element = typename GridView::template Codim<0>::Entity; @@ -220,6 +221,22 @@ public: */ // \{ + /*! + * \brief Evaluate the source term for all phases within a given + * sub-control-volume. + * + * For this method, the \a priVars parameter stores the rate mass + * of a component is generated or annihilate per volume + * unit. Positive values mean that mass is created, negative ones + * mean that it vanishes. + * + * The units must be according to either using mole or mass fractions. (mole/(m^3*s) or kg/(m^3*s)) + */ + NumEqVector sourceAtPos(const GlobalPosition &globalPos) const + { + return NumEqVector(0.0); + } + /*! * \brief Evaluate the initial value for a control volume. * diff --git a/exercises/exercise-basic/injection2pniproblem.hh b/exercises/exercise-basic/injection2pniproblem.hh index ad241c8..d89fa7f 100644 --- a/exercises/exercise-basic/injection2pniproblem.hh +++ b/exercises/exercise-basic/injection2pniproblem.hh @@ -95,6 +95,7 @@ class InjectionProblem2PNI : public PorousMediumFlowProblem using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); + using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); enum { dimWorld = GridView::dimensionworld }; using Element = typename GridView::template Codim<0>::Entity; @@ -215,6 +216,22 @@ public: */ // \{ + /*! + * \brief Evaluate the source term for all phases within a given + * sub-control-volume. + * + * For this method, the \a priVars parameter stores the rate mass + * of a component is generated or annihilate per volume + * unit. Positive values mean that mass is created, negative ones + * mean that it vanishes. + * + * The units must be according to either using mole or mass fractions. (mole/(m^3*s) or kg/(m^3*s)) + */ + NumEqVector sourceAtPos(const GlobalPosition &globalPos) const + { + return NumEqVector(0.0); + } + /*! * \brief Evaluate the initial value for a control volume. * diff --git a/exercises/exercise-basic/injection2pproblem.hh b/exercises/exercise-basic/injection2pproblem.hh index 46b5d38..f9f585e 100644 --- a/exercises/exercise-basic/injection2pproblem.hh +++ b/exercises/exercise-basic/injection2pproblem.hh @@ -91,6 +91,7 @@ class InjectionProblem2P : public PorousMediumFlowProblem using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); + using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); enum { dimWorld = GridView::dimensionworld }; using Element = typename GridView::template Codim<0>::Entity; @@ -216,6 +217,22 @@ public: */ // \{ + /*! + * \brief Evaluate the source term for all phases within a given + * sub-control-volume. + * + * For this method, the \a priVars parameter stores the rate mass + * of a component is generated or annihilate per volume + * unit. Positive values mean that mass is created, negative ones + * mean that it vanishes. + * + * The units must be according to either using mole or mass fractions. (mole/(m^3*s) or kg/(m^3*s)) + */ + NumEqVector sourceAtPos(const GlobalPosition &globalPos) const + { + return NumEqVector(0.0); + } + /*! * \brief Evaluate the initial value for a control volume. * -- GitLab From d4bab1a6f2e446b9a6dfa99444c381a688ae306d Mon Sep 17 00:00:00 2001 From: Theresa Kurz Date: Thu, 12 Jul 2018 15:46:36 +0200 Subject: [PATCH 2/4] [exercise-basic] remove input-parameter tasks in readme --- exercises/exercise-basic/README.md | 57 ++---------------------------- 1 file changed, 2 insertions(+), 55 deletions(-) diff --git a/exercises/exercise-basic/README.md b/exercises/exercise-basic/README.md index e81ca62..c674a8d 100644 --- a/exercises/exercise-basic/README.md +++ b/exercises/exercise-basic/README.md @@ -55,60 +55,7 @@ paraview injection-2p2c.pvd ```


-### Task 3: Changing input parameters -
- -In the input file `exercise1.input` you can find the following section - -```ini -[SpatialParams] -EntryPressureAquitard = 4.5e4 -EntryPressureAquifer = 1e4 -``` - -* Change the values for the aquitard entry pressure in the input file to a lower value and compare the results with the previous solution. You don't need to recompile the executable. - -


-### Task 4: Runtime parameters -
- -The injection rate is currently hard-coded in `injection2p2cproblem.hh` to $`1e-4 kg/(s m^2)`$. - -```c++ - // set the Neumann values for the Nitrogen component balance - // convert from units kg/(s*m^2) to mole/(s*m^2) -values[Indices::contiNEqIdx] = -1e-4/FluidSystem::molarMass(FluidSystem::nCompIdx); -values[Indices::contiWEqIdx] = 0.0; -``` - -We want to be able to set it at runtime. To this end, -* use the following DuMuX macro to read a runtime parameter from the input file - -```c++ -// read the injection rate from the input file at run time -totalAreaSpecificInflow_ = getParam("GROUPNAME.PARAMNAME"); -``` - -* Replace -``,``,`` by what is appropriate for your case: - * `` is the type of the parameter to read - * `` is the group in the input file - * `` is the name of the parameter in the input file - -Note that due to the way the macro works, the names are specified as plain text within the "quotation marks".`` and `` need to be separated by a dot (.). -Follow the instructions given as a - -```c++ -// TODO: dumux-course-task -``` -in the `injection2p2cproblem.hh` file and also remember to also set the parameter totalAreaSpecificInflow in the input file. - -* Check the influence of that parameter on the simulation result by rerunning the simulation with different injection rates. Remember to also set the parameter totalAreaSpecificInflow in the input file. - -Since you have changed your header file, you have to recompile the program. - -


-### 5. Setting up a new executable (for a non-isothermal simulation) +### Task 3: Setting up a new executable (for a non-isothermal simulation)
* Copy the main file `exercise1_2p.cc` and rename it to `exercise1_2pni.cc` @@ -131,7 +78,7 @@ make exercise1_2pni # builds new executable ```


-### 6. Setting up a non-isothermal __2pni__ test problem +### Task 4: Setting up a non-isothermal __2pni__ test problem
* Open the file `injection2pniproblem.hh`. It is a copy of the `injection2pproblem.hh` with some useful comments on how to implement a non-isothermal model. Look for comments containing -- GitLab From de66b3b84f594e597003b448ea5220db5df1fd48 Mon Sep 17 00:00:00 2001 From: Theresa Kurz Date: Thu, 12 Jul 2018 15:56:44 +0200 Subject: [PATCH 3/4] [exercise-basic] update readme --- exercises/exercise-basic/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/exercise-basic/README.md b/exercises/exercise-basic/README.md index c674a8d..316dc4c 100644 --- a/exercises/exercise-basic/README.md +++ b/exercises/exercise-basic/README.md @@ -9,9 +9,9 @@ The aquifer is situated 2700 m below sea level and the domain size is 60 m x 40 ## Preparing the exercise -* Navigate to the directory `dumux/tutorial/ex1` +* Navigate to the directory `dumux-course/exercises/exercise-basic` -_Exercise 1_ deals with two problems: a two-phase immiscible problem (__2p__) and a two-phase compositional problem (__2p2c__). They both set up the same scenario with the difference that the 2p2c assumes a miscible fluid state for the two fluids (water and gaseous N$`_2`$) and the 2p model assumes an immiscible fluid state. +The first exercise deals with two problems: a two-phase immiscible problem (__2p__) and a two-phase compositional problem (__2p2c__). They both set up the same scenario with the difference that the 2p2c assumes a miscible fluid state for the two fluids (water and gaseous N$`_2`$) and the 2p model assumes an immiscible fluid state.

### Task 1: Getting familiar with the code @@ -32,7 +32,7 @@ Locate all the files you will need for this exercise * Change to the build-directory ```bash -cd ../../build-cmake/tutorial/ex1 +cd ../../build-cmake/exercises/exercise-basic ``` * Compile both executables `exercise1_2p` and `exercise1_2p2c` -- GitLab From 080985bfd23f4b20a038333c9b9722e4635a526f Mon Sep 17 00:00:00 2001 From: Theresa Kurz Date: Thu, 12 Jul 2018 18:40:01 +0200 Subject: [PATCH 4/4] [exercise-basic] cleanup --- exercises/exercise-basic/exercise1.input | 3 --- 1 file changed, 3 deletions(-) diff --git a/exercises/exercise-basic/exercise1.input b/exercises/exercise-basic/exercise1.input index 792afb3..fed0a94 100644 --- a/exercises/exercise-basic/exercise1.input +++ b/exercises/exercise-basic/exercise1.input @@ -13,9 +13,6 @@ OnlyPlotMaterialLaws = true AquiferDepth = 2700.0 # m InjectionDuration = 2.628e6 # in seconds, i.e. one month -#TODO: dumux-course-task: -#set totalAreaSpecificInflow - [SpatialParams] PermeabilityAquitard = 1e-15 # m^2 EntryPressureAquitard = 4.5e4 # Pa -- GitLab