Tutorial

1. Install from GitHub

if(!require("remotes")) { install.packages("remotes") }
remotes::install_github(repo = "KWB-R/kwb.hantush", dependencies = TRUE)

2. Using the package

2.1 Loading the package

library(kwb.hantush)
#> Loading required package: lattice

2.2 Model validation

For comparing the implementation of the Hantush equation, 1967 the results are compared to the USGS benchmark example (page 25). The results can be visualized with the following code:

### Comparision of R results to all 
### eight benchmark models in one plot
plotModelComparison()
#> Warning: 'rNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'wNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'rd' can not be computed: some elements in 'obs' are zero !
#> Warning: 'rNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'wNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'rd' can not be computed: some elements in 'obs' are zero !
#> Warning: 'rNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'wNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'rd' can not be computed: some elements in 'obs' are zero !
#> Warning: 'rNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'wNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'rd' can not be computed: some elements in 'obs' are zero !
#> Warning: 'rNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'wNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'rd' can not be computed: some elements in 'obs' are zero !


### Comparision of R results to all 
### eight benchmark models in multiple plots (one plot for each model)
plotModelComparison(layout=c(1,1))
#> Warning: 'rNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'wNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'rd' can not be computed: some elements in 'obs' are zero !
#> Warning: 'rNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'wNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'rd' can not be computed: some elements in 'obs' are zero !
#> Warning: 'rNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'wNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'rd' can not be computed: some elements in 'obs' are zero !
#> Warning: 'rNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'wNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'rd' can not be computed: some elements in 'obs' are zero !
#> Warning: 'rNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'wNSE' can not be computed: some elements in 'obs' are zero !
#> Warning: 'rd' can not be computed: some elements in 'obs' are zero !

3. How to perform model runs?

3.1 Model parameterisation

baseProps <- baseProperties( time = 2^(0:6), ## day, for 6 different times !
                             infiltrationRate = 1, ## meter / day
                             basinWidth = 10, ## meter
                             basinLength = 50, ## meter
                             horizConductivity = 10, ## meter / day
                             iniHead = 10, ## meter
                             specificYield = 0.2)

3.2 Running the model

res <- hantushDistancesBaseProps(baseProps = baseProps)
#> Calculating results for changed baseProperty 'time': 1.00000  ... Done!
#> Calculating results for changed baseProperty 'time': 2.00000  ... Done!
#> Calculating results for changed baseProperty 'time': 4.00000  ... Done!
#> Calculating results for changed baseProperty 'time': 8.00000  ... Done!
#> Calculating results for changed baseProperty 'time': 16.00000  ... Done!
#> Calculating results for changed baseProperty 'time': 32.00000  ... Done!
#> Calculating results for changed baseProperty 'time': 64.00000  ... Done!

3.3 Plotting the results

cols <- length(unique(res$dat[[res$changedBaseProp.Name]]))
mainTxt <- sprintf("Changed baseProperty: %s", res$changedBaseProp.Name)
xyplot(WLincrease ~ x,
       groups=res$dat[[res$changedBaseProp.Name]],
       data=res$dat,
       type="b",
       auto.key=list(columns=cols),
       main=mainTxt)