Skip to content
Snippets Groups Projects
Commit 5f0b2b40 authored by Ned Coltman's avatar Ned Coltman
Browse files

[exercises][ff-pm][models] Update readme for the models exercise

parent 0702136e
No related branches found
No related tags found
1 merge request!153Update exercise-coupled-ff-pm
......@@ -212,7 +212,7 @@ Hint: A relation between velocity and position is used for the vertical velocity
### 2. Changing the porous medium model
In this part of the exercise, the coupled system will be extended such that the transport of components
in both parts is included and the presence of a second phase in the porous medium is considered.
in both domains is included and the presence of a second phase in the porous medium domain is considered.
This enables the simulation of the drying of a porous medium (however no energy balance is included yet).
This part of the exercise consists of the following steps:
......@@ -260,30 +260,41 @@ In this case, the chosen formulation will set the given value as the mole fracti
__Task B: Add output__:
In the next step, we want to add some output to the simulation.
First we want to know the water mass in the (porous-medium) system.
Therefore, we evaluate the storage term of the water component.
In the next step, we want to add some output to the simulation. The standard method for providing simulation output for visualization is via a VtkWriter. These tools take the grid geometries of each domain, as well as the solutions and write spatial output that one can view in visualization tools such as paraview.
Although this Vtk output is very useful, some output is more suited for other forms of visualization.
Two examples of data ouput formats are `.csv` files and `.json` files.
From these files, data can be visualized using many different tools.
In this exercise, data exported to a `.csv` file will be plotted using gnuplot, and data exported to a `.json` output will be plotted using the matplotlib python library.
First as example output data, we want to investigate the water mass in the (porous-medium) system.
There are two ways to evaluate this: (1) the total storage of water mass in the porous medium domain, and (2) the water vapor flux along the interface.
The total storage can be plotted over time, whereas the water vapor flux will vary spatially along the interface as well as over time.
First, we evaluate the storage term of the water component.
* Have a look at the function `evaluateWaterMassStorageTerm()` in the `porousmediumsubproblem.hh`.
Then implement a calculation of the total water mass:
$`\sum_{\alpha \in \textrm{g,l}} \left( \phi S_\alpha X^\text{w}_\alpha \varrho_\alpha V_\textrm{scv} \right)`$.
Afterwards, adapt the method `init()` such that the variable `initialWaterContent_` is initialized correctly using the `evaluateWaterMassStorageTerm()` method and assign that value also to the variable `lastWaterMass_`.
We also want to investigate the temporal evolution of the water mass.
The following steps need to be done to do so.
Check if all instructions are implemented accordingly:
* Calculate the initial water mass at the beginning of the simulation and add the water mass loss to the output.
Based on the water mass loss you can derive the evaporation rate. Because despite at the interface, all
boundaries have Neumann no-flow conditions and no sources are present, the water can only leave the system
via the porous-medium free-flow interface. The evaporation in [mm/d] can be calculated by:
Afterwards, adapt the method `startStorageEvaluation()` such that the variable `initialWaterContent_` is initialized correctly using the `evaluateWaterMassStorageTerm()` method and assign that value also to the variable `lastWaterMass_`.
In order to evaluate how the stored water mass evolves over time, we should make sure the following is implemented:
* Calculate the initial water mass at the beginning of the simulation.
* For each time step, add the water mass loss to the output.
* Based on the water mass loss you can derive the evaporation rate. The evaporation in [mm/d] can be calculated by:
$`e = \frac{\textrm{d}\, M^\text{w}}{\textrm{d}\, t} / A_\textrm{interface}`$.
(all boundaries have Neumann no-flow conditions and no sources are present, meaning the water can only leave the system
via the porous-medium free-flow interface.)
During the simulation a `.csv` file is created (enable by setting `[Problem.ExportStorage] = true` in the `params.input` file). In addition, a gnuplot script `StorageOverTime.gp` is written and the mass loss and cumulative mass are plotted over time (`StorageOverTime.png`), when plotting is enabled with `[Problem.PlotStorage] = true`.
Finally we want to know the distribution of the water mass fluxes across the interface.
Second, we want to know the distribution of the water mass fluxes across the interface.
* Have a look at the function `evaluateInterfaceFluxes()` in the porous medium problem.
Use the facilities therein to return the values of ...massCouplingCondition... from the `couplingManager`
for each coupling scvf. Then the fluxes are visualized with gnuplot, when setting `Problem.PlotFluxes = true`.
If the simulation is too fast, you can have a look at the flux*.png files after the simulation.
* You can use the parameter `Problem.PlotStorage = true` to see the temporal evolution of the evaporation rate
and the cumulative water mass loss.
for each coupling scvf. Multiply this with the relevant face sizes, extrusion factor, massfraction and seconds per day to get the [mm/d] units as seen in the storage evaluation.
* When the `[Problem.ExportFluxes] = true` parameter is enabled, simulation data will be exported for this simulation to a `.json` file.
This file can flexibly handle data of different types, which in this case is helpful as we have both temporal and spatial data.
* Use the python plotting script `plotFluxes.py` to visualize the flux distribution across the surface at different times.
This script uses `matplotlib`, a very popular python based visualization library.
Compile and run the simulation and take a look at the results.
......
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