water_flow

.py

School

Brigham Young University, Idaho *

*We aren’t endorsed by this school

Course

111

Subject

Mechanical Engineering

Date

Apr 3, 2024

Type

py

Pages

3

Uploaded by BaronMonkey12666 on coursehero.com

def water_column_height(tower_height, tank_height): h = tower_height + (3 * tank_height) / 4 return h def pressure_gain_from_water_height(height): P = (998.2 * 9.80665 * height) / 1000 # Pressure in kilopascals return P def pressure_loss_from_pipe(diameter, length, friction_factor, velocity): pressure_loss = (-friction_factor * length * 998.2 * velocity**2) / (2000 * diameter) return pressure_loss def pressure_loss_from_fittings(fluid_velocity, quantity_fittings): """ Calculate the pressure loss from pipe fittings. Parameters: fluid_velocity (float): The velocity of the water flowing through the pipe in meters per second. quantity_fittings (int): The quantity of fittings in the pipeline. Returns: float: The pressure loss in kilopascals. """ # Calculate pressure loss pressure_loss_fitting = (-0.04 * 998.2 * fluid_velocity**2 * quantity_fittings) / 2000 return pressure_loss_fitting def reynolds_number(hydraulic_diameter, fluid_velocity): """ Calculate the Reynolds number for fluid flow in a pipe. Parameters: hydraulic_diameter (float): The hydraulic diameter of the pipe in meters. fluid_velocity (float): The velocity of the water flowing through the pipe in meters per second. Returns: float: The Reynolds number, a unitless ratio of inertial and viscous forces in the fluid. """ # Constants density_water = 998.2 # Density of water in kilograms per cubic meter dynamic_viscosity = 0.0010016 # Dynamic viscosity of water in Pascal seconds # Calculate Reynolds number reynolds_number = (density_water * hydraulic_diameter * fluid_velocity) / dynamic_viscosity return reynolds_number def pressure_loss_from_pipe_reduction(larger_diameter, fluid_velocity, reynolds_number, smaller_diameter):
""" Calculate the pressure loss due to water moving from a pipe with a large diameter into a smaller diameter pipe. Parameters: larger_diameter (float): The diameter of the larger pipe in meters. fluid_velocity (float): The velocity of the water flowing through the larger diameter pipe in meters per second. reynolds_number (float): The Reynolds number corresponding to the pipe with the larger diameter. smaller_diameter (float): The diameter of the smaller pipe in meters. Returns: float: The pressure loss in kilopascals. """ # Constants density_water = 998.2 # Density of water in kilograms per cubic meter # Calculate k constant k = (0.1 + 50 / reynolds_number) * ((larger_diameter / smaller_diameter)**4 - 1) # Calculate pressure loss pressure_loss = -k * density_water * fluid_velocity**2 / 2000 return pressure_loss PVC_SCHED80_INNER_DIAMETER = 0.28687 # (meters) 11.294 inches PVC_SCHED80_FRICTION_FACTOR = 0.013 # (unitless) SUPPLY_VELOCITY = 1.65 # (meters / second) HDPE_SDR11_INNER_DIAMETER = 0.048692 # (meters) 1.917 inches HDPE_SDR11_FRICTION_FACTOR = 0.018 # (unitless) HOUSEHOLD_VELOCITY = 1.75 # (meters / second) def main(): tower_height = float(input("Height of water tower (meters): ")) tank_height = float(input("Height of water tank walls (meters): ")) length1 = float(input("Length of supply pipe from tank to lot (meters): ")) quantity_angles = int(input("Number of 90° angles in supply pipe: ")) length2 = float(input("Length of pipe from supply to house (meters): ")) water_height = water_column_height(tower_height, tank_height) pressure = pressure_gain_from_water_height(water_height) diameter = PVC_SCHED80_INNER_DIAMETER friction = PVC_SCHED80_FRICTION_FACTOR velocity = SUPPLY_VELOCITY reynolds = reynolds_number(diameter, velocity) loss = pressure_loss_from_pipe(diameter, length1, friction, velocity) pressure += loss loss = pressure_loss_from_fittings(velocity, quantity_angles) pressure += loss loss = pressure_loss_from_pipe_reduction(diameter, velocity, reynolds, HDPE_SDR11_INNER_DIAMETER) pressure += loss
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help