| Title: | Simulation of Reservoir Mass Balance |
|---|---|
| Description: | A demonstration of reservoir level and stratification management, based on simple mass balances. |
| Authors: | Thomas Petzoldt [aut, cre] (ORCID: <https://orcid.org/0000-0002-4951-6468>), LuGu [aut] |
| Maintainer: | Thomas Petzoldt <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 0.4-2 |
| Built: | 2026-10-04 10:00:50 UTC |
| Source: | https://github.com/tpetzoldt/outfloweR |
The package aims to demonstrate reservoir management options by abstracting water either from the bottom outlet or the surface layer (the epilimnion). It uses a simple mass-balance approach and provides a shiny-app.
Thomas Petzoldt, LuGu
ATT-Schriftenreihe Bd. 7: Integrale Bewirtschaftung von Trinkwassertalsperren gemäß DIN 19700. Siegburg, 2009.
Useful links:
approx_flows
approx_flows(time, in_E, out_E, in_H, out_H, wb_E, wb_H)approx_flows(time, in_E, out_E, in_H, out_H, wb_E, wb_H)
time |
numeric |
in_E |
numeric |
out_E |
numeric |
in_H |
numeric |
out_H |
numeric |
wb_E |
numeric |
wb_H |
numeric |
The functions calculate area resp. volume of a lake with a conical depth profile.
areaFunction(level, zmax, amax) volumeFunction(level, zmax, amax) vol2level(vol, zmax, amax)areaFunction(level, zmax, amax) volumeFunction(level, zmax, amax) vol2level(vol, zmax, amax)
level |
vector of water level above ground |
zmax |
maximum lake depth |
amax |
surface area of the lake surface for |
vol |
vector of given volume(s) |
level <- seq(0, 50, 1) amax <- 9e6 zmax <- 50 area <- areaFunction(level, zmax, amax) vol <- volumeFunction(level, zmax, amax) plot(vol, cumsum(area), type="l") (vol - cumsum(area)) / vollevel <- seq(0, 50, 1) amax <- 9e6 zmax <- 50 area <- areaFunction(level, zmax, amax) vol <- volumeFunction(level, zmax, amax) plot(vol, cumsum(area), type="l") (vol - cumsum(area)) / vol
Example Hydrological Data of d Dry Year
Example data sets with inflow and outflow of a reservoir (in Mio m3/d) of a normal, a wet and a dry year.
Data frame with the following columns:
time in days
water inflow
managed outflow, e.g. for drinking water supply
outflow to the river bed
Lukas Gunzelmann, derived from real measurements
data("discharge_dry")data("discharge_dry")
Example Hydrological Data of d Normal Year
Example data sets with inflow and outflow of a reservoir (in Mio m3/d) of a normal, a wet and a dry year.
Data frame with the following columns:
time in days
water inflow
managed outflow, e.g. for drinking water supply
outflow to the river bed
Lukas Gunzelmann, derived from real measurements
data("discharge_normal") plot(inflow ~ time, data = discharge_normal, type="l", ylim=c(0, 1.5)) lines(outflow ~ time, data = discharge_normal, col="blue") lines(outflow_wb ~ time, data = discharge_normal, col="green")data("discharge_normal") plot(inflow ~ time, data = discharge_normal, type="l", ylim=c(0, 1.5)) lines(outflow ~ time, data = discharge_normal, col="blue") lines(outflow_wb ~ time, data = discharge_normal, col="green")
Example data sets with inflow and outflow of a reservoir (in Mio m3/d) of a theoretical year with a high flood in summer.
Data frame with the following columns:
time in days
water inflow
managed outflow, e.g. for drinking water supply
outflow to the river bed
Lukas Gunzelmann, derived from real measurements
data("discharge_summerflood")data("discharge_summerflood")
Example Hydrological Data of d Wet Year
Example data sets with inflow and outflow of a reservoir (in Mio m3/d) of a normal, a wet and a dry year.
Data frame with the following columns:
time in days
water inflow
managed outflow, e.g. for drinking water supply
outflow to the river bed
Lukas Gunzelmann, derived from real measurements
data("discharge_wet")data("discharge_wet")
Launch a shiny app to visualize mass balance of reservoirs.
flower(...)flower(...)
... |
optional parameters passed to the app (not yet implemented) |
The app is still experimental.
This function has no return value.
## Not run: flower() ## End(Not run)## Not run: flower() ## End(Not run)
Hypsographic Table of Bautzen Reservoir
http://www.tu-dresden.de/hydrobiologie
Hypsographic Table of a Lake with Conical Morphometry
Generated data, see example below.
Sachse, R., Petzoldt, T., Blumstock, M., Moreira, S., Pätzig, M., Rücker, J., Janse, J. H., Mooij, W. M., Hilt, S. (2014). Extending one-dimensional models for deep lakes to simulate the impact of submerged macrophytes on water quality. Environmental Modelling and Software, 61, 410-423
Hrbácek, J. (1966). A morphometrical study of some backwaters and fish ponds in relation to the representative plankton samples (with an appendix by C. 0. Junge on depth distribution for quadric surfaces and other configurations). Hydrobiological Studies, 1, 221–257.
zmax <- 20 # maximum depth (m) area <- function(Amax, zmax, z){Amax * (1 - (z)/zmax)^2} volume <- function(Amax, zmax, z){Amax * zmax/3 * (1 - z/zmax)^3} Amax <- 12.07 * 1000 * 1000 # total Area (m^2) depth <- seq(zmax, 0, -.1) # depth (m) hypso_cone <- data.frame(depth = depth, volume = volume(Amax, zmax, depth), area=area(Amax, zmax, depth) ) ## inverted depth order hypso_cone$level <- zmax - hypso_cone$depthzmax <- 20 # maximum depth (m) area <- function(Amax, zmax, z){Amax * (1 - (z)/zmax)^2} volume <- function(Amax, zmax, z){Amax * zmax/3 * (1 - z/zmax)^3} Amax <- 12.07 * 1000 * 1000 # total Area (m^2) depth <- seq(zmax, 0, -.1) # depth (m) hypso_cone <- data.frame(depth = depth, volume = volume(Amax, zmax, depth), area=area(Amax, zmax, depth) ) ## inverted depth order hypso_cone$level <- zmax - hypso_cone$depth
The main function creates a function list object from a data table to allow interpolation of depths, areas and volume fractions of layers.
hypso_functions(table)hypso_functions(table)
table |
hypsographic table (bathymetry) given as data frame with
columns |
a list of functions with the following elements (slots):
level(volume) interpolates level from volume
volume(level) interpolates volume from a given water level
area(level) interpolates area from a given level
vh(level, zmixreal) calculates hypolimnic volume from surface
water level (m above ground) and mixing depth (zmixreal, thermocline in m
below surface)
ve(level, zmixreal) calculates epilimnic volume from surface
water level and zmixreal
zmix(level, zmixreal) calculates average mixing depth (zmix)
from surface water level and zmixreal
zhm(level, zmixreal) calculates average depth of bottom layer
(hypolimnion and metalimnion)
sediment_area(level) calculates sediment area for a series of
water levels, where level shoudl be a vecor of water levels in
ascending order
pelagic_ratio(level) calculates the area ratio of the pelagic
part (water) to the total area of layers. It is equal to 1 - sediment area
fraction.
hypso_bautzen, an example of a hypsographic table areaFunction, functions to create a hypsographic table for
lakes with conical shape.
data(hypso_bautzen) # load data table hypso <- hypso_functions(hypso_bautzen) # create function object hypso$volume(166) # volume at 166 m a.s.l. hypso$sediment_area(c(160, 166)) # sediment area of hypo- and epilimniondata(hypso_bautzen) # load data table hypso <- hypso_functions(hypso_bautzen) # create function object hypso$volume(166) # volume at 166 m a.s.l. hypso$sediment_area(c(160, 166)) # sediment area of hypo- and epilimnion
plot_flows
plot_flows( discharge, xlab = "Tag im Jahr", ylab_inflow = "Zufluss (m3/d)", ylab_outflow = "Rohwasserabgabe (m3/d)", ylab_wildbed = "Wildbettabgabe (m3/d)" )plot_flows( discharge, xlab = "Tag im Jahr", ylab_inflow = "Zufluss (m3/d)", ylab_outflow = "Rohwasserabgabe (m3/d)", ylab_wildbed = "Wildbettabgabe (m3/d)" )
discharge |
A data frame containing discharge data (must have 'time', 'inflow', 'outflow', 'outflow_wb' columns). |
xlab |
Label for the x-axis for all plots. |
ylab_inflow |
Label for the y-axis of the inflow plot. |
ylab_outflow |
Label for the y-axis of the raw water outflow plot. |
ylab_wildbed |
Label for the y-axis of the wild bed outflow plot. |
A combined ggplot object using 'ggpubr::ggarrange'.
plot_volumes
plot_volumes( out, xlab = "Tag im Jahr", ylab = "Volumen (Mio m3)", legend_title = "Teilraum", legend_labels = c("Epilimnion", "Hypolimnion") )plot_volumes( out, xlab = "Tag im Jahr", ylab = "Volumen (Mio m3)", legend_title = "Teilraum", legend_labels = c("Epilimnion", "Hypolimnion") )
out |
output from 'ode' (deSolve Object). |
xlab |
Label for the x-axis. |
ylab |
Label for the y-axis. |
legend_title |
Title for the legend. |
legend_labels |
Labels for the legend entries (corresponding to Epilimnion and Hypolimnion). |
A ggplot object.
Run scenarions of a reservoir mass balance model
scenario( option = c("standard", "cold_inflow", "wb_top"), vol, t_strat, t_autumn, inflow, outflow, outflow_wb )scenario( option = c("standard", "cold_inflow", "wb_top"), vol, t_strat, t_autumn, inflow, outflow, outflow_wb )
option |
character, specifying the water inflow and water abstraction regime |
vol |
numeric value, volume of the reservoir (in Mio m3) |
t_strat |
numeric value, day of stratification onset |
t_autumn |
numeri value, end of stratification |
inflow |
numeric vector, inflow in Mio m3/d |
outflow |
numeric vector, outflow in Mio m3/d |
outflow_wb |
numeric vector, bottom outlet in Mio m3/d |
stratification_event
stratification_event(time, y, parms, inflows)stratification_event(time, y, parms, inflows)
time |
numeric |
y |
numeric |
parms |
numeric |
inflows |
list |
volume_model
volume_model(time, y, parms, inflows, ...)volume_model(time, y, parms, inflows, ...)
time |
numeric |
y |
numeric |
parms |
numeric |
inflows |
list |
... |
not used |