This document briefly demonstrates the basic functionalities of the telemac package. The package is an R interface for the modelling suite OpenTELEMAC. The focus of this vignette is the TELEMAC-2D module for 2-dimensional hydrodynamic modelling. The example demonstrates rainfall-induced inundation modelling for an urban area in the northwest of the megacity of Lagos, Nigeria, including mesh generation based on a freely available DEM.

Prerequisites

Aside from R and the telemac package (and its package dependencies) the OpenTELEMAC software is needed. The model suite can be obtained and downloaded for free after registration from http://www.opentelemac.org. Install it and make sure it is running on your system.

In addition we need some more R packages to run this demonstration, which include tidyverse, raster, and sf. The packages can be installed directly from CRAN.

library(raster)
library(sf)
library(tidyverse)
library(telemac)

Input data

For a basic TELEMAC-2D setup three input files are required: a geometry file (*.slf) with mesh information, boundary conditions (*.cli), and steering parameters (*.cas). In the following the basic setup of each input is explained in more detail.

The geometry (mesh) file (*.slf)

The geometry of a TELEMAC setup is stored in a binary file of type SELAFIN (also referred to as SERAFIN). The mesh is typically stored as a triangulated irregular network (TIN). There are several possible approaches to obtain such a mesh, which shall not be discussed here in greater detail. In this demonstration we will start with a typical DEM represented by a regular grid and convert it into a TIN by constrained Delaunay triangulation using the well-known Triangle algorithm.

First we read an example DEM. This shows an urban area in the northwestern region of the city of Lagos, Nigeria, and is derived from the (after registration) freely available MERIT Hydro DEM. Despite its coarse resolution of about 90 x 90 m the DEM is hydrologicall