265 lines
8.2 KiB
Text
265 lines
8.2 KiB
Text
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Exercice 3-11 from Borman\n",
|
|
"\n",
|
|
"## Two phase equilibrium\n",
|
|
"\n",
|
|
"Solid carbon reacts with steam at 1000 K and 1 atm to produce carbon monoxide and hydrogen.\n",
|
|
"\n",
|
|
"Find the equilibrium composition if the initial $C/O$ atom mole ratio is $1/1$ and the initial $C/H$ atom mole ratio $1/1$.\n",
|
|
"\n",
|
|
"The reaction is $C_{(s)} + H_2O = CO + H_2$ ."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Create multiphase mixture object"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"************ Phase ************\n",
|
|
"Moles: 1.0\n",
|
|
"\n",
|
|
" temperature 300 K\n",
|
|
" pressure 101325 Pa\n",
|
|
" density 0.0818891 kg/m^3\n",
|
|
" mean mol. weight 2.01588 amu\n",
|
|
"\n",
|
|
" 1 kg 1 kmol\n",
|
|
" ----------- ------------\n",
|
|
" enthalpy 26470 5.336e+04 J\n",
|
|
" internal energy -1.2109e+06 -2.441e+06 J\n",
|
|
" entropy 64914 1.309e+05 J/K\n",
|
|
" Gibbs function -1.9448e+07 -3.92e+07 J\n",
|
|
" heat capacity c_p 14312 2.885e+04 J/K\n",
|
|
" heat capacity c_v 10187 2.054e+04 J/K\n",
|
|
"\n",
|
|
" X Y Chem. Pot. / RT\n",
|
|
" ------------- ------------ ------------\n",
|
|
" H2 1 1 -15.7173\n",
|
|
" [ +2 minor] 0 0\n",
|
|
"\n",
|
|
"************ Phase graphite ************\n",
|
|
"Moles: 0.0\n",
|
|
"\n",
|
|
" graphite:\n",
|
|
"\n",
|
|
" temperature 300 K\n",
|
|
" pressure 101325 Pa\n",
|
|
" density 2160 kg/m^3\n",
|
|
" mean mol. weight 12.011 amu\n",
|
|
"\n",
|
|
" 1 kg 1 kmol\n",
|
|
" ----------- ------------\n",
|
|
" enthalpy 1318.4 1.584e+04 J\n",
|
|
" internal energy 1271.5 1.527e+04 J\n",
|
|
" entropy 481.8 5787 J/K\n",
|
|
" Gibbs function -1.4322e+05 -1.72e+06 J\n",
|
|
" heat capacity c_p 715.32 8592 J/K\n",
|
|
" heat capacity c_v 715.32 8592 J/K\n",
|
|
"\n",
|
|
" X Y Chem. Pot. / RT\n",
|
|
" ------------- ------------ ------------\n",
|
|
" C(gr) 1 1 -0.689657\n",
|
|
"\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"import cantera as ct\n",
|
|
"\n",
|
|
"# Get all of the Species objects defined in the GRI 3.0 mechanism\n",
|
|
"species = {}\n",
|
|
"for S in ct.Species.listFromFile('gri30.cti'):\n",
|
|
" species[S.name] = S\n",
|
|
"\n",
|
|
"# Create an IdealGas object with selected species\n",
|
|
"complete_species = []\n",
|
|
"for Sname in (str.split(' H2 CO H2O ')):\n",
|
|
" complete_species.append(species[Sname])\n",
|
|
"\n",
|
|
"steam = ct.Solution(thermo='IdealGas', species=complete_species)\n",
|
|
"\n",
|
|
"# Load Solid Carbon phase\n",
|
|
"carbon = ct.Solution('graphite.cti')\n",
|
|
"\n",
|
|
"# Create an Mixture object with gas and solid phases\n",
|
|
"mix = ct.Mixture([steam, carbon])\n",
|
|
"\n",
|
|
"mix()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Set Initial Condtion and Calculate Equilibrium"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"************ Phase ************\n",
|
|
"Moles: 2.797483219797536\n",
|
|
"\n",
|
|
" temperature 1000 K\n",
|
|
" pressure 101325 Pa\n",
|
|
" density 0.242227 kg/m^3\n",
|
|
" mean mol. weight 19.8765 amu\n",
|
|
"\n",
|
|
" 1 kg 1 kmol\n",
|
|
" ----------- ------------\n",
|
|
" enthalpy -3.3612e+06 -6.681e+07 J\n",
|
|
" internal energy -3.7795e+06 -7.512e+07 J\n",
|
|
" entropy 11162 2.219e+05 J/K\n",
|
|
" Gibbs function -1.4523e+07 -2.887e+08 J\n",
|
|
" heat capacity c_p 1655 3.29e+04 J/K\n",
|
|
" heat capacity c_v 1236.7 2.458e+04 J/K\n",
|
|
"\n",
|
|
" X Y Chem. Pot. / RT\n",
|
|
" ------------- ------------ ------------\n",
|
|
" H2 0.285072 0.028912 -18.7606\n",
|
|
" CO 0.642536 0.905474 -39.3365\n",
|
|
" H2O 0.0723925 0.0656136 -56.5747\n",
|
|
"\n",
|
|
"************ Phase graphite ************\n",
|
|
"Moles: 0.202516780202464\n",
|
|
"\n",
|
|
" graphite:\n",
|
|
"\n",
|
|
" temperature 1000 K\n",
|
|
" pressure 101325 Pa\n",
|
|
" density 2160 kg/m^3\n",
|
|
" mean mol. weight 12.011 amu\n",
|
|
"\n",
|
|
" 1 kg 1 kmol\n",
|
|
" ----------- ------------\n",
|
|
" enthalpy 9.8191e+05 1.179e+07 J\n",
|
|
" internal energy 9.8186e+05 1.179e+07 J\n",
|
|
" entropy 2035.8 2.445e+04 J/K\n",
|
|
" Gibbs function -1.0538e+06 -1.266e+07 J\n",
|
|
" heat capacity c_p 1800.4 2.162e+04 J/K\n",
|
|
" heat capacity c_v 1800.4 2.162e+04 J/K\n",
|
|
"\n",
|
|
" X Y Chem. Pot. / RT\n",
|
|
" ------------- ------------ ------------\n",
|
|
" C(gr) 1 1 -1.52238\n",
|
|
"\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"mix.species_moles = 'CO:2.0, H2:1.0'\n",
|
|
"mix.T = 1000\n",
|
|
"mix.P = ct.one_atm\n",
|
|
"mix.equilibrate('TP')\n",
|
|
"\n",
|
|
"mix()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Calculate Mole Fractions"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"['H2', 'CO', 'H2O', 'C(gr)']\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"print (mix.species_names)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"[0.26582774 0.59916107 0.06750559 0.06750559]\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"Xi = mix.species_moles / mix.species_moles.sum()\n",
|
|
"print (Xi)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"H2\t0.2658277399325119\n",
|
|
"CO\t0.5991610732658453\n",
|
|
"H2O\t0.06750559340082132\n",
|
|
"C(gr)\t0.06750559340082132\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"for tup in zip(mix.species_names, Xi):\n",
|
|
" print (\"{}\\t{}\".format(*tup))"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.7.3"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|