knitr::opts_chunk$set(echo = TRUE)
The aim of this vignette is to run the simulation of the semi-distributed model of the Seine River with naturalized flows.
library(airGRiwrm)
It is necessary to run the vignette("01_First_network", package = "airGRiwrm")
before this one in order to create the Rdata file loaded below:
load("_cache/V01.RData")
GR4J parameters come from a calibration realized during the ClimAware project using naturalized flows.
library(seinebasin) data(ClimAwareParams) names(ClimAwareParams) <- c("id_sgl", "Tau0", "K0", "X1", "X2", "X3", "X4", "NashId") ClimAwareParams
The lag $\tau_0$ and routing $K_0$ parameters of TGR are expressed as time delay in hours corresponding to the delay time between the farthest upstream inlet and the outlet of the sub-basin. Almost all sub basins have a routing parameter equal to 0. The only exception is for La Marne à Noisiel (NOISI_17) that has a routing parameter that can be approximated to a single lag parameter equal to $\tau_0 + K_0$.
This lag parameter has to be converted in a speed in m/s used in the airGR lag model:
# Convert TGR routing parameter into speed params <- merge(griwrm, ClimAwareParams, by.x = "id", by.y = "id_sgl") ParamClimAware <- sapply(griwrm$id, function(id) { nodeParam <- ClimAwareParams[ClimAwareParams$id_sgl == id,] # Record hydrological model parameters Param <- unlist(nodeParam[c("X1", "X2", "X3", "X4")]) # Add lag model parameter if upstream nodes exist UpstrNodes <- which(griwrm$down == id & !is.na(griwrm$down)) if (length(UpstrNodes) > 0) { maxLength <- max(griwrm$length[UpstrNodes]) Param <- c( maxLength * 1000 / ((nodeParam$Tau0 + nodeParam$K0) * 3600), Param ) } return(Param) })
The CreateRunOptions()
function allows to prepare the options required by the RunModel()
function.
The user must at least define the following arguments:
IndPeriod_Run <- seq( which(InputsModel[[1]]$DatesR == (InputsModel[[1]]$DatesR[1] + 365*24*60*60)), # Set aside a one-year period for warm up length(InputsModel[[1]]$DatesR) # Until the end of the time series )
We define the (optional but recommended) warm up period as a one-year period before the run period:
IndPeriod_WarmUp <- seq(1, IndPeriod_Run[1] - 1)
RunOptions <- CreateRunOptions( InputsModel, IndPeriod_WarmUp = IndPeriod_WarmUp, IndPeriod_Run = IndPeriod_Run )
OutputsModelsClimAware <- RunModel( InputsModel, RunOptions = RunOptions, Param = ParamClimAware )
We plot the simulated discharges against the naturalized ones.
data(QNAT) plot(OutputsModelsClimAware, Qobs = Qnat[IndPeriod_Run,])
save(RunOptions, ParamClimAware, IndPeriod_Run, file = "_cache/V02.RData")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.