# About the examples

The following examples only cover open channel flow problems using the Gauckler-Manning-Strickler equation (commonly called Manning’s equation) [Wikimedia] to calculate the missing parameters and the critical depth.

Other examples using the Gauckler-Manning-Strickler equation can be found in the iemisc vignette written by the author.

Note: If you wish to replicate the R code below, then you will need to copy and paste the following commands in R first (to make sure you have all the packages and their dependencies):

install.packages("install.load")
# install the install.load package

# install and/or load the packages and their dependencies

install.packages("import")
# install the import package

import::from(pracma, interp1)
# import interp1 from the pracma package

This document was created with rmarkdown 1.2 using the following:

• R 3.3.2 (2016-10-31)
• iemisc 0.9.7
• iemiscdata 0.6.1
• htmlTable 1.7
• rivr 1.2
• data.table 1.9.8

# 1) Solve for the missing values in the table below (Urroz):

install.load::load_package("data.table", "htmlTable")
# load needed packages using the load_package function from the install.load
# package (it is assumed that you have already installed these packages)

import::from(pracma, interp1)
# import interp1 from the pracma package

trap <- data.table(units = c("SI", "SI", "SI", "SI", "SI", "SI", "Eng", "Eng",
"Eng", "Eng", "Eng", "Eng"), Q = c(NA, 0.2, 0.25, 0.3, 0.35, 0.5, NA, 25,
50, 75, 100, 75), b = c(0.65, NA, 0, 0, 0, 0, 2, NA, 2.5, 1.5, 3.5, 5),
y = c(0.25, 0.1, NA, 0.25, 0.25, 0.1, 0.5, 0.75, NA, 1, 1.2, 1.1), m = c(1,
0, 1.5, NA, 1, 0, 1, 0, 1.5, NA, 1, 0), Sf = c(1e-05, 1e-04, 0.001,
5e-05, NA, 1e-04, 1e-05, 1e-04, 0.001, 5e-05, NA, 1e-04), n = c(0.01,
0.012, 0.015, 0.02, 0.008, NA, 0.01, 0.012, 0.015, 0.02, 0.008, NA))

htmlTable(trap, rnames = FALSE, align = "c", align.header = "c", caption = "Table of Cross-Section Values (Urroz)",
css.cell = "padding-left: 1em; padding-right: 1em;")
 units Q b y m Sf n Table of Cross-Section Values (Urroz) SI 0.65 0.25 1 1e-05 0.01 SI 0.2 0.1 0 1e-04 0.012 SI 0.25 0 1.5 0.001 0.015 SI 0.3 0 0.25 5e-05 0.02 SI 0.35 0 0.25 1 0.008 SI 0.5 0 0.1 0 1e-04 Eng 2 0.5 1 1e-05 0.01 Eng 25 0.75 0 1e-04 0.012 Eng 50 2.5 1.5 0.001 0.015 Eng 75 1.5 1 5e-05 0.02 Eng 100 3.5 1.2 1 0.008 Eng 75 5 1.1 0 1e-04
getvalues <- copy(trap)  # copy trap data.table

source("http://www.ecoccs.com/R_Examples/Manning.R")  # read in the Manning function

# changing column to numeric class obtain the name of the columns based on
# the column numbers
change_class <- names(getvalues[, 2:ncol(getvalues)])
for (col in change_class) set(getvalues, j = col, value = as.numeric(getvalues[[col]]))  # Source 1

values <- copy(getvalues)  # copy the getvalues data.table

values1 <- Manning(n = getvalues$n[1], m = getvalues$m[1], Sf = getvalues$Sf[1], y = getvalues$y[1], b = getvalues$b[1], units = getvalues$units[1])
##
## Flow is NOT in the rough turbulent zone so the Gauckler-Manning-Strickler equation is not acceptable to use.
##
##
## This is subcritical flow.
values2 <- Manning(n = getvalues$n[2], m = getvalues$m[2], Sf = getvalues$Sf[2], y = getvalues$y[2], Q = getvalues$Q[2], units = getvalues$units[2])
##
## Flow is NOT in the rough turbulent zone so the Gauckler-Manning-Strickler equation is not acceptable to use.
##
##
## This is subcritical flow.
values3 <- Manning(n = getvalues$n[3], m = getvalues$m[3], Sf = getvalues$Sf[3], Q = getvalues$Q[3], b = getvalues$b[3], units = getvalues$units[3])
##
## Flow is NOT in the rough turbulent zone so the Gauckler-Manning-Strickler equation is not acceptable to use.
##
##
## This is subcritical flow.
values4 <- Manning(n = getvalues$n[4], Q = getvalues$Q[4], Sf = getvalues$Sf[4], y = getvalues$y[4], b = getvalues$b[4], units = getvalues$units[4])
##
## Flow is NOT in the rough turbulent zone so the Gauckler-Manning-Strickler equation is not acceptable to use.
##
##
## This is subcritical flow.
values5 <- Manning(n = getvalues$n[5], m = getvalues$m[5], Q = getvalues$Q[5], y = getvalues$y[5], b = getvalues$b[5], units = getvalues$units[5])
##
## Flow is NOT in the rough turbulent zone so the Gauckler-Manning-Strickler equation is not acceptable to use.
##
##
## This is supercritical flow.
values6 <- Manning(Q = getvalues$Q[6], m = getvalues$m[6], Sf = getvalues$Sf[6], y = getvalues$y[6], b = getvalues$b[6], units = getvalues$units[6])
##
## This is supercritical flow.
values7 <- Manning(n = getvalues$n[7], m = getvalues$m[7], Sf = getvalues$Sf[7], y = getvalues$y[7], b = getvalues$b[7], units = getvalues$units[7])
##
## Flow IS in the rough turbulent zone so the Gauckler-Manning-Strickler equation is acceptable to use.
##
##
## This is subcritical flow.
values8 <- Manning(n = getvalues$n[8], m = getvalues$m[8], Sf = getvalues$Sf[8], y = getvalues$y[8], Q = getvalues$Q[8], units = getvalues$units[8])
##
## Flow IS in the rough turbulent zone so the Gauckler-Manning-Strickler equation is acceptable to use.
##
##
## This is subcritical flow.
values9 <- Manning(n = getvalues$n[9], m = getvalues$m[9], Sf = getvalues$Sf[9], Q = getvalues$Q[9], b = getvalues$b[9], units = getvalues$units[9])
##
## Flow IS in the rough turbulent zone so the Gauckler-Manning-Strickler equation is acceptable to use.
##
##
## This is subcritical flow.
values10 <- Manning(n = getvalues$n[10], Q = getvalues$Q[10], Sf = getvalues$Sf[10], y = getvalues$y[10], b = getvalues$b[10], units = getvalues$units[10])
##
## Flow IS in the rough turbulent zone so the Gauckler-Manning-Strickler equation is acceptable to use.
##
##
## This is subcritical flow.
values11 <- Manning(n = getvalues$n[11], m = getvalues$m[11], Q = getvalues$Q[11], y = getvalues$y[11], b = getvalues$b[11], units = getvalues$units[11])
##
## Flow IS in the rough turbulent zone so the Gauckler-Manning-Strickler equation is acceptable to use.
##
##
## This is supercritical flow.
values12 <- Manning(Q = getvalues$Q[12], m = getvalues$m[12], Sf = getvalues$Sf[12], y = getvalues$y[12], b = getvalues$b[12], units = getvalues$units[12])
##
## Flow IS in the rough turbulent zone so the Gauckler-Manning-Strickler equation is acceptable to use.
##
##
## This is supercritical flow.
values6 <- NA_real_

# change the row number in the data.table named values where there is a
# column with a NA to the first row in values1 to values12

# explanation of data.table syntax is below set(data.table name, i = row
# number, j = column number, value = value to replace with)

getvalues1 <- which(is.na(getvalues[1]))
set(values, i = 1L, j = getvalues1, value = values1[1])

getvalues2 <- which(is.na(getvalues[2]))
set(values, i = 2L, j = getvalues2, value = values2[1])

getvalues3 <- which(is.na(getvalues[3]))
set(values, i = 3L, j = getvalues3, value = values3[1])

getvalues4 <- which(is.na(getvalues[4]))
set(values, i = 4L, j = getvalues4, value = values4[1])

getvalues5 <- which(is.na(getvalues[5]))
set(values, i = 5L, j = getvalues5, value = values5[1])

getvalues6 <- which(is.na(getvalues[6]))
set(values, i = 6L, j = getvalues6, value = values6[1])

getvalues7 <- which(is.na(getvalues[7]))
set(values, i = 7L, j = getvalues7, value = values7[1])

getvalues8 <- which(is.na(getvalues[8]))
set(values, i = 8L, j = getvalues8, value = values8[1])

getvalues9 <- which(is.na(getvalues[9]))
set(values, i = 9L, j = getvalues9, value = values9[1])

getvalues10 <- which(is.na(getvalues[10]))
set(values, i = 10L, j = getvalues10, value = values10[1])

getvalues11 <- which(is.na(getvalues[11]))
set(values, i = 11L, j = getvalues11, value = values11[1])

getvalues12 <- which(is.na(getvalues[12]))
set(values, i = 12L, j = getvalues12, value = values12[1])

htmlTable(round(values[, 2:ncol(values)], digits = 3), rnames = FALSE, align = "c",
align.header = "c", caption = "Solved Table of Cross-Section Values (Urroz)",
css.cell = "padding-left: 1em; padding-right: 1em;")
 Q b y m Sf n Solved Table of Cross-Section Values (Urroz) 0.021 0.65 0.25 1 0 0.01 0.2 11.271 0.1 0 0 0.012 0.25 0 0.481 1.5 0.001 0.015 0.3 0 0.25 54.312 0 0.02 0.35 0 0.25 1 0.051 0.008 0.5 0 0.1 0 0 0.301 2 0.5 1 0 0.01 25 33.575 0.75 0 0 0.012 50 2.5 2.295 1.5 0.001 0.015 75 1.5 1 224.62 0 0.02 100 3.5 1.2 1 0.012 0.008 75 5 1.1 0 0 0.001

# 2) Problem 1 from Chadwick (page 623)

library(iemisc)

# a) What is the y (flow depth) for this trapezoidal cross-section?

y <- Manningtrap(Q = 21, b = 2, m = 1, n = 0.015, Sf = 2/1000, units = "SI")
##
## Flow IS in the rough turbulent zone so the Gauckler-Manning-Strickler equation is acceptable to use.
##
##
## This is subcritical flow.
# Q = 21 m^3/s, b = 2 m, m = 1 m/m, n = 0.015, Sf = 2/1000 m/m, units = SI
# units This will solve for y since it is missing and y will be in m

# Note: y (flow depth), velocity (V), area (A), wetted perimeter (P), R
# (hydraulic radius), Re (Reynolds number), and Fr (Froude number) are
# returned as an R list

y
## $y ## [1] 1.84915 ## ##$V
## [1] 2.950409
##
## $A ## [1] 7.117658 ## ##$P
## [1] 7.230187
##
## $R ## [1] 0.9844362 ## ##$Re
## [1] 2893.486
##
## $Fr ## [1] 0.8429969 # b) What is the y (flow depth) for this trapezoidal cross-section? y <- Manningtrap(Q = 95, b = 10, m = 2, n = 0.04, Sf = 1/1000, units = "SI") ## ## Flow IS in the rough turbulent zone so the Gauckler-Manning-Strickler equation is acceptable to use. ## ## ## This is subcritical flow. # Q = 95 m^3/s, b = 10 m, m = 2 m/m, n = 0.04, Sf = 1/1000 m/m, units = SI # units This will solve for y since it is missing and y will be in m # Note: y (flow depth), velocity (V), area (A), wetted perimeter (P), R # (hydraulic radius), Re (Reynolds number), and Fr (Froude number) are # returned as an R list y ##$y
## [1] 3.763681
##
## $V ## [1] 1.440105 ## ##$A
## [1] 65.9674
##
## $P ## [1] 26.83169 ## ##$R
## [1] 2.458563
##
## $Re ## [1] 3527.176 ## ##$Fr
## [1] 0.2834093

# 3) Problem 1 from Chadwick (page 623)

# load needed packages using the load_package function from the install.load
# package (it is assumed that you have already installed these packages)

# a) What is the y (flow depth) for this trapezoidal cross-section?

y <- Manningtrap(Q = 15, b = 5, m = 2, n = 0.035, Sf = 10/1000, units = "SI")
##
## Flow is NOT in the rough turbulent zone so the Gauckler-Manning-Strickler equation is not acceptable to use.
##
##
## This is subcritical flow.
# Q = 15 m^3/s, b = 5 m, m = 2 m/m, n = 0.035, Sf = 10/1000 m/m, units = SI
# units This will solve for y since it is missing and y will be in m

# Note: y (flow depth), velocity (V), area (A), wetted perimeter (P), R
# (hydraulic radius), Re (Reynolds number), and Fr (Froude number) are
# returned as an R list

y
## $y ## [1] 0.9539086 ## ##$V
## [1] 2.276374
##
## $A ## [1] 6.589426 ## ##$P
## [1] 9.266009
##
## $R ## [1] 0.7111396 ## ##$Re
## [1] 1612.687
##
## $Fr ## [1] 0.8407877 # What is the critical depth for this given discharge? critical_depth(15, y$y, 9.80665, 5, 2)
## [1] 0.860826
# b) What is the y (flow depth) for this trapezoidal cross-section?

y <- Manningtrap(Q = 15, b = 5, m = 2, n = 0.035, Sf = 50/1000, units = "SI")
##
## Flow is NOT in the rough turbulent zone so the Gauckler-Manning-Strickler equation is not acceptable to use.
##
##
## This is supercritical flow.
# Q = 15 m^3/s, b = 5 m, m = 2 m/m, n = 0.035, Sf = 50/1000 m/m, units = SI
# units This will solve for y since it is missing and y will be in m

# Note: y (flow depth), velocity (V), area (A), wetted perimeter (P), R
# (hydraulic radius), Re (Reynolds number), and Fr (Froude number) are
# returned as an R list

y
## $y ## [1] 0.6080206 ## ##$V
## [1] 3.968799
##
## $A ## [1] 3.779481 ## ##$P
## [1] 7.719151
##
## $R ## [1] 0.4896239 ## ##$Re
## [1] 1935.857
##
## $Fr ## [1] 1.777207 # What is the critical depth for this given discharge? critical_depth(15, y$y, 9.80665, 5, 2)
## [1] 0.860826

install.load::load_package("iemisc", "iemiscdata")
# load needed packages using the load_package function from the install.load
# package (it is assumed that you have already installed these packages)

# 4) Modified Practice Problem 14.42 from Mott (page 393)

# What is the y (flow depth) for this trapezoidal cross-section?

# See nchannel in the iemiscdata R package for the Manning's n table that
# the following example uses Use the normal Manning's n value for Natural
# streams - minor streams (top width at floodstage < 100 ft), Lined or
# Constructed Channels, Concrete, and trowel finish

# The 1st heading is 'Manning's n for Channels' The 2nd heading is 'Natural
# streams - minor streams (top width at floodstage < 100 ft)' The 3rd
# heading is 'Lined or Constructed Channels,' The 4th heading is 'Concrete'
# The 5th heading is 'trowel finish'

data(nchannel)
# load the data set nchannel from iemiscdata

nlocation <- grep("trowel finish", nchannel$"Type of Channel and Description") # search for the term 'trowel finish' in the 'Type of Channel and # Description' column in the nchannel data set nlocation ## [1] 69 n <- nchannel[nlocation, 3] # 3 for column 3 - Normal n # the value of n will be found in column 3 at the location specified by # nlocation n ## [1] 0.013 y <- Manningtrap(b = 3, m = 0.75, Q = 0.8, Sf = 0.1/100, n = n, units = "Eng") ## ## Flow IS in the rough turbulent zone so the Gauckler-Manning-Strickler equation is acceptable to use. ## ## ## This is subcritical flow. # b = 3.0 ft, m = 0.75 ft/ft, Q = 0.80 ft^3/s, Sf = 0.1 percent ft/ft, n = # 0.013, units = Eng units This will solve for Q since it is missing and Q # will be in ft^3/s # Note: y (flow depth), velocity (V), area (A), wetted perimeter (P), R # (hydraulic radius), Re (Reynolds number), and Fr (Froude number) are # returned as an R list y ##$y
## [1] 0.2120953
##
## $V ## [1] 1.193987 ## ##$A
## [1] 0.6700241
##
## $P ## [1] 3.530238 ## ##$R
## [1] 0.1897957
##
## $Re ## [1] 20164.62 ## ##$Fr
## [1] 0.4684352
# What is the critical depth for this given discharge?

critical_depth(0.8, y\$y, 9.80665 * (3937/1200), 3, 0.75)
## [1] 0.1288487

## Source used in the R code

Source 1
r - Convert column classes in data.table - Stack Overflow answered by Matt Dowle on Dec 27 2013. See http://stackoverflow.com/questions/7813578/convert-column-classes-in-data-table.

## Works Cited

Andrew Chadwick, John Morfett, and Martin Borthwick, Hydraulics in Civil and Environmental Engineering, Fourth Edition, New York City, New York: Spon Press, 2004, page 623.

Gilberto E. Urroz, Utah State University Civil and Environmental Engineering, CEE6510 - Numerical Methods in Civil Engineering, Spring 2006, Solving selected equations and systems of equations in hydraulics using Matlab, August/September 2004, http://ocw.usu.edu/Civil_and_Environmental_Engineering/Numerical_Methods_in_Civil_Engineering/.

Robert L. Mott and Joseph A. Untener, Applied Fluid Mechanics, Seventh Edition, New York City, New York: Pearson, 2015, page 376, 379-380.

Wikimedia Foundation, Inc. Wikipedia, 26 November 2015, “Manning formula”, https://en.wikipedia.org/wiki/Manning_formula.