summaryrefslogtreecommitdiff
path: root/Thermodynamics:_From_concepts_to_applications/Chapter13_2.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Thermodynamics:_From_concepts_to_applications/Chapter13_2.ipynb')
-rwxr-xr-xThermodynamics:_From_concepts_to_applications/Chapter13_2.ipynb217
1 files changed, 217 insertions, 0 deletions
diff --git a/Thermodynamics:_From_concepts_to_applications/Chapter13_2.ipynb b/Thermodynamics:_From_concepts_to_applications/Chapter13_2.ipynb
new file mode 100755
index 00000000..110060a8
--- /dev/null
+++ b/Thermodynamics:_From_concepts_to_applications/Chapter13_2.ipynb
@@ -0,0 +1,217 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:d016c4eeb787b1d0c0380525317de7921eaea49abd3574e22c9db72f92b90771"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter13-thermodynamic relations"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2-pg376"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate entropy wrt pressures and volume wrt temerature\n",
+ "##initialisation of variables\n",
+ "S1= 6.539 ##kJ/kg K\n",
+ "S2= 6.7664 ##kJ/kg K\n",
+ "v1= 0.10976 ##m^3\n",
+ "v2= 0.08700 ##m^3\n",
+ "P= 3. ##Mpa\n",
+ "P1= 2. ##Mpa\n",
+ "T= 350. ##K\n",
+ "T1= 250. ##K\n",
+ "S3= 3.1741 ##kJ/kg K\n",
+ "S4= 3.2071 ##kJ/kg K\n",
+ "P2= 30. ##Mpa\n",
+ "P3= 20. ##Mpa\n",
+ "v3= 0.0014217 ##m^3\n",
+ "v4= 0.0012860 ##m^3\n",
+ "T2= 320. ##K\n",
+ "T3= 280. ##K\n",
+ "##CALCULATIONS\n",
+ "r= (S1-S2)/(P*10*10*10-P1*10*10*10)\n",
+ "r1= (v1-v2)/(T-T1)\n",
+ "R= (S3-S4)/(P2*10*10*10-P3*10*10*10)\n",
+ "R1= (v3-v4)/(T2-T3)\n",
+ "##RESULTS\n",
+ "print'%s %.7f %s'% ('entropy wrt pressre=',r,'kJ/kg K kpa')\n",
+ "print'%s %.e %s'% ('entropy wrt pressre=',R,'kJ/kg K kpa')\n",
+ "print'%s %.7f %s'% ('volume wrt temperature=',r1,'m^3/kg K ')\n",
+ "print'%s %.2e %s'% ('volume wrt temperature=',R1,'m^3/kg K ')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "entropy wrt pressre= -0.0002274 kJ/kg K kpa\n",
+ "entropy wrt pressre= -3e-06 kJ/kg K kpa\n",
+ "volume wrt temperature= 0.0002276 m^3/kg K \n",
+ "volume wrt temperature= 3.39e-06 m^3/kg K \n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3-pg379"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#saturation pressure\n",
+ "##initialisation of variables\n",
+ "hfg= 2406.7 ##kJ/kg\n",
+ "Psat40= 7.384 ##kPa\n",
+ "R= 8.314 ##J/mol K\n",
+ "T= 40. ##C\n",
+ "T1= 50. ##C\n",
+ "M= 18.##kg\n",
+ "##CALCULATIONS\n",
+ "Psat50= Psat40*math.e**((hfg*M/R)*((1/(273.15+T))-(1/(273.15+T1))))\n",
+ "##RESULTS\n",
+ "print'%s %.3f %s' %('Saturation pressure=',Psat50,'kPa')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Saturation pressure= 12.357 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4-pg379"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calcualte lowest temprature\n",
+ "##initialisation of variables\n",
+ "W= 800. ##N\n",
+ "A= 0.4 ##cm^2\n",
+ "p= 0.611 ##Mpa\n",
+ "P1= 0.1 ##Mpa\n",
+ "T= 0.01 ##C\n",
+ "vs= 0.0010908 ##m^3/kg\n",
+ "hs= -333.40 ##kJ/kg\n",
+ "vf= 0.0010002 ##m^3/kg\n",
+ "hf= 0 ##kJ/kg\n",
+ "vg= 206.14 ##m^3/kg\n",
+ "hg= 2501.4 ##kJ/kg\n",
+ "##CALCULATIONS\n",
+ "P2= P1+(W/A)*math.pow(10,(4-6))\n",
+ "dT= (273.15++T)*(vf-vs)*(P2*10*10*10-p)/(0-hs)\n",
+ "Tmin= dT+T\n",
+ "##RESULTS\n",
+ "print'%s %.2f %s'% ('lowest temperature=',Tmin,'C')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "lowest temperature= -1.48 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7-pg385"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate volume exapansion coefficent and isothermal compressibilitiy and isotherma modulus of elasticity\n",
+ "##initialisation of variables\n",
+ "vi= 0.0009992 ##m^3\n",
+ "T= 60. ##C\n",
+ "T1= 20. ##C\n",
+ "T2= 40. ##C\n",
+ "vi1= 0.0010042 ##m^3\n",
+ "vi2= 0.0009886 ##m^3\n",
+ "v= 0.000951 ##m^3\n",
+ "v1= 0.0009992 ##m^3\n",
+ "v2= 0.0009956 ##m^3\n",
+ "##CALCULATIONS\n",
+ "B= (vi1-vi2)/(vi*(T-T1))\n",
+ "Kt= (v1-v2)/(v*(T2-T1))\n",
+ "Et= 1/Kt\n",
+ "##RESULTS\n",
+ "print'%s %.2e %s'% ('volume exapansion coefficient=',B,'L/s')\n",
+ "print'%s %.3e %s'% ('isothermal compressibility=',Kt,'Mpa')\n",
+ "print'%s %.f %s'% ('isothermal modulus of elasticity=',Et,'Mpa')\n",
+ "\n",
+ "\n",
+ "##ANSWER FOR Et GIVEN IN THE TEXTBOOK IS WRONG\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "volume exapansion coefficient= 3.90e-04 L/s\n",
+ "isothermal compressibility= 1.893e-04 Mpa\n",
+ "isothermal modulus of elasticity= 5283 Mpa\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file