import math
#Vairable Decleration
V=10#Volume of the bucket in Gal
r_in=1 #Radius of the hose in cm
r_e=0.4 #Radius of the hose at the nozzle exit in cm
t=50 #Time taken to fill the bucket in s
C_gl=3.7854 #Conversion factor gal to Lit
rho=1 #Denisty of water in kg/Lit
C_v=10**-3 #Conersion factor in m^3/lit
#Calculations
#Part (a)
V_dot=(V*C_gl)/t #Volume flow rate in Lit/s
m_dot=rho*V_dot #Mass flow rate in kg/s
#Part(b)
A_e=pi*r_e**2*10**-4 #Cross-Sectional Area of the nozzle at exit in m^2
V_e=(V_dot*C_v)/A_e #Average Velocity of water at nozzle exit in m/s
#Result
print "The Volume Flow rate is",round(V_dot,3),"L/s and the mass flow rate is",round(m_dot,3),"kg/s"
print "The area of cross section at nozzle exit is",round(A_e,5),"m^2"
print "The Average Velocity of water is",round(V_e,1),"m/s"
import math
#Variable Decleration
h_o=1.2 #Original Height in m
h_2=0.6 #Water level drop in m
g=9.81 #Acceleration due to gravity in m/s^2
D_tank=0.9 #Diameter of the tank in m
D_jet=0.013 #Diameter at the jet in m
#Calculations
#After carrying out the theroetical calculations and integration we arrive to obtain
t_min=((h_o**0.5-h_2**0.5)/((g/2)**0.5))*((D_tank/D_jet)**2) #Time required to reach a level 0.6m in s
t=t_min/60 #Converting time from sec to min
#Result
print "The time it takes to half empty the tank is",round(t,1),"min"
import math
##Note:The symbols in the textbook are cumbersome to code hence a different one has been used in this coding
#Variable Decleration
h=50 #Elevation difference in m
m_dot=5000 #Mass flow rate at which the water is to be supplied in kg/s
W_dot_out=1862 #Electric Power generated in kWh
n_generator=0.95 #Efficiency of the generator in fraction
g=9.81 #Acceleration due to gravity in m/s^2
C=10**-3 #Conversion factor in kJ/kg/m^2/s^2
#Calculations
#Part(a)
#Calling e_mech_in-e_mech_out as del_e for convienence
del_e=g*h*C #Change in water's mechanical energy per unit mass in kJ/kg
delta_E_fluid=m_dot*del_e # Change in energy of the fluid in kW
n_overall=W_dot_out/delta_E_fluid #Overall Efficiency in fraction
#Part(b)
n_turbine_gen=n_overall/n_generator #Mechanical efficiency os the turbine in fraction
#Part(c)
W_dot_shaft_out=n_turbine_gen*delta_E_fluid #Shaft power output in kW
#Result
print "The overall efficiency is",round(n_overall,2)
print "The mechanical efficiency of the turbine is",round(n_turbine_gen,1)
print "The shaft power output is",round(W_dot_shaft_out,1),"kW"
import math
#Variable Decleration
P1=400 #Pressure at upstream of the jet in kPa
g=9.81 #Acceleration due to gravity in m/s^2
rho=1000 #Density of water in kg/m^3
C1=1000 #Conversion factor in N/m^2.kPa
C2=1 #Conversion factor in kg.m/s^2.N
#Calculations
#Applying the Bernoulli Equation
z2=(P1*C1*C2)/(rho*g) #maximun height the water jet reaches in m
#Result
print "The water jet rises up to",round(z2,1),"m"
import math
#Variable Decleration
h=5 #Height at which the water tank is filled in m
g=9.81 #Acceleration due to gravity in m/s^2
#Calculations
z1=h #Decleration in terms of datum in m
#Applying the Bernoulli Equation
V2=(2*g*z1)**0.5 #Maximum velocity that the water jet can attain in m/s
#Result
print "The maximum velocity that the water jet can attain is",round(V2,1),"m/s"
import math
#Variable Decleration
P_atm=101.3 #Atmospheric pressure in kPa
g=9.81 #Acceleration due to gravity in m/s^2
rho=750 #Denisty of gasoline in kg/m^3
z1=0.75 #Location of point 2 w.r.t point 1
D=5*10**-3 #Diameter of the siphon pipe in m
V=4 #Volume of gasoline to be siphoned in Lit
z3=2.75 #Height of point 3 w.r.t to point 2 in m
C1=1 #conversion factor in N.s^2/kg.m
C2=10**-3 #Conversion factor in kPa.m^2/N
#Calculations
#Part (a)
#Applying the Bernoulli Equation
V2=(2*g*z1)**0.5 #Velocity in m/s
A=(pi*D**2)/4 #Cross-Sectional Area in m^2
V_dot=V2*A*1000#Volume flow rate in L/s
delta_t=V/V_dot #Time required to siphon gasoline in s
#Part(b)
#Applying Bernoulli Equations
P3=P_atm-(rho*g*z3*C1*C2) #Pressure at point 3 in kPa
#result
print "The time requires to siphon 4L gasoline is",round(delta_t,1),"s"
print "The pressure at point 3 is",round(P3,1),"kPa"
import math
#Variable Declerations
g=9.81 #Acceleration due to Gravity in m/s^2
h3=0.12 #Difference in level in m
#Calculations
#Applying Bernoulli Equations
V1=(2*g*h3)**0.5 #Velocity of Fluid in m/s
#Result
print "The velocity of fkuid is",round(V1,2),"m/s"
import math
#Variable Decleration
rho_hg=13600 #density of mercury in kg/m^3
rho_sw=1025 #density of sea-water in kg/m^3
rho_atm_air=1.2 #Density of air in kg/m^3
P_atm_air=762 #Atmospheric pressure 320km away from the eye in mm oh Hg
P_air=560 #Atmospheric pressure at the eye of the strom in mm og Hg
C=10**-3 #Conversion factor in m/mm
V_A=250 #Hurricane Wind Velocity in km/hr
C_k=1/3.6 #Conversion Factor from km/hr to m/s
g=9.81 #Acceleration due to gravity in m/s^2
#Calculations
#part(a)
h3=(rho_hg*(P_atm_air-P_air)*C)/rho_sw #Pressure difference in m
#Part(b)
#Applying Bernoulli Equations
h_air=(V_A**2*C_k**2)/(2*g) #Height of air column in m
rho_air=(P_air*rho_atm_air)/P_atm_air #Density of Air in the hurricane in kg/m^3
h_dynamic=(rho_air*h_air)/rho_sw #Sea-Water column equivalent to air-column in m
h2=h3+h_dynamic #Total storm surge at point 2 in m
#Result
print "The pressure difference between point's 1 and 3 in terms of sea-water column is",round(h3,2),"m"
print "The total Storm Surge at point2 is",round(h2,2),"m"
import math
#Variable Decleration
V_dot=50 #Volumetric Flow rate in L/s
rho=1 #Density of water
n_motor=0.9 #efficiency of the electric motor in fraction
W_dot_electric=15 #Power of the electric motor in kW
P2=300 #Absolute pressure at the outlet in kPa
P1=100 #Absolute pressure at the inlet in kPa
c=4.18 #Specific heat of water in kJ/kg C
#Calculations
#Part(a)
m_dot=rho*V_dot #Mass flow rate in kg/s
W_dot_pump=n_motor*W_dot_electric #Mechanical shaft power delivered in kW
delta_E_dot_mech_fluid=(m_dot*((P2-P1)/rho))/1000 #Increase in mechanical energy in kW
n_pump=delta_E_dot_mech_fluid/W_dot_pump #Efficiency in fraction
#part (b)
E_dot_loss=W_dot_pump-delta_E_dot_mech_fluid #Lost mechanical energy in kW
delta_T=(E_dot_loss)/(m_dot*c) #Temperature rise of water due to mechanical inefficiency in degree C
#Result
print "The Mechanical efficiency of the pump is",round(n_pump,3)
print "The temperature rise of water due to mechanical inefficiency is",round(delta_T,3),"Degree Centigrade"
import math
#Variable Decleration
V_dot=100 #Discharge through the power plant in m^3/s
rho=1000 #Density of water in kg/m^3
z1=120 #Elevation from which the water flows in m
h_l=35 #Elevation of point 2 in m
n_turbine_gen=0.8 #Overall efficiency of the generator in fraction
g=9.81 #Acceleration due to gravity in m/s^2
C=10**-3 #Conversion Factor
#Calculations
m_dot=rho*V_dot #mass flow rate through the turbine in kg/s
#Applying Bernoullis principle and taking point 2 as reference point z2=0
h_turbine=z1-h_l #extracted turbine head in m
W_dot_turbine=m_dot*g*h_turbine*C #Turbine Power in kW
W_dot_electric=C*n_turbine_gen*W_dot_turbine #Electrical Power Generated by the actual Unit in MW
#Result
print "The electrical Power generated is",round(W_dot_electric,1),"MW"
import math
#Variable Decleration
void_fraction=0.5 #Void Fraction
l=12 #Dimension of the fan in cm
w=40 #Dimension of the fan in cm
h=40 #Dimension of the fan in cm
delta_t=1 #time in s
rho=1.2 #Ddensity of air in kg/m^3
D=0.05 #Diameter of opening in the case in m
alpha2=1.1 #kinetic correction factor
n_fan=0.3 #Efficiency of the fan-motor
#Calculations
#Part(a)
V=void_fraction*l*w*h #Volume in cm^3
V_dot=(V/delta_t)*10**-6 #Volumetric flow rate in m^3/s
m_dot=rho*V_dot #mass flow rate in kg/s
A=(pi*D**2)/4 #Area of the opening is the case in m^2
#Notation has been changed to avoid conflict
Vel=V_dot/A #Velocity of the air thorught the opening in m/s
#Applying Bernoullis principle
W_dot_fan=m_dot*alpha2*Vel**2*0.5 #Work done in W
W_dot_electric=W_dot_fan/n_fan #Electric Work done in W
#Part(b)
#Applying Brnoullis principle
#Notation has been changed here
delta_P=(rho*W_dot_fan)/m_dot #Pressure rise across fan in Pa
#Result
print "Wattage of the fan to be purchased is",round(W_dot_electric,4),"W"
print "The pressure difference across the fan is",round(delta_P,1),"Pa"
import math
#Variable Decleration
W_shaft=5 #Shaft Power in kW
n_pump=0.72 #Efficiency of the pump in fraction
g=9.81 #Acceleration due to gravity in m/s^2
h_l=4 #Head loss in m
z2=25 #Datum in m
rho=1000 #Density of water in kg/m^3
#Calculations
W_dot_pump=n_pump*W_shaft #Useful mechanical power returned in kW
#Applying Bernoullis Principle
m_dot=(W_dot_pump/(g*(z2+h_l)))*1000 #mass floe rate in kg/s
V_dot=(m_dot/rho) #Volumetric flow rate in m^3/s
delta_P=W_dot_pump/V_dot #Pressure difference in kPa
#Result
print "Discharge of water is",round(V_dot,4),"m^3/s"
print "The pressure difference across the pump is",round(delta_P),"kPa"
#Answer in the coding is off by 1 kPa due to decimal point accuracy