{ "metadata": { "name": "", "signature": "sha256:c42287d60d2420025e9cb75cd5a29fe499f8ec6aad7d7b81c5d1437599962d5d" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 5 : Relationships among thermodynamic properties - Graphical representation of properties and processes" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.5 page : 208" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from scipy.optimize import fsolve\n", "\t\t\t\n", "# Variables\n", "R = 8314.3\n", "b = 0.0306 \t\t\t#m**3/kmol\n", "a = 0.548*10**6 \t\t\t#pa m**6/kmol**6\n", "T = 973.1\n", "P = 25*10**6 \t\t\t#Pa\n", "\t\t\t\n", "# Calculations\n", "Vi = R*T/P\n", "#x = poly(0,'x')\n", "def f(x):\n", " return P*x**2 *(x-b) +a*(x-b) - R*T*(x**2)\n", "#vec = roots(P*x**2 *(x-b) +a*(x-b) - R*T*(x**2))\n", "#vec = roots([P,(P*b+R*T),a,-a*b])\n", "vec = fsolve(f,0,full_output=1)\n", "volume = vec[0]\n", "dH = 8.0906*10**6 -P*volume +0.548*10**6 /volume\n", "\t\t\t\n", "# Results\n", "print \"Change in enthalpy = %.2e J/kmol\"%(dH)\n", "\n", "\n", "# Note : Answer is different because fsolve function calculates differently. Please check manually.\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Change in enthalpy = 2.21e+07 J/kmol\n" ] } ], "prompt_number": 1 } ], "metadata": {} } ] }