diff options
Diffstat (limited to 'Thermodynamics:_From_concepts_to_applications/Chapter5.ipynb')
-rwxr-xr-x | Thermodynamics:_From_concepts_to_applications/Chapter5.ipynb | 166 |
1 files changed, 166 insertions, 0 deletions
diff --git a/Thermodynamics:_From_concepts_to_applications/Chapter5.ipynb b/Thermodynamics:_From_concepts_to_applications/Chapter5.ipynb new file mode 100755 index 00000000..63ce2dea --- /dev/null +++ b/Thermodynamics:_From_concepts_to_applications/Chapter5.ipynb @@ -0,0 +1,166 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:38617d08dc78615a27f3bb0a8bac191fa91e9820c1bc63b1ee3f0d39bccfa426"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter5 -the ideal gas"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1-pg 66"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate specific volumes at given pressure\n",
+ "##initialisation of variables\n",
+ "R= 8.314 ##J/mol K\n",
+ "M= 18.016 ##gms\n",
+ "T= 400. ##C\n",
+ "p= 0.01 ##Mpa\n",
+ "p1= 0.1 ##Mpa\n",
+ "p2= 20. ##Mpa\n",
+ "##CALCULATIONS\n",
+ "v= R*(273.156+T)/(M*p*1000)\n",
+ "v1= R*(273.156+T)/(M*p1*1000)\n",
+ "v2= R*(273.156+T)/(M*p2*1000)\n",
+ "##RESULTS\n",
+ "print'%s %.3f %s'%(' specific voulme =',v,'m^3/kg')\n",
+ "print'%s %.3f %s'%('specific voulme = ', v1,'m^3/kg')\n",
+ "print'%s %.3f %s'%('specific voulme = ',v2,'m^3/kg')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " specific voulme = 31.065 m^3/kg\n",
+ "specific voulme = 3.106 m^3/kg\n",
+ "specific voulme = 0.016 m^3/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 3-pg73 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate final temperature and pressure and work ,energy\n",
+ "##initialisation of variables\n",
+ "p1= 300.##kPa\n",
+ "V1= 0.03 ##m^3\n",
+ "V2= 0.08 ##m^3\n",
+ "T1= 27. ##C\n",
+ "##CALCULATIONS1\n",
+ "T2= T1+273\n",
+ "p2= p1*(V1/V2)*(T2/(T1+273))\n",
+ "W= 0\n",
+ "Q= 0\n",
+ "##RESULTS\n",
+ "print'%s %.2f %s'%('final temperature =',T2,'K')\n",
+ "print'%s %.1f %s'%('final pressure =',p2,'kPa')\n",
+ "print'%s %.f %s'%('work = ',W,'kJ')\n",
+ "print'%s %.f %s'%('energy =',Q,'kJ')\n",
+ " \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "final temperature = 300.00 K\n",
+ "final pressure = 112.5 kPa\n",
+ "work = 0 kJ\n",
+ "energy = 0 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4 -pg74\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate mass of nitrogen and final temperature and piston rise\n",
+ "##initialisation of variables\n",
+ "p1= 2. ##Mpa\n",
+ "V1= 0.2 ##m^3\n",
+ "R= 8.314 ##J/mol K\n",
+ "T1= 500. ##C\n",
+ "M= 28. ##gms\n",
+ "p2= 0.3 ##Mpa\n",
+ "T2= 250 ##C\n",
+ "k= 1.4\n",
+ "A= 0.1 ##m^2\n",
+ "##CALCULATIONS\n",
+ "m1= p1*10*10*10*V1*M/(R*(273.15+T1))\n",
+ "m2= p2*10*10*10*V1*M/(R*(273.15+T2))\n",
+ "m3= -(m2-m1)\n",
+ "T3= (m1*(273.15+T1)-m2*(273.15+T2))/(k*m3)\n",
+ "z3= m3*R*T3/(p2*10*10*10*A*M)\n",
+ "##RESULTS\n",
+ "print'%s %.4f %s'%(' mass of nitrogen =',m3,'kg')\n",
+ "print'%s %.1f %s'%('final temperature =',T3,'K')\n",
+ "print'%s %.2f %s'%('piston rise =',z3,'m')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " mass of nitrogen = 1.3561 kg\n",
+ "final temperature = 603.1 K\n",
+ "piston rise = 8.10 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |