import math
# Variables
V1 = 15. #ft**3/min volumetric flow rate
ft = 0.3048 #m relationship
min = 60. #secs relationship
# Calculation
V = V1*ft**3/min;
# Result
print "Volumetric flowrate = %.3e m**3/s"%V
D = 1000 #kg/m**3
M = V * D;
print "mass flowrate = %.3f kg/s"%M
# Variables
ft = 0.3048; #m
lb = 0.4536; #kg
# Calculation
P = ft*lb;
# Result
print "1 poundal is 1 ft*lb/s**2 = %.4f N"%P
# Variables
kgf = 9.80665; #N KGF
# Calculation and Result
cm = 10**-2; #m
P = kgf/cm**2;
print "1 kgf/cm**2 = %0.3e N/m**2"%P
lbf = 32.174; #lb*ft#s**2
lb = 0.4535924; #kg
ft = 0.3048; #m
in_ = 0.0254; #m
P1 = lbf*lb*ft/in_**2;
print "1 lbf/in**2 = %.2f N/m**2"%P1
# Variables
Q1 = 10000. #kJ/hr rate of heat transfer
kJ = 1000. #J
hr = 3600. #s
# Calculation
Q = Q1*kJ/hr; #J/s
print "Q = %.2f J/s"%Q
x = 0.1; #m
A = 1. #m**2
T = 800. #K
k = x*Q/(A*T);
# Result
print "thermal conductivity = %.3f W/(m*k)"%k
J = 1/4.1868 #cal
k1 = k*J*hr/1000
print "thermal conductivity = %.3F kcal/(h*m*C)"%k1
# note : answers may vary because of rounding off error.
# Variables
F = 300. #N weight of object
a = 9.81; #m/s**2 gravity
# Calculation
m = F/a; #kg
# Result
print "mass in kg = %.2f kg"%m
lb = 4.535924/10; #kG
m1 = m/lb
print "mass in pounds = %.2f LB"%m1
# Variables
z = 15. #m height
PE = 2000.; #J potential energy
g = 9.8067; #m/s**2
# Calculation
m = PE/(z*g);
# Result
print "mass = %.3f kg"%m
v = 50; #m/s
KE = 1./2*m*(v**2)/1000.;
print "kinetic energy = %.3f kj"%KE
# Variables
g = 9.81; #m/s**2 gravity
m = 100 * 0.4536; #kg weight
P = 101325.; #N/m**2 standard atomosphere
D1 = 4.; #inch
# Calculation
D = D1 * 2.54 * 10**-2; #m
A = 3.1415 * (D**2)/4; #m**2
F1 = P * A; #N
F2 = m * g; #N
F = F1 + F2;
# Result
print "Total force acting on the gas = %.2f N"%F
P1 = F / A; #N/m**2
P2 = P1/100000.; #bar
P3 = P1/(6.894757 * 10**3); #psi
print "Pressure in N/m**2 = %.3e N/m**2"%P1
print "Pressure in bar = %.3f bar"%P2
print "Pressure in psi = %.2f psi"%P3
d = 0.4; #m
W = F * d;
print "Work done = %.2f J"%W
PE = m * g * d;
print "Change in potential energy = %.2f J"%PE
# Variables
#kG = (6.7 * 10**-4) * (( G * (ds + dt) / ds)**0.8) / ((ds**0.4)*(dG**0.2))
#kG - lbmol/(h ft**2 atm), G - lb/(ft**2 h), ds, dG, dt - feet
#kG1 - kmol/(m**2 h atm), G1 - kg/(m**2 h), ds1, dG1, dt1 - m
G = 0.2048; #G1 * lb/(ft**2 h) velocity
d = 3.2808; #d1 * ft clearance between grids
ds = d; # clearance between grids
dt = d; # clearance between grids
dG = d; # clearance between grids
kG = 4.885; #kG1 (lbmol/(h ft**2 atm) = 4.885 * kmol/(m**2 h atm))
# Calculation
C = (6.7 * 10**-4) * (( G * d / ds)**0.8) / ((ds**0.4)*(dG**0.2))* kG;
# Result
print "Co-efficient = %.2e (kmol)(kg)**-0.8 (m)**0.2 (h)**-0.2 (atm)**-1"%C
# this is the constant for the equation
# the equation thus becomes,
# kG1 = C * (( G1 * (ds1 + dt1) / ds1)**0.8) / ((ds1**0.4)*(dG1**0.2))
from sympy import Symbol
# Variables
#Cp = 7.13 + 0.577 * (10**-3) * t + 0.0248 * (10**-6) * t**2
#Cp - Btu/lb-mol F, t - F
#Cp1 - kJ/kmol K , t1 - K
a = 7.13 # first term
b = 0.577 * 10**-3 # second term
c = 0.0248 * 10**-6 # third term
#t = 1.8 * t1 - 459.67
Cp = 4.1868; #Cp1 (Btu/lb-mol F = 4.1868 * (kJ/kmol K) )
t = Symbol('T')
#substituting the above, we get,
#Cp1 = 28.763 + 4.763 * (10**-3) * t1 + 0.3366 * (10**-6) * t**2
a1 = 28.763
# Calculation
b1 = 4.763 * (10**-3)
c1 = 0.3366 * (10**-6)
Cp = a1 + b1*t + c1*t**2
# Result
print "a1 = ",a1
print "b1 = ",b1
print "c1 = ",c1
# this are the co efficents for the following equation;
# Cp1 = a1 + b1 * t1 + c1 * (t1)**2
print "Equation Cp = ",Cp