summaryrefslogtreecommitdiff
path: root/sample_notebooks
diff options
context:
space:
mode:
Diffstat (limited to 'sample_notebooks')
-rw-r--r--sample_notebooks/ApurvaBhushan/Chapter_1.ipynb325
-rw-r--r--sample_notebooks/ManchukondaLalitha Pujitha/Chpater_1_Gravity.ipynb176
2 files changed, 501 insertions, 0 deletions
diff --git a/sample_notebooks/ApurvaBhushan/Chapter_1.ipynb b/sample_notebooks/ApurvaBhushan/Chapter_1.ipynb
new file mode 100644
index 00000000..f669826b
--- /dev/null
+++ b/sample_notebooks/ApurvaBhushan/Chapter_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, Internal Energy and Enthalpy, 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, Flow and Non-Flow Work, 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, Change of Entropy in a Polytropic Process, 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, Fanning's Coefficient, 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, Adiabatic Bulk Modulus of a Gas, 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, Conditions at altitudes, 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
+}
diff --git a/sample_notebooks/ManchukondaLalitha Pujitha/Chpater_1_Gravity.ipynb b/sample_notebooks/ManchukondaLalitha Pujitha/Chpater_1_Gravity.ipynb
new file mode 100644
index 00000000..a5fe0aae
--- /dev/null
+++ b/sample_notebooks/ManchukondaLalitha Pujitha/Chpater_1_Gravity.ipynb
@@ -0,0 +1,176 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 1: Gravity"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1 pgno:10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Time period of the pendulum is sec 1.00303620705\n"
+ ]
+ }
+ ],
+ "source": [
+ "#INPUT DATA\n",
+ "L=1;#Length of the bar in m\n",
+ "l=0.25;#Length of the pemdulum in m\n",
+ "from math import sqrt\n",
+ "#CALCULATIONS\n",
+ "k=sqrt((L**2)/12);#Radius of gyration m\n",
+ "T=sqrt(((k**2/l)+l)/9.8)*2*3.14;#Time period of pendulum in s\n",
+ "\n",
+ "#OUTPUT\n",
+ "print'Time period of the pendulum is sec',T\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2 pgno:11"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The acceleration due to gravity is m s^-2 9.8002855276\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "#INPUT DATA\n",
+ "T=2.223;#Time taken for 1 oscillation in sec\n",
+ "L=1.228;#Length of the pendulum in m\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "g=((4*3.14**2*L)/(T**2));#Acceleration due to gravity in m.s^-2\n",
+ "\n",
+ "#OUTPUT\n",
+ "print'The acceleration due to gravity is m s^-2',g\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3 pgno:12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The time period of pendulum is s\n",
+ "Distance of another point from centre of gravity on bar with same time period is m 1.79428571429 0.2\n"
+ ]
+ }
+ ],
+ "source": [
+ "#INPUT DATA\n",
+ "l=1.2;#Length of of bar in m\n",
+ "from math import sqrt\n",
+ "#CALCULATIONS\n",
+ "k=sqrt(l**2/12);#Radius of gyration in m\n",
+ "T=sqrt(((k**2/(l/2))+(l/2))/9.8)*2*3.14;#Time period of the pendulum in s\n",
+ "L=((9.8*T**2)/(4*3.14**2));#Length in m\n",
+ "D=L-(l/2);#Another point where pendulum has same timeperiod in m\n",
+ "\n",
+ "#OUTPUT\n",
+ "print'The time period of pendulum is s\\nDistance of another point from centre of gravity on bar with same time period is m',T,D\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1 pgno:14"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The minimum time period is obtained at cm -28.9035753267\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "#INPUT DATA\n",
+ "L=1;#Length of pendulum in m\n",
+ "B=0.05;#Width of pendulum in m\n",
+ "from math import sqrt\n",
+ "#CALCULATIONS\n",
+ "k=sqrt((L**2+B**2)/12);#Radius of gyration in m\n",
+ "D=((L/2)-k)*100;#distance of point of minimum time period from one end in cm\n",
+ "\n",
+ "#OUTPUT\n",
+ "print'The minimum time period is obtained at cm',D\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.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}