RunModel_Lag.Rd 3.84 KB
Newer Older
1
2
3
\encoding{UTF-8}


4
5
\name{RunModel_Lag}
\alias{RunModel_Lag}
6
7


8
\title{Run with the Lag model}
9
10
11


\description{
12
Function which performs a single run for the Lag model over the test period.
13
14
15
16
}


\usage{
17
RunModel_Lag(InputsModel, RunOptions, Param)
18
19
20
21
}


\arguments{
22
\item{InputsModel}{[object of class \emph{InputsModel}] created with SD model inputs, see \code{\link{CreateInputsModel}} for details. The object should also contain a key \emph{OutputsModel} of class \code{\link{CreateInputsModel}} coming from the simulation of the downstream subcatchment runoff.}
23
24
25
26
27

\item{RunOptions}{[object of class \emph{RunOptions}] see \code{\link{CreateRunOptions}} for details}

\item{Param}{[numeric] vector of 1 parameter
  \tabular{ll}{
28
    Velocity \tab Mean flow velocity [m/s]
29
30
31
32
33
34
35
  }}
}


\value{
[list] see \code{\link{RunModel_GR4J}} or \code{\link{RunModel_CemaNeigeGR4J}} for details.

36
The list value contains an extra item named \code{QsimDown} which is a copy of \code{InputsModel$OutputsModel$Qsim}, a numeric series of simulated discharge [mm/time step] related to the runoff contribution of the downstream sub-catchment.
37
38
39
40
}


\examples{
41
42
43
44
#####################################################################
## Simulation of a reservoir with a purpose of low-flow mitigation ##
#####################################################################

45
## ---- preparation of the InputsModel object
46

47
## loading package and catchment data
48
library(airGR)
49
50
data(L0123001)

51
52
53
54
## the reservoir withdraws 1 m3/s when it's possible considering the flow observed in the basin
Qupstream <- matrix(-sapply(BasinObs$Qls / 1000 - 1, function(x) {
  min(1, max(0, x, na.rm = TRUE))
}), ncol = 1)
55

56
57
## except between July and September when the reservoir releases 3 m3/s for low-flow mitigation
month <- as.numeric(format(BasinObs$DatesR, "\%m"))
58
Qupstream[month >= 7 & month <= 9] <- 3
59
Qupstream <- Qupstream * 86400 ## Conversion in m3/day
60

61
## the reservoir is not an upstream subcachment: its areas is NA
62
63
BasinAreas <- c(NA, BasinInfo$BasinArea)

64
## delay time between the reservoir and the catchment outlet is 2 days and the distance is 150 km
65
LengthHydro <- 150000
66
67
68

InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR4J, DatesR = BasinObs$DatesR,
                                 Precip = BasinObs$P, PotEvap = BasinObs$E,
69
                                 Qupstream = Qupstream, LengthHydro = LengthHydro,
70
71
                                 BasinAreas = BasinAreas)

72

73
74
75
## ---- simulation of the basin with the reservoir influence

## run period selection
76
77
78
Ind_Run <- seq(which(format(BasinObs$DatesR, format = "\%Y-\%m-\%d")=="1990-01-01"),
               which(format(BasinObs$DatesR, format = "\%Y-\%m-\%d")=="1999-12-31"))

79
## creation of the RunOptions object
80
81
82
RunOptions <- CreateRunOptions(FUN_MOD = RunModel_GR4J,
                               InputsModel = InputsModel, IndPeriod_Run = Ind_Run)

83
## simulation of the runoff of the catchment with a GR4J model
84
85
86
87
Param <- c(X1 = 257.238, X2 = 1.012, X3 = 88.235, X4 = 2.208)
OutputsModelDown <- RunModel_GR4J(InputsModel = InputsModel,
                                  RunOptions = RunOptions, Param = Param)

88
89
## with a delay of 2 days for 150 km, the flow velocity is 75 km per day
Velocity <- (LengthHydro / 2) / 86400 ## Conversion m/day -> m/s
90

91
## add the output of the precipitation-runoff model in the InputsModel object
92
InputsModel$OutputsModel <- OutputsModelDown
93

94
## run the lag model which routes precipitation-runoff model and upstream flows
95
OutputsModel <- RunModel_Lag(InputsModel = InputsModel,
96
                             RunOptions = RunOptions, Param = Velocity)
97

98
## results preview of comparison between naturalised (observed) and influenced flow (simulated)
99
100
101
102
103
plot(OutputsModel, Qobs = OutputsModel$QsimDown)
}


\author{
104
Olivier Delaigue, David Dorchies, Guillaume Thirel
105
106
107
108
109
110
111
}


\seealso{
\code{\link{RunModel}}, \code{\link{CreateInputsModel}}, \code{\link{CreateRunOptions}}.
}