Running Topmodel

Introduction
Topmodel is a conceptual semi-distributed model developed for shallow, mountainous catchments. Despite being about 30 years old, it is still widely used. Nevertheless it is highly recommended to study the theory behind the model before applying it in any hydrological study. Some good resources are given in the references section below.

Important note
In its current stage, the model does very little checking of input data. Feeding the function with unrealistic parameter values, such as very small channel flows (<50 m / hour) are known to crash the underlying compiled libraries (and probably R with it). So be careful (and let me know any problems you come across)!

Packages and data
Topmodel is part of the topmodel package (duh!). A set of example data are available from a small mountainous catchment in the Ecuadorian Andes with the unpronouncable name Huagrahuma.

library(topmodel) data(huagrahuma) attach(huagrahuma)

Running the model
Topmodel needs the following parameters:


 * qs0 = Initial subsurface flow per unit area [m]
 * lnTe = log of the areal average of T0 [m2/h]
 * m = Model parameter [m]
 * Sr0 = Initial root zone storage deficit [m]
 * Srmax = Maximum root zone storage deficit [m]
 * td = Unsaturated zone time delay per unit storage deficit [h/m]
 * vch = channel flow outside the catchment catchment [m/h]
 * vr = channel flow inside catchment [m/h]
 * k0 = Surface hydraulic conductivity [m/h]
 * CD = capillary drive, see Morel-Seytoux and Khanji (1974) [m]
 * dt = The timestep [hours]

We need to construct a vector with the parameter values (the order is important):

parameters<-c(qs0,lnTe,m,Sr0,Srmax,td,vch,vr,k0,CD,dt)

(good values for the example catchment come with the Huagrahuma dataset)

Then the model is run with the inputs described above:

Qsim <- topmodel(parameters, topidx, delay, rain, ET0)

Special features

 * The model can be run with several parameter sets at the time. Then "parameters" should be a 2-dimensional matrix with a parameter set in each row.


 * The Nash-Sutcliffe efficiency is calculated directly when observed discharge ("Qobs") is passed to the function:

NS <- topmodel(parameters, topidx, delay, rain ,ET0, Qobs = Qobs)