summaryrefslogtreecommitdiff
path: root/sample_notebooks/ApurvaBhushan/Chapter_1_1.ipynb
diff options
context:
space:
mode:
authorTrupti Kini2015-12-24 23:30:11 +0600
committerTrupti Kini2015-12-24 23:30:11 +0600
commitc3b348c7471415edf22aeb8e9ca6732d7f73bf9d (patch)
treeb847831fbe2458e3f0a69aed11d2532a7a34cf4a /sample_notebooks/ApurvaBhushan/Chapter_1_1.ipynb
parent6f92b85533f7592db6f2f6283650b464e0f54d47 (diff)
downloadPython-Textbook-Companions-c3b348c7471415edf22aeb8e9ca6732d7f73bf9d.tar.gz
Python-Textbook-Companions-c3b348c7471415edf22aeb8e9ca6732d7f73bf9d.tar.bz2
Python-Textbook-Companions-c3b348c7471415edf22aeb8e9ca6732d7f73bf9d.zip
Added(A)/Deleted(D) following books
A A_Textbook_of_Electrical_Technology_:_AC_and_DC_Machines_(Volume_-_2)_by_A._K._Theraja_B.L_Thereja/chapter25.ipynb A A_Textbook_of_Electrical_Technology_:_AC_and_DC_Machines_(Volume_-_2)_by_A._K._Theraja_B.L_Thereja/chapter26.ipynb A A_Textbook_of_Electrical_Technology_:_AC_and_DC_Machines_(Volume_-_2)_by_A._K._Theraja_B.L_Thereja/chapter27.ipynb A A_Textbook_of_Electrical_Technology_:_AC_and_DC_Machines_(Volume_-_2)_by_A._K._Theraja_B.L_Thereja/chapter28.ipynb A A_Textbook_of_Electrical_Technology_:_AC_and_DC_Machines_(Volume_-_2)_by_A._K._Theraja_B.L_Thereja/chapter29.ipynb A A_Textbook_of_Electrical_Technology_:_AC_and_DC_Machines_(Volume_-_2)_by_A._K._Theraja_B.L_Thereja/chapter30.ipynb A A_Textbook_of_Electrical_Technology_:_AC_and_DC_Machines_(Volume_-_2)_by_A._K._Theraja_B.L_Thereja/chapter31.ipynb A A_Textbook_of_Electrical_Technology_:_AC_and_DC_Machines_(Volume_-_2)_by_A._K._Theraja_B.L_Thereja/chapter32.ipynb A A_Textbook_of_Electrical_Technology_:_AC_and_DC_Machines_(Volume_-_2)_by_A._K._Theraja_B.L_Thereja/chapter33.ipynb A A_Textbook_of_Electrical_Technology_:_AC_and_DC_Machines_(Volume_-_2)_by_A._K._Theraja_B.L_Thereja/chapter34.ipynb A A_Textbook_of_Electrical_Technology_:_AC_and_DC_Machines_(Volume_-_2)_by_A._K._Theraja_B.L_Thereja/chapter35.ipynb A A_Textbook_of_Electrical_Technology_:_AC_and_DC_Machines_(Volume_-_2)_by_A._K._Theraja_B.L_Thereja/chapter36.ipynb A A_Textbook_of_Electrical_Technology_:_AC_and_DC_Machines_(Volume_-_2)_by_A._K._Theraja_B.L_Thereja/chapter37.ipynb A A_Textbook_of_Electrical_Technology_:_AC_and_DC_Machines_(Volume_-_2)_by_A._K._Theraja_B.L_Thereja/chapter38.ipynb A A_Textbook_of_Electrical_Technology_:_AC_and_DC_Machines_(Volume_-_2)_by_A._K._Theraja_B.L_Thereja/chapter39.ipynb A A_Textbook_of_Electrical_Technology_:_AC_and_DC_Machines_(Volume_-_2)_by_A._K._Theraja_B.L_Thereja/screenshots/chapter29example32.png A A_Textbook_of_Electrical_Technology_:_AC_and_DC_Machines_(Volume_-_2)_by_A._K._Theraja_B.L_Thereja/screenshots/chapter29example33.png A A_Textbook_of_Electrical_Technology_:_AC_and_DC_Machines_(Volume_-_2)_by_A._K._Theraja_B.L_Thereja/screenshots/chapter32example30.png A sample_notebooks/ApurvaBhushan/Chapter_1_1.ipynb
Diffstat (limited to 'sample_notebooks/ApurvaBhushan/Chapter_1_1.ipynb')
-rw-r--r--sample_notebooks/ApurvaBhushan/Chapter_1_1.ipynb325
1 files changed, 325 insertions, 0 deletions
diff --git a/sample_notebooks/ApurvaBhushan/Chapter_1_1.ipynb b/sample_notebooks/ApurvaBhushan/Chapter_1_1.ipynb
new file mode 100644
index 00000000..03a5ae95
--- /dev/null
+++ b/sample_notebooks/ApurvaBhushan/Chapter_1_1.ipynb
@@ -0,0 +1,325 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "#Chapter 1: Definitions and Basic Relations"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example 1.1, Page No. 38"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " Enthalpy = 301.500000 kJ/kg\n",
+ " Internal Energy = 215.400000 kJ/kg\n",
+ "\n",
+ " Diameter = 46.824337 cm\n"
+ ]
+ }
+ ],
+ "source": [
+ "from math import pi;\n",
+ "from math import sqrt;\n",
+ "#variable declaration\n",
+ "R=0.287; #in kJ.kg K\n",
+ "c_p=1.005; #in kJ.kg K\n",
+ "m=3; #in kg/s\n",
+ "T=300; #in K\n",
+ "p=1.5; #in bar\n",
+ "c=10; #in m/s\n",
+ "p=p*10**5; #converts bar into Pa\n",
+ "\n",
+ "#calculation\n",
+ "c_v=c_p-R;\n",
+ "h=c_p*T;\n",
+ "u=c_v*T;\n",
+ "rho=p/(R*T*1000);\n",
+ "D=sqrt((4*m)/(pi*c*rho));\n",
+ "D=D*100; #converts m into cm\n",
+ "\n",
+ "#result\n",
+ "print('\\n Enthalpy = %f kJ/kg\\n Internal Energy = %f kJ/kg')%(h,u);\n",
+ "print '\\n Diameter = %f cm' %(D);\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example 1.2, Page No. 38"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " Final Temperature = 382.397541 K\n",
+ " Enthalpy Drop = 88.473301 kJ/kg\n",
+ " Change in Internal Energy = 71.349436 kJ/kg\n"
+ ]
+ }
+ ],
+ "source": [
+ "#variable declaration\n",
+ "R=0.189; #in kJ/kg K\n",
+ "gamma_1=1.24; #no unit\n",
+ "T1=473; #in K\n",
+ "p1=3.0; #in bar\n",
+ "p2=1.0; #in bar\n",
+ "\n",
+ "#calculation\n",
+ "c_p=(gamma_1*R)/(gamma_1-1);\n",
+ "c_v=c_p/gamma_1;\n",
+ "ratio=(p2/p1)**((gamma_1-1)/gamma_1);\n",
+ "T2=ratio*T1;\n",
+ "h=c_p*(T1-T2);\n",
+ "u=c_v*(T1-T2);\n",
+ "\n",
+ "#result\n",
+ "print('\\n Final Temperature = %f K\\n Enthalpy Drop = %f kJ/kg\\n Change in Internal Energy = %f kJ/kg')%(T2,h,u);\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example 1.3, Page No. 39"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "Change in Entropy = 0.165932\n",
+ "\n",
+ "\n",
+ "Note : There are computational problems in the book of this example\n"
+ ]
+ }
+ ],
+ "source": [
+ "#variable declaration\n",
+ "from math import log;\n",
+ "gamma_1=1.3; #no unit\n",
+ "T1=650; #in K\n",
+ "n=1.2; #no unit\n",
+ "p1=10.0; #in bar\n",
+ "p2=3.0; #in bar\n",
+ "c_p=2.15; #in kJ/kg K\n",
+ "\n",
+ "#cslculation\n",
+ "c_v=c_p/gamma_1;\n",
+ "ratio_p=p2/p1;\n",
+ "ratio_v=(1/ratio_p)**(1/n);\n",
+ "s=c_v*log(ratio_p)+c_p*log(ratio_v);\n",
+ "\n",
+ "#result\n",
+ "print('\\nChange in Entropy = %f')%(s);\n",
+ "print('\\n\\nNote : There are computational problems in the book of this example')\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example 1.4, Page No. 39"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 25,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "Pressure at the exit of duct = 2.925336 bar\n",
+ "\n",
+ "\n",
+ "Note : There are computational problems in the book of this example\n"
+ ]
+ }
+ ],
+ "source": [
+ "#variable declaration\n",
+ "L=100; #in m\n",
+ "R=287; #in kJ/kg K\n",
+ "D=0.5; #in m\n",
+ "T=315; #in K\n",
+ "p=3.0; #in bar\n",
+ "c=15; #in m/s\n",
+ "f=0.025; #no unit\n",
+ "\n",
+ "#calculation\n",
+ "rho=p/(R*T);\n",
+ "delta_p=4*f*L*rho*c**2/(2*D)\n",
+ "p2=p-delta_p;\n",
+ "\n",
+ "#result\n",
+ "print('\\nPressure at the exit of duct = %f bar')%(p2);\n",
+ "print('\\n\\nNote : There are computational problems in the book of this example')\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example 1.5, Page No. 40"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " Bulk Modulus of Elasticity = 31295.652174 bar\n",
+ "\n",
+ " More Accurate Value of Bulk Modulus of Elasticity = 29459.521175 bar\n"
+ ]
+ }
+ ],
+ "source": [
+ "#variable declaration\n",
+ "p1=1; #in bar\n",
+ "p2=3600; #in bar\n",
+ "v1=1; #in m^3\n",
+ "v2=0.885 #in m^3\n",
+ "\n",
+ "#calculation & result\n",
+ "K_t=-v1*(p2-p1)/(v2-v1);\n",
+ "print('\\n Bulk Modulus of Elasticity = %f bar')%(K_t);\n",
+ "K_t=(p2-p1)/log(v1/v2);\n",
+ "print('\\n More Accurate Value of Bulk Modulus of Elasticity = %f bar')%(K_t)\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example 1.6, Page No. 41"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "At Z=10000m\n",
+ "Temperature = 223.200000 K\n",
+ "Pressure = 0.264259 bar\n",
+ "Density = 0.412528 kg/m**3\n",
+ "Viscosity = 0.0000148 kg/ms\n",
+ "\n",
+ "At Z=15000m\n",
+ "Temperature = 216.500000 K\n",
+ "Pressure = 0.120714 bar\n",
+ "Density = 0.194276 kg/m**3\n",
+ "Viscosity = 0.0000142 kg/ms\n"
+ ]
+ }
+ ],
+ "source": [
+ "#variable declaration\n",
+ "from math import exp;\n",
+ "p0=1.0133; #in bar\n",
+ "#p0=p0*10**5; #conversion to Pa\n",
+ "T0=288.2; # in K\n",
+ "Tt=216.5; # in K\n",
+ "u0=1.79*10**-5; #in kg/ms\n",
+ "ut=1.42*10**-5; #in kg/ms\n",
+ "pt=0.227; #in bar\n",
+ "Z1=10000; #in m\n",
+ "Z2=15000; #in m\n",
+ "Zt=11000; #in m\n",
+ "R=287; #in J/kg K\n",
+ "a1=6.5/1000; #in deg C/m\n",
+ "g=9.81; #in m/s**2\n",
+ "\n",
+ "#calculation\n",
+ "rho0=p0/(R*T0);\n",
+ "T=T0-a1*Z1;\n",
+ "p=p0*(T/T0)**(g/(a1*R));\n",
+ "rho=p*10**5/(R*T);\n",
+ "u=u0*(T/T0)**0.75;\n",
+ "p1=pt*exp(-g*(Z2-Zt)/(R*Tt));\n",
+ "rho1=p1*10**5/(R*Tt);\n",
+ "\n",
+ "#result\n",
+ "print('\\nAt Z=10000m\\nTemperature = %f K\\nPressure = %f bar\\nDensity = %f kg/m**3\\nViscosity = %.7f kg/ms\\n\\nAt Z=15000m\\nTemperature = %f K\\nPressure = %f bar\\nDensity = %f kg/m**3\\nViscosity = %.7f kg/ms')%(T,p,rho,u,Tt,p1,rho1,ut);\n",
+ "\n"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 2",
+ "language": "python",
+ "name": "python2"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.10"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}