diff --git a/exercises/exercise-basic/README.md b/exercises/exercise-basic/README.md index e81ca62821af5bc60947ff259d848187825b22f1..316dc4c836b3c36ad99925c9109e66532d54e8f8 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` @@ -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 diff --git a/exercises/exercise-basic/exercise1.input b/exercises/exercise-basic/exercise1.input index 792afb3c7b4f9373c4d327572790a4b13534a19a..fed0a9410eceb556a9b84859a634a0ccbd9e1fdb 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 diff --git a/exercises/exercise-basic/injection2p2cproblem.hh b/exercises/exercise-basic/injection2p2cproblem.hh index 3c30c2a2bf971657cb8da4c06dc360bacabb1acd..26e111092c6ff2d19ed587c3c2609a6a40389eb8 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 ad241c88f28575338cd3cdc54579b2a37ad11d0b..d89fa7f1c4ca1abcf7096a16fbe76859c8531314 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 46b5d38930906614e8d279085bb5fdd346fd744f..f9f585e86ca311f5079a9e978a5b307c047b13fc 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. *