import math
#variable declaration
Gf = 2; #guage factor
a = 100*10**6; #stress in N/m**2
E = 200*10**9; #elasticity of steel in N/m**2
#calculation
st = (a/float(E)); #strain
x = Gf*st; # change in guage resistance
p = (x)*100; #percentage change in resistance in %
#result
print"percentage change in resistance %1.1f"%p,"%";
import math
#variable declaration
D1 = 200*10**-3; # inlet horizontal venturimeter in m
D2 = 100*10**-3; #throat horizontal enturimeter in m
h = 220*10**-3; #pressure in m
Cd = 0.98; #coefficient of discharge
phg = 13.6; #specific gravity of mercury
p = 1000; #density of water in kg/m**3
g = 9.81; #gravitational constant
pw = 1; #density of water in kg/m**3
w = 9.81;
#calculation
x = (g)*(h)*(phg-pw)*1000; #differential pressure head in N/m**2
a = 1-((D2/float(D1))**4); #velocity approach factor
M = 1/(float(math.sqrt(a))); #velocity of approach
b = math.sqrt(((2*g)/(float(w*p)))*x);
A2 = (math.pi/float(4))*((D2)**2); #area in m**2
Q = Cd*M*A2*(b); #discharge through venturimeter in m**3/s
#result
print'water flow rate %3.4f'%Q,'m**3/s';
import math
#variable declaration
D1 = 400*10**-3; #diameter at inlet in m
D2 = 200*10**-3; #diameter at throat in m
y = 50*10**-3; #reading of differential manometer in m
Shl = 13.6; #specific gravity of mercury in U-tube
Sp = 0.7; #specific gravity of oil in U-tube
h = 0.92;
#bernoulli's equation
#p1/w +z1+V1**2=p2/w +z2+V2**2
#solving we get h+(V1**2/2*g)-(V2**2/2*g)=0
# calculations
A1 = (math.pi/float(4))*(D1**2); #area in m**2
A2 = (math.pi/4)*(D2**2); #area in m**2
a = A2/float(A1); #ratio of areas
#V1 = a*V2;
#h+(V1**2/2*g)*(1-(1/4))=0
V2 = math.sqrt((2*g*h)/(float(1-((a)**2))));
Q = A2*V2; #rate of oil flow in m**3/s
#result
print'rate of flow of oil %f'%Q,'m**3/s';
import math
#variable declaration
Q = 0.015; #rate of flow in m**3/s
D0 = 100*10**-3; #diameter orifice in m
D1 = 200*10**-3; #diameter of pipe in m
Cc = 0.6; #coefficient of contraction
Cd = 0.6; #coefficient of discharge
E = 1; #thermal expansion factor
g = 9.81; #gravitational constant
w = 9810;
#calculations
A0 = ((math.pi)/float(4))*(D0**2); #area in m**2
A1 = ((math.pi)/float(4))*(D1**2); #area in m**2
a = (Cc*A0)/(float(A1));
M = math.sqrt(1-((a)**2));
K = Cd/float(M);
x = ((Q/float(K*E*A0))**2);
dp = (x*w/float(2*g)); #difference in pressure head in N/m**2
#result
print'difference in pressure head %3.3f'%dp,'N/m**2';
import math
#variable declaration
C0 = 0.6; #coefficient of orifice
Cv = 0.97; #coefficient of discharge
Qv = 1.2; #flow rate in m**3/s
#calculations
Q0 = (C0/Cv)*Qv; #discharge through the orifice in m**3/s
#result
print'discharge through the orifice %3.3f'%Q0,'m**3/s'
import math
#variable declaration
Shl = 13.6; #specific gravity of mercury
Sl = 1.025; #specific gravity of sea water
y = 200*10**-3; #reading in m
g = 9.81; #constant
#calculation
x = Shl/float(Sl);
h = (y*((x)-1)); #head
V = math.sqrt(2*g*h); #velocity of submarine in km/h
#result
print'velocity of submarine %3.1f'%(V*(18/float(5))),'km/h';