mech496-cantera/borman-exercise-3-10.ipynb
2019-09-19 16:50:14 +09:00

149 lines
4.6 KiB
Text

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Exercice 3-10 from Borman\n",
"\n",
"Consider the reaction of carbon with stoichiometric air to produce $CO_2$, $CO$, and $O_2$ at 2200 K and 2 atm pressure. \n",
"\n",
"How much $CO$ exists when the products are in equilibrium at 2200 K due to the dissociation of $CO_2$?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Create gas phase object"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" temperature 0.001 K\n",
" pressure 0.00412448 Pa\n",
" density 0.001 kg/m^3\n",
" mean mol. weight 2.01588 amu\n",
"\n",
" 1 kg 1 kmol\n",
" ----------- ------------\n",
" enthalpy -3.786e+06 -7.632e+06 J\n",
" internal energy -3.786e+06 -7.632e+06 J\n",
" entropy 6210.9 1.252e+04 J/K\n",
" Gibbs function -3.786e+06 -7.632e+06 J\n",
" heat capacity c_p 9669.2 1.949e+04 J/K\n",
" heat capacity c_v 5544.7 1.118e+04 J/K\n",
"\n",
" X Y Chem. Pot. / RT\n",
" ------------- ------------ ------------\n",
" H2 1 1 -917934\n",
" [ +4 minor] 0 0\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 O2 N2 CO2 CO ')):\n",
" complete_species.append(species[Sname])\n",
"\n",
"cair = ct.Solution(thermo='IdealGas', species=complete_species)\n",
"\n",
"cair()"
]
},
{
"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": [
"\n",
" temperature 2200 K\n",
" pressure 202650 Pa\n",
" density 0.345633 kg/m^3\n",
" mean mol. weight 31.1979 amu\n",
"\n",
" 1 kg 1 kmol\n",
" ----------- ------------\n",
" enthalpy -2.4656e+05 -7.692e+06 J\n",
" internal energy -8.3288e+05 -2.598e+07 J\n",
" entropy 8543.1 2.665e+05 J/K\n",
" Gibbs function -1.9041e+07 -5.941e+08 J\n",
" heat capacity c_p 1319.4 4.116e+04 J/K\n",
" heat capacity c_v 1052.9 3.285e+04 J/K\n",
"\n",
" X Y Chem. Pot. / RT\n",
" ------------- ------------ ------------\n",
" O2 0.00561358 0.00575768 -33.5984\n",
" N2 0.785482 0.705306 -26.8056\n",
" CO2 0.197678 0.278857 -54.6716\n",
" CO 0.0112272 0.0100801 -37.8724\n",
" [ +1 minor] 0 0\n",
"\n"
]
}
],
"source": [
"cair.X = 'N2:3.76, CO2:1.0'\n",
"cair.TP = (2200, ct.one_atm*2)\n",
"cair.equilibrate('TP')\n",
"cair()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"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
}