summaryrefslogtreecommitdiff
path: root/Chemical_Engineering_Thermodynamics/ch2.ipynb
diff options
context:
space:
mode:
authornice2014-08-27 16:12:51 +0530
committernice2014-08-27 16:12:51 +0530
commit238d7e632aecde748a97437c2b5774e136a3b4da (patch)
treea05d96f81cf72dc03ceec32af934961cf4ccf7dd /Chemical_Engineering_Thermodynamics/ch2.ipynb
parent7e82f054d405211e1e8760524da8ad7c9fd75286 (diff)
downloadPython-Textbook-Companions-238d7e632aecde748a97437c2b5774e136a3b4da.tar.gz
Python-Textbook-Companions-238d7e632aecde748a97437c2b5774e136a3b4da.tar.bz2
Python-Textbook-Companions-238d7e632aecde748a97437c2b5774e136a3b4da.zip
adding book
Diffstat (limited to 'Chemical_Engineering_Thermodynamics/ch2.ipynb')
-rwxr-xr-xChemical_Engineering_Thermodynamics/ch2.ipynb117
1 files changed, 117 insertions, 0 deletions
diff --git a/Chemical_Engineering_Thermodynamics/ch2.ipynb b/Chemical_Engineering_Thermodynamics/ch2.ipynb
new file mode 100755
index 00000000..b7849ef3
--- /dev/null
+++ b/Chemical_Engineering_Thermodynamics/ch2.ipynb
@@ -0,0 +1,117 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:76568d79b614fc85568c92855047632dbe19f5ec7540dbd287268967c3318f2b"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 2 : Review of basic concepts"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.1 Page No : 29"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "# Variables\n",
+ "R = 8.314;\t\t\t #universal gas constant in J/molK\n",
+ "t1 = 300.;\t\t\t #initial temperature of gas in K\n",
+ "p1 = 0.1;\t\t\t #initial pressure of the gas in MPa\n",
+ "p2 = 0.5;\t\t\t #pressure of gas after heating in MPa\n",
+ "p3 = 0.1;\t\t\t #pressure of gas after expansion in MPa\n",
+ "n = 1.; \t\t\t #number of moles of gas in mole\n",
+ "\n",
+ "# Calculations\n",
+ "w1 = 0*n; \t\t\t # Calculations of work done by the gas during heating in kJ (since dv = 0)\n",
+ "t2 = t1*(p2/p1);\t\t\t # Calculations of temperature of gas after heating in K\n",
+ "t3 = t2;\t\t \t # Calculations of temperature of gas after expansion in K (constant temperature expansion)\n",
+ "volume2 = p2/p3;\t\t\t # Calculations of ratio of volume of gas after expansion to the volume of gas after heating (no unit)\n",
+ "w2 = (R*t2*math.log(volume2)*n)/1000\n",
+ "volume3 = t3/t1;\t\t\n",
+ "w3 = (R*t1*(1-volume3)*n)/1000\n",
+ "work_net = w1+w2+w3;\t\t\t # Calculations of net work done by the gas for the process in kJ\n",
+ "\n",
+ "# Results\n",
+ "print ' Work done during heating process:Work from 1-2 = %d kJ '%(w1);\n",
+ "print ' Work done during constant temperature expansion: Work from 2-3 = %.3f kJ '%(w2);\n",
+ "print ' Work done during constant pressure compression: Work from 3-1 = %.3f kJ '%(w3);\n",
+ "print ' Net work done by the gas during the process = %.3f kJ '%(work_net);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Work done during heating process:Work from 1-2 = 0 kJ \n",
+ " Work done during constant temperature expansion: Work from 2-3 = 20.071 kJ \n",
+ " Work done during constant pressure compression: Work from 3-1 = -9.977 kJ \n",
+ " Net work done by the gas during the process = 10.095 kJ \n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.2 Page No : 30"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variables\n",
+ "v1 = 0.1;\t\t\t #volume of gas initially present in the cylinder in m**3\n",
+ "p1 = 0.1;\t\t\t #initial pressure of gas in MPa\n",
+ "p_atm = 0.1;\t\t #atmospheric pressure acting on the piston in MPa\n",
+ "v2 = 0.3;\t\t\t #volume of gas after heating in m**3\n",
+ "p2 = 0.6;\t\t\t #pressure of gas after heating in MPa\n",
+ "\n",
+ "# Calculations\n",
+ "work = ((p1+p2)*(v2-v1)*10**6)/(2*1000);\t\t\t # Calculations of work done by the gas in kJ \n",
+ "\n",
+ "# Results\n",
+ "print ' The work done by the gas = %d kJ'%(work);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The work done by the gas = 70 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file