diff options
Diffstat (limited to 'Chemical_Engineering_Thermodynamics_by_T_E_Daubert')
8 files changed, 3257 insertions, 0 deletions
diff --git a/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/1-Purpose_Usefulness_and_Definitions_of_Thermodynamics.ipynb b/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/1-Purpose_Usefulness_and_Definitions_of_Thermodynamics.ipynb new file mode 100644 index 0000000..22e914b --- /dev/null +++ b/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/1-Purpose_Usefulness_and_Definitions_of_Thermodynamics.ipynb @@ -0,0 +1,63 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 1: Purpose Usefulness and Definitions of Thermodynamics" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1: Example_1.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"P=2050 //kPa\n", +"T=700 //K\n", +"E=10 //J\n", +"//calculations\n", +"Pe=P*10^3 *0.3048^2 /4.4482 /144\n", +"Te=T*1.8-460\n", +"Ee=E*10^8 /(1055.1)\n", +"//results\n", +"printf('Temperature = %d F',Te)\n", +"printf('\n Pressure = %d lbf/in^2 ',Pe)\n", +"printf('\n Energy = %.3e Btu',Ee)" + ] + } +], +"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 +} diff --git a/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/2-PVT_Properties_of_Fluids_Equations_of_State.ipynb b/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/2-PVT_Properties_of_Fluids_Equations_of_State.ipynb new file mode 100644 index 0000000..5fe24be --- /dev/null +++ b/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/2-PVT_Properties_of_Fluids_Equations_of_State.ipynb @@ -0,0 +1,285 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2: PVT Properties of Fluids Equations of State" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.1: Example_1.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"basis = 1 //kmol n butane\n", +"P=1.013*10^5 //N/m^2\n", +"R=8.3143*10^3 //J/kmol K\n", +"T=272.6 //K\n", +"//calculations\n", +"V=basis*R*T/P\n", +"Ts=373.1 //K\n", +"Vs=basis*R*Ts/P\n", +"//results\n", +"printf('Volume in case 1 = %.2f m^3',V)\n", +"printf('\n Volume in case 2 = %.2f m^3',Vs)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2: Example_2.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"Vb=30 //m^3/kmol\n", +"P=1.013*10^5 //Pa\n", +"R=8.3143*10^3 //J/kmol K\n", +"T=373.1 //K\n", +"//calculations\n", +"Z=P*Vb/(R*T)\n", +"//results\n", +"printf('Compressibility factor = %.3f',Z)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.3: Example_3.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"Pc=22.12*10^6 //Pa\n", +"Tc=647.3 //K\n", +"Vc=0.05697 //m^3/Kmol\n", +"R=8.3143*10^3\n", +"Tr=0.7\n", +"//calculations\n", +"Zc=Pc*Vc/(R*Tc) \n", +"T=Tr*Tc\n", +"Ps=10^6 //Pa\n", +"w=-log10(Ps/Pc) -1\n", +"//results\n", +"printf('critical compressibility factor = %.3f',Zc)\n", +"printf('\n Accentric factor = %.4f',w)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.4_b: Example_4b.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"basis= 1 //kmol ammonia\n", +"P=10^6 //pa\n", +"a=4.19\n", +"b=0.0373\n", +"R=8314.3\n", +"Tc=405.5\n", +"Pc=11.28*10^6\n", +"//calculations\n", +"disp('part b')\n", +"an=27*R^2*Tc^2 /(64*Pc)\n", +"bn=R*Tc/(8*Pc)\n", +"V=3\n", +"//results\n", +"printf('Since an and bn are same as a and b, V is the same = %d m^3/kmol',V)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.4_c: Example_4c.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"disp('part c')\n", +"disp('USing SRK equation, P= RT/(V-b) -alph*a/(V*(V+b))')\n", +"disp('By trail and error method,')\n", +"//calculations\n", +"v2=2.98\n", +"//results\n", +"printf('volume = %.2f m^3/kmol',v2)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.4: Example_4.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"basis= 1 //kmol ammonia\n", +"P=10^6 //pa\n", +"a=4.19\n", +"b=0.0373\n", +"R=8314.3\n", +"Tc=405.5\n", +"Pc=11.28*10^6\n", +"//calculations\n", +"disp('case a')\n", +"disp('Using vandwerwaals equation, ')\n", +"disp('(P+a/v^2)*(V-b) = R*T, on solving by trail and error method,')\n", +"V=3\n", +"printf('Volume = %d m^3/kmol',V)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.5: Example_5.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"Pc=22.12*10^6 //Pa\n", +"Tc=647.3 //K\n", +"Zc=0.234\n", +"T=973.1 //K\n", +"P=25*10^6 //Pa\n", +"//calculations\n", +"Tr=T/Tc\n", +"Pr=P/Pc\n", +"Z=0.916\n", +"Zn=Z+0.05*(Zc-0.27)\n", +"//results\n", +"printf('Compresson factor = %.3f ',Zn)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.6: Example_6.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"w=0.3448\n", +"Z0=0.898\n", +"Z1=0.08\n", +"//calculations\n", +"Z=Z0 + Z1*w\n", +"//results\n", +"printf('Compression factor = %.3f ',Z)" + ] + } +], +"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 +} diff --git a/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/3-Conservation_of_Energy_First_law_of_Thermodynamics.ipynb b/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/3-Conservation_of_Energy_First_law_of_Thermodynamics.ipynb new file mode 100644 index 0000000..527482f --- /dev/null +++ b/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/3-Conservation_of_Energy_First_law_of_Thermodynamics.ipynb @@ -0,0 +1,553 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3: Conservation of Energy First law of Thermodynamics" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.10: Example_10.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"eff=0.75\n", +"Hf=[-110600 -241980 -393770 0]\n", +"Hc=[30.35 36 45.64 29.30]\n", +"T2=540 //C\n", +"T1=25 //C\n", +"mass=500 //kmol H2 produced\n", +"work=10^6 //kJ\n", +"//calculations\n", +"dHr= Hf(3) + Hf(4) - Hf(1) -Hf(2)\n", +"dHpr= (eff*(Hc(3) +Hc(4)) + (1-eff)*(Hc(2)+Hc(1)))*(T2-T1)\n", +"q= dHr*eff +dHpr\n", +"heat = q*mass/eff\n", +"qe=heat-work\n", +"//results\n", +"printf('Heat produced = %.3e kJ',qe)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.11: Example_11.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"so3=6\n", +"h2=-296840 //kJ/kmol\n", +"h3=-395720 //kJ/kmol\n", +"t2=400 //C\n", +"t1=25 //C\n", +"//calculations\n", +"Hr=so3*(h3-h2)\n", +"cp=[1.059 0.967 0.714]\n", +"n=[82.76 11 8]\n", +"M=[28 32 64]\n", +"Ht= sum(cp.*n.*M)\n", +"Hre=Ht*(t2-t1)\n", +"Hpr=Hre-Hr\n", +"Tf=t1 + Hpr/3261.6\n", +"//results\n", +"printf('temperature of exit gases = %d C',Tf)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.12: Example_12.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"x=0.25\n", +"Hr=1.4278*10^6 //kJ/kmol\n", +"ti=25 //C\n", +"cp=[1.24 2.39 1.11]\n", +"M=[44 18 32]\n", +"z=[12 3 0.5]\n", +"r=4.186\n", +"//calculations\n", +"v=cp.*M.*z\n", +"v2=sum(v)\n", +"T=ti+ Hr/(v2)\n", +"//results\n", +"printf('Theoretical temperature = %d C',T)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.1: Example_1.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"//Initialization of variables\n", +"clear\n", +"mass=4000 //kg/m^2\n", +"Patm=1.013*10^5 //pa\n", +"g=9.807\n", +"M=28\n", +"R=8.3143*10^3\n", +"T=303 //K\n", +"P1=800*10^3 //pa\n", +"//calculations\n", +"Ps=Patm+mass*g\n", +"n=1/M\n", +"V1=n*R*T/P1\n", +"W=Ps*(2*V1)\n", +"//results\n", +"printf('Work done on the surroundings = %d J',W)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.2_b: Example_2b.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"t1=1000 //K\n", +"p1=20 //Mpa\n", +"p2=10 //Mpa\n", +"ti=600 //K\n", +"t2=700 //K\n", +"v1=0.02188\n", +"vi=0.02008\n", +"v2=0.02825\n", +"Ei=2617.5\n", +"E2=2893.1\n", +"E1=3441.8\n", +"x=0.22\n", +"m=1 //kg\n", +"cp=4.186\n", +"t3=639 //K\n", +"H3=2409.5\n", +"H1=3879.3\n", +"//calculations\n", +"Tf= ti+ (v1-vi)/(v2-vi) *(t2-ti)\n", +"Hf=H3 - m*cp*(t3-Tf)\n", +"Q2=Hf-H1\n", +"//results\n", +"disp('part b')\n", +"printf('Heat transfer = %.1f kJ/kg',Q2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.2: Example_2.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"t1=1000 //K\n", +"p1=20 //Mpa\n", +"p2=10 //Mpa\n", +"ti=600 //K\n", +"t2=700 //K\n", +"v1=0.02188\n", +"vi=0.02008\n", +"v2=0.02825\n", +"Ei=2617.5\n", +"E2=2893.1\n", +"E1=3441.8\n", +"x=0.22\n", +"m=1 //kg\n", +"cp=4.186\n", +"t3=639 //K\n", +"H3=2409.5\n", +"H1=3879.3\n", +"//calculations\n", +"Tf= ti+ (v1-vi)/(v2-vi) *(t2-ti)\n", +"Ef= Ei+ x*(E2-Ei)\n", +"Q1=Ef-E1\n", +"//results\n", +"disp('part a')\n", +"printf('Heat transfer = %.1f kJ/kg',Q1)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3: Example_3.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"p1=2.181\n", +"p2=2.637\n", +"p3=3.163\n", +"vg1=0.09150\n", +"vg2=0.07585\n", +"vg3=0.06323\n", +"vl1=0.00118\n", +"vl2=0.00120\n", +"vl3=0.00122\n", +"M=18\n", +"t1=490 //K\n", +"t2=500 //K\n", +"t3=510 //K\n", +"R=8.3143\n", +"//calculations\n", +"lam1= (p2-p1)*10^3 *M*(vg2-vl2) *2.154/ log(t3/t1)\n", +"lam2 = log(p3/p1) *R/(1/t1 -1/t3)\n", +"err=(lam2-lam1)/lam1\n", +"//results\n", +"printf('latent heat using calyperon equation = %d kJ/kmol',lam1)\n", +"printf('\n latent heat using the clasius calyperon equation = %d kJ/kmol',lam2)\n", +"printf('\n Error = %d percent',err*100)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.4: Example_4.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"h1=147360 \n", +"h2=29790\n", +"//calculations\n", +"Hr=h1-h2\n", +"//results\n", +"printf('heat of reaction = %d kJ/kmol',Hr)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.5: Example_5.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"R=8314.3\n", +"T=700 //K\n", +"T2=437.5 //K\n", +"T3=350 //K\n", +"T4=T3\n", +"p2=0.552 //Mpa\n", +"p1=2.758 //Mpa\n", +"cp=29.3\n", +"R0=8.3\n", +"k=1.4\n", +"//calculations\n", +"cv=cp-R0\n", +"Q1=-R*T*log(p2/p1)\n", +"Q2=cv*(T2-T)\n", +"dH2= cp*(T2-T)\n", +"p3=p2*T3/T2\n", +"p3=0.345\n", +"Q3=cp*(T3-T2)\n", +"dE3=cv*(T3-T2)\n", +"W3=Q3-dE3\n", +"T5=T4*(p1/p3)^((k-1)/k)\n", +"dH4= cp*(T5-T4)\n", +"W4=-cv*(T5-T4)\n", +"Q5= cp*(T-T5)\n", +"dE5=cv*(T-T5)\n", +"W5=Q5-dE5\n", +"//results\n", +"disp('part a isothermal')\n", +"printf('dH = 0, dE=0, Q= W = %d kJ/kmol',Q1/10^3)\n", +"disp('part 2 isometric')\n", +"printf('dH = %d kJ/kmol, W=0, Q= dE = %d kJ/kmol',dH2,Q2)\n", +"disp('part 3 isobaric')\n", +"printf('dE = %d kJ/kmol, W= %d kJ/kmol, Q= dH = %d kJ/kmol',dE3,W3,Q3)\n", +"disp('part 4 adiabatic')\n", +"printf('dH = %d kJ/kmol, W= -dE = %d kJ/kmol, Q= 0 kJ/kmol',dH4,W4)\n", +"disp('part 5 isobaric')\n", +"printf('dE = %d kJ/kmol, W= %d kJ/kmol, Q= dH = %d kJ/kmol',dE5,W5,Q5)\n", +"disp('The graph cannot be plotted since volume axis values are not known. In the textbook it is randomly drawn to be of that shape.')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.6: Example_6.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"p=[2.75 0.5 0.31 0.31 2.75]\n", +"v=[116.17 654.8 654.8 597 110.65]\n", +"t=[440 440 170 140 410]\n", +"h=[3325 3356 2802.6 2738.5 3257.7]\n", +"e=[3005.6 3028.6 2602.6 2553.6 2953.4]\n", +"//calculations\n", +"dh1=h(2) - h(1)\n", +"de1=e(2) - e(1)\n", +"q2=e(3) - e(2)\n", +"dh2=h(3) - h(2)\n", +"dh3=h(4) - h(3)\n", +"de3=e(4) - e(3)\n", +"W3= p(3) *(v(4) - v(3))\n", +"Q3= de3+W3\n", +"dh4=h(5) -h(4)\n", +"de4=e(5) -e(4)\n", +"dh5=h(1) - h(5)\n", +"de5= e(1) - e(5)\n", +"W5= p(5) *(v(1) - v(5))\n", +"q5 = de5+W5\n", +"//results\n", +"printf('In case 1 , dH = %.1f kJ/kg dE = %.1f kJ/kg W= pDv kJ/kg Q= %.1f + W kJ/kg',dh1,de1,de1)\n", +"printf('\n In case 2, W =0 kJ/kg Q = dE = %d kJ/kg dH = %.1f kJ/kg',q2,dh2)\n", +"printf('\n In case 3, dH= %.1f kJ/kg dE = %.1f kJ/kg W= %.1f kJ/kg Q = %.1f kJ/kg',dh3,de3,W3,Q3)\n", +"printf('\n In case 4, Q= 0 kJ/kg dH = %.1f kJ/kg dE = -W = %.1f kJ/kg',dh4,de4)\n", +"printf('\n In case 5, dH = %.1f kJ/kg dE = %.1f kJ/kg W = %.1f kJ/kg Q = %.1f kJ/kg',dh5,de5,W5,q5)\n", +"xlabel('Volume (m^3/kg)')\n", +"ylabel('Pressure (Mpa)')\n", +"plot(v,p)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.7: Example_7.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"P=0.1*10^6 //Pa\n", +"P2=0.55*10^6 //Pa\n", +"M=28.84\n", +"R=8314.4\n", +"T1=303.1 //K\n", +"T2=316.1 //K\n", +"d1=0.154 //m\n", +"d2=0.028 //m\n", +"mass=0.25 //m^3/s\n", +"Q=2.764*10^8 //J/h\n", +"cp=29.3*10^3 \n", +"//calculations\n", +"rho1= P*M/(T1*R)\n", +"u1=mass/(%pi/4 *d1^2)\n", +"rho2= P2*M/(R*T2)\n", +"u2=u1*d1^2 *rho1/(d2^2 *rho2)\n", +"Wsd= (u2^2 - u1^2 )/2 + cp/M *(T2-T1) + Q/(mass*rho1*3600)\n", +"mdot= u1*%pi/4 *d1^2 *rho1\n", +"Ws=Wsd*mdot/745.7\n", +"//results\n", +"printf('Power input to the compressor = %d hp',Ws)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.8: Example_8.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"u1=1.1 //m/s\n", +"rho1=1.21*10^3 //kg/m^3\n", +"d1=0.078\n", +"z1=4\n", +"h2=18 //m\n", +"g=9.806\n", +"//calculations\n", +"mdot= u1*rho1*%pi/4 *d1^2\n", +"Wsd= z1+h2\n", +"Ws=Wsd*mdot*g\n", +"dP= Ws*rho1/mdot\n", +"//results\n", +"printf('Power input = %d W',Ws)\n", +"printf('Pressure drop = %.3f Mpa',dP/10^6)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.9: Example_9.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"eff=0.75\n", +"Hf=[-110600 -241980 -393770 0]\n", +"Hc=[30.35 36 45.64 29.30]\n", +"T2=540 //C\n", +"T1=25 //C\n", +"mass=500 //kmol H2 produced\n", +"//calculations\n", +"dHr= Hf(3) + Hf(4) - Hf(1) -Hf(2)\n", +"dHpr= (eff*(Hc(3) +Hc(4)) + (1-eff)*(Hc(2)+Hc(1)))*(T2-T1)\n", +"q= dHr*eff +dHpr\n", +"heat = q*mass/eff\n", +"//results\n", +"printf('Heat produced = %.3e kJ',heat)" + ] + } +], +"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 +} diff --git a/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/4-The_Second_Law_of_Thermodynamics_and_its_Applications.ipynb b/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/4-The_Second_Law_of_Thermodynamics_and_its_Applications.ipynb new file mode 100644 index 0000000..dd2d02f --- /dev/null +++ b/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/4-The_Second_Law_of_Thermodynamics_and_its_Applications.ipynb @@ -0,0 +1,1069 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4: The Second Law of Thermodynamics and its Applications" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.10: Example_10.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"T1=673 //K\n", +"T2=293 //K\n", +"//calculations\n", +"eta=(T1-T2)/T1\n", +"//results\n", +"if eta>=0.5 then\n", +" printf('Max efficiency = %.3f and an efficiency of 0.5 is possible',eta)\n", +"else\n", +" printf('Max efficiency = %.3f and an efficiency of 0.5 is not possible',eta)\n", +"end" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.11: Example_11.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"T1=280 //K\n", +"T2=300 //K\n", +"//calculations\n", +"cop=T1/(T2-T1)\n", +"//results\n", +"printf('coefficient of performance = %.1f',cop)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.12: Example_12.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"P=2 //Mpa\n", +"T1=212.4+273.1 //K\n", +"T2=25+273.1 //K\n", +"h1=2799.5\n", +"h2=104.89\n", +"s1=6.3409\n", +"s2=0.3674\n", +"//calculations\n", +"dh=h1-h2\n", +"ds=s1-s2\n", +"exergy=dh-T2*ds\n", +"//results\n", +"printf('exergy = %.1f kJ/kg',exergy)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.13: Example_13.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"R=8314.3\n", +"T=700 //K\n", +"T2=437.5 //K\n", +"T3=350 //K\n", +"T4=T3\n", +"p2=0.552 //Mpa\n", +"p1=2.758 //Mpa\n", +"p3=0.345 //Mpa\n", +"cp=29.3\n", +"R0=8.3143\n", +"k=1.4\n", +"n=1\n", +"P0=0.103 //Mpa\n", +"//calculations\n", +"cv=cp-R0\n", +"p3=p2*T3/T2\n", +"p3=0.345\n", +"T5=T4*(p1/p3)^((k-1)/k)\n", +"G1=n*R*T*log(p2/p1)\n", +"V700=R*10^3 *T/(p2*10^9)\n", +"Sa= 209\n", +"Sb=199.2\n", +"Sc=204.7\n", +"S2=(T2-T)/6 *(Sa+4*Sc+Sb )\n", +"G2=V700*(p3-p2)*10^3 -S2\n", +"saa=199.2\n", +"sbb=192.6\n", +"savg=(saa+sbb)*0.5\n", +"G3=-savg*(T3-T2)\n", +"pmid=(p3+p2)/2\n", +"vmid=2.88\n", +"sav=192.7\n", +"v4=8.435 //m^3\n", +"v5=1.911 //m^3\n", +"integ=(p1-p3)*10^3 /6 *(v4+4*vmid+v5)\n", +"G4=integ - sav*(T5-T3)\n", +"Sav=194.25\n", +"G5= -Sav*(T-T5)\n", +"Gt=G1/10^3 +G2+G3+G4+G5\n", +"//results\n", +"printf('in case 1, Change in gibbs free energy = %d kJ',G1/10^3)\n", +"printf('\n in case 2, Change in gibbs free energy = %d kJ',G2)\n", +"printf('\n in case 3, Change in gibbs free energy = %d kJ',G3)\n", +"printf('\n in case 4, Change in gibbs free energy = %d kJ',G4)\n", +"printf('\n in case 5, Change in gibbs free energy = %d kJ',G5)\n", +"printf('\n Net change in gibbs energy = %d kJ',Gt)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.14: Example_14.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"v=1/430\n", +"pi=4.08 //Mpa\n", +"pf=10 //Mpa\n", +"pf2=1 //Mpa\n", +"pii=0.1 //Mpa\n", +"R=8314.3\n", +"n=1/28\n", +"T=273.1\n", +"//calculations\n", +"logpr=v*(pf-pii)*10^6 /(R*T*n)\n", +"pr=exp(logpr)\n", +"p=pr*pi\n", +"logpr=v*(pf2-pii)*10^6 /(R*T*n)\n", +"pr=exp(logpr)\n", +"p2=pr*pi\n", +"//results\n", +"printf('Final pressure = %.2f Mpa',p)\n", +"printf('\n Final pressure in case 2 = %.2f Mpa',p2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.15: Example_15.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"Hvap=338.14 //kJ/kg\n", +"T=409.3 //K\n", +"//calculations\n", +"dss=Hvap/T\n", +"dg=0\n", +"//results\n", +"printf('change in entropy and gibbs energy of system are %.3f kJ/kg K and %d kJ/kg respectivey',dss,dg)\n", +"printf('\n change in entropy and gibbs energy of universe are %.3f kJ/kg K and %d kJ/kg respectivey',-dss,-dg)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.16: Example_16.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"T=373.1 //K\n", +"R=8314.3\n", +"Pd=0.1013*10^6 //Pa\n", +"P=10 //Mpa\n", +"p3=5*10^6 //Pa\n", +"vf=0.0373\n", +"a=424.447\n", +"//calculations\n", +"Vd=R*T/Pd\n", +"V=0.5\n", +"dss=-R*(log(p3/Pd) + log((V-vf)/(Vd-vf)))\n", +"dhh=R*T/10^3 - p3/10^3 *V+ a/V^2\n", +"//results\n", +"printf('Change in entropy = %.4f kJ/kmol K',dss/10^3)\n", +"printf('\n change in enthalpy= %d kJ/kmol',dhh)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.18: Example_18.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"Tc=647.3 //K\n", +"dh=1.1\n", +"Db=-2\n", +"v2=0.234\n", +"v1=0.27\n", +"//calculations\n", +"dh2=dh+Db*(v2-v1)\n", +"dhh=dh2*Tc\n", +"dhbar=dhh*4.18/18\n", +"disp('From steam tables,')\n", +"h1=3777.5 //kJ/kg\n", +"h2=3928.2 //kJ/kg\n", +"dhs=h2-h1\n", +"err=abs(dhs-dhbar)/dhs\n", +"//results\n", +"printf('Enthalpy departure = %d kJ/kg',dhbar)\n", +"printf('\n Percentage error = %.1f ',err*100)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.19: Example_19.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"w=0.3448\n", +"R=8.3143\n", +"Tc=647.3\n", +"//calculations\n", +"disp('From charts of entropy')\n", +"h0=0.57\n", +"h1=0.05\n", +"h2=h0+w*h1\n", +"h3=h2*R*Tc\n", +"dh=-h3\n", +"//results\n", +"printf('Enthalpy departure = %d kJ/kmol',dh)\n", +"disp('The answer is a bit different due to rounding off error in the textbook')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.1: Example_1.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"T=500 //K\n", +"Qr=5*10^6 //kJ\n", +"T2=600 //K\n", +"//calculations\n", +"dSS=Qr/T\n", +"dSS2=-Qr/T2\n", +"Ds=dSS+dSS2\n", +"//results\n", +"printf('Entropy change of the system = %d kJ/K',dSS)\n", +"printf('\n Entropy change of the surroundings = %d kJ/K',dSS2)\n", +"printf('\n Entropy change if the universe = %d kJ/K',Ds)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.20: Example_20.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"ta=310 //K\n", +"pa=80 //kPa\n", +"r=10\n", +"k=1.4\n", +"R=8.3143\n", +"n=5/29\n", +"cv=20.93\n", +"//calculations\n", +"Qab=0\n", +"tb=ta*r^(k-1)\n", +"va=R*ta/pa\n", +"vb=va/r\n", +"pb=R*tb/vb\n", +"Wab= -n*R*ta/(k-1) *((pb/pa)^((k-1)/k) -1)\n", +"vc=vb\n", +"Qbc=500 //kJ\n", +"Wbc=0\n", +"tc=tb+ Qbc/(n*cv)\n", +"pc=R*tc/vc\n", +"Qcd=0\n", +"td=tc/r^(k-1)\n", +"vd=va\n", +"pd=td/tc*(vc/vd)*pc\n", +"Wcd=-n*R*tc/(k-1) *((pd/pc)^((k-1)/k)-1)\n", +"Wda=0\n", +"Qda=n*cv*(ta-td)\n", +"eta0=1-1/r^(k-1)\n", +"//results\n", +"printf('Efficiency of cycle = %.3f',eta0)\n", +"p=[pa pb pc pd]\n", +"t=[ta tb tc td]\n", +"Q=[Qab Qbc Qcd Qda]\n", +"W=[Wab Wbc Wcd Wda]\n", +"disp('Pressure (kPa) = ')\n", +"format('v',6);p\n", +"disp(p)\n", +"disp('Temperature (K)= ')\n", +"format('v',6);t\n", +"disp(t)\n", +"disp('Heat (kJ)= ')\n", +"format('v',6);Q\n", +"disp(Q)\n", +"disp('Work done (kJ) = ')\n", +"format('v',6);W\n", +"disp(W)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.21: Example_21.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"ta=310 //K\n", +"tc=917.3 //K\n", +"td=365.2 //K\n", +"n=0.602\n", +"k=1.4\n", +"//calculations\n", +"lntb= 1/(1-n)/k\n", +"tb=tc- lntb*(td-ta)\n", +"rc=(tb/ta)^(1/(k-1))\n", +"//results\n", +"printf('Temperature at B = %.1f K',tb)\n", +"printf('\n Compression ratio = %d ',rc)\n", +"disp('The answer given in textbook for rc is wrong. please check using a calculator')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.22: Example_22.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"pr=4\n", +"k=1.4\n", +"ta=298 //K\n", +"pa=0.1 //Mpa\n", +"pdr=0.01\n", +"tc=900 //K\n", +"pri=0.005 //Mpa\n", +"//calculations\n", +"pb=pr*pa\n", +"nji=1- (pr)^((1-k)/k)\n", +"tb=ta*(pb/pa)^((k-1)/k)\n", +"pc=pb-pdr\n", +"pd=pa+pri\n", +"td=tc*(pd/pc)^((k-1)/k)\n", +"//results\n", +"p=[pa pb pc pd]\n", +"t=[ta tb tc td]\n", +"printf('ideal thermal efficiency = %.3f ',nji)\n", +"disp('pressure (Mpa) = ')\n", +"format('v',6);p\n", +"disp(p)\n", +"disp('temperature (K) = ')\n", +"format('v',6);t\n", +"disp(t)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.23_a: Example_23a.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"sd=4.9269//kJ/kg/K\n", +"sf=1.1453//kJ/kg/K\n", +"sg=7.5320//kJ/kg/K\n", +"hf=359.86//kJ/kg\n", +"hg=2653.5//kJ/kg\n", +"hd=2409.7//kJ/kg\n", +"//calculations\n", +"x=(sd-sg)/(sf-sg)\n", +"he=x*hf+(1-x)*hg\n", +"etar=(hd-he)/(hd-hf)\n", +"//results\n", +"printf('Thermal efficiency = %.4f',etar)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.23_b: Example_23b.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"sd=6.7039//kJ/kg/K\n", +"sf=1.1453//kJ/kg/K\n", +"sg=7.5320//kJ/kg/K\n", +"hf=359.86//kJ/kg\n", +"hg=2653.5//kJ/kg\n", +"hd=3717.9//kJ/kg\n", +"//calculations\n", +"x=(sd-sg)/(sf-sg)\n", +"he=x*hf+(1-x)*hg\n", +"etar=(hd-he)/(hd-hf)\n", +"//results\n", +"printf('Thermal efficiency = %.4f',etar)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.24: Example_24.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"ha=2510.6 //kJ/kg\n", +"hd=125.78 //kJ/kg\n", +"//calculations\n", +"kg=(10^6)/(ha-hd)\n", +"//results\n", +"printf('circulation rate = %d kg steam/h',kg)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.25: Example_25.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"tin=298 //K\n", +"tout=273 //K\n", +"tout2=308 //K\n", +"tin2=294 //K\n", +"//calculations\n", +"eta1=(tin-tout)/tin\n", +"eta2=abs((tin2-tout2)/tin2)\n", +"//results\n", +"printf('Efficiency in case 1 = %.3f',eta1)\n", +"printf('\n efficiency in case 2 = %.3f',eta2)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.26: Example_26.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"ma=500 //kg/h\n", +"cp1=3.2 //kJ/kg K\n", +"ta=20 //C\n", +"mb=200\n", +"mc=300 //kg/h\n", +"cp2=2.8 //kJ/kg K\n", +"tc=80 //C\n", +"tb=80 //C\n", +"me=50 //kg/h\n", +"te=120 //C\n", +"td=120 //C\n", +"hg=503.7\n", +"he=2706.3\n", +"//calcualtions\n", +"Ws=(mb+me)*hg + mc*cp2*(tc) - me*he -ma*cp1*(ta)\n", +"//results\n", +"printf('Net work done = %d kJ/h',Ws)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.27: Example_27.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"hc=150 //Btu/lb\n", +"he=-115 //Btu/lb\n", +"hg=168 //Btu/lb\n", +"//calculations\n", +"frac=(hg-hc)/(hg-he)\n", +"//results\n", +"printf('Fraction of solid = %.3f',frac)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.28: Example_28.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"H=2696.5 //kJ/kg\n", +"hg=2706.7 //kJ/kg\n", +"hf=504.7 //kJ/kg\n", +"//calculations\n", +"x= (H-hf)/(hg-hf)\n", +"x2=1\n", +"//results\n", +"printf('In case 1, fraction of vapor = %.3f',x)\n", +"printf('\n In case 2, fraction of vapor = %.3f',x2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.2: Example_2.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"p1=2.758 //Mpa\n", +"p2=0.552 //Mpa\n", +"T1=700 //K\n", +"T2=700 //K\n", +"n=1\n", +"R=8.3143\n", +"Cv=21\n", +"Cp=29.3\n", +"//calculations\n", +"dsa=n*R*log(p1/p2)\n", +"T3=437.5 //K\n", +"dsb=Cv*log(T3/T2)\n", +"T4=350 //K\n", +"dsc=Cp*log(T4/T3)\n", +"T5=634 //K\n", +"dsd=0\n", +"T6=700 //K\n", +"dse=Cp*log(T6/T5)\n", +"dstotal=dsa+dsb+dsc+dsd+dse\n", +"//results\n", +"printf('Entropy change in case a = %.3f kJ/kmol K',dsa)\n", +"printf('\n Entropy change in case b = %.3f kJ/kmol K',dsb)\n", +"printf('\n Entropy change in case c = %.3f kJ/kmol K',dsc)\n", +"printf('\n Entropy change in case d = %.3f kJ/kmol K',dsd)\n", +"printf('\n Entropy change in case e = %.3f kJ/kmol K',dse)\n", +"printf('\n Entropy change in total process = %.3f kJ/kmol K',dstotal)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.3: Example_3.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"ratio=1/2\n", +"R=8.314\n", +"p1=0.5 //kPa\n", +"p2=0.1 //kPa\n", +"//calculations\n", +"ya=ratio/(1+ratio)\n", +"ds=-ya*R*log(ya) - (1-ya)*R*log(1-ya)\n", +"dss=R*log(p1/p2)\n", +"//results\n", +"printf('Entropy of mixing = %.3f kJ/kmol K',ds)\n", +"printf('\n Total entropy change of the universe = %.2f kJ/kmol K',dss)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4: Example_4.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"s1=7.096 //kJ/kg K\n", +"s2=7.915 //kJ/kg K\n", +"s3=7.16 //kJ/kg K\n", +"s4=7.014 //kJ/kg K\n", +"s5=6.999 //kJ/kg K\n", +"//calculations\n", +"dsa=s2-s1\n", +"dsb=s3-s2\n", +"dsc=s4-s3\n", +"dsd=s5-s4\n", +"dse=s1-s5\n", +"dstotal=dsa+dsb+dsc+dsd+dse\n", +"//results\n", +"printf('Change in entropy in process a =%.3f kJ/kg K',dsa)\n", +"printf('\n Change in entropy in process b =%.3f kJ/kg K',dsb)\n", +"printf('\n Change in entropy in process c =%.3f kJ/kg K',dsc)\n", +"printf('\n Change in entropy in process d =%.3f kJ/kg K',dsd)\n", +"printf('\n Change in entropy in process e =%.3f kJ/kg K',dse)\n", +"printf('\n Change in entropy in total process =%.3f kJ/kg K',dstotal)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.5: Example_5.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"m1=5000 //kg/h\n", +"cp1=3.2 //kJ/kg K\n", +"cp2=4.186 //kJ/kg K\n", +"t1=220 //C\n", +"t2=30 //C\n", +"T1=210 //C\n", +"T2=20 //C\n", +"//calculations\n", +"m2=m1*cp1*(t1-t2)/(cp2*(T1-T2))\n", +"ds=m1*cp1*log((t2+273.1)/(t1+273.1)) + m2*cp2*log((T1+273.1)/(T2+273.1))\n", +"//results\n", +"printf('Change in entropy = %d kJ/h K',ds)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.6: Example_6.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"s1=218.8 //kJ/kmol K\n", +"s2=188.85 //kJ/kmol K\n", +"s3=237.8 //kJ/kmol K\n", +"s4=205.2 //kJ/kmol K\n", +"//calculations\n", +"ds=s1+s2-s3-0.5*s4\n", +"//results\n", +"printf('Entropy change = %.2f kJ/kmol K',ds)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.7: Example_7.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"Q=6 //kJ/kg\n", +"p1=1.5 //Mpa\n", +"p2=0.1 //Mpa\n", +"t1=500 //C\n", +"t2=140.8 //C\n", +"h1=3473.1 //kJ\n", +"h2=2758.1 //kJ\n", +"s1=7.5698 //kJ/K\n", +"s2=7.5698 //kJ/K\n", +"eff=0.85\n", +"Ts=293.1 //K\n", +"//calculations\n", +"Wideal=h2-h1\n", +"Ws=eff*Wideal\n", +"dH=-Q-Ws\n", +"H2=h1+dH\n", +"S2=7.8005\n", +"ds=S2-s1\n", +"Wlost=Ts*ds+Q\n", +"//results\n", +"printf('lost work = %.1f kJ',Wlost)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.8: Example_8.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"m=5000 ///kg/h\n", +"cp=3.2 //kJ/kg K\n", +"Ts=30+273.1 //K\n", +"t1=220 //C\n", +"t2=40 //C\n", +"Q=2.88*10^6 //kJ\n", +"//calculations\n", +"Q=m*cp*(t2-t1)\n", +"dss=m*cp*log((t2+273.1)/(t1+273.1))\n", +"Wlost=Ts*dss-Q\n", +"eff=Ts*dss/Q\n", +"//results\n", +"printf('Lost work = %d kJ',Wlost)\n", +"printf('\n Efficiency = %.3f',eff)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.9: Example_9.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"R=8.314\n", +"cp=35.58\n", +"n=100/16\n", +"T1=300 //K\n", +"T2=500 //K\n", +"k=1.305\n", +"P2=3 //Mpa\n", +"P1=0.5 //Mpa\n", +"Ts=290 //K\n", +"//calculations\n", +"cv=cp-R\n", +"Wi=n*R*T1/(k-1) *((P2/P1)^((k-1)/k) -1)\n", +"Hi=Wi\n", +"Ha=n*cp*(T2-T1)\n", +"eta=abs(Hi/Ha)\n", +"dss1=cp*log(T2/T1) - R*log(P2/P1)\n", +"Wl1=Ts*dss1\n", +"dss2=n*cp*log(T2/T1)\n", +"dss3=abs(Ha/Ts)\n", +"dsst=dss2+dss3\n", +"Wl2=-Ts*dss2 +Ha\n", +"Wlost=Wl1+Wl2\n", +"//results\n", +"printf('Thermodynamic efficiency = %.3f',eta)\n", +"printf('\n Net work lost = %d kJ',Wlost)" + ] + } +], +"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 +} diff --git a/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/5-Relationships_among_Thermodynamic_Properties_Graphical_Representation_of_properties_and_processes.ipynb b/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/5-Relationships_among_Thermodynamic_Properties_Graphical_Representation_of_properties_and_processes.ipynb new file mode 100644 index 0000000..94d3f56 --- /dev/null +++ b/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/5-Relationships_among_Thermodynamic_Properties_Graphical_Representation_of_properties_and_processes.ipynb @@ -0,0 +1,65 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5: Relationships among Thermodynamic Properties Graphical Representation of properties and processes" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5: Example_5.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"R=8314.3\n", +"b=0.0306 //m^3/kmol\n", +"a=0.548*10^6 //pa m^6/kmol^6\n", +"T=973.1\n", +"P=25*10^6 //Pa\n", +"//calculations\n", +"Vi= R*T/P\n", +"x=poly(0,'x')\n", +"vec=roots(P*x^2 *(x-b) +a*(x-b) - R*T*(x^2))\n", +"volume= vec(1)\n", +"dH=8.0906*10^6 -P*volume +0.548*10^6 /volume\n", +"//results\n", +"printf('Change in enthalpy = %.2e J/kmol',dH)" + ] + } +], +"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 +} diff --git a/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/7-Solution_Properties_and_Physical_Equilibria.ipynb b/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/7-Solution_Properties_and_Physical_Equilibria.ipynb new file mode 100644 index 0000000..73b02de --- /dev/null +++ b/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/7-Solution_Properties_and_Physical_Equilibria.ipynb @@ -0,0 +1,255 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7: Solution Properties and Physical Equilibria" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.2: Example_2.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"T=154.5 //C\n", +"P=8620*10^3 //Pa\n", +"Tc=135 //C\n", +"T0=273.1 //C\n", +"Pc=3648*10^3 //Pa\n", +"w=0.1756\n", +"V=0.154 \n", +"R=8.3143*10^3\n", +"//calculations\n", +"Tr=(T+T0)/(T0+Tc)\n", +"Pr= P/Pc\n", +"Z=P*V/(R*(T+T0))\n", +"a= 0.42747*R^2 *(Tc+T0)^2 /Pc *(1+ (0.48508 + 1.55171*w - 0.15613*w^2)*(1-sqrt(Tr)))^2\n", +"b=0.08664*R*(Tc+T0)/Pc\n", +"A= a*P/(R^2 *(T+T0)^2)\n", +"B=b*P/(R*(T+T0))\n", +"lnphi= (Z-1) - log(Z-B) - A/B *log((Z+B)/Z) \n", +"phi=exp(lnphi)\n", +"f=phi*P\n", +"//results\n", +"printf('fugacity = %d kPa',f/10^3)\n", +"//The answer is a bit different due to rounding off error in textbook" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.3: Example_3.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"T=154.5 //C\n", +"P=8620*10^3 //Pa\n", +"Tc=135 //C\n", +"T0=273.1 //C\n", +"Pc=3648*10^3 //Pa\n", +"w=0.1756\n", +"V=0.154 \n", +"R=8.3143*10^3\n", +"D=0.35\n", +"Vc=0.263 //m^3/kmol\n", +"//calculations\n", +"Tr=(T+T0)/(T0+Tc)\n", +"Pr= P/Pc\n", +"Zc=Pc*Vc/(R*(Tc+T0))\n", +"phi1=0.44\n", +"phi2=phi1*10^(D*(Zc-0.27))\n", +"f=phi2*P\n", +"//results\n", +"printf('fugacity = %d kPa',f/10^3)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.4: Example_4.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"f0=0.7\n", +"\n", +"V=5.1e-2\n", +"P1=0.77 //Mpa\n", +"P2=10 //Mpa\n", +"R=8.3143*10^3\n", +"T=298 //K\n", +"//calculations\n", +"lnr= V/(R*T) *(P2-P1)*10^6\n", +"f=exp(lnr) *f0\n", +"//results\n", +"printf('Fugacity = %.3f Mpa',f)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.5: Example_5.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"Pt=0.1013\n", +"ya=0.605\n", +"P1=0.1373\n", +"P2=0.06\n", +"xa=0.4\n", +"//calculations\n", +"if ya*Pt == xa*Pt & (1-ya)*Pt == (1-xa)*Pt then\n", +" printf('The system is ideal')\n", +"else\n", +" printf('The system is not ideal')\n", +"end" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.6: Example_6.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"Y=0.06\n", +"X=0.0012\n", +"P=2.53 //Mpa\n", +"//calculations\n", +"y=Y/(1+Y)\n", +"x=X/(1+X)\n", +"H=y*P/x\n", +"//results\n", +"printf('Henrys law constant = %.2f Mpa',H)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.7: Example_7.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"Hi=55\n", +"Pi=11.8\n", +"xi=0.514\n", +"H2=18.1\n", +"H3=26.9\n", +"Pi2=17.4\n", +"//calculations\n", +"ai=Pi/Hi\n", +"gam=ai/xi\n", +"a2=Pi/H2\n", +"gam2=a2/xi\n", +"a3=Pi2/H3\n", +"gam3=a3/(1-xi)\n", +"//results\n", +"disp('part a')\n", +"printf('Activity of acetic acid = %.4f ',ai)\n", +"printf('\n Activity coefficient = %.4f ',gam)\n", +"\n", +"disp('part b')\n", +"printf('Activity of acetic acid = %.4f ',a2)\n", +"printf('\n Activity coefficient = %.4f ',gam2)\n", +"\n", +"disp('part c')\n", +"printf('Activity of toluene = %.4f ',a3)\n", +"printf('\n Activity coefficient = %.4f ',gam3)" + ] + } +], +"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 +} diff --git a/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/8-Physical_Equilibria_among_Phases.ipynb b/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/8-Physical_Equilibria_among_Phases.ipynb new file mode 100644 index 0000000..717fa3f --- /dev/null +++ b/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/8-Physical_Equilibria_among_Phases.ipynb @@ -0,0 +1,436 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 8: Physical Equilibria among Phases" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.10_a: Example_10a.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"v1=0.1316\n", +"v2=0.2941\n", +"x1=0.5\n", +"x2=0.2\n", +"x3=0.8 \n", +"d1=14.87\n", +"d2=16.34\n", +"//calculations and results\n", +"vm=x1*(v1+v2)\n", +"phi1=x1*v1/vm\n", +"phi2=(1-x1)*v2/vm\n", +"Hl1=vm*phi1*phi2*(d1-d2)^2 *10^3\n", +"disp('case 1')\n", +"printf('enthalpy = %.1f kJ/mol',Hl1)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.10_b: Example_10b.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"v1=0.1316\n", +"v2=0.2941\n", +"x1=0.5\n", +"x2=0.2\n", +"x3=0.8 \n", +"d1=14.87\n", +"d2=16.34\n", +"//calculations and results\n", +"vm=(1-x2)*v1+x2*v2\n", +"phi1=(1-x2)*v1/vm\n", +"phi2=(x2)*v2/vm\n", +"Hl2=vm*phi1*phi2*(d1-d2)^2 *10^3\n", +"disp('case 2')\n", +"printf('enthalpy = %.1f kJ/mol',Hl2)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.10_c: Example_10c.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"v1=0.1316\n", +"v2=0.2941\n", +"x1=0.5\n", +"x2=0.2\n", +"x3=0.8 \n", +"d1=14.87\n", +"d2=16.34\n", +"//calculations and results\n", +"vm=(1-x3)*v1+x3*v2\n", +"phi1=(1-x3)*v1/vm\n", +"phi2=(x3)*v2/vm\n", +"Hl3=vm*phi1*phi2*(d1-d2)^2 *10^3\n", +"disp('case 3')\n", +"printf('enthalpy = %.1f kJ/mol',Hl3)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.1: Example_1.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"function V = func(C,phi)\n", +" V=C+2-phi\n", +"endfunction\n", +"//calculations and results\n", +"disp('part a')\n", +"printf('degrees of freedom = %d ',func(2,2))\n", +"disp('part b')\n", +"printf('degrees of freedom = %d ',func(3,2))\n", +"disp('part c')\n", +"printf('degrees of freedom = %d ',func(3,3))" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.2: Example_2.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"T=95 //C\n", +"P=1013 //kPa\n", +"Tc=135 //C\n", +"Pc=3648 //kPa\n", +"T0=273.1 //C\n", +"D=0.3\n", +"P0=1800 //kPa\n", +"D2=0.42\n", +"//calculations\n", +"Zc=0.283\n", +"Tr=(T+T0)/(Tc+T0)\n", +"Pr=P/Pc\n", +"phic=0.88\n", +"phi2=phic*10^(D*0.013)\n", +"Prd= P0/Pc\n", +"phi3=0.78\n", +"phi4= phi3*10^(D2*0.013)\n", +"gl= phi2*P/(phi3*P0)\n", +"//results\n", +"printf('equation is gl = %.3f *(y/x)',gl)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.3: Example_3.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"ye=0.434\n", +"Pt=40.25 //kPa\n", +"xe=0.616\n", +"Pe1=22.9 //kPa\n", +"Pe2=29.6 //kPa\n", +"//calculations\n", +"ge= ye*Pt/(xe*Pe1)\n", +"gb=(1-ye)*Pt/((1-xe)*Pe2)\n", +"E= log10(ge) *(1+ (1-xe)*log(gb) /(xe*log(ge)))^2\n", +"B= log10(gb) *(1+ xe/(1-xe) *log(ge) /log(gb))^2\n", +"xe2=0.4\n", +"xb2=0.6\n", +"lnge2=E/(1+ E*xe2/(B*xb2))^2\n", +"lngb2=B/(1+ B*xb2/(E*xe2))^2\n", +"ge2=10^(lnge2)\n", +"gb2=10^(lngb2)\n", +"Pt1=ge2*Pe1\n", +"Pt2=gb2*Pe2\n", +"//results\n", +"printf('Total pressure in case 1 = %.2f kPa and in case 2 = %.2f kPa',Pt1, Pt2 )" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.4: Example_4.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"k4=1.8\n", +"k5=0.8\n", +"//calculations\n", +"A=[k4 k5;1 1]\n", +"b=[1; 1]\n", +"C=A\b\n", +"x4=C(1)\n", +"x5=C(2)\n", +"y4=k4*x4\n", +"y5=k5*x5\n", +"//results\n", +"printf('Vapor and liquid mole fractions of component 1 = %.2f and %.2f respectively',y4,x4)\n", +"printf('\n Vapor and liquid mole fractions of component 2 = %.2f and %.2f respectively',y5,x5)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.5: Example_5.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"v1=81 //cm^3/gmol\n", +"v2=97 //cm^3/gmol\n", +"d1=9.2 //(cal/cm^3)^0.5\n", +"d2=8.6 //(cal/cm^3)^0.5\n", +"R=1.987\n", +"T=373.1 //K\n", +"//calculations\n", +"d=0.5*(d1+d2)\n", +"lng1=v1*(d1-d)^2 /(R*T)\n", +"lng2=v2*(d2-d)^2 /(R*T)\n", +"g1=exp(lng1)\n", +"g2=exp(lng2)\n", +"//results\n", +"printf('Activity coeffecients of components are %.3f and %.3f respectively',g1,g2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.6: Example_6.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"xe=0.3\n", +"xe2=0.9\n", +"Pe0=810\n", +"Pa0=470\n", +"ge=1.85\n", +"ge2=1.05\n", +"ga=1.15\n", +"ga2=3\n", +"Pt=820 //mm\n", +"Pt2=900 //mm\n", +"//calculations\n", +"ye=ge*xe*Pe0/Pt\n", +"ya=ga*(1-xe)*Pa0/Pt\n", +"yt=ye+ya\n", +"ye2=ye/yt\n", +"ya2=ya/yt\n", +"ye3=ge2*xe2*Pe0/Pt2\n", +"ya3=ga2*(1-xe2)*Pa0/Pt2\n", +"yt2=ye+ya\n", +"ye4=ye3/yt2\n", +"ya4=ya3/yt2\n", +"//results\n", +"printf('In case 1, ye = %.3f and ya = %.3f',ye2,ya2)\n", +"printf('\n In case 1, ye = %.3f and ya = %.3f',ye4,ya4)\n", +"disp('The calculations of ya in case 1 in textbook is wrong. please use a calculator')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.7: Example_7.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"m1=121\n", +"m2=18\n", +"p1=0.0042\n", +"p2=0.0858\n", +"//calculations\n", +"massfrac= (p1*m1)/(p1*m1+p2*m2)\n", +"//results\n", +"printf('mass fractions of DMA and water are %.3f and %.3f respectively',massfrac,1-massfrac)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.9: Example_9.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"FR=25\n", +"FE=19\n", +"bf=130 //kg\n", +"af=85 //kg\n", +"//calculations\n", +"law=FR/FE\n", +"x1=45/150\n", +"x2=65/150\n", +"ER=18.5/6\n", +"e=[0.5 0.1 0.9]\n", +"r=[0.28 0.96 0.04]\n", +"et=sum(e)\n", +"rt=sum(r)\n", +"ett=e/et\n", +"rtt=r/rt\n", +"//results\n", +"disp('the compositions of raffinate are ')\n", +"disp(rtt)\n", +"disp('the compositions of extract are')\n", +"disp(ett)" + ] + } +], +"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 +} diff --git a/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/9-Chemical_Equilibria.ipynb b/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/9-Chemical_Equilibria.ipynb new file mode 100644 index 0000000..830cdc0 --- /dev/null +++ b/Chemical_Engineering_Thermodynamics_by_T_E_Daubert/9-Chemical_Equilibria.ipynb @@ -0,0 +1,531 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 9: Chemical Equilibria" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.10_a: Example_10a.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"kp=1.09\n", +"feed=[ 1 5 0 0 0 ]\n", +"//calculations\n", +"x=poly(0,'x')\n", +"vec=roots(kp/4^4 /4 *(1-x)*(5-2*x)^2 *(6+2*x)^2 -x^5)\n", +"x=vec(5)\n", +"pro=[1-x 5-2*x x 4*x 0]\n", +"//results\n", +"disp('Equlibrium composition (moles)= ')\n", +"format('v',6);pro\n", +"disp(pro)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.10_b: Example_10b.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"kp=1.09\n", +"kp2=0.154\n", +"feed=[ 1 5 0 0 0 ]\n", +"//calculations\n", +"x=poly(0,'x')\n", +"vec=roots(kp/4^4 /4 *(1-x)*(5-2*x)^2 *(6+2*x)^2 -x^5)\n", +"x=vec(5)\n", +"pro=feed- [x 2*x -x -4*x 0]\n", +"y=poly(0,'y')\n", +"vec2=roots(kp2*(0.273-y)*(0.727-y)*(7.454+2*y)^2 - 4*y^2 *(2.908+2*y)^2 *4)\n", +"y=vec2(4)\n", +"pro2=pro-[ y 0 y -2*y -2*y]\n", +"z=poly(0,'z')\n", +"vec3= roots(kp*(0.189-z)*(3.546-2*z)^2 *(7.622+2*z)^2 -(0.643+z)*(3.076+4*z)^4 *4)\n", +"z=vec3(5)\n", +"pro3=pro2 - [z 2*z -z -4*z 0]\n", +"w=poly(0,'w')\n", +"vec4=roots(kp2*(0.229-w)*(0.603-w)*(7.542+2*w) - (2.916+2*w)^2 *(0.168+2*w)^2 *4)\n", +"w=vec4(4)\n", +"w=0.01\n", +"pro4=pro3-[w 0 w -2*w -2*w]\n", +"//results\n", +"disp('feed = ')\n", +"format('v',6);feed\n", +"disp(feed)\n", +"disp('After reactor 1,')\n", +"format('v',6);pro\n", +"disp(pro)\n", +"disp('After reactor 2,')\n", +"format('v',6);pro2\n", +"disp(pro2)\n", +"disp('After reactor 3,')\n", +"format('v',6);pro3\n", +"disp(pro3)\n", +"disp('After reactor 4')\n", +"format('v',6);pro4\n", +"disp(pro4)\n", +"disp('The answers are a bit different due to rounding off error in textbook')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.1_a: Example_1a.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"g11=178900 //kJ/kmol\n", +"g12=207037 //kJ/kmol\n", +"g21=211852 //kJ/kmol\n", +"g22=228097 //kJ/kmol\n", +"//calculations\n", +"dG=g21-g11\n", +"//results\n", +"printf('Standard free energy change = %d kJ/kmol',dG)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.1_b: Example_1b.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"m1=54.1\n", +"m2=56.1\n", +"m3=2\n", +"cp1=2.122 //kJ/kmol K\n", +"cp2=2.213 //kJ/kmol K\n", +"cp3=14.499 //kJ/kmol K\n", +"hf1=110200 //kJ/kmol\n", +"hf2=-126 //kJ/kmol\n", +"T=700 //K\n", +"Ts=298 //K\n", +"//calculations\n", +"hf=hf1-hf2\n", +"cpn=cp1*m1-cp2*m2+cp3*m3\n", +"h700=hf+ cpn*(T-Ts)\n", +"s298=103.7\n", +"s700 = s298 + cpn*log(T/Ts)\n", +"G700=h700-T*s700\n", +"//results\n", +"printf('Change in gibbs energy = %d kJ/kmol',G700)\n", +"disp('The answer is a bit different due to rounding off error in textbook')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.2: Example_2.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"g1=150670 //kJ/kmol\n", +"g2=71500 //kJ/kmol\n", +"R=8.314\n", +"Ts=298 //K\n", +"T=700 //K\n", +"//calculationd\n", +"G=g1-g2\n", +"G2=33875 //kJ/kmol\n", +"K1=exp(-G/R/Ts)\n", +"K2=exp(-G2/R/T)\n", +"//results\n", +"printf('In case 1, equilibrium constant = %.2e',K1)\n", +"printf('\n In case 2, equilibrium constant = %.5f',K2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.3: Example_3.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"R=8.3143\n", +"T1=1273 //K\n", +"T2=2273 //K\n", +"k2=0.0018\n", +"A=123.94\n", +"B=7.554\n", +"C=8.552*10^-3\n", +"D=-13.25e-6\n", +"E=7.002e-9\n", +"F=13.494e-13\n", +"//calculations\n", +"function y= cp(T)\n", +" y=A/T^2 +B/T +C +D*T +E*T^2 -F*T^3\n", +"endfunction\n", +"lnk=1/R *intg(T1,T2,cp)\n", +"k1=k2/ exp(lnk)\n", +"//results\n", +"printf('Equilibrium constant = %.5f ',k1)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.4_a: Example_4a.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"G=-30050 //kJ/kmol\n", +"R=8.314\n", +"T=573 //K\n", +"//calculations\n", +"lnk=G/(R*T)\n", +"k=exp(lnk)\n", +"x=poly(0,'x')\n", +"vec=roots(4*x^2 - k*(1-x)^2)\n", +"x2=vec(2)\n", +"//results\n", +"printf('Mole fraction of HCN = %.4f',x2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.4_b: Example_4b.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"G=-30050 //kJ/kmol\n", +"R=8.314\n", +"T=573 //K\n", +"phi1=0.980\n", +"phi2=0.915\n", +"phi3=0.555\n", +"//calculations\n", +"lnk=G/(R*T)\n", +"k=exp(lnk)\n", +"kexp= k*phi1*phi2/phi3^2 /4\n", +"x=poly(0,'x')\n", +"vec=roots(x^2 - kexp*(1-x)^2)\n", +"x2=vec(2)\n", +"//results\n", +"printf('Mole fraction of HCN = %.4f',x2)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.5: Example_5.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"kp=74\n", +"//calculations\n", +"f=poly(0,'f')\n", +"vec=roots(f^2 *(100-6*f) - kp^2 *(1-f)^2 *(9-6*f))\n", +"fn=vec(3)\n", +"//results\n", +"printf('Fractional conversion = %.3f',fn)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.6_a: Example_6a.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"C=3\n", +"phi=3\n", +"R=1\n", +"Sc=0\n", +"function V=fun(C,phi,R,Sc)\n", +" V=2+C-phi-R-Sc\n", +"endfunction\n", +"//calculations\n", +"V=fun(C,phi,R,Sc)\n", +"//results\n", +"printf('Degrees of freedom = %d ',V)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.6_b: Example_6b.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"C=3\n", +"phi=1\n", +"R=1\n", +"Sc=1\n", +"function V=fun(C,phi,R,Sc)\n", +" V=2+C-phi-R-Sc\n", +"endfunction\n", +"//calculations\n", +"V=fun(C,phi,R,Sc)\n", +"//results\n", +"printf('Degrees of freedom = %d ',V)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.6_c: Example_6c.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"C=6\n", +"phi=1\n", +"R=3\n", +"Sc=0\n", +"function V=fun(C,phi,R,Sc)\n", +" V=2+C-phi-R-Sc\n", +"endfunction\n", +"//calculations\n", +"V=fun(C,phi,R,Sc)\n", +"//results\n", +"printf('Degrees of freedom = %d ',V)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.7: Example_7.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"a1=0.956\n", +"y=0.014\n", +"x=0.956\n", +"M=18\n", +"z=0.475\n", +"P=8.37 //Mpa\n", +"//calculations\n", +"m=y/(x*M) *10^3\n", +"w=0.0856\n", +"phi1=-0.04\n", +"phi2=0.06\n", +"phi=10^(phi1+ w*phi2)\n", +"f=z*phi*P\n", +"K=m/(f*a1)\n", +"//results\n", +"printf('Equilibrium constant = %.3f',K)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.9: Example_9.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"y=0.18\n", +"z=0.6\n", +"//calculations\n", +"mole=[1-y-z 5-y-2*z y 3*y+4*z z]\n", +"s=sum( mole)\n", +"molef=mole/s\n", +"//results\n", +"disp('Product composition moles = ')\n", +"format('v',6);mole\n", +"disp(mole)\n", +"disp('Mole fraction = ')\n", +"format('v',6);molef\n", +"disp(molef)" + ] + } +], +"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 +} |