from __future__ import division
import math
#Initializing the variables
L1 = 5;
L2 = 10;
d = 0.1;
f = 0.08;
Za_Zc = 4; #difference in height between A and C
g = 9.81 ;
Pa = 0;
Va = 0;
Za_Zb = -1.5;
V = 1.26;
rho = 1000;
#Calculations
D = 1.5 + 4*f*(L1+L2)/d ; # Denominator in case of v**2
v = (2*g*Za_Zc/D)**0.5;
Pb = rho*g*Za_Zb - rho*V**2/2*(1.5+4*f*L1/d);
print "Pressure in the pipe at B (kN/m2):",round(Pb/1000,2)
print "Mean Velocity at C (m/s) :",round(v,2)
from __future__ import division
import math
from sympy import symbols,solve
import sympy
#Initializing the variables
Za_Zb = 10;
f = 0.008;
L = 100;
d1 = 0.05;
g = 9.81;
d2 = 0.1;
#Calculations
def flowRate(d):
D = 1.5 + 4*f*L/d ; # Denominator in case of v1**2
A = math.pi*d**2/4;
v = (2*g*Za_Zb/D)**0.5;
z = A*v;
return z
Q1 = flowRate(d1);
Q2 = flowRate(d2);
Q=round(Q1+Q2,4)
D=symbols('D')
roots=solve(241212*D**5 -3.2, D)
dia=roots[0]
print "Rate flow for pipe 1 (m^3/s) :",round(Q1,4)
print "Rate flow for pipe 2 (m^3/s) :",round(Q2,4)
print "Combined Rate flow (m^3/s) :",round(Q,4)
print "Diameter of single equivalent pipe (mm) :",round(dia,3)*1000
from __future__ import division
import math
import sympy
from sympy import solve,symbols
#Initializing the variables
Za_Zb = 16;
Za_Zc = 24;
f = 0.01;
l1 = 120;
l2 = 60;
l3 = 40;
d1 = 0.12;
d2 = 0.075;
d3 = 0.060;
g = 9.81;
#Calculations
v1=symbols('v1')
ash=solve(v1-0.3906*(g-1.25*v1**2)**0.5-0.25*(17.657-1.5*v1**2)**0.5,v1)
v1=round(abs(ash[0]),2)
Q1=math.pi/4*d1**2*v1
v2=(g-1.25*v1**2)**0.5
Q2=math.pi/4*d2**2*v2
v3=(17.657-1.5*v1**2)**0.5
Q3=math.pi/4*d3**2*v3
print "Flow rate in pipe 1 (m^3/s):",round(Q1,4)
print "Flow rate in pipe 2 (m^3/s):",round(Q2,4)
print "Flow rate in pipe 3 (m^3/s):",round(Q3,4)
print "continuity condition satisfied as Q1=Q2+Q3"
from __future__ import division
import math
#Initializing the variables
D = 0.3;
Q = 0.8;
rho = 1.2;
f = 0.008;
L_entry = 10;
L_exit = 30;
Lt = 20*D #Transition may be represented by a separation loss equivalent length of 20 * the approach duct diameter
K_entry = 4;
K_exit = 10
l = 0.4; # length of cross section
b = 0.2; # width of cross section
#Calculations
A = math.pi*D**2/4;
Dp1 = 0.5*rho*Q**2/A**2*(K_entry + 4*f*(L_entry+Lt)/D);
area = l*b;
perimeter =2*(l+b);
m = area/perimeter;
Dp2 = 0.5*rho*Q**2/area**2*(K_exit + f*L_exit/m);
Dfan = Dp1+Dp2;
print "fan Pressure input (N/m2) :",round(Dfan,1)
from __future__ import division
import math
#Initializing the variables
D = [0.15 , 0.3];
rho = 1.2;
f = 0.008;
L_entry = 10;
L_exit = 20;
Lt = 20*D[1]
K = 4;
Q1 = 0.2;
#Calculations
Q2 = 4*Q1;
A=[0.0,0.0]
A[0] = math.pi*D[0]**2/4;
A[1] = math.pi*D[1]**2/4;
Dp1 = 0.5*rho*Q1**2/A[0]**2*(K + 4*f*L_entry/D[0]);
Dp2 = 0.5*rho*Q2**2/A[1]**2*(4*f*(L_exit + Lt)/D[1]);
Dfan = Dp1+Dp2;
print "fan Pressure input (N/m2) :",round(Dfan,2)
from __future__ import division
import math
from scipy.optimize import fsolve
#Initializing the variables
d = [0.1 , 0.125, 0.15, 0.1, 0.1 ]; # Corrosponding to AA1B AA2B BC CD CF
l = [30 , 30 , 60, 15, 30]; # Corrosponding to AA1B AA2B BC CD CF
rho = 1.2;
f = 0.006;
Ha = 100;
Hf = 60;
He = 40;
K = [0.0, 0.0, 0.0, 0.0, 0.0]
#Calculations
for i in range(0,len(l)):
K[i] = f*l[i]/(3*d[i]**5);
K_ab = K[0]*K[1]/((K[0])**0.5+(K[1])**0.5)**2;
K_ac = K_ab + K[2];
Hc = (K_ac*Hf +K[4]*Ha/4)/(K_ac+K[4]/4);
Q = ((Ha - Hc)/K_ac)**0.5;
def f(n):
z = He - Hc + (0.5*Q)**2 *(K[3]+(4000/n)**2);
return z
n = fsolve(f,1);
print "total Volume flow rate (m3/s):",round(Q, 4)
print "Head at C (m) :",round(Hc,2)
print "Percentage valve opening (%) :",round(n,2)