options(rmarkdown.html_vignette.check_title = FALSE)
knitr::opts_chunk$set(echo = TRUE, collapse = TRUE, comment = "#>")
library(RMODFLOW)

Boundary conditions are a inherent part of partial differential equations. In terms of groundwater flow modelling, they typically represent features that add fluxes to the system or specify constant head values. These features may vary in space and time. MODFLOW is quite flexible in the way it lets users define boundary conditions. There are multiple ways to 'group' boundary conditions (e.g. Dirichlet, Neumann, Cauchy types). For the purpose of the RMODFLOW API however, all MODFLOW boundary conditions can be placed in one of two groups:

This is similar to the way RMODFLOW handles input data (see also the vignette in input data structures), i.e. rmf_lists and rmf_arrays.

Some of the basic boundary condition packages in MODFLOW-2005 are (for an extensive overview of RMODFLOW supported packages, check out https://github.com/rogiersbart/RMODFLOW/wiki/Overview-of-supported-MODFLOW-packages):

The RCH & EVT packages represent spatially continuous data; the others discrete features.

Discrete boundary conditions

As with other packages, RMODFLOW can read in boundary condition packages with the appropriate rmf_read_* function:

dis <- rmf_example_file('water-supply-problem.dis') %>%
  rmf_read_dis()
riv <- rmf_example_file('water-supply-problem.riv') %>%
  rmf_read_riv(dis = dis)

The discrete boundary condition packages are lists with following elements:

str(riv)

Writing can be done with the appropriate rmf_write_* function:

rmf_write_riv(riv, dis = dis, file = 'input.riv')

Creating discrete boundary condition objects can be done by supplying rmf_list objects with the appropriate variables and kper argument to the rmf_create_* function:

riv_east <- data.frame(i = 1:dis$nrow, j = dis$ncol, k = 1, stage = 0, conductance = 0.02, rbot = -10) %>%
  rmf_create_list(kper = 1)

riv_west <- data.frame(i = 1:dis$nrow, j = 1, k = 1, stage = 0, conductance = 0.02, rbot = -10) %>%
  rmf_create_list(kper = 1)

riv_new <- rmf_create_riv(riv_east, riv_west, dis = dis)
str(riv_new)

As input, the rmf_create_* functions can either take one or more rmf_list objects (possibly of class rmf_parameter) or a single list with one or more rmf_list objects (possibly of class rmf_parameter). If no kper argument is set on any of the objects, RMODFLOW will throw an error:

riv_east <- data.frame(i = 1:dis$nrow, j = dis$ncol, k = 1, stage = 0, conductance = 0.02, rbot = -10) %>%
  rmf_create_list()

riv_new <- rmf_create_riv(riv_east, dis = dis)

Continuous boundary conditions

Similar to their discrete kin, continuous boundary condition packages can be read in through the appropriate rmf_read_* function and written with their rmf_write_* function. When reading a continuous boundary condition package that has been defined using MODFLOW parameters (see also the vignette on RMODFLOW parameters), a mlt and zon argument should often be specified.

# Currently, no example models with RCH or EVT packages

Creating continuous boundary condition packages can be done by supplying rmf_2d_array objects (possibly of class rmf_parameter) or a single list with rmf_2d_array objects (possibly of class rmf_parameter) to the rmf_create_* function. Similar to the discrete boundary conditions, a kper argument must be set on all objects:

dis <- rmf_create_dis(nper = 2)

rch_summer <- rmf_create_array(0.0002, dim = c(dis$nrow, dis$ncol), kper = 1)
rch_winter <- rmf_create_array(0.0003, dim = c(dis$nrow, dis$ncol), kper = 2)

rch <- rmf_create_rch(list(rch_summer, rch_winter), dis = dis)

The continuous boundary condition packages are lists with following elements:

str(rch)

Notice that for different stress-periods, the variables (e.g. recharge) are defined as separate rmf_2d_arrays with kper attributes rather than a single 3D array where the 3th dimension represents stress-periods.



rogiersbart/RMODFLOW documentation built on Jan. 14, 2023, 4:21 a.m.