Introduction to LWFBrook90R

This vignette gives a brief introduction to the usage of the LWFBrook90R R-package. The package serves as an interface between R and the executable code of the hydrological model LWF-BROOK90 (Hammel and Kennel 2001). The functionality is presented on a working example.


1 Introduction

LWF-BROOK90 (Hammel and Kennel 2001) is a hydrological model to calculate daily evaporation (transpiration, interception, and soil evaporation) and soil water fluxes, along with soil water contents and soil water tension of a soil profile covered with vegetation. It is an upgraded version of the original BROOK90 hydrological model (Federer, Vörösmarty, and Fekete 2003; Federer 2002), featuring additional parameterizations of the soil water retention and conductivity functions (Mualem 1976; Genuchten 1980), and the option to take interannual variation of aboveground vegetation characteristics into account. The core function of the package runLWFB90 runs LWF-Brook90 by:

The model control options thereby let you select different functions for defining aboveground stand dynamics, phenology, and root length density depth distributions. Additionally, a set of pedotransfer functions is provided to derive hydraulic parameters from soil physical properties.

In this vignette, we will use meteorological and soil data from the longterm monitoring beech forest site SLB1 in the Solling mountains, Germany. The datasets are available after loading the package. Use ?slb1_soil and ?slb1_meteo to see the meaning of the variables and their units.

First of all, load LWFBrook90R and the data.table package:

library(LWFBrook90R)
library(data.table)

2 Basic usage

2.1 Input Objects

The central function to run LWF-BROOK90 from within R is runLWFB90. Before we use it, we need to set up the required input objects that are passed as arguments. Aside from meteorological and soil data, we need to define the model control options and model parameter objects. The model options contains basic information about the simulation and which submodels to use (e.g. the start and end dates of the simulation, the precipitation interval, the phenology model, root length density depth distribution function, etc). The model parameter object contains about 100 parameters, of which most are required to run the model, but some only take effect if certain model options are selected (see section Model control options). Two functions are defined in LWFBrook90R that can be used to generate default lists of model options and parameters:

The created objects can be easily manipulated by reference, or simply by assigning values to the option and parameter names directly in the function calls. To look up the meanings of the various options and parameters see ?setoption_LWFB90 and ?setparam_LWFB90. The meaning and context of most input parameters (and output variables) can also be looked up in the documentation of the original Brook90 model version on Tony Federer’s webpages, which is always a recommended source of information when working with any Brook90 version.

We want to run LWF-BROOK90 using the sample data from the Solling site and we need to prepare the soil dataset for LWF-BROOK90. The data.frame slb1_soil contains soil physical data of the soil horizons, but not yet the hydraulic parameters that LWF-BROOK90 requires. Fortunately, LWFBrook90R comes with a set of pedotransfer functions to derive the Mualem/van Genuchten parameters of the soil water retention and hydraulic conductivity functions. Here we use texture tabulated values from Wessolek, Renger & Kaupenjohann (2009) and create a data.frame containing the required MvG-parameters along with the soil physical data:

Before we run the simulation, we need to select the output variables and their temporal resolution. Sets of output variables are chosen in a [5,10]-matrix, that is used as argument in runLWFB90. To create the matrix, you can use the function setoutput_LWFB90. It will create a [5,10]-matrix, with a default set of output selected. You can modify the selection by flagging groups of output variables with 0 and 1. The default selection are annual, monthly and daily evapotranspiration datasets and layer by layer daily soil water state variables.

2.2 Single-run simulations

Now we are ready to perform the single-run simulation using the central function runLWFB90:

runLWFB90 thereby creates the project directory (project.dir), derives the daily stand properties (lai, sai, height, densef, age) and root distribution from parameters, and passes climate, vegetation properties and parameters to the Fortran dynamic library. The model writes the selected output datasets to the specified folder project.dir as text files. As a last step, runLWFB90 returns the contents of the text files (if read.output = TRUE). The returned object is a list containing the model output (as specified by the output-argument and named according to the ‘.ASC’ files in the project.dir-folder), along with the model input (options.b90, param.b90 and derived daily vegetation properties standprop_daily), if desired (rtrn.input = TRUE). The model output items in the result list are data.tables, as the function fread from data.table package is used internally to read the files. The EVAPDAY.ASC file contains daily evaporation water fluxes:

EVAPDAY.ASC contains date variables (‘YR’, ‘MO’, ‘DA’, ‘DOY’), actual evaporation fluxes (‘EVAP’, ‘TRAN’, ‘IRVP’, ‘ISVP’, ‘SLVP’, ‘SNVP’), potential evaporation fluxes (‘PINT’, ‘PTRAN’, ‘PSLVP’) and total runoff (‘FLOW’). For a detailed description of all output variables refer to the list of parameters and variables on Tony Federer’s webpages. To plot the data, it is convenient to derive a Date object from the date variables. We use data.table syntax:

Another result that is returned by default are daily soil moisture variables (‘SWATI’, ‘THETA’, ‘WETNES’, ‘PSIMI’, ‘PSITI’), of the individual soil layers. The file in the project.dir-folder is named ‘SWATDAY.ASC’ and contains the values of the individual layers organized in rows. We want to plot absolute soil water storage (‘SWATI’) down to a soil depth of 100 cm, so we need to integrate b90res$swatday.asc$swati over the the 14 uppermost soil layers. Again, we use data.table syntax for convenient aggregation:

Now we can plot soil water storage along with transpiration: Simulation results for sample data

2.3 Multi-run Simulations

With LWFBrook90R, parallelized multi-run simulations can be conveniently performed, extending the basic single-run applications using the function runLWFB90 described in the previous section. Two different multi-run functions exist for two different problems:

  1. Perform Monte-Carlo simulations with single parameters set up for variation, and
  2. simulations over multiple locations, parameter sets, or climate scenarios.

For the first case, the function mrunLWFB90 is available. The second problem can be tackled using the function msiterunLWFB90. Both functions are wrapper functions for runLWFB90 and allow for parallel processing of tasks using a specified number of CPUs to speed up the execution of a multi-run simulation.

The functions return lists of the individual single-run simulation results, as they are returned by runLWFB90. These lists can become very large when many simulations are performed, and if the selected output comprises daily data sets (e.g. EVAPDAY.ASC) and especially soil moisture state variables of individual soil layers (SWATDAY.ASC). To minimize memory allocation, it is therefore recommended to reduce the selected output to a minimum and make use of the output_fun-argument in runLWFB90. With this argument, it is possible to pass custom functions to runLWFB90, which directly perform on the simulation output list object. With rtrn.output set to FALSE, the original simulation output list containing .ASC file contents can be discarded, and only the results from the output_fun-argument are returned. This can be very useful for model calibration or sensitivity analyses tasks comprising ten thousands of simulations in a Monte-Carlo setting. With this magnitude, only a relatively small output can be returned for each individual simulation, e.g., a measure of agreement between simulated and observed values. Similarly, it is possible to define functions to aggregate model output on-the-fly, or to redirect the output to a database, when Multi-Site forward simulations shall be performed for a large number of sites.

To demonstrate the usage of the output_fun-argument, we perform a Monte-Carlo simulation using the function mrunLWFB90. The function is a simple wrapper function for runLWFB90 and takes a data.frame paramvar, that contains variable parameter values in columns and their realisations in rows. For each row in paramvar, the respective parameter values in param.b90 are replaced by name, and runLWFB90 is executed. The return of mrunLWFB90 is a list containing the individual single-run simulation results, as returned by runLWFB90. In order to reduce the returned output, we define a function that integrates depth-specific soil moisture to soil water storage in 0-100 cm soil depths (as we did in the first example) and return the calculated values in a data.frame along with daily transpiration:

We can test our custom output function on the previous single-run simulation b90res result and see that it works:

For the multi-run simulation, we set up two parameters for variation, the maximum leaf area index (maxlai) and the maximum leaf conductance (glmax). We define a data.frame with two columns, containing 50 random uniform realisations of the two parmeters:

Now we can run the simulation. We use our custom output function, and suppress the inclusion of the original simulation result objects and model input in the return value.

The result is a list of the individual single-run results, from which we can easily extract the results of our output function and rbind them to a data.table:

Now we can plot the results of the 50 simulations:

Transpiration and soil water storage of 50 simulations, with random variation of parameters ‘maxlai’ and ‘glmax’

Transpiration and soil water storage of 50 simulations, with random variation of parameters ‘maxlai’ and ‘glmax’

3 Options and parameters

The model control options (options.b90-argument in runLWFB90) let you select basic information about the simulation like start and end dates of the simulation (startdate, enddate), the radiation input (global radiation or sunshine duration, fornetrad), the precipitation interval (prec.interval), correction for evaporation bias of precipitation (prec.corr), and which water retention and hydraulic conductivity model to use (imodel, Mualem/van Genuchten or Clapp/Hornberger).

Aside from the basic technical information, the options control the basic shape of the annual course of leaf area index, which phenology model, and which root density depth distribution function to use. The interplay of options and parameters is shown briefly in the following paragraphs, by describing how options and parameters are passed from the options.b90 and param.b90 arguments to the individual functions that are called from within runLWFB90.

3.1 Aboveground vegetation characteristics

3.1.1 Intra-annual variation of leaf area index

In the simulation, we used the default parameters representing a deciduous forest stand, without leafs in winter and maximum leaf area index in summer. The maximum leaf area index is defined by the parameter param.b90$maxlai, the minimum value in winter is internally calculated as a fraction (param.b90$winlaifrac) of param.b90$maxlai. The basic shape of the intra-annual leaf area index dynamics can be selected by the option options.b90$lai.method. The default setting 'b90' is also implemented in the original LWF-BROOK90 GUI and makes use of the parameters budburstdoy, leaffalldoy, emergedur and leaffalldur, that define the dates of budburst and leaffall, and the durations of leaf unfolding and leaf shedding until maxlai, and respectively winlaifrac are reached. Within Run.B90(), the parameters are passed to MakeSeasLAI that constructs the daily timeseries of leaf area index development for a single year:

MakeSeasLAI() also provides other shape functions, that require additional parameters. For example, the model control option options.b90$lai.method = 'linear' uses value pairs of day-of-year and leaf area index as fraction of maxlai passed from parameters param.b90$lai.doy and param.b90$lai.frac. The doy/value-pairs are then used to interpolate the intra-annual course of leaf area index to a daily time series.

A third shape-option for the intra-annual variation of leaf area index is called ‘Coupmodel’ and uses the interpolation method as implemented in the ‘Coupmodel’ (Jansson and Karlberg 2004). With option.b90$lai.method ='Coupmodel, form parameters for leaf unfolding and leaf fall (shape.budburst, shape.leaffall), and the date when leaf area is at its maximum (shape.optdoy) come into action.

A plot of all three methods shows the roles of the different parameters:

Methods featured by MakeSeasLAI()

Methods featured by MakeSeasLAI()

3.1.2 Inter-annual variation of leaf area index

By passing a single value via param.b90$maxlai we used the same maximum leaf area index for each year of the simulation period. In order to incorporate between-year variation of the leaf area index, we can simply assign vectors of values for each year of the simulation period to any of the parameters used by function MakeSeasLAI(). In the following example, we pass three values for maxlai and shape.optdoy, to get different seasonal courses of leaf area index for the three years of the simulation period. Additionally, we add variation to the dates of budburst, by assigning a vector of values to the parameter budburstdoy.

Options and parameters affecting interannual variation of leaf area index.

Options and parameters affecting interannual variation of leaf area index.

Beside the obvious between-year variation of maximum leaf area index, we can also see the effect of the shape parameter for the leaf unfolding phase shape.budburst. Values greater 1 result in concave, values below 1 in convex functions, while values of 1 give linear progressions. The budburst day-of-year is varying as specified in the parameters, but can also be estimated using temperature based phenology models. By selecting other settings than the default options.b90$budburst.method = 'fixed' and options.b90$leaffall.method = 'fixed', the vegperiod() function of the ‘vegperiod’-Package is called from within Run.B90. budburstdoy and/or leaffalldoy are then calculated for each year from the climate data using the desired methods. See vegperiod for a list of available models. The estimated values for budburstdoy and/or leaffalldoy can be found in the param.b90 list element of the results object after the simulation.

3.1.3 Other plant properties (height, sai, densef)

Like the leaf area index parameters and budburst/leaffall-dates, it is also possible to provide vectors of values for stand height, stem area index, and stand density to generate between-year variation of stand characteristics. From the yearly values, daily values are interpolated using the function approx_standprop. The approx.method- argument of the function defines how to interpolate the yearly values passed by y. Within runLWFB90, the option options.b90$standprop.interp is passed to the approx.method- argument of approx_standprop. The default interpolation method ‘constant’ results in a yearly changing step function, while ‘linear’ interpolates the values:

For linear interpolation, additional parameters height.ini, sai.ini, densef.ini have to be provided to Run.B90 via the param.b90-argument. These parameters define the values at the beginning of the simulation, to which the value of the first year is interpolated to. By default, the yearly values are interpreted to be valid at December 31st of the respective years, so that the interpolated timeseries are linearly increasing or decreasing during the whole year. In order to constrain the interpolation to the growth period only, the option options.b90$standprop.use_growthperiod was introduced, which requires the arguments startdoy and enddoy, when set to TRUE. Then, values decrease or increase between budburst and leaffall only, and remain constant during winter.

A plot reveals the differences between the interpolated timeseries of stand height using the different options and parameters

Interpolated stand height derived from parameters using approx_standprop()

Interpolated stand height derived from parameters using approx_standprop()

Another option for incorporating between-year variation of plant properties is to provide a table with yearly values of ‘height’, ‘maxlai’, ‘sai’, ‘densef’ and ‘age’ via the list element standprop.table of the param.b90-argument of Run.B90. To take effect, the option options.b90$standprop.input has to be set to ‘table’. In this case, the values passed via parameters height, sai, densef and age.ini are ignored. As maxlai is also provided via the table, the maxlai value from parameters is ignored as well, while the other parameters that affect intra-annual leaf area development (e.g., shape.budburst) are still active. For demonstration purposes we use the table slb1_standprop, that contains observed stand data of the Solling Beech Experimental site from 1966 to 2014, along with estimated leaf and stem area index derived using allometric functions. For creating the daily timeseries of stand properties, we use the runLWFB90, and make use of the option to not run the model (run = FALSE), but only return the model input.

3.2 Root density depth distribution

The root depth density depth distribution can either be provided in the column rootden of the soil- argument of Run.B90(), or can be derived using the function MakeRelRootDens(). In order to use root density as specified in the soil data, the root.method element of the options.b90-list has to be set to ‘soilvar’. Other method names are passed to MakeRelRootDens(). Currently, the function provides four methods to assign values of relative root density to a vector of soil depths. The default method ‘betamodel’ uses the model of Gale & Grigal ((1987)), which is of the form \(y = 1- \beta^d\), where \(y\) is the cumulative root fraction down to soil depth \(d\) and \(\beta\) is the depth coefficient. Larger values of \(\beta\) correspond to a greater proportion of roots in deeper soil layers:

For larger values of \(\beta\), the root density will reach zero only in very deep soil layer. In order to set the root density to zero at any desired soil depth, the parameter maxrootdepth was defined. With this parameter, the root density is set to zero in all soil layers that lie deeper than maxrootdepth. Within Run.B90(), the function is called in the following way:

A second option to define the root distribution for the soil layers is to provide value pairs of soil depth and root density, that are interpolated to midpoints of the soil layers. The value pairs are passed from the rootden.table-entry of the parameter list to mrunLWFB90() As an example, we set up a hypothetical root density depth distribution:

A third option generates a linear root density depth distriution, with the maximum at the uppermost soil layer and a root density of 0 at ‘maxrootdepth’. If the parameter ‘relrootden’ is provided, the first element of the vector is used as the maximum, otherwise the interpolation is made between 0 and 1. The last option returns a uniform root distribution, with the first vector-element of ‘relrootden’ (if provided) as value for all layers down to ‘maxrootdepth’.

References

Federer, C. A. 2002. “BROOK 90: A Simulation Model for Evaporation, Soil Water, and Streamflow.” http://www.ecoshift.net/brook/brook90.htm.

Federer, C. A., C. Vörösmarty, and B. Fekete. 2003. “Sensitivity of Annual Evaporation to Soil and Root Properties in Two Models of Contrasting Complexity.” J. Hydrometeor 4 (6): 1276–90. https://doi.org/10.1175/1525-7541(2003)004<1276:SOAETS>2.0.CO;2.

Gale, M. R., and D. F. Grigal. 1987. “Vertical Root Distributions of Northern Tree Species in Relation to Successional Status.” Canadian Journal of Forest Research 17 (8): 829–34.

Genuchten, T. van. 1980. “A Closed-Form Equation for Predicting the Hydraulic Conductivity of Unsaturated Soils.” Soil Science Society of America Journal 44 (5): 892–98.

Hammel, Klaus, and Martin Kennel. 2001. Charakterisierung Und Analyse Der Wasserverfügbarkeit Und Des Wasserhaushalts von Waldstandorten in Bayern Mit Dem Simulationsmodell BROOK90. Vol. 185. Forstliche Forschungsberichte München.

Jansson, P.-E., and L. Karlberg. 2004. “Coupled Heat and Mass Transfer Model for Soil-Plant-Atmosphere Systems.” Stockholm: Royal Institute of Technolgy, Dept of Civil; Environmental Engineering Stockholm.

Mualem, Y. 1976. “A New Model for Predicting the Hydraulic Conductivity of Unsaturated Porous Media.” Water Resource Research 12: 513–22.

Wessolek, Gerd, Martin Kaupenjohann, and Manfred Renger. 2009. Bodenphysikalische Kennwerte Und Berechnungsverfahren Für Die Praxis. Bodenökologie Und Bodengenese 40. Berlin: Inst. für Ökologie, Fachgebiet Bodenkunde, Standortkunde und Bodenschutz.