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")
# Simplify with rSymPy
eqsimp <- sympy("expr = n*Q*(2*y*sqrt(1+m**2))**(2/3)-k*(m*y**2)**(5/3)*sqrt(Sf)")
# eqsimp is "Q*n - k*m*Sf**(1/2)*y**2"
# This is the equation that was used to solve for the missing variables
# Modified Exercise 4.1 from Sturm (page 153)
Manningtri(Q = 3000, m = 3, Sf = 0.002, n = 0.025, units = "Eng")
# Q = 3000 cfs, 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.1 from Sturm (page 153)
# See \\code{\\link[iemiscdata]{nchannel}} for the Manning's n table that the
# following example uses
# Use the maximum 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, 4] # 4 for column 4 - Maximum n
Manningtri(Q = 3000, m = 3, Sf = 0.002, n = n, units = "Eng")
# Q = 3000 cfs, m = 3, Sf = 0.002 ft/ft, n = 0.05, 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)
Manningtri(Q = 950, m = 2, Sf = 0.022, n = 0.023, units = "SI")
# Q = 950 m^3/s, 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
Run the code above in your browser using DataLab