# ReFH analysis

## The `ReFH()` function

This quick guide provides an overview of how to generate a design hydrograph using the ReFH method. It is assumed that the reader has knowledge of the theory of the ReFH method; this guide is intended to demonstrate how to use the UKFE package rather than to explain the method.

The `ReFH()` function is designed for flexibility and each parameter of the model, along with the inputs and initial conditions, can be user-defined. By default, when catchment descriptors are provided, the ReFH function uses these descriptors to estimate the parameters of the ReFH model, and an estimate of the two-year rainfall for the critical duration. When catchment descriptors are applied, individual parameters and settings can still be adjusted by the user and these adjustments override the estimates from the catchment descriptors. Further details can be found in the function’s help file.

This function applies the ReFH model as specified by Kjeldsen (2007). The ReFH model has since been updated to address some of the limitations. The updated version(s), known as ReFH2, was developed by Wallingford Hydro Solutions (2019) and is available for a licence fee. Henceforth, the original model is denoted ReFH1, and the term ‘ReFH’ is used when the comment applies to the original and updated versions.

The ReFH outputs are commonly used only to derive a reasonable hydrograph shape. This shape is then scaled to match the peak flow estimate derived using other methods (usually FEH statistical methods). An example of doing this with the function is provided below. There is no automated way of doing so within the function but ReFH parameters can be calibrated using observed rainfall and data to replicate storm events.

Assumptions and limitations of the ReFH1 model are provided at the bottom after the example of how to derive a design hydrograph.

## Derive a design hydrograph using the ReFH method

In the following example, the ReFH() function is used to derive a design hydrograph, i.e., a hydrograph shape scaled to our design flood estimate (assuming the site to be ungauged). The default use of ReFH() with the catchment descriptors provides the rainfall-runoff outputs for an estimate of the two-year design rainfall event:

    library(UKFE)

    # Obtain catchment descriptors for NRFA gauge 55002
    CDs.55002 <- GetCDs(55002)

    # Obtain outputs of the ReFH model from catchment descriptors for a default 2-year
    # rainfall event
    ReFH(CDs.55002)

    #> [[1]]
    #>       AREA       TP        D      BR       BL     Cmax     Cini    BFini
    #> 1 1894.257 12.90487 28.77787 1.14785 63.50554 309.7927 138.5238 150.4984
    #>
    #> [[2]]
    #>    Rain NetRain Runoff Baseflow TotalFlow
    #> 1  0.28    0.13   0.00   150.50    150.50
    #> 2  0.34    0.15   0.13   148.15    148.28
    #> 3  0.41    0.19   0.55   145.84    146.39
    #> 4  0.50    0.23   1.31   143.58    144.89
    #> 5  0.61    0.28   2.50   141.37    143.87
    #> 6  0.74    0.34   4.21   139.22    143.43
    #> 7  0.90    0.41   6.55   137.14    143.69
    #> 8  1.09    0.50   9.66   135.14    144.80
    #> 9  1.32    0.61  13.71   133.24    146.96
    #> 10 1.60    0.75  18.92   131.45    150.37
    #> 11 1.93    0.92  25.52   129.80    155.32
    #> 12 2.32    1.12  33.84   128.30    162.15
    #> 13 2.78    1.36  44.26   127.00    171.26
    #> 14 3.29    1.64  57.21   125.93    183.14
    #> 15 3.61    1.84  73.01   125.13    198.13
    #> 16 3.29    1.71  91.92   124.65    216.57
    #> 17 2.78    1.48 113.92   124.55    238.47
    #> 18 2.32    1.25 138.51   124.87    263.37
    #> 19 1.93    1.06 165.05   125.64    290.69
    #> 20 1.60    0.88 192.95   126.89    319.83
    #> 21 1.32    0.74 221.58   128.62    350.21
    #> 22 1.09    0.61 250.36   130.84    381.21
    #> 23 0.90    0.51 278.67   133.54    412.21
    #> 24 0.74    0.42 305.86   136.70    442.56
    #> 25 0.61    0.35 331.23   140.28    471.51
    #> 26 0.50    0.29 354.02   144.23    498.26
    #> 27 0.41    0.24 373.36   148.50    521.86
    #> 28 0.34    0.20 388.31   153.01    541.32
    #> 29 0.28    0.16 398.07   157.67    555.74
    #> 30   NA      NA 402.57   162.39    564.96
    #> 31   NA      NA 402.26   167.07    569.33
    #> 32   NA      NA 397.76   171.63    569.39
    #> 33   NA      NA 389.79   176.01    565.80
    #> 34   NA      NA 378.97   180.15    559.12
    #> 35   NA      NA 365.88   184.02    549.90
    #> 36   NA      NA 351.02   187.57    538.59
    #> 37   NA      NA 334.84   190.79    525.63
    #> 38   NA      NA 317.75   193.66    511.41
    #> 39   NA      NA 300.13   196.17    496.31
    #> 40   NA      NA 282.36   198.33    480.69
    #> 41   NA      NA 264.79   200.14    464.93
    #> 42   NA      NA 247.72   201.61    449.32
    #> 43   NA      NA 231.24   202.75    433.99
    #> 44   NA      NA 215.59   203.59    419.18
    #> 45   NA      NA 200.83   204.14    404.97
    #> 46   NA      NA 186.81   204.43    391.23
    #> 47   NA      NA 173.41   204.46    377.87
    #> 48   NA      NA 160.54   204.26    364.81
    #> 49   NA      NA 148.18   203.84    352.02
    #> 50   NA      NA 136.26   203.21    339.47
    #> 51   NA      NA 124.75   202.37    327.12
    #> 52   NA      NA 113.61   201.35    314.95
    #> 53   NA      NA 102.82   200.14    302.96
    #> 54   NA      NA  92.39   198.76    291.15
    #> 55   NA      NA  82.32   197.23    279.54
    #> 56   NA      NA  72.64   195.53    268.17
    #> 57   NA      NA  63.33   193.70    257.03
    #> 58   NA      NA  54.43   191.73    246.16
    #> 59   NA      NA  46.03   189.63    235.66
    #> 60   NA      NA  38.24   187.42    225.67
    #> 61   NA      NA  31.19   185.12    216.31
    #> 62   NA      NA  25.03   182.73    207.76
    #> 63   NA      NA  19.85   180.28    200.13
    #> 64   NA      NA  15.57   177.78    193.35
    #> 65   NA      NA  12.06   175.25    187.31
    #> 66   NA      NA   9.21   172.70    181.91
    #> 67   NA      NA   6.91   170.15    177.06
    #> 68   NA      NA   5.08   167.60    172.68
    #> 69   NA      NA   3.63   165.06    168.69
    #> 70   NA      NA   2.51   162.53    165.04
    #> 71   NA      NA   1.65   160.03    161.68
    #> 72   NA      NA   1.01   157.56    158.57
    #> 73   NA      NA   0.56   155.11    155.67
    #> 74   NA      NA   0.26   152.69    152.95
    #> 75   NA      NA   0.08   150.31    150.39

The output that is printed to the console is a list with two elements. The first element is a data frame of parameters, initial conditions and the catchment area. The second is a data frame with the following columns: Rain, NetRain, Runoff, Baseflow and TotalFlow. A runoff hydrograph plot is also produced.

## Scaled ReFH hydrograph

To scale the hydrograph to the design flow estimate, the results from the ungauged pooling can be used (assuming this is for the ungauged case). We can use the estimate from the FEH statistical analysis vignette:

    # Create an ungauged pooling group for site 55002
    PoolUG.55002 <- Pool(CDs.55002, exclude = 55002)

    # Estimate QMED for site 55002 using catchment descriptors and two donor gauges
    CDsQmed.55002 <- QMED(CDs.55002, Don2 = c(55007, 55016))$QMEDs.adj

    # Estimate design flows using the above pooling group and QMED
    Results55002 <- PoolEst(PoolUG.55002, QMED = CDsQmed.55002)

The results are in the form of a list. The first element provides the return levels, and the 100-year flow estimate is in the seventh row in the second column. We’ll make it an object and use it to scale the hydrograph:

    # Extract the 100-year flow estimate
    Q100.55002 <- Results55002[[1]][7, 2]

    # Obtain outputs of the ReFH model from catchment descriptors for a default 2-year
    # rainfall, scaling to the 100-year peak flow estimate
    ReFH(CDs.55002, scaled = Q100.55002)

    #> [[1]]
    #>       AREA       TP        D      BR       BL     Cmax     Cini    BFini
    #> 1 1894.257 12.90487 28.77787 1.14785 63.50554 309.7927 138.5238 150.4984
    #>
    #> [[2]]
    #>  [1]  336.539  331.574  327.342  323.992  321.711  320.725  321.310  323.803
    #>  [9]  328.616  336.253  347.327  362.590  382.955  409.522  443.056  484.283
    #> [17]  533.253  588.944  650.036  715.201  783.115  852.437  921.772  989.630
    #> [25] 1054.377 1114.180 1166.956 1210.475 1242.724 1263.332 1273.110 1273.253
    #> [33] 1265.210 1250.287 1229.656 1204.369 1175.383 1143.587 1109.823 1074.910
    #> [41] 1039.660 1004.759  970.482  937.362  905.577  874.862  844.986  815.768
    #> [49]  787.178  759.111  731.495  704.286  677.469  651.061  625.105  599.674
    #> [57]  574.751  550.444  526.978  504.625  483.710  464.596  447.520  432.355
    #> [65]  418.854  406.784  395.938  386.134  377.219  369.060  361.546  354.585
    #> [73]  348.096  342.015  336.287

In this case, the second element of the output list in the console is a numeric vector containing the scaled hydrograph, instead of the results data frame.

## Exporting results

For use outside of ‘R’, these outputs can be saved as objects and then written to CSV files:

    # Save the ReFH design hydrograph to an object called 'DesignHydro.55002.unscaled'
    DesignHydro.55002.unscaled <- ReFH(CDs.55002)

    # Write to csv
    write.csv(DesignHydro.55002.unscaled, "my/file/path/DesHydro55002_unscaled.csv", row.names = FALSE)

    # Save the ReFH design hydrograph to an object called 'DesignHydro.55002.scaled'
    DesignHydro.55002.scaled <- ReFH(CDs.55002, scaled = Q100.55002)

    # Write to csv
    write.csv(DesignHydro.55002.scaled, "my/file/path/DesHydro55002_scaled.csv", row.names = FALSE)

Note in these examples that `row.names = FALSE` in the `write.csv()` function: our data has no row names, so this prevents an index column being added to the CSV.

## ReFH overview, assumptions and limitations

The ReFH model has three components that conceptualise the catchment process.

Model structure:

1. A loss model to account for hydrological processes such as evaporation, soil moisture storage, groundwater recharge and interception losses.
2. A unit hydrograph-based routing model to distribute the net rainwater over time at the catchment outlet (runoff).
3. A baseflow model which determines the proportion of the runoff which becomes baseflow recharge and specifies the exponential decay of the river flow once the net rainfall has been routed through the catchment outlet.

### Loss model

The loss model quantifies, for each timestep of rainfall, the proportion of the rain that is effective (the rain that forms the runoff hydrograph). It does so by assuming a maximum catchment soil moisture capacity in mm (Cmax) and an initial catchment soil moisture content in mm (Cini). The original ReFH report (Kjeldsen, 2007) suggests that the Cini / Cmax (Cini divided by Cmax) can be conceptualised as the initial proportion of the catchment that is saturated, and the initial rainfall on this saturated area will form the storm hydrograph. It is assumed that the proportion of rain becoming effective is the same as this saturated proportion.

As rainfall is added, catchment soil moisture increases and Cini / Cmax becomes Ct / Cmax, i.e. the soil moisture for the given timestep divided by the Cmax is the proportion of rain for each timestep which becomes effective.

### Runoff routing model (unit hydrograph)

The unit hydrograph (UH) model is a well-established method for routing effective rainfall to the catchment outlet (Sherman, 1932). There are a number of assumptions:

1. There is a direct proportional relationship between the effective rainfall and the surface runoff.
2. The property of superposition. That is, if two successive amounts of effective rainfall, then the surface runoff is the sum of the two associated unit hydrographs (the second one being ahead by one timestep).
3. The UH does not change over time.
4. The UH shape is the same for all catchments. Only the time to peak and the associated base of the UH changes between catchments.
5. The catchment rainfall is spatially homogeneous.
6. The rainfall in a given timestep has a constant intensity.

### Baseflow model

The baseflow model assumes that the saturated area of the catchment that produces surface runoff is the same area that also produces the baseflow recharge. The assumption is that the ratio of recharge to runoff is fixed (the BR parameter). A further parameter, baseflow lag (BL), ensures that the resulting baseflow hydrograph is lagged behind that of the runoff hydrograph (effectively providing a slow flow component). However, this baseflow model does not consider the volume of rainfall directly in the same way the unit hydrograph component does. The resulting baseflow hydrograph is in addition to the runoff hydrograph volume and is calculated as a proportion of it. This means that the volume of the total hydrograph minus initial baseflow is greater than the net/effective rainfall. For the most part, this is not a significant problem because it is assumed that some of the remaining volume of the rainfall makes up the difference. However, if the proportion of effective rainfall is closer to one, the volume of the hydrograph can be greater than the gross/total input of rainfall. This will almost certainly not happen unless the event duration is considerably longer than recommended and only in catchments with a high initial proportion of saturation (due to low BFIHOST and high PROPWET). Note that ReFH2 addresses this issue but is not available via UKFE.

## Use cases for the `ReFH()` function

There are three primary use cases:

1. A flexible tool to model the catchment response to event rainfall.
2. A tool for estimating the T-year flow as a function of the T-year rainfall.
3. To develop a plausible hydrograph shape for scaling to peak flow estimates (usually for the purposes of developing a model boundary).