You are on page 1of 1

Product Team Enterprise Explore Marketplace Pricing Search Sign in Sign up

mjksill / CP213-online Public Notifications Fork 2 Star 1

Code Issues Pull requests Actions Projects Wiki Security Insights

master CP213-online / tutorials / tutorialS1_2.ipynb Go to file

mjksill update to tutorial 2 Latest commit 65bee52 on 10 Sep 2021 History

1 contributor

360 lines (360 sloc) 11.4 KB Raw Blame

CP213: Tutorial Notebook 2

Question 1
The pressure drop Δp of a fluid of density ρ and viscosity µ flowing at an mean velocity v through a pipe of diameter D and length L can be determined through an
equation relating the Reynolds number Re, which is defined as

Dρv
Re = ,
µ
and the friction factor f , which is defined as:

Δp D
f= .
2ρv2 L
For Re > 4000, where the fluid flow is turbulent, the friction factor and Reynolds number are related by the von K\'arm\'an-Nikuradse equation
1
= 4.0 log10 (Re√f) − 0.4.
√f

N. What is the pressure drop for water (with density 1000 kg m−3 and viscosity 10−3 Pa s) flowing with a mean velocity of 3 m s−1 across a 1 m length of pipe
with an inner diameter of 2 cm?

S. Plot the friction factor (on the y-axis) against the Reynolds number (on the x-axis) from Re = 4000 to 100000. Use a log scale for both the x- and y-axes.

V. For the system described in part 1, plot the pressure drop as a function of the mean velocity up to 5 m s−1 . Make sure you only include values of the velocity
where Re > 4000.

In [ ]:

Question 2
The ideal gas molar heat capacity can be represented by the Shomate equation, which is given by

Cp (T ) = A + Bt + Ct2 + Dt3 + Et−2

where t = T /1000, T is absolute temperature in kelvin, Cp is molar heat capacity in J mol−1 K−1 , and A, B, C, D, and E are constants.

The parameters of the Shomate equation for nitrogen are given below (taken from the NIST webbook):

Temperature / K 100. - 500. 500. - 2000. 2000. - 6000.

A 28.98641 19.50583 35.51872


B 1.853978 19.88705 1.128728
C −9.647459 −8.598535 −0.196103
D 16.63537 1.369784 0.014662
E 0.000117 0.527601 −4.553760

N. Create a function that takes the temperature as an argument and returns the corresponding value of the ideal gas molar heat capacity. Plot the ideal gas molar
heat capacity of nitrogen with temperature from 100 to 6000 K.

S. Using the relation:

T
H(T ) = H(T0 ) + ∫ dT ′ Cp (T ′ ),
T0

where H is the molar enthalpy, create a function that takes the temperature as an argument and returns the corresponding value of the ideal gas enthalpy. Take
the enthalpy at T = 298.15 K to be equal to zero. Plot the ideal gas enthalpy of nitrogen with temperature from 100 to 6000 K.

In [ ]:

Question 3
Evaluate the following integrals analytically (possibly with help from an integral table) and using sympy:

b
N. ∫ dx εx
a
b
S. ∫ dx (γ − εx)
z
b
V.
ε
∫ dx
a x2
b
[.
ε+x
∫ dx
a x2
b
\.
γ−x
∫ dx
a (ε − x)2
4
]. ∫ dx x ex Hint: use integration by parts.
1
1
^. ∫ dx 2x Hint: use substitution.
0

In [ ]:

Question 4
Consider the gas-water shift reaction

CO(g) + H2 O(g) ⇆ CO2 (g) + H2 (g)

gas Mw Hf Gf

g mol −1 kJ mol −1 kJ mol −1

CO(g) 28.01 −110.5 −137.2


CO 2 (g) 44.01 −393.3 −394.6
H 2 (g) 2.02 0.0 0.0
H 2 O(g) 18.02 −241.8 −228.4

The heat capacity of the gases can be described by the equation

Cp
= a0 + a1 T + a2 T 2 + a3 T 3 + a4 T 4
R
where T is the absolute temperature in kelvin, R = 8.314\,J−1 \,mol\,K−1 is the ideal gas constant, and the coefficients ak are given in the table below.

gas a 0 a 1 × 10 3 a 2 × 10 5 a 3 × 10 8 a 4 × 10 11

K −1 K −2 K −3 K −4

CO(g) 3.912 −3.913 1.182 −1.302 0.515


CO 2 (g) 3.259 1.356 1.502 −2.374 1.056
H 2 (g) 2.883 3.681 −0.772 0.692 −0.213
H 2 O(g) 4.395 −4.186 1.405 −1.564 0.632

The information in both tables have been summarized in the dictionary data . The stoichiometric coefficients (the stoichiometric coefficient for species k is
typically denoted by the symbol νk ) of the reaction are held in the dictionary nu . Note that product species have a positive stoichiometric coefficient, and reactant
species have a negative stoichiometric coefficient.

In what follows below, assume that the mixtures behave as an ideal gas.

In [1]:
R = 8.314e-3 # ideal gas constant / kJ mol^{-1} K^{-1}
T0 = 298.15 # reference temperature / K
p0 = 1.0e5 # reference pressure / Pa

data = {}
data['CO'] = {'Mw':28.01, 'Hf':-110.5, 'Gf':-137.2 }
data['CO2'] = {'Mw':44.01, 'Hf':-393.3, 'Gf':-394.6 }
data['H2'] = {'Mw': 2.02, 'Hf': 0.0, 'Gf': 0.0 }
data['H2O'] = {'Mw':18.02, 'Hf':-241.8, 'Gf':-228.4 }

data['CO'] ['Cp_coeff'] = [3.912, -3.913e-3, 1.182e-5, -1.302e-8, 0.515e-11]


data['CO2']['Cp_coeff'] = [3.259, 1.356e-3, 1.502e-5, -2.374e-8, 1.056e-11]
data['H2'] ['Cp_coeff'] = [2.883, 3.681e-3, -0.772e-5, 0.692e-8, -0.213e-11]
data['H2O']['Cp_coeff'] = [4.395, -4.186e-3, 1.405e-5, -1.564e-8, 0.632e-11]

nu = {}
nu['CO'] = -1.0
nu['CO2'] = 1.0
nu['H2'] = 1.0
nu['H2O'] = -1.0

Part 1: Enthalpy
The enthalpy can be determined from the heat capacity:

T
H(T ) = Hf + ∫ dT ′ Cp (T ′ )
T0

Task: Using the empirical form of the heat capacity that was provided above, create a function that takes the temperature and component mole numbers as input
and returns the total enthalpy of the mixture.

In [ ]:
import numpy as np
T_data = np.arange(100.0, 500.0)

moles = {'CO':1, 'CO2':2, 'H2O':0.5, 'H2':0.9}

def get_H(T, moles):


H = 0.0
# TODO <--- your work here
return H

H_data = [get_H(T, moles) for T in T_data]

import pylab as plt

plt.plot(T_data, H_data)
plt.ylabel(r'enthalpy / kJ')
plt.xlabel(r'temperature / K')

plt.show()

Part 2: Enthalpy of reaction


The enthalpy of reaction is given by

ΔHrxn (T ) = ∑ νk Hf,k (T ).
k

Task: Plot the enthalpy of reaction for the gas-water shift reaction as a function of temperature.

In [ ]:
import numpy as np
T_data = np.arange(100.0, 500.0)

H_data = # TODO <--- your work here

import pylab as plt

plt.plot(T_data, H_data)
plt.ylabel(r'$\Delta H_{\rm rxn}$ / kJ mol$^{-1}$')
plt.xlabel(r'temperature / K')

plt.show()

© 2022 GitHub, Inc. Terms Privacy Security Status Docs Contact GitHub Pricing API Training Blog About

You might also like