diff options
Diffstat (limited to 'Thermodynamics:_From_concepts_to_applications/Chapter17_1.ipynb')
-rwxr-xr-x | Thermodynamics:_From_concepts_to_applications/Chapter17_1.ipynb | 250 |
1 files changed, 250 insertions, 0 deletions
diff --git a/Thermodynamics:_From_concepts_to_applications/Chapter17_1.ipynb b/Thermodynamics:_From_concepts_to_applications/Chapter17_1.ipynb new file mode 100755 index 00000000..2d6dc101 --- /dev/null +++ b/Thermodynamics:_From_concepts_to_applications/Chapter17_1.ipynb @@ -0,0 +1,250 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:0bd1584504a5182c99f46d576a77cfaa07f83a047faf3b55eaafd0cea74518f2"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter17-Ideal solutions"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1-pg367"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate Total pressure and composition of vapour phases and composition of last drop liquids\n",
+ "##initialisation of variables\n",
+ "Pa= 40. ##kPa\n",
+ "Pb= 50. ##kPa\n",
+ "na= 2. ##moles\n",
+ "nb= 6. ##moles\n",
+ "##CALCULATIONS\n",
+ "a= Pb/Pa\n",
+ "xa= na/(na+nb)\n",
+ "xb= 1.-xa\n",
+ "p= xa*Pa+xb*Pb\n",
+ "y= (xa*Pa)/p\n",
+ "ya= 1.-y\n",
+ "Xa= a*xa/(1+(a-1)*xa)\n",
+ "Xb= 1.-Xa\n",
+ "##RESULTS\n",
+ "print'%s %.1f %s'%('Total pressure=',p,'kPa')\n",
+ "print'%s %.4f %s'%('composition of vapour phase=',y,'')\n",
+ "print'%s %.4f %s'%('composition of vapour phase=',ya,'')\n",
+ "print'%s %.4f %s'%('composition of last drop of liquid=',Xa,'')\n",
+ "print'%s %.4f %s'%('composition of last drop of liquid=',Xb,'')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total pressure= 47.5 kPa\n",
+ "composition of vapour phase= 0.2105 \n",
+ "composition of vapour phase= 0.7895 \n",
+ "composition of last drop of liquid= 0.2941 \n",
+ "composition of last drop of liquid= 0.7059 \n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2-pg371"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\t\n",
+ "#calculate pressure of the phase of pure A\n",
+ "##initialisation of variables\n",
+ "p0= 10. ##Mpa\n",
+ "R= 8.314 ##J/mol K\n",
+ "T= 30. ##C\n",
+ "va= 0.02 ##m^3/kmol\n",
+ "xa= 0.98\n",
+ "##CALCULATIONS\n",
+ "p= p0+(R*(273.15+T)*math.log(xa)/(va*1000.))\n",
+ "##RESULTS\n",
+ "print'%s %.2f %s'%('Pressure of the phase of pure A=',p,'Mpa')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Pressure of the phase of pure A= 7.45 Mpa\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3-pg373"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate the boiling point elevation\n",
+ "##initialisation of variables\n",
+ "hfg= 2257.0 ##kJ/kg\n",
+ "Tb= 100 ##C\n",
+ "R= 8.314 ##J/mol K\n",
+ "m2= 10 ##gms\n",
+ "M2= 58.5 ##gms\n",
+ "m1= 90. ##gms\n",
+ "M1= 18. ##gms\n",
+ "##CALCULATIONS\n",
+ "x2= (m2/M2)/((m2/M2)+(m1/M1))\n",
+ "dT= R*math.pow(273.15+Tb,2)*x2/(M1*hfg)\n",
+ "##RESULTS\n",
+ "print'%s %.3f %s'%(' Boiling point elevation=',dT,'C')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Boiling point elevation= 0.942 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4-pg376"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate Osomatic pressures\n",
+ "##initialisation of variables\n",
+ "M1= 18.02 ##gms\n",
+ "m1= 0.965 ##gms\n",
+ "m2= 0.035 ##gms\n",
+ "M2= 58.5 ##gms\n",
+ "R= 8.314 ##J/mol K\n",
+ "M= 18.02 ##kg\n",
+ "T= 20. ##C\n",
+ "vf= 0.001002 ##m^3\n",
+ "x21= 0.021856 ##m^3\n",
+ "##CALCULATIONS\n",
+ "n1= m1/M1\n",
+ "n2= m2/M2\n",
+ "x1= n1/(n1+n2)\n",
+ "x2= n2/(n2+n1)\n",
+ "P= R*(273.15+T)*x2/(M*vf)\n",
+ "P1= R*(273.15+T)*x21/(M*vf)\n",
+ "##RESULTS\n",
+ "print'%s %.1f %s'%('Osmotic pressure=',P,'kpa')\n",
+ "print'%s %.1f %s'%('Osmotic pressure=',P1,'kpa')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Osmotic pressure= 1491.4 kpa\n",
+ "Osmotic pressure= 2950.2 kpa\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5-pg377"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#what is useful work in the process and heat interaction and maximum work and irreversibility\n",
+ "##initialisation of variables\n",
+ "W= 0.\n",
+ "Q= 0.\n",
+ "R= 8.314 ##J/mol K\n",
+ "T0= 300. ##K\n",
+ "x= 5./13.\n",
+ "n1= 0.5 ##kmol/s\n",
+ "n2= 0.8 ##kmol/s\n",
+ "##CALCULATIONS\n",
+ "W1= (n1+n2)*R*T0*(x*math.log(1/x)+(1-x)*math.log(1/(1-x)))\n",
+ "I= W1\n",
+ "##RESULTS\n",
+ "print'%s %.f %s'%('useful work of the process=',W,'kW') \n",
+ "print'%s %.f %s'%('heat interaction=',Q,'kW') \n",
+ "print'%s %.1f %s'%('maximum work=',W1,'kW') \n",
+ "print'%s %.1f %s'%('irreversibility=',I,'kW')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "useful work of the process= 0 kW\n",
+ "heat interaction= 0 kW\n",
+ "maximum work= 2160.4 kW\n",
+ "irreversibility= 2160.4 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |