summaryrefslogtreecommitdiff
path: root/Chemical_Engineering_Thermodynamics_by_P_Ahuja/18-Adiabatic_Reaction_Temperature.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Chemical_Engineering_Thermodynamics_by_P_Ahuja/18-Adiabatic_Reaction_Temperature.ipynb')
-rw-r--r--Chemical_Engineering_Thermodynamics_by_P_Ahuja/18-Adiabatic_Reaction_Temperature.ipynb531
1 files changed, 531 insertions, 0 deletions
diff --git a/Chemical_Engineering_Thermodynamics_by_P_Ahuja/18-Adiabatic_Reaction_Temperature.ipynb b/Chemical_Engineering_Thermodynamics_by_P_Ahuja/18-Adiabatic_Reaction_Temperature.ipynb
new file mode 100644
index 0000000..3900022
--- /dev/null
+++ b/Chemical_Engineering_Thermodynamics_by_P_Ahuja/18-Adiabatic_Reaction_Temperature.ipynb
@@ -0,0 +1,531 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 18: Adiabatic Reaction Temperature"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 18.1: Calculation_of_heat_transfer.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"\n",
+"//Example - 18.1\n",
+"//Page number - 650\n",
+"printf('Example - 18.1 and Page number - 648\n\n');\n",
+"\n",
+"// Given\n",
+"\n",
+"T_1 = 298.15;//[K] - Standard reaction temperature\n",
+"T_2 = 500;//[K] - Reaction temperature\n",
+"P = 1;//[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",
+"// The standard enthalpy of formation at 298.15 K is given by\n",
+"delta_H_for_CO2 = -94.052;//[kcal/mol]\n",
+"delta_H_for_C3H8 = -24.820;//[kcal/mol]\n",
+"delta_H_for_H2O = -57.7979;//[kcal/mol]\n",
+"\n",
+"// The reaction with stoichiometric amount of air is\n",
+"// C3H8 + 5(O2 + 3.7N2) - 3CO2 + 4H2O + 18.8N2\n",
+"\n",
+"// The reaction with 100% excess air is\n",
+"// C3H8 + 10(O2 + 3.7N2) - 3CO2 + 4H2O + 5O2 + 37.6N2\n",
+"\n",
+"// The standard 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",
+"// 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",
+"// To raise the exit species from 298.15 to 500 K the enthalpy change is\n",
+"delta_H_rkn = integrate('sum_ai_ni+sum_bi_ni*T+sum_ci_ni*T^(2)+sum_di_ni*T^(3)','T',T_1,T_2);//[cal]\n",
+"delta_H_rkn = delta_H_rkn*10^(-3);//[kcal]\n",
+"\n",
+"// Therefore per mole of fuel the heat exchange is\n",
+"// Q = Heat exchange in step 1 + Heat exchange in step 2\n",
+"Q = delta_H_rkn_298 + delta_H_rkn;\n",
+"\n",
+"printf(' The heat transfer from the combustion chamber per mole of fuel is %f kcal (per mol of C3H8)',Q);\n",
+"\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 18.2: Calculation_of_adiabatic_flame_temperature.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"\n",
+"//Example - 18.2\n",
+"//Page number - 650\n",
+"printf('Example - 18.2 and Page number - 650\n\n');\n",
+"\n",
+"// Given\n",
+"\n",
+"T_1 = 298.15;//[K] - Standard 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",
+"// The standard enthalpy of formation at 298.15 K is given by\n",
+"delta_H_for_CO2 = -94.052;//[kcal/mol]\n",
+"delta_H_for_C2H6 = -20.236;//[kcal/mol]\n",
+"delta_H_for_H2O = -57.7979;//[kcal/mol]\n",
+"\n",
+"// The reaction with stoichiometric amount of air is\n",
+"// C2H6 + (7/2)O2 - 2CO2 + 3H2O\n",
+"\n",
+"// The reaction with 4 mol of O2 and 10 mol CO2 is\n",
+"// C2H6 + 4O2 + 10CO2 - 12H2O + 3H2O + 0.5O2\n",
+"// 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;//[kcal]\n",
+"delta_H_rkn_298 = delta_H_rkn_298*10^(3);//[cal]\n",
+"\n",
+"// 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",
+"// From energy balance equation we get\n",
+"// 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",
+"// Solving above equation for T_2\n",
+"deff('[y]=f(T_2)','y=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(-1,f);\n",
+"\n",
+"printf(' The adiabatic flame temperature is %f K',T_2);\n",
+"\n",
+"\n",
+"\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 18.3: Calculation_of_mole_fraction_and_average_heat_capacity.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"\n",
+"//Example - 18.3\n",
+"//Page number - 651\n",
+"printf('Example - 18.3 and Page number - 651\n\n');\n",
+"\n",
+"// Given\n",
+"T_1 = 298.15;//[K] - Standard reaction temperature\n",
+"\n",
+"// The reaction with theoritical air is\n",
+"// CH4 + 2(O2 + 3.76N2) - CO2 + 2H20 + 7.52N2\n",
+"\n",
+"//(1)\n",
+"n_product = (1 + 2 + 7.52);// Total number of moles of product\n",
+"// The mole fraction of water vapour is\n",
+"y_H2O = 2/(n_product);\n",
+"printf(' (1).The mole fraction of water vapour is %f\n\n',y_H2O);\n",
+"\n",
+"//(2)\n",
+"delta_H_rkn_298 = -730*10^(3);//[J/mol]\n",
+"C = 40;//[J/mol-K] - Average molar heat capacity\n",
+"\n",
+"// From energy balance we have\n",
+"// delta_H_rkn_298 + n_product*C(T_2 - T_1) = 0\n",
+"T_2 = - delta_H_rkn_298/(n_product*C) + T_1;//[K]\n",
+"T_max = T_2 - T_1;\n",
+"\n",
+"printf(' (2).The maximum temperature rise of the exhaust gases is %f K\n',T_max);\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 18.4: Determination_of_adiabatic_flame_temperature.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"\n",
+"//Example - 18.4\n",
+"//Page number - 651\n",
+"printf('Example - 18.4 and Page number - 651\n\n');\n",
+"\n",
+"// Given\n",
+"T_1 = 298.15;//[K] - Standard reaction temperature\n",
+"\n",
+"// The standard enthalpy of formation at 298.15 K is given by\n",
+"delta_H_for_CO2 = -94.052;//[kcal/mol]\n",
+"delta_H_for_C8H18 = -59.780;//[kcal/mol]\n",
+"delta_H_for_H2O = -57.7979;//[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",
+"//(a)\n",
+"// The reaction with stoichiometric amount of air is\n",
+"// C3H18 + 12.5(O2 + 3.76N2) - 8CO2 + 9H2O + 47N2\n",
+"\n",
+"// 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;//[kcal]\n",
+"delta_H_rkn_298 = delta_H_rkn_298*10^(3);//[cal]\n",
+"\n",
+"// 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",
+"// From energy balance equation we get\n",
+"// 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",
+"// Solving above equation for T_2\n",
+"deff('[y]=f(T_2)','y=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(-1,f);\n",
+"\n",
+"printf(' (1).The adiabatic flame temperature is %f K\n\n',T_2);\n",
+"\n",
+"//(2)\n",
+"// The mean standard heat capacity of various components over the temperature range from 25 to 3000 C is \n",
+"Cp_CO2 = 13.91;//[cal/mol-K]\n",
+"Cp_H2O = 10.16;//[cal/mol-K]\n",
+"Cp_O2 = 7.88;//[cal/mol-K]\n",
+"Cp_N2 = 7.45;//[cal/mol-K]\n",
+"\n",
+"// From energy balance equation we get\n",
+"// 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);//[K]\n",
+"\n",
+"printf(' (2).The adiabatic flame temperature is %f K',T_2_prime);\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 18.5: Calculation_of_conversion.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"\n",
+"//Example - 18.5\n",
+"//Page number - 652\n",
+"printf('Example - 18.5 and Page number - 652\n\n');\n",
+"\n",
+"// Given\n",
+"// N2 + 3H2 - 2NH3\n",
+"T_1 = 700;//[K] - Reaction temperature\n",
+"Max_adia_rise = 100;///[K] - Maximum adiabatic rise in temperature\n",
+"T_2 = T_1 + Max_adia_rise;//[K] - \n",
+"\n",
+"delta_H_rkn_700 = -94.2;//[kJ] - Standard enthalpy of reaction at 700 K\n",
+"delta_H_rkn_700 = delta_H_rkn_700*10^(3);//[J]\n",
+"\n",
+"// The mean standard heat capacity of various components over the temperature range from 700 to 800 K is \n",
+"Cp_N2 = 30.0;//[cal/mol-K]\n",
+"Cp_H2 = 28.9;//[cal/mol-K]\n",
+"Cp_NH3 = 49.2;//[cal/mol-K]\n",
+"\n",
+"// The energy balance equation is\n",
+"// X*delta_H_rkn_700 + integrate('(sum_ni_Cpi_exit)*dT','T',T_1,T_2)\n",
+"\n",
+"//At exit, let moles of NH3 = (1-X), moles of H2 = (3-3X), moles of NH3 = 2X . Therefore we have,\n",
+"// delta_H_rkn_700*X + {(1-X)*Cp_N2 + (3-3X)*Cp_H2 + (2X)*Cp_NH3}*(T_2 - T_1)\n",
+"// On simplification we get, 960.3*X = 116.7\n",
+"X = 116.7/960.3;\n",
+"\n",
+"printf(' The maximum allowable conversion fraction in the reactor is given by, X = %f \n',X);\n",
+"\n",
+"\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 18.6: Calculation_of_maximum_pressure.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"\n",
+"//Example - 18.6\n",
+"//Page number - 653\n",
+"printf('Example - 18.6 and Page number - 653\n\n');\n",
+"\n",
+"// Given\n",
+"T_1 = 298.15;//[K] - Standard reaction temperature\n",
+"V = 2.0*10^(-3);//[m^(3)] - Volume of calorimeter\n",
+"m = 10;//[g] - Mass of liquid octane\n",
+"Mol_wt = 114;//[g/mol] - Molecular weight of octane\n",
+"n = m/Mol_wt;//[mol] - No of moles of octane\n",
+"R = 8.314;//[J/mol*K] - Universal gas constant\n",
+"\n",
+"// The standard enthalpy of formation at 298.15 K is given by\n",
+"delta_H_for_CO2 = -94.052;//[kcal/mol]\n",
+"delta_H_for_C8H18 = -59.780;//[kcal/mol]\n",
+"delta_H_for_H2O = -57.7979;//[kcal/mol]\n",
+"\n",
+"// The standard molar heat capacity of various components in high temperature range from is given by \n",
+"// Cp_H2O = 6.970 + 0.3464*10^(-2)*T - 0.04833*10^(-5)*T^(2);\n",
+"// Cp_O2 = 6.732 + 0.1505*10^(-2)*T - 0.01791*10^(-5)*T^(2);\n",
+"// Cp_CO2 = 18.036 - 4.474*10^(-5)*T - 158.08/(T^(1/2));\n",
+"// Therefore we have\n",
+"// Sum_ni_Cpi_exit = 249.09 + 0.04*T - 0.547*10^(-5)*T^(2) - 1264.64/(T^(1/2))\n",
+"\n",
+"// The reaction with stoichiometric amount of oxygen is\n",
+"// C8H18 + 12.5O2 - 8CO2 + 9H2O\n",
+"\n",
+"// The reaction with 50% excess oxygen is\n",
+"// C8H18 + 18.75O2 - 8CO2 +9H2O + 6.25O2\n",
+"\n",
+"// 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;//[kcal]\n",
+"delta_H_rkn_298 = delta_H_rkn_298*10^(3);//[cal]\n",
+"\n",
+"// From the energy balance equation we get\n",
+"// delta_H_rkn_298 + integrate('(sum_ni_Cpi_exit)*dT','T',T_1,T_2)\n",
+"// 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",
+"// Solving above equation for T_2\n",
+"deff('[y]=f(T_2)','y=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(1000,f);\n",
+"\n",
+"// When 1 mol of octane reacts the final number of moles in the calorimeter is 23.25\n",
+"// When n mol of octane reacts the final number of moles in the calorimeter is\n",
+"n_total = n*23.25;//[mol]\n",
+"\n",
+"// The maximum explosion pressure is calculated when no heat is dissipated to the surroundings and thus bomb calorimeter attains the adiabatic flame temperature\n",
+"// Thus maximum explosion pressure is given by\n",
+"P = (n_total*R*T_2)/V;//[N/m^(2)]\n",
+"P = P*10^(-5);//[bar]\n",
+"\n",
+"printf(' The maximum explosion pressure inside the bomb calorimeter is %f bar',P);\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 18.7: Calculation_of_number_of_moles.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"\n",
+"//Example - 18.7\n",
+"//Page number - 656\n",
+"printf('Example - 18.7 and Page number - 656\n\n');\n",
+"\n",
+"// Given\n",
+"T_1 = 400 + 273.15;//[K]\n",
+"// 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",
+"// At 400 C, from the given 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);//[cal]\n",
+"// This is the standard enthalpy change of reaction for 1 mol of SO2 reacted. Since X moles of SO2 are reactants therefore \n",
+"// delta_H_rkn_T_X (for X moles of SO2 reacted) = delta_H_rkn_T_1*X\n",
+"\n",
+"// Let the number of moles at equilibrium be\n",
+"// n_O2 = 9-0.5*X\n",
+"// n_SO2 = 12-X\n",
+"// n_SO3 = X\n",
+"// n_N2 = 79\n",
+"// Total moles at equilibrium = 100-0.5X\n",
+"// Ky = y_SO3/(y_SO2*y_O2^(1/2))\n",
+"// Ky = (X*(100-0.5*X)^(1/2))/((12-X)*(9-0.5*X)^(1/2))\n",
+"// We know that K = Ky*Kp. Since P = 1 atm, therefore Ky = K\n",
+"\n",
+"// 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",
+"// 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",
+"// From energy balance equation we get\n",
+"// delta_H_rkn_T_1 + integrate('sum_ni_Cp_i','T',T_1,T)\n",
+"// The above equation on simplification becomes\n",
+"// (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",
+"// Let us assume a temperature, say\n",
+"T = 800;//[K]\n",
+"fault = 10;\n",
+"\n",
+"while(fault>0.01)\n",
+" K = exp(3.87 + (11389.10/T) - 2.6580*log(T) + 0.4825*10^(-2)*T - 0.1409*10^(-5)*T^(2) + 0.2320*10^(-9)*T^(3));\n",
+" deff('[y]=f(X)','y= K - (X*(100-0.5*X)^(1/2))/((12-X)*(9-0.5*X)^(1/2))');\n",
+" X1 = fsolve(0.1,f);// X from equilibrium equation\n",
+" deff('[y]=f1(X)','y= (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",
+" X2 = fsolve(1,f1);// X from energy balance equation\n",
+" fault = abs(X1-X2);\n",
+" T = T + 0.01;\n",
+"end\n",
+"\n",
+"printf(' The moles of SO2 reacted are %f mol\n\n',X1);\n",
+"printf(' The adiabatic reaction temperature is %f K\n',T);\n",
+""
+ ]
+ }
+],
+"metadata": {
+ "kernelspec": {
+ "display_name": "Scilab",
+ "language": "scilab",
+ "name": "scilab"
+ },
+ "language_info": {
+ "file_extension": ".sce",
+ "help_links": [
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "scilab",
+ "version": "0.7.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}