2/18/2020 Exam 1 heat and mass
In [2]: from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import glob as gb
import time
from scipy.optimize import curve_fit
from scipy.optimize import fsolve
from scipy.optimize import minimize_scalar
from scipy.integrate import odeint, quad
from scipy.interpolate import interp1d
from scipy.misc import derivative
from sympy import *
init_printing() # for pretty output for symbolic math
from IPython.display import Image
import scipy.special as bsl
Problem 11
In [16]: thickness = 3.1*10**-3
r1 = 40*10**-3
r2 = r1+thickness
L = 976*10**-3
Pi = 20 * 100000 # Pa
Ti = 400 # C
xCO2 = .8
P2 = 1 * 100000 # Pa
T2 = 400
S = 3.80*10**-4 # mol/(m**3*Pa)
D = 12.6*10**-11 # m**2/s
In [18]: Ci = S*Pi
Co = S*P2
print(Ci)
print(Co)
R_tot = np.log(r1/r2)/(2*np.pi*D*L)
print (R_tot)
N = (Co-Ci) / R_tot
print (N, "mol/s")
g = N*3600*44 # mol/s * 3600 s/hr * 44 g/mol
print(g, "g/hr")
760.0
38.0
-96603311.52150452
7.47386387307518e-06 mol/s
1.1838600374951085 g/hr
Problem 12
In [19]: hh = 988
Th = 2288 + 273 # K
kbo = 10
Lbo = .01
Rcont = .006
kbr = .72
Lbr = .018
hc = 218
Tc = 24 + 273 # K
In [30]: A = 1 # assuming 1 m**2 area
R_conv1 = 1/(hh*A)
R_cond1 = Lbo/(kbo*A)
R_cont = Rcont
R_cond2 = Lbr/(kbr*A)
R_conv2 = 1/(hc*A)
R_tot = R_conv1+R_cond1+R_cont+R_cond2+R_conv2
print(R_tot)
q = (Th-Tc)/R_tot
print(q, "W/m**2")
T_s1 = (q*R_conv2 + Tc) - 273 # C
# T_s2 = -(q*R_conv1 - Th) - 273
print (T_s1, "C")
# print (T_s2)
0.0375993017122906
60213.88421849162 W/m**2
300.2104780664754 C
Problem 13
localhost:8888/nbconvert/html/Documents/BYU 2019/Untitled Folder/Exam 1 heat and mass.ipynb?download=false 1/2
2/18/2020 Exam 1 heat and mass
In [33]: T0 = -40 + 273 # K
q = -3.5*10**3
r0 = 2
k = 20
In [39]: C2 = T0 - (-q*r0**2) / (6*k)
def T(r):
return (-q*r**2)/(6*k) + C2
r = np.linspace (0, 2, 100)
plt.plot(r, T(r))
plt.show()
print (T(0) - 273, "C")
print (T(2) - 273, "C")
-156.66666666666669 C
-40.0 C
Problem 15
In [53]: k1 = 10**-6 # s**-1
H = 1730 # bar
Dab = .20*10**-8
L = 1.5
P_tot = 1 # bar
y_CO2 = 408*10**-6
P_CO2 = P_tot*y_CO2
x_CO2_0 = P_CO2 / H
print("mol fraction of CO2 at surface of pool:", x_CO2_0, "mol/m**3")
C_tot = 55.5 # mol/L
C_CO2_0 = C_tot * x_CO2_0
print ("concentration of CO2 at surface of pool:", C_CO2_0, "mol/m**3")
mol fraction of CO2 at surface of pool: 2.3583815028901734e-07 mol/m**3
concentration of CO2 at surface of pool: 1.3089017341040463e-05 mol/m**3
In [58]: m = (k1/Dab)**.5
def C_CO2(x):
C = C_CO2_0 * (np.cosh(m*(L-x))/np.cosh(m*L))
return C
print("Concentration of carbon dioxiade halfway between the surface and the bottome of the pool =", C_CO2(L/2), "mol/m**3")
x_all = np.linspace(0, L, 100)
plt.plot(x_all, C_CO2(x_all))
Concentration of carbon dioxiade halfway between the surface and the bottome of the pool = 6.816589867491887e-13 mol/m**3
Out[58]: [<matplotlib.lines.Line2D at 0x21dac52e048>]
In [61]: CO2_consumed = -k1 * quad(C_CO2, 0, L)[0] * 100 * 44.01
print(CO2_consumed)
-2.5761634215763216e-09
localhost:8888/nbconvert/html/Documents/BYU 2019/Untitled Folder/Exam 1 heat and mass.ipynb?download=false 2/2