{
 "metadata": {
  "name": "",
  "signature": "sha256:9a8a7685dfe3ac94231d04568a5fa2ca80f262b83285bc314eef1bc912a7ecc6"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 11: Balances on Transient Processes"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.1-2, page no. 547"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#Initialization of variables\n",
      "import math\n",
      "import numpy\n",
      "from numpy import linalg\n",
      "import scipy\n",
      "from scipy import integrate\n",
      "v0=math.pow(10.,9)\n",
      "\n",
      "#Calculations and printing :\n",
      "\n",
      "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
      "def dv(t):\n",
      "    dv=math.pow(10,6)*math.exp(-t/100) -math.pow(10,7)\n",
      "    return dv\n",
      "\n",
      "vol, err=scipy.integrate.quad(dv,0,60) #integrate.quad is an inbult function used for definite integration\n",
      "print '%s %.3E' %(\" \\n Volume at the end of 60 days=\",vol+v0)\n",
      "raw_input('press enter key to exit')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
        " \n",
        " Volume at the end of 60 days= 4.451E+08\n"
       ]
      },
      {
       "name": "stdout",
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "press enter key to exit\n"
       ]
      },
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 1,
       "text": [
        "''"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.3-1, page no. 556"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#Initialization of variables\n",
      "import math\n",
      "import numpy\n",
      "from numpy import linalg\n",
      "\n",
      "m1=1.50 #kg\n",
      "m2=3.0 #kg\n",
      "Cv1=0.9 #cal/g C\n",
      "Cv2=0.12 #cal/g C\n",
      "Qdot=500.0 #W\n",
      "T1=250.0 #C\n",
      "T2=25.0 #C\n",
      "\n",
      "#Calculations and printing :\n",
      "\n",
      "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
      "MCv=(m1*Cv1 + m2*Cv2)*1000*4.184\n",
      "print(MCv)\n",
      "tf=(T1-T2)*MCv/Qdot\n",
      "print '%s %d %s %.3f' %(\" \\n Time required\",tf+1,\" in sec and in min =\",tf/60)\n",
      "raw_input('press enter key to exit')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
        "7154.64\n",
        " \n",
        " Time required 3220  in sec and in min = 53.660\n"
       ]
      },
      {
       "name": "stdout",
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "press enter key to exit\n"
       ]
      },
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 2,
       "text": [
        "''"
       ]
      }
     ],
     "prompt_number": 2
    }
   ],
   "metadata": {}
  }
 ]
}