{ "metadata": { "name": "ch18_1", "signature": "sha256:32121f42f5b148741ef15da1993d191234c228c3ab7dcf05f69114fbe323a883" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 18 : Adiabatic Reaction Temperature" ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 18.1 Page Number : 650" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "\n", "import math \n", "from scipy.integrate import quad \n", "\n", "\n", "# Variables\n", "T_1 = 298.15;\t\t\t#[K] - standard reaction temperature\n", "T_2 = 500;\t\t\t#[K] - Reaction temperature\n", "P = 1;\t\t\t#[atm] - Pressure \n", "\n", "a_CO2 = 5.316;\n", "a_O2 = 6.085;\n", "a_N2 = 6.903;\n", "a_H2O = 7.700;\n", "a_C3H8 = -0.966;\n", "b_CO2 = 1.4285*10**(-2);\n", "b_O2 = 0.3631*10**(-2);\n", "b_N2 = -0.03753*10**(-2);\n", "b_H2O = 0.04594*10**(-2);\n", "b_C3H8 = 7.279*10**(-2);\n", "c_CO2 = -0.8362*10**(-5);\n", "c_O2 = -0.1709*10**(-5);\n", "c_N2 = 0.1930*10**(-5);\n", "c_H2O = 0.2521*10**(-5);\n", "c_C3H8 = -3.755*10**(-5);\n", "d_CO2 = 1.784*10**(-9);\n", "d_O2 = 0.3133*10**(-9);\n", "d_N2 = -0.6861*10**(-9);\n", "d_H2O = -0.8587*10**(-9);\n", "d_C3H8 = 7.580*10**(-9);\n", "\n", "\t\t\t# The smath.tan(math.radiansard enthalpy of formation at 298.15 K is given by\n", "delta_H_for_CO2 = -94.052;\t\t\t#[kcal/mol]\n", "delta_H_for_C3H8 = -24.820;\t\t\t#[kcal/mol]\n", "delta_H_for_H2O = -57.7979;\t\t\t#[kcal/mol]\n", "\n", "\t\t\t# The reaction with stoichiometric amount of air is\n", "\t\t\t# C3H8 + 5(O2 + 3.7N2) - 3CO2 + 4H2O + 18.8N2\n", "\n", "\t\t\t# The reaction with 100% excess air is\n", "\t\t\t# C3H8 + 10(O2 + 3.7N2) - 3CO2 + 4H2O + 5O2 + 37.6N2\n", "\n", "# Calculations\n", "\t\t\t# The smath.tan(math.radiansard enthalpy change of reaction at 298.15 K\n", "delta_H_rkn_298 = 3*delta_H_for_CO2 + 4*delta_H_for_H2O - delta_H_for_C3H8;\n", "\n", "\t\t\t# For exit stream\n", "sum_ai_ni = 3*a_CO2 + 4*a_H2O + 5*a_O2 + 37.6*a_N2;\n", "sum_bi_ni = 3*b_CO2 + 4*b_H2O + 5*b_O2 + 37.6*b_N2;\n", "sum_ci_ni = 3*c_CO2 + 4*c_H2O + 5*c_O2 + 37.6*c_N2;\n", "sum_di_ni = 3*d_CO2 + 4*d_H2O + 5*d_O2 + 37.6*d_N2;\n", "\n", "\n", "\t\t\t# To raise the exit species from 298.15 to 500 K the enthalpy change is\n", "\n", "def f1(T): \n", "\t return sum_ai_ni+sum_bi_ni*T+sum_ci_ni*T**(2)+sum_di_ni*T**(3)\n", "\n", "delta_H_rkn = quad(f1,T_1,T_2)[0]\n", "\n", "delta_H_rkn = delta_H_rkn*10**(-3);\t\t\t#[kcal]\n", "\n", "\t\t\t# Therefore per mole of fuel the heat exchange is\n", "\t\t\t# Q = Heat exchange in step 1 + Heat exchange in step 2\n", "Q = delta_H_rkn_298 + delta_H_rkn;\n", "\n", "# Results\n", "print \" The heat transfer from the combustion chamber per mole of fuel is %f kcal (per mol of C3H8)\"%(Q);\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " The heat transfer from the combustion chamber per mole of fuel is -415.328732 kcal (per mol of C3H8)\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 18.2 Page Number : 650" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "\n", "from scipy.optimize import fsolve \n", "\n", "# Variables\n", "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard reaction temperature\n", "\n", "a_CO2 = 5.316;\n", "a_H2O = 7.700;\n", "a_O2 = 6.085;\n", "a_C2H6 = 1.648;\n", "b_CO2 = 1.4285*10**(-2);\n", "b_H2O = 0.04595*10**(-2);\n", "b_O2 = 0.3631*10**(-2);\n", "b_C2H6 = 4.124*10**(-2);\n", "c_CO2 = -0.8362*10**(-5);\n", "c_H2O = 0.2521*10**(-5);\n", "c_O2 = -0.1709*10**(-5);\n", "c_C2H6 = -1.530*10**(-5);\n", "d_CO2 = 1.784*10**(-9);\n", "d_H2O = -0.8587*10**(-9);\n", "d_O2 = 0.3133*10**(-9);\n", "d_C2H6 = 1.740*10**(-9);\n", "\n", "\t\t\t# The stabdard enthalpy of formation at 298.15 K is given by\n", "delta_H_for_CO2 = -94.052;\t\t\t#[kcal/mol]\n", "delta_H_for_C2H6 = -20.236;\t\t\t#[kcal/mol]\n", "delta_H_for_H2O = -57.7979;\t\t\t#[kcal/mol]\n", "\n", "# Calculations\t\t\n", " \t# The reaction with stoichiometric amount of air is\n", "\t\t\t# C2H6 + (7/2)O2 - 2CO2 + 3H2O\n", "\n", "\t\t\t# The reaction with 4 mol of O2 and 10 mol CO2 is\n", "\t\t\t# C2H6 + 4O2 + 10CO2 - 12H2O + 3H2O + 0.5O2\n", "\t\t\t# The product consists of 12 mol of CO2, 3 mol of water vapour and 0.5 mol of oxygen\n", "delta_H_rkn_298 = 2*delta_H_for_CO2 + 3*delta_H_for_H2O - delta_H_for_C2H6;\t\t\t#[kcal]\n", "delta_H_rkn_298 = delta_H_rkn_298*10**(3);\t\t\t#[cal]\n", "\n", "\t\t\t# For exit stream\n", "sum_ai_ni = 12*a_CO2 + 3*a_H2O + 0.5*a_O2;\n", "sum_bi_ni = 12*b_CO2 + 3*b_H2O + 0.5*b_O2;\n", "sum_ci_ni = 12*c_CO2 + 3*c_H2O + 0.5*c_O2;\n", "sum_di_ni = 12*d_CO2 + 3*d_H2O + 0.5*d_O2;\n", "\n", "\t\t\t# From energy balance equation we get\n", "\t\t\t# delta_H_rkn_298 + sum_ai_ni*(T_2 - T_1) + (sum_bi_ni/2)*(T_2**(2) - T_1**(2)) + (sum_ci_ni/3)*(T_2**(3) - T_1**(3)) + (sum_di_ni/4)*(T_2**(4) - T_1**(4))\n", "\t\t\t# Solving above equation for T_2\n", "def f(T_2): \n", "\t return delta_H_rkn_298 +sum_ai_ni*(T_2-T_1)+(sum_bi_ni/2)*(T_2**(2)-T_1**(2))+(sum_ci_ni/3)*(T_2**(3)-T_1**(3))+(sum_di_ni/4)*(T_2**(4)-T_1**(4))\n", "T_2 = fsolve(f,-1)\n", "\n", "# Results\n", "print \" The adiabatic flame temperature is %f K\"%(T_2);\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " The adiabatic flame temperature is 2090.385277 K\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 18.3 Page Number : 651" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "# Variables\n", "T_1 = 298.15;\t\t\t#[K] - Standard reaction temperature\n", "\n", "\t\t\t# The reaction with theoritical air is\n", "\t\t\t# CH4 + 2(O2 + 3.76N2) - CO2 + 2H20 + 7.52N2\n", "\n", "# Calculations and Results\n", "\t\t\t#(1)\n", "n_product = (1 + 2 + 7.52);\t\t\t# Total number of moles of product\n", "\t\t\t# The mole fraction of water vapour is\n", "y_H2O = 2/(n_product);\n", "print \" 1).The mole fraction of water vapour is %f\"%(y_H2O);\n", "\n", "\t\t\t#(2)\n", "delta_H_rkn_298 = -730*10**(3);\t\t\t#[J/mol]\n", "C = 40;\t\t\t#[J/mol-K] - Average molar heat capacity\n", "\n", "\t\t\t# From energy balance we have\n", "\t\t\t# delta_H_rkn_298 + n_product*C(T_2 - T_1) = 0\n", "T_2 = - delta_H_rkn_298/(n_product*C) + T_1;\t\t\t#[K]\n", "T_max = T_2 - T_1;\n", "\n", "print \" 2).The maximum temperature rise of the exhaust gases is %f K\"%(T_max);\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " 1).The mole fraction of water vapour is 0.190114\n", " 2).The maximum temperature rise of the exhaust gases is 1734.790875 K\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 18.4 Page Number : 651" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "from scipy.optimize import fsolve \n", "\n", "\n", "# Variables\n", "T_1 = 298.15;\t\t\t#[K] - Standiansard reaction temperature\n", "\n", "\t\t\t# The standard enthalpy of formation at 298.15 K is given by\n", "delta_H_for_CO2 = -94.052;\t\t\t#[kcal/mol]\n", "delta_H_for_C8H18 = -59.780;\t\t\t#[kcal/mol]\n", "delta_H_for_H2O = -57.7979;\t\t\t#[kcal/mol]\n", "\n", "a_CO2 = 5.316;\n", "a_H2O = 7.700;\n", "a_N2 = 6.903;\n", "b_CO2 = 1.4285*10**(-2);\n", "b_H2O = 0.04595*10**(-2);\n", "b_N2 = -0.03753*10**(-2);\n", "c_CO2 = -0.8362*10**(-5);\n", "c_H2O = 0.2521*10**(-5);\n", "c_N2 = 0.1930*10**(-5);\n", "d_CO2 = 1.784*10**(-9);\n", "d_H2O = -0.8587*10**(-9);\n", "d_N2 = -0.6861*10**(-9);\n", "\n", "# Calculations and Results\n", "\t\t\t#(a)\n", "\t\t\t# The reaction with stoichiometric amount of air is\n", "\t\t\t# C3H18 + 12.5(O2 + 3.76N2) - 8CO2 + 9H2O + 47N2\n", "\n", "\t\t\t# The standard enthalpy change of reaction at 298.15 K is\n", "delta_H_rkn_298 = 8*delta_H_for_CO2 + 9*delta_H_for_H2O - delta_H_for_C8H18;\t\t\t#[kcal]\n", "delta_H_rkn_298 = delta_H_rkn_298*10**(3);\t\t\t#[cal]\n", "\n", "\t\t\t# For exit stream\n", "sum_ai_ni = 8*a_CO2 + 9*a_H2O + 47*a_N2;\n", "sum_bi_ni = 8*b_CO2 + 9*b_H2O + 47*b_N2;\n", "sum_ci_ni = 8*c_CO2 + 9*c_H2O + 47*c_N2;\n", "sum_di_ni = 8*d_CO2 + 9*d_H2O + 47*d_N2;\n", "\n", "\t\t\t# From energy balance equation we get\n", "\t\t\t# delta_H_rkn_298 + sum_ai_ni*(T_2 - T_1) + (sum_bi_ni/2)*(T_2**(2) - T_1**(2)) + (sum_ci_ni/3)*(T_2**(3) - T_1**(3)) + (sum_di_ni/4)*(T_2**(4) - T_1**(4))\n", "\t\t\t# Solving above equation for T_2\n", "def f(T_2): \n", "\t return delta_H_rkn_298 +sum_ai_ni*(T_2-T_1)+(sum_bi_ni/2)*(T_2**(2)-T_1**(2))+(sum_ci_ni/3)*(T_2**(3)-T_1**(3))+(sum_di_ni/4)*(T_2**(4)-T_1**(4))\n", "T_2 = fsolve(f,-1)\n", "\n", "print \" 1).The adiabatic flame temperature is %f K\"%(T_2);\n", "\n", "\t\t\t#(2)\n", "\t\t\t# The mean standard heat capacity of various components over the temperature range from 25 to 3000 C is \n", "Cp_CO2 = 13.91;\t\t\t#[cal/mol-K]\n", "Cp_H2O = 10.16;\t\t\t#[cal/mol-K]\n", "Cp_O2 = 7.88;\t\t\t#[cal/mol-K]\n", "Cp_N2 = 7.45;\t\t\t#[cal/mol-K]\n", "\n", "\t\t\t# From energy balance equation we get\n", "\t\t\t# delta_H_rkn_298 + (8*Cp_CO2 + 9*Cp_H2O + 47*Cp_N2)*(T_2_prime)\n", "T_2_prime = - delta_H_rkn_298/(8*Cp_CO2 + 9*Cp_H2O + 47*Cp_N2);\t\t\t#[K]\n", "print \" 2).The adiabatic flame temperature is %f K\"%(T_2_prime);\n", "\n", "# The answer is correct. Please calculate it manually. Wrong answer is given in book." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " 1).The adiabatic flame temperature is 2415.861178 K\n", " 2).The adiabatic flame temperature is 2193.675005 K\n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 18.5 Page Number : 652" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "# Variables\n", "\t\t\t# N2 + 3H2 - 2NH3\n", "T_1 = 700;\t\t\t#[K] - Reaction temperature\n", "Max_adia_rise = 100;\t\t\t#/[K] - Maximum adiabatic rise in temperature\n", "T_2 = T_1 + Max_adia_rise;\t\t\t#[K] - \n", "\n", "delta_H_rkn_700 = -94.2;\t\t\t#[kJ] - Smath.tan(math.radiansard enthalpy of reaction at 700 K\n", "delta_H_rkn_700 = delta_H_rkn_700*10**(3);\t\t\t#[J]\n", "\n", "\t\t\t# The mean standard heat capacity of various components over the temperature range from 700 to 800 K is \n", "Cp_N2 = 30.0;\t\t\t#[cal/mol-K]\n", "Cp_H2 = 28.9;\t\t\t#[cal/mol-K]\n", "Cp_NH3 = 49.2;\t\t\t#[cal/mol-K]\n", "\n", "# Calculations\t\t\t\n", " # The energy balance equation is\n", "\n", "def f46(T): \n", "\t return (sum_ni_Cpi_exit)*dT\n", "\n", "\t\t\t# X*delta_H_rkn_700 + quad(f46,T_1,T_2)[0]\n", "\n", "\n", "\t\t\t#At exit, let moles of NH3 = (1-X), moles of H2 = (3-3X), moles of NH3 = 2X . Therefore we have,\n", "\t\t\t# delta_H_rkn_700*X + {(1-X)*Cp_N2 + (3-3X)*Cp_H2 + (2X)*Cp_NH3}*(T_2 - T_1)\n", "\t\t\t# On simplification we get, 960.3*X = 116.7\n", "X = 116.7/960.3;\n", "\n", "# Results\n", "print \" The maximum allowable conversion fraction in the reactor is given by X = %f \"%(X);\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " The maximum allowable conversion fraction in the reactor is given by X = 0.121525 \n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 18.6 Page Number : 653" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "from scipy.optimize import fsolve \n", "import math \n", "from scipy.integrate import quad \n", "\n", "\n", "# Variables\n", "T_1 = 298.15;\t\t\t#[K] - standard reaction temperature\n", "V = 2.0*10**(-3);\t\t\t#[m**(3)] - Volume of calorimeter\n", "m = 10.;\t\t\t#[g] - Mass of liquid octane\n", "Mol_wt = 114.;\t\t\t#[g/mol] - Molecular weight of octane\n", "n = m/Mol_wt;\t\t\t#[mol] - No of moles of octane\n", "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", "\n", "\t\t\t# The standard enthalpy of formation at 298.15 K is given by\n", "delta_H_for_CO2 = -94.052;\t\t\t#[kcal/mol]\n", "delta_H_for_C8H18 = -59.780;\t\t\t#[kcal/mol]\n", "delta_H_for_H2O = -57.7979;\t\t\t#[kcal/mol]\n", "\n", "\t\t\t# The standard molar heat capacity of various components in high temperature range from is given by \n", "\t\t\t# Cp_H2O = 6.970 + 0.3464*10**(-2)*T - 0.04833*10**(-5)*T**(2);\n", "\t\t\t# Cp_O2 = 6.732 + 0.1505*10**(-2)*T - 0.01791*10**(-5)*T**(2);\n", "\t\t\t# Cp_CO2 = 18.036 - 4.474*10**(-5)*T - 158.08/(T**(1/2));\n", "\t\t\t# Therefore we have\n", "\t\t\t# Sum_ni_Cpi_exit = 249.09 + 0.04*T - 0.547*10**(-5)*T**(2) - 1264.64/(T**(1/2))\n", "\n", "\t\t\t# The reaction with stoichiometric amount of oxygen is\n", "\t\t\t# C8H18 + 12.5O2 - 8CO2 + 9H2O\n", "\n", "\t\t\t# The reaction with 50% excess oxygen is\n", "\t\t\t# C8H18 + 18.75O2 - 8CO2 +9H2O + 6.25O2\n", "\n", "# Calculations\n", "\t\t\t# The standard enthalpy change of reaction at 298.15 K is\n", "delta_H_rkn_298 = 8*delta_H_for_CO2 + 9*delta_H_for_H2O - delta_H_for_C8H18;\t\t\t#[kcal]\n", "delta_H_rkn_298 = delta_H_rkn_298*10**(3);\t\t\t#[cal]\n", "\n", "\t\t\t# From the energy balance equation we get\n", "\n", "def f10(T): \n", "\t return (sum_ni_Cpi_exit)*dT\n", "\n", "\t\t\t# delta_H_rkn_298 + quad(f10,T_1,T_2)[0]\n", "\n", "\t\t\t# delta_H_rkn_298 + 249.09*(T_2 - T_1) + (0.04/2)*(T_2**(2) - T_1**(2)) - ((0.547*10**(-5))/3)*(T_2**(3)-T_1**(3)) - (1264.64*2)*(T_2**(1/2)-T_1**(1/2))\n", "\t\t\t# Solving above equation for T_2\n", "def f(T_2): \n", "\t return delta_H_rkn_298 + 249.09*(T_2 - T_1) + (0.04/2)*(T_2**(2)-T_1**(2)) - ((0.547*10**(-5))/3)*(T_2**(3)-T_1**(3)) - (1264.64*2)*(T_2**(1./2)-T_1**(1./2))\n", "T_2 = fsolve(f,1000)\n", "\n", "\t\t\t# When 1 mol of octane reacts the final number of moles in the calorimeter is 23.25\n", "\t\t\t# When n mol of octane reacts the final number of moles in the calorimeter is\n", "n_total = n*23.25;\t\t\t#[mol]\n", "\n", "\t\t\n", "\t\t\t# Thus maximum explosion pressure is given by\n", "P = (n_total*R*T_2)/V;\t\t\t#[N/m**(2)]\n", "P = P*10**(-5);\t\t\t#[bar]\n", "\n", "# Results\n", "print \" The maximum explosion pressure inside the bomb calorimeter is %f bar\"%(P);\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " The maximum explosion pressure inside the bomb calorimeter is 397.138166 bar\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 18.7 Page Number : 656" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from scipy.optimize import fsolve\n", "import math\n", " \n", "\n", "# Variables\n", "T_1 = 400 + 273.15;\t\t\t#[K]\n", "\t\t\t# SO2(g) + 1./2*(O2) (g) - SO3 (g)\n", "\n", "a_SO2 = 6.157;\n", "a_SO3 = 3.918;\n", "a_O2 = 6.085;\n", "a_N2 = 6.903;\n", "b_SO2 = 1.384*10**(-2);\n", "b_SO3 = 3.483*10**(-2);\n", "b_O2 = 0.3631*10**(-2);\n", "b_N2 = -0.03753*10**(-2);\n", "c_SO2 = -0.9103*10**(-5);\n", "c_SO3 = -2.675*10**(-5);\n", "c_O2 = -0.01709*10**(-5);\n", "c_N2 = 0.1930;\n", "d_SO2 = 2.057*10**(-9);\n", "d_SO3 = 7.744*10**(-9);\n", "d_O2 = 0.3133*10**(-9);\n", "d_N2 = -0.6861*10**(-9);\n", "\n", "# Calculations\n", "\t\t\t# At 400 C, from the given math.expressions\n", "delta_H_rkn_T_1 = -22630.14 - 5.2815*T_1 + 0.9587*10**(-2)*T_1**(2) - 0.5598*10**(-5)*T_1**(3) + 1.3826*10**(-9)*T_1**(4);\t\t\t#[cal]\n", "\n", "\t\t\t# delta_H_rkn_T_X (for X moles of SO2 reacted) = delta_H_rkn_T_1*X\n", "\n", "\t\t\t# Let the number of moles at equilibrium be\n", "\t\t\t# n_O2 = 9-0.5*X\n", "\t\t\t# n_SO2 = 12-X\n", "\t\t\t# n_SO3 = X\n", "\t\t\t# n_N2 = 79\n", "\t\t\t# Total moles at equilibrium = 100-0.5X\n", "\t\t\t# Ky = y_SO3/(y_SO2*y_O2**(1./2))\n", "\t\t\t# Ky = (X*(100-0.5*X)**(1./2))/((12-X)*(9-0.5*X)**(1./2))\n", "\t\t\t# We know that K = Ky*Kp. Since P = 1 atm, therefore Ky = K\n", "\n", "\t\t\t# Now we have to account for the heat required to raise 9-0.5*X mol of O2, 12-X mol of SO2, X mol of SO3 and 79 mol of N2 from T to ART\n", "\t\t\t# sum_ni_Cp_i = (12-X)*(a + b*T + c*T**(2) + d*T**(3)) + (9-0.5*X)*(a + b*T + c*T**(2) + d*T**(3)) + X*(a + b*T + c*T**(2) + d*T**(3)) + 79*(a + b*T + c*T** (2) + d*T**(3))\n", "\n", "\t\t\t# From energy balance equation we get\n", "\n", "def f19(T): \n", "\t return sum_ni_Cp_i\n", "\n", "\t\t\t# delta_H_rkn_T_1 + quad(f19,T_1,T)[0]\n", "\n", "\t\t\t# The above equation on simplification becomes\n", "\t\t\t# (673.99-5.2815*X)*(T-T_1) + (16.91+1.9175*X)*(10**(-2)/2)*(T**(2)-T_1**(2)) + (2.79-1.6793*X)*(10**(-5)/3)*(T**(3)-T_1**(3)) + (-26.70+5.5304*X)*(10**(-9) /4)*(T**(4)-T_1**(4)) = delta_H_rkn_T_1*X\n", "\n", "\t\t\t# Let us assume a temperature, say\n", "T = 800;\t\t\t#[K]\n", "fault = 10;\n", "def f(X): \n", "\t return K - (X*(100-0.5*X)**(1./2))/((12-X)*(9-0.5*X)**(1./2))\n", "\n", "def f1(X): \n", "\t return (673.99-5.2815*X)*(T-T_1)+(16.91+1.9175*X)*(10**(-2)/2)*(T**(2)-T_1**(2))+(2.79-1.6793*X)*(10**(-5)/3)*(T**(3)-T_1**(3))+(-26.70+5.5304*X)*(10**(-9)/4)*(T**(4)-T_1**(4))+delta_H_rkn_T_1*X\n", "\n", "while(fault>0.01):\n", " K = math.exp(3.87 + (11389.10/T) - 2.6580*math.log(T) + 0.4825*10**(-2)*T - 0.1409*10**(-5)*T**(2) + 0.2320*10**(-9)*T**(3));\n", " X1 = fsolve(f,0.1)\n", " X2 = fsolve(f1,1)\n", " fault = abs(X1-X2);\n", " T = T + 0.01;\n", "\n", "# Results\n", "print \" The moles of SO2 reacted are %f mol\"%(X1);\n", "print \" The adiabatic reaction temperature is %f K\"%(T);\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " The moles of SO2 reacted are 7.594592 mol\n", " The adiabatic reaction temperature is 886.860000 K\n" ] } ], "prompt_number": 2 } ], "metadata": {} } ] }