Route a flood wave down a prismatic channel.
route_wave(So, n, Cm, g, B, SS, initial.condition, boundary.condition, downstream.condition, timestep, spacestep, numnodes, monitor.nodes, monitor.times, engine = c("Dynamic", "Kinematic"), scheme = c("MacCormack", "Lax"), boundary.type = c("QQ", "Qy", "yQ", "yy"))
So | Channel slope [\(L L^{-1}\)]. |
---|---|
n | Manning's roughness coefficient. |
Cm | Unit conversion coefficient for Manning's equation. For SI units, Cm = 1. |
g | Gravitational acceleration [\(L T^{-2}\)]. |
B | Channel bottom width [\(L\)]. |
SS | Channel sideslope [\(L L^{-1}\)]. |
initial.condition | The initial flow rate [\(L^3 T^{-1}\)], assumed constant throughout the channel. |
boundary.condition | Vector specifying the upstream boundary condition
for the full duration of the model. If |
downstream.condition | Only used if |
timestep | Temporal resolution of the model. Also the assumed time interval [\(T\)]
between elements of |
spacestep | the spatial resolution of the model, interpreted as the distance [\(L\)] between nodes in the model domain. The user is responsible for ensuring numerical stability. |
numnodes | The number of nodes used to discretize the channel. The total channel extent is
computed as |
monitor.nodes | the nodes to be monitored every time step. Specified as a vector of node
indices, with 1 being the upstream boundary and |
monitor.times | the time steps at which to monitor every node. Specified as a vector of
indices of |
engine | The engine to be used for routing the flood wave. May be either "Kinematic" or "Dynamic". |
scheme | Only used if |
boundary.type | Only used if |
data.frame with columns:
Time step.
Node index.
Time since start.
Downstream distance.
Flow rate.
Flow depth.
Flow velocity.
Flow area.
Row refers to a monitored node ("node") or timestep ("timestep").
Provides implementations of a Kinematic Wave Model (KWM) and a Dynamic Wave Model (DWM) with the choice of two numerical schemes. The MacCormack scheme is a second-order accurate predictor-corrector scheme that provides efficient flood wave routing. The Lax diffusive scheme can be used to obtain smooth solutions for problems with discontinuities in the boundary conditions, e.g. sudden gate closures. The DWM implementation uses the Method of Characteristics (MOC) to compute the flow regime at the model boundaries, and allows the user to specify boundaries in terms of depths and/or flows. the KWM implementation assumes the normal depth at the upstream boundary and is only first-order accurate.
# NOT RUN { # kinematic wave routing times = seq(0, 30000, by = 25) floodwave = ifelse(times >= 9000, 250, 250 + (750/pi)*(1 - cos(pi*times/(60*75)))) route_wave(0.001, 0.045, 1.486, 32.2, 100, 0, initial.condition = 250, boundary.condition = floodwave, timestep = 25, spacestep = 50, numnodes=301, monitor.nodes = c(1, 101, 201, 301), monitor.times = seq(1, length(times), by = 10), engine = "Kinematic") # dynamic wave routing with zero-gradient downstream condition using MacCormack scheme route_wave(0.001, 0.045, 1.486, 32.2, 100, 0, initial.condition = 250, boundary.condition = floodwave, downstream.condition = rep(-1, length(times)), timestep = 25, spacestep = 500, numnodes = 31, engine = "Dynamic", scheme = "MacCormack", monitor.nodes = c(1, 11, 21, 31), monitor.times = seq(1, length(times), by = 10)) # mixed boundary conditions (sudden gate closure) using Lax scheme lax = route_wave(0.00008, 0.013, 1, 9.81, 6.1, 1.5, initial.condition = 126, boundary.condition = rep(5.79, 2001), downstream.condition = rep(0, 2001), timestep = 1, spacestep = 10, numnodes = 501, monitor.nodes = c(1, 151, 251, 301, 501), monitor.times = c(1, 501, 1001, 1501, 2001), engine="Dynamic", scheme="Lax", boundary.type="yQ") # extract data for a monitored point require(dplyr) filter(lax, monitor.type == "node", node == 151) # }