library(iemisc)
library(iemiscdata)
# The equations used in this function were solved analytically after
# following these steps:
library(rSymPy) # review the package to determine its system dependencies
Q <- Var("Q")
n <- Var("n")
m <- Var("m")
k <- Var("k")
Sf <- Var("Sf")
y <- Var("y")
b <- Var("b")
# Simplify with rSymPy
eqsimp <- sympy("expr = n*Q*(b+2*y*sqrt(1+m**2))**(2/3)-k*(y*(b+m*y))**(5/3)*sqrt(Sf)")
# eqsimp is "Q*n - k*y*Sf**(1/2)*(b + m*y)"
# This is the equation that was used to solve for the missing variables
# Maxima (http://maxima.sourceforge.net) was used to solve for the variable
# y using the equation in eqsimp
# Exercise 4.1 from Sturm (page 153)
Manningtrap(Q = 3000, b = 40, m = 3, Sf = 0.002, n = 0.025, units = "Eng")
# Q = 3000 cfs, b = 40 ft, m = 3, Sf = 0.002 ft/ft, n = 0.025,
# units = English units
# This will solve for y since it is missing and y will be in ft
# Modified Exercise 4.5 from Sturm (page 154)
Manningtrap(Q = 950, b = 10, m = 2, Sf = 0.022, n = 0.023, units = "SI")
# Q = 950 m^3/s, b = 10 m, m = 2, Sf = 0.022 m/m, n = 0.023, units = SI
# units
# This will solve for y since it is missing and y will be in m
# Modified Exercise 4.5 from Sturm (page 154)
# See \\code{\\link[iemiscdata]{nchannel}} for the Manning's n table that the
# following example uses
# Use the minimum Manning's n value for 1) Natural streams - minor streams
# (top width at floodstage < 100 ft), 2) Mountain streams, no vegetation
# in channel, banks usually steep, trees and brush along banks submerged at
# high stages and 3) bottom: gravels, cobbles, and few boulders.
data(nchannel)
nlocation <- grep("bottom: gravels, cobbles, and few boulders",
nchannel$"Type of Channel and Description")
n <- nchannel[nlocation, 2] # 2 for column 2 - Minimum n
Manningtrap(Q = 950, b = 10, m = 2, Sf = 0.022, n = n, units = "SI")
# Q = 950 m^3/s, b = 10 m, m = 2, Sf = 0.022 m/m, n = 0.03, units = SI
# units
# This will solve for y since it is missing and y will be in m
Run the code above in your browser using DataLab