You are on page 1of 2

Alangilan Campus

College of Engineering – Department of Civil Engineering

NAME: MAAC, ALLEN G.


SECTION: BSCE - 2103

Laboratory 4
Functions

DIRECTIONS:

Create a python program that calculates the water flow in a rectangular, concrete, open
channel, you can use Manning's equation, which relates the flow rate to the channel geometry, slope,
and Manning's roughness coefficient. The program must prompt the user to input the channel width,
channel depth, and Manning's roughness coefficient then and calculates the flow rate.
• Defines rectangular_channel_flow () function that implements Manning's equation for rec-
tangular channels.
• Defines main () function takes user input for channel width, depth, slope, and Manning's
roughness coefficient, calculates the flow rate using the defined rectangular_channel_flow ()
function, and then prints the result.

Use this formula


Geometry Calculations:

Calculate the cross-sectional area of the channel

cross_sectional_area=width×depth

Calculate the wetted perimeter of the channel:

wetted_perimeter=2×width+depth

Calculate the hydraulic radius:

hydraulic_radius= cross_sectional_area/ wetted_perimeter

Manning's Equation:

Use Manning's equation to calculate the flow rate:

Manning’s Equation

where:
Q is the flow rate,
n is Manning's roughness coefficient,
A is the cross-sectional area of the channel,
R is the hydraulic radius, and
S is the slope of the channel.

Alangilan, Batangas City, Philippines +63 43 425 - 0139 loc. 2121

www.batstate-u.edu.ph coe.alangilan@g.batstate-u.edu.ph
Alangilan Campus

College of Engineering – Department of Civil Engineering

• Loop for Repeated Calculation:


The script runs in a loop, allowing the user to determine the flow rate multiple times.
The user is prompted to enter 'y' to determine the flow rate again or 'n' to exit the loop.

EXAMPLE OUTPUT

Paste your code here…..

def main():
width = float(input("Enter the width (m): "))
depth = float(input("Enter the depth (m): "))
slope = float(input("Enter the slope: "))
coefficient = float(input("Enter the Manning's coefficient: "))
cross_sectional_area = width * depth
wetted_perimeter = 2 * width + depth
hydraulic_radius = cross_sectional_area / wetted_perimeter
flow_rate = 1/coefficient * cross_sectional_area * (hydraulic_radius**(2/3))
* (slope**(1/2))
print("The water flow rate in the channel is approximately ", flow_rate,
"cubic meters per second.")
again = input("Determine the flow rate again? Yes or No : ")
if again == "Yes":
return main()

def rectangular_channel_flow(flow_rate):
return flow_rate

main()

Alangilan, Batangas City, Philippines +63 43 425 - 0139 loc. 2121

www.batstate-u.edu.ph coe.alangilan@g.batstate-u.edu.ph

You might also like