Package 'outfloweR'

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

Help Index


Simulation of Reservoir Mass Balance

Description

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.

Author(s)

Thomas Petzoldt, LuGu

References

ATT-Schriftenreihe Bd. 7: Integrale Bewirtschaftung von Trinkwassertalsperren gemäß DIN 19700. Siegburg, 2009.

See Also

Useful links:


approx_flows

Description

approx_flows

Usage

approx_flows(time, in_E, out_E, in_H, out_H, wb_E, wb_H)

Arguments

time

numeric

in_E

numeric

out_E

numeric

in_H

numeric

out_H

numeric

wb_E

numeric

wb_H

numeric


Hypsographic Functions for Conical Lake Geometry

Description

The functions calculate area resp. volume of a lake with a conical depth profile.

Usage

areaFunction(level, zmax, amax)

volumeFunction(level, zmax, amax)

vol2level(vol, zmax, amax)

Arguments

level

vector of water level above ground

zmax

maximum lake depth

amax

surface area of the lake surface for level = zmax

vol

vector of given volume(s)

Examples

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)) / vol

Data set discharge_dry

Description

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.

Format

Data frame with the following columns:

time

time in days

inflow

water inflow

outflow

managed outflow, e.g. for drinking water supply

outflow_wb

outflow to the river bed

Source

Lukas Gunzelmann, derived from real measurements

Examples

data("discharge_dry")

Data set discharge_normal

Description

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.

Format

Data frame with the following columns:

time

time in days

inflow

water inflow

outflow

managed outflow, e.g. for drinking water supply

outflow_wb

outflow to the river bed

Source

Lukas Gunzelmann, derived from real measurements

Examples

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")

Inflow and Outflow Data

Description

Example data sets with inflow and outflow of a reservoir (in Mio m3/d) of a theoretical year with a high flood in summer.

Format

Data frame with the following columns:

time

time in days

inflow

water inflow

outflow

managed outflow, e.g. for drinking water supply

outflow_wb

outflow to the river bed

Source

Lukas Gunzelmann, derived from real measurements

Examples

data("discharge_summerflood")

Data set discharge_wet

Description

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.

Format

Data frame with the following columns:

time

time in days

inflow

water inflow

outflow

managed outflow, e.g. for drinking water supply

outflow_wb

outflow to the river bed

Source

Lukas Gunzelmann, derived from real measurements

Examples

data("discharge_wet")

Launch outfloweR shiny App

Description

Launch a shiny app to visualize mass balance of reservoirs.

Usage

flower(...)

Arguments

...

optional parameters passed to the app (not yet implemented)

Details

The app is still experimental.

Value

This function has no return value.

Examples

## Not run: 
flower()

## End(Not run)

Data set hypso

Description

Example of a Hypsographic Table


Data set hypso_bautzen

Description

Hypsographic Table of Bautzen Reservoir

References

http://www.tu-dresden.de/hydrobiologie


Hypsographic Table of a Conic Lake

Description

Hypsographic Table of a Lake with Conical Morphometry

Source

Generated data, see example below.

References

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.

Examples

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$depth

Hypsographic Functions from Tabular Interpolation

Description

The main function creates a function list object from a data table to allow interpolation of depths, areas and volume fractions of layers.

Usage

hypso_functions(table)

Arguments

table

hypsographic table (bathymetry) given as data frame with columns level, area and volume

Value

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.

See Also

hypso_bautzen, an example of a hypsographic table
areaFunction, functions to create a hypsographic table for lakes with conical shape.

Examples

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 epilimnion

plot_flows

Description

plot_flows

Usage

plot_flows(
  discharge,
  xlab = "Tag im Jahr",
  ylab_inflow = "Zufluss (m3/d)",
  ylab_outflow = "Rohwasserabgabe (m3/d)",
  ylab_wildbed = "Wildbettabgabe (m3/d)"
)

Arguments

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.

Value

A combined ggplot object using 'ggpubr::ggarrange'.


plot_volumes

Description

plot_volumes

Usage

plot_volumes(
  out,
  xlab = "Tag im Jahr",
  ylab = "Volumen (Mio m3)",
  legend_title = "Teilraum",
  legend_labels = c("Epilimnion", "Hypolimnion")
)

Arguments

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).

Value

A ggplot object.


Run scenarions of a reservoir mass balance model

Description

Run scenarions of a reservoir mass balance model

Usage

scenario(
  option = c("standard", "cold_inflow", "wb_top"),
  vol,
  t_strat,
  t_autumn,
  inflow,
  outflow,
  outflow_wb
)

Arguments

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

Description

stratification_event

Usage

stratification_event(time, y, parms, inflows)

Arguments

time

numeric

y

numeric

parms

numeric

inflows

list


volume_model

Description

volume_model

Usage

volume_model(time, y, parms, inflows, ...)

Arguments

time

numeric

y

numeric

parms

numeric

inflows

list

...

not used