Integration of the reservoir connections into the model

The goal of this vignette is to add reservoirs connections to the Seine River model previously set up. A complete description of the reservoir system of the Seine River can be found in Dehay (2012)

Add connections to the reservoirs in the gauging station network

Because of the airGR SD model structure, the topology of the network will differ between the physical one and the modelled one.

For example, the physical topology of the Aube lake is represented below:

In the SD model, we do not model intermediate flows as well as the reservoir in the catchment. As a result, an equivalent topology compatible with airGR will be the one below:

AUBE_P2 will propagate negative flow to downstream (reservoir inflows) while AUBE_R3 will propagate positive flow to downstream (reservoir releases).

Configuration on lake Seine is similar:

which can be translate as:

Pannecière is an inline reservoir:

It can be modelled as:

With \(Q_{PANNEC\_P} = - Q_{CHAUM\_07}\) as all the upstream flow fills the reservoir.

Marne lake can be mapped as:

And can be modeled as:

Hence the topological connection to the reservoirs is described in the model as below:

reservoir_connections <- read.table(
  file = system.file("seine_data", "network_reservoir_connections.txt", package = "seinebasin"),
  sep = ";", header = TRUE
)
reservoir_connections
#>          id length     down
#> 1  AUBE-_P2  66500 ARCIS_24
#> 2  AUBE-_R3  44500 ARCIS_24
#> 3 MARNE_P23   3000 STDIZ_04
#> 4 MARNE_P28  82420 CHALO_21
#> 5 MARNE_R25  56870 CHALO_21
#> 6  PANNEC_P 153074 GURGY_02
#> 7  PANNEC_R 153074 GURGY_02
#> 8  SEINE_P7  73766 MERY-_22
#> 9  SEINE_R8  41766 MERY-_22

Reservoir connections are added to the GRiwrm object:

reservoir_connections$length <- reservoir_connections$length / 1000
reservoir_connections$model <- NA
reservoir_connections$area <- NA
load("_cache/V01.RData")
griwrm2 <- rbind(griwrm, reservoir_connections[, names(griwrm)])
plot(griwrm2)
#> NULL

Loading reservoir observation time series

Description of the files, the columns and the type of connection (inlet / outlet) are defined in the list below:

lCfgReservoirs <- jsonlite::read_json(system.file("seine_data", "config_reservoirs.json", package = "seinebasin"))
str(lCfgReservoirs)
#> List of 4
#>  $ Aube      :List of 2
#>   ..$ file       : chr "Obs_Aube_1987-2008.txt"
#>   ..$ connections:List of 2
#>   .. ..$ AUBE-_P2:List of 2
#>   .. .. ..$ col : chr "Q_prise_m3s"
#>   .. .. ..$ type: chr "in"
#>   .. ..$ AUBE-_R3:List of 2
#>   .. .. ..$ col : chr "Q_restitution_total_m3s"
#>   .. .. ..$ type: chr "out"
#>  $ Marne     :List of 2
#>   ..$ file       : chr "Obs_Marne_1973-2008.txt"
#>   ..$ connections:List of 3
#>   .. ..$ MARNE_P23:List of 2
#>   .. .. ..$ col : chr "Q_prise_Marne_m3s"
#>   .. .. ..$ type: chr "in"
#>   .. ..$ MARNE_P28:List of 2
#>   .. .. ..$ col : chr "Q_prise_Blaise_m3s"
#>   .. .. ..$ type: chr "in"
#>   .. ..$ MARNE_R25:List of 2
#>   .. .. ..$ col : chr "Q_restitution_total_m3s"
#>   .. .. ..$ type: chr "out"
#>  $ Panneciere:List of 2
#>   ..$ file       : chr "Obs_Panneciere_1949-2008.txt"
#>   ..$ connections:List of 1
#>   .. ..$ PANNEC_R:List of 2
#>   .. .. ..$ col : chr "Q_aval_bassin_m3s"
#>   .. .. ..$ type: chr "out"
#>  $ Seine     :List of 2
#>   ..$ file       : chr "Obs_Seine_1965-2008.txt"
#>   ..$ connections:List of 2
#>   .. ..$ SEINE_P7:List of 2
#>   .. .. ..$ col : chr "Q_prise_m3s"
#>   .. .. ..$ type: chr "in"
#>   .. ..$ SEINE_R8:List of 2
#>   .. .. ..$ col : chr "Q_restitution_total_m3s"
#>   .. .. ..$ type: chr "out"

Then, we load observation data for each reservoir and each connection:

library(seinebasin)
data(QNAT)
data(Qreservoirs)
Qnat <- cbind(Qnat, Qreservoirs)

How to handle online reservoir? The Pannecière lake case.

There are two possibilities:

  • truncate the system and only simulate the release of the reservoir if we only care about downstream flows
  • add a fictive inlet to the reservoir that will store all upstream discharge into the reservoir

If we know in advance the flow released by the reservoir, upstream flow informations is not usefull for the simulation. But reservoir management simulation would need upstream flow informations for simulating the reservoir state during simulation. The second alternative will be useful for the next phases.

Qnat <- cbind(Qnat, -Qnat[,"CHAUM_07"] * griwrm2$area[griwrm2$id == "CHAUM_07"] * 1e3)
colnames(Qnat)[ncol(Qnat)] <- "PANNEC_P"

Create the InputsModel object

InputsModel2 <- CreateInputsModel(griwrm2, DatesR, Precip, PotEvap, Qnat)
#> CreateInputsModel.GRiwrm: Treating sub-basin TRANN_01...
#> CreateInputsModel.GRiwrm: Treating sub-basin STDIZ_04...
#> CreateInputsModel.GRiwrm: Treating sub-basin BAR-S_06...
#> CreateInputsModel.GRiwrm: Treating sub-basin CHAUM_07...
#> CreateInputsModel.GRiwrm: Treating sub-basin CUSSY_08...
#> CreateInputsModel.GRiwrm: Treating sub-basin STGER_09...
#> CreateInputsModel.GRiwrm: Treating sub-basin GUILL_10...
#> CreateInputsModel.GRiwrm: Treating sub-basin AISY-_11...
#> CreateInputsModel.GRiwrm: Treating sub-basin EPISY_14...
#> CreateInputsModel.GRiwrm: Treating sub-basin MONTR_18...
#> CreateInputsModel.GRiwrm: Treating sub-basin LOUVE_19...
#> CreateInputsModel.GRiwrm: Treating sub-basin LASSI_20...
#> CreateInputsModel.GRiwrm: Treating sub-basin VITRY_25...
#> CreateInputsModel.GRiwrm: Treating sub-basin MERY-_22...
#> CreateInputsModel.GRiwrm: Treating sub-basin GURGY_02...
#> CreateInputsModel.GRiwrm: Treating sub-basin CHABL_12...
#> CreateInputsModel.GRiwrm: Treating sub-basin BRIEN_03...
#> CreateInputsModel.GRiwrm: Treating sub-basin ARCIS_24...
#> CreateInputsModel.GRiwrm: Treating sub-basin CHALO_21...
#> CreateInputsModel.GRiwrm: Treating sub-basin COURL_23...
#> CreateInputsModel.GRiwrm: Treating sub-basin NOISI_17...
#> CreateInputsModel.GRiwrm: Treating sub-basin NOGEN_13...
#> CreateInputsModel.GRiwrm: Treating sub-basin MONTE_15...
#> CreateInputsModel.GRiwrm: Treating sub-basin ALFOR_16...
#> CreateInputsModel.GRiwrm: Treating sub-basin PARIS_05...

Run simulation with naturalised flow parameters

Load calibration parameters

# Load RunOptions
load("_cache/V02.RData")
# Load calibrated parameters with Michel's method
load("_cache/V03.RData")

How to handle former upstream sub-basins with upstream flows ?

A lag parameter is now mandatory for these sub-basins. As no calibration is possible at that stage an arbitrary one will be used.

ParamMichel$STDIZ_04 <- c(1, ParamMichel$STDIZ_04)

Run simulation

OutputsModels2 <- RunModel(
  InputsModel2,
  RunOptions = RunOptions,
  Param = ParamMichel
)
#> RunModel.GRiwrmInputsModel: Treating sub-basin TRANN_01...
#> RunModel.GRiwrmInputsModel: Treating sub-basin STDIZ_04...
#> Warning in RunModel_Lag(InputsModel, RunOptions, Param[1], OutputsModel): 139
#> time steps with negative flow, set to zero.
#> RunModel.GRiwrmInputsModel: Treating sub-basin BAR-S_06...
#> RunModel.GRiwrmInputsModel: Treating sub-basin CHAUM_07...
#> RunModel.GRiwrmInputsModel: Treating sub-basin CUSSY_08...
#> RunModel.GRiwrmInputsModel: Treating sub-basin STGER_09...
#> RunModel.GRiwrmInputsModel: Treating sub-basin GUILL_10...
#> RunModel.GRiwrmInputsModel: Treating sub-basin AISY-_11...
#> RunModel.GRiwrmInputsModel: Treating sub-basin EPISY_14...
#> RunModel.GRiwrmInputsModel: Treating sub-basin MONTR_18...
#> RunModel.GRiwrmInputsModel: Treating sub-basin LOUVE_19...
#> RunModel.GRiwrmInputsModel: Treating sub-basin LASSI_20...
#> RunModel.GRiwrmInputsModel: Treating sub-basin VITRY_25...
#> RunModel.GRiwrmInputsModel: Treating sub-basin MERY-_22...
#> Warning in RunModel_Lag(InputsModel, RunOptions, Param[1], OutputsModel): 16
#> time steps with negative flow, set to zero.
#> RunModel.GRiwrmInputsModel: Treating sub-basin GURGY_02...
#> RunModel.GRiwrmInputsModel: Treating sub-basin CHABL_12...
#> RunModel.GRiwrmInputsModel: Treating sub-basin BRIEN_03...
#> RunModel.GRiwrmInputsModel: Treating sub-basin ARCIS_24...
#> RunModel.GRiwrmInputsModel: Treating sub-basin CHALO_21...
#> Warning in RunModel_Lag(InputsModel, RunOptions, Param[1], OutputsModel): 1 time
#> steps with negative flow, set to zero.
#> RunModel.GRiwrmInputsModel: Treating sub-basin COURL_23...
#> RunModel.GRiwrmInputsModel: Treating sub-basin NOISI_17...
#> RunModel.GRiwrmInputsModel: Treating sub-basin NOGEN_13...
#> RunModel.GRiwrmInputsModel: Treating sub-basin MONTE_15...
#> RunModel.GRiwrmInputsModel: Treating sub-basin ALFOR_16...
#> RunModel.GRiwrmInputsModel: Treating sub-basin PARIS_05...

Compare modelled flows with observed flows

Load observed flow

data(QOBS)

Save data for next vignettes

ReduceOutputsModel <- function(OutputsModels, IndPeriod) {
  items <- names(OutputsModels)
  OutputsModelsOut <- sapply(items, function(x) {OutputsModels[[x]] <- OutputsModels[[x]][IndPeriod]})
  OutputsModelsOut$StateEnd <- OutputsModels$StateEnd
  class(OutputsModelsOut) <- class(OutputsModels)
  return(OutputsModelsOut)
}

save(griwrm2, ReduceOutputsModel, file = "_cache/V04.RData")

Comparison with simulated flows

IndPeriod <- RunOptions[[1]]$IndPeriod_Run
IndPeriod <- IndPeriod[IndPeriod <= nrow(Qobs)]
htmltools::tagList(lapply(
  colnames(Qobs),
  function(x) {
    Q2 <- Qobs[IndPeriod,x]
    IndPeriod_Obs <- which(!is.na(Q2))
    OutputsModels <- ReduceOutputsModel(OutputsModels2[[x]], IndPeriod_Obs)
    plot(OutputsModels, Qobs = Q2[IndPeriod_Obs], main = x, which = c("Regime"))
  }
))

#> Warning in plot.OutputsModel(OutputsModels, Qobs = Q2[IndPeriod_Obs], main =
#> x, : zeroes detected in 'Qsim': some plots in the log space will not be created
#> using all time-steps

#> Warning in plot.OutputsModel(OutputsModels, Qobs = Q2[IndPeriod_Obs], main =
#> x, : zeroes detected in 'Qsim': some plots in the log space will not be created
#> using all time-steps

References

Dehay, F. 2012. “Etude de l’impact du changement climatique sur la gestion des lacs-réservoirs de la Seine.” Other, Diplôme d’ingénieur de l’ENGEES ,Strasbourg. https://hal.inrae.fr/hal-02597326.