summaryrefslogtreecommitdiff
path: root/Fundamental_Of_Engineering_Thermodynamics_by_M_J_Moran/3-Evaluating_properties.ipynb
diff options
context:
space:
mode:
authorPrashant S2020-04-14 10:25:32 +0530
committerGitHub2020-04-14 10:25:32 +0530
commit06b09e7d29d252fb2f5a056eeb8bd1264ff6a333 (patch)
tree2b1df110e24ff0174830d7f825f43ff1c134d1af /Fundamental_Of_Engineering_Thermodynamics_by_M_J_Moran/3-Evaluating_properties.ipynb
parentabb52650288b08a680335531742a7126ad0fb846 (diff)
parent476705d693c7122d34f9b049fa79b935405c9b49 (diff)
downloadall-scilab-tbc-books-ipynb-master.tar.gz
all-scilab-tbc-books-ipynb-master.tar.bz2
all-scilab-tbc-books-ipynb-master.zip
Merge pull request #1 from prashantsinalkar/masterHEADmaster
Initial commit
Diffstat (limited to 'Fundamental_Of_Engineering_Thermodynamics_by_M_J_Moran/3-Evaluating_properties.ipynb')
-rw-r--r--Fundamental_Of_Engineering_Thermodynamics_by_M_J_Moran/3-Evaluating_properties.ipynb480
1 files changed, 480 insertions, 0 deletions
diff --git a/Fundamental_Of_Engineering_Thermodynamics_by_M_J_Moran/3-Evaluating_properties.ipynb b/Fundamental_Of_Engineering_Thermodynamics_by_M_J_Moran/3-Evaluating_properties.ipynb
new file mode 100644
index 0000000..670d500
--- /dev/null
+++ b/Fundamental_Of_Engineering_Thermodynamics_by_M_J_Moran/3-Evaluating_properties.ipynb
@@ -0,0 +1,480 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 3: Evaluating properties"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.10: Example_10.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//(3.10) One kmol of carbon dioxide gas (CO2) in a piston–cylinder assembly undergoes a constant-pressure process at 1 bar from T1 = 300 K to T2. Plot the heat transfer to the gas, in kJ, versus T2 ranging from 300 to 1500 K. Assume the ideal gas model, and determine the specific internal energy change of the gas using. (a)Ubar data from IT.(b) a constant Cv bar evaluated at T1 from IT.\n",
+"\n",
+"printf('This is solved by the referred software ')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.11: Example_11.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//(3.11) Air undergoes a polytropic compression in a piston–cylinder assembly from p1 = 1 bar, T1 = 22C to p2 = 5 bars. Employing the ideal gas model, determine the work and heat transfer per unit mass, in kJ/kg, if n = 1.3.\n",
+"\n",
+"//solution\n",
+"\n",
+"//variable initialization\n",
+"p1 = 1 //initial pressure in bar\n",
+"T1 = 295 //initial temperature in kelvin \n",
+"p2 = 5 //final pressure in bar\n",
+"n=1.3 //polytropic constant\n",
+"R = 8314/28.97 // gas constant for air in SI units\n",
+"\n",
+"T2 = T1*(p2/p1)^((n-1)/n)\n",
+"w = R*(T2-T1)/(1-n)\n",
+"printf('the work done per unit mass in KJ/Kg is :\n\tW = %f',w/1000)\n",
+"\n",
+"//from table A-22\n",
+"u2 = 306.53\n",
+"u1 = 210.49\n",
+"Q = u2-u1+w/1000\n",
+"\n",
+"printf('\n\nthe heat transfer per unit mass in KJ/Kg is:\n\t Q = %f',Q)"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.1: Example_1.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// (3.1) A closed, rigid container of volume 0.5 m3 is placed on a hot plate. Initially, the container holds a two-phase mixture of saturated liquid water and saturated water vapor at p1 = 1 bar with a quality of 0.5. After heating, the pressure in the container is p2=  1.5 bar. Indicate the initial and final states on a T–v diagram, and determine (a) the temperature, in degree Celcius, at each state.(b) the mass of vapor present at each state, in kg.(c) If heating continues, determine the pressure, in bar, when the container holds only saturated vapor.\n",
+"// solution \n",
+"//initializing variables\n",
+"p1 = 10^5 // initial pressure in pascal \n",
+"x1 = .5 // initial quality\n",
+"p2 = 1.5*10^5 // pressure after heating in pascal\n",
+"v = .5 // volume of container in m3\n",
+"vf1 = 1.0432*10^(-3) // specific volume of fluid in state 1 in m3/Kg(from table A-3)\n",
+"vg1 = 1.694 // specific volume of gas in state 1 in m3/kg(from table A-3)\n",
+"v1 = vf1 + x1*(vg1-vf1) // specific volume in state 1 in m3/Kg\n",
+"v2 = v1 // specific volume in state 2 in m3/Kg\n",
+"vf2 = 1.0582*10^(-3) // specific volume of fluid in state 2 in m3/Kg(from table A-3)\n",
+"vg2 = 1.159 // specific volume of gas in state 2 in m3/Kg(from table A-3) \n",
+"// part (a)\n",
+"T1 = 99.63 // temperature in degree celcius in state 1, from table A-3\n",
+"T2 = 111.4 // temperature in degree celcius in state 2, from table A-3\n",
+"printf('the temperature in degree celcius in state 1 is:\n\t T1 = %f',T1);\n",
+"printf('\nthe temperature in degree celcius in state 2 is:\n\t T2 = %f',T2);\n",
+"// part (b)\n",
+"m = v/v1 // total mass in Kg\n",
+"mg1 = x1*m // mass of vapour in state 1 in Kg\n",
+"printf('\nthe mass of vapor in state 1 in Kg is:\n\t mg1 = %f',mg1 );\n",
+"x2 = (v1-vf2)/(vg2-vf2) // quality in state 2\n",
+"mg2 = x2*m // mass of vapor in state 2 in Kg \n",
+"printf('\nthe mass of vapor in state 2 in Kg is:\n\t mg2 = %f',mg2 );\n",
+"//part(c)\n",
+"p3 = 2.11 // pressure in state 3 from table A-3\n",
+"printf('\nthe pressure corresponding to state 3 in bar is:\n\t p3 = %f',p3 );"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.2: Example_2.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//(3.2) A vertical piston–cylinder assembly containing 0.05 kg of ammonia, initially a saturated vapor, is placed on a hot plate. Due to the weight of the piston and the surrounding atmospheric pressure, the pressure of the ammonia is 1.5 bars. Heating occurs slowly, and the ammonia expands at constant pressure until the final temperature is 25C. Show the initial and final states on T–v and p–v diagrams, and determine(a) the volume occupied by the ammonia at each state, in m3.(b) the work for the process, in kJ.\n",
+"\n",
+"// solution\n",
+"\n",
+"// variable initialization\n",
+"\n",
+"m = .05 // mass of ammonia in kg \n",
+"p1 = 1.5*10^5 // initial pressure of ammonia in pascal\n",
+"T2 = 25 // final temperature in degree celcius\n",
+"\n",
+"//part (a)\n",
+"v1 = .7787 // specific volume in state 1 in m3/kg from table A-14\n",
+"V1 = m*v1 // volume occupied by ammonia in state 1 in m3\n",
+"v2 = .9553 // specific volume in state 2 in m3/kg from table A-15\n",
+"V2 = m*v2 // volume occupied by ammonia in state 2 in m3\n",
+"\n",
+"printf('the volume occupied by ammonia in state 1 in m3 is:\n\t V1 = %f',V1);\n",
+"printf('\nthe volume occupied by ammonia in state 2 in m3 is:\n\t V2 = %f',V2);\n",
+"\n",
+"// part (b)\n",
+"w = (p1*(V2-V1))/1000 // work in KJ\n",
+"printf('\nthe work done for the process in KJ is:\n\t W = %f',w)"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.3: Example_3.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// (3.3) A well-insulated rigid tank having a volume of .25 m3 contains saturated water vapor at 100C. The water is rapidly stirred until the pressure is 1.5 bars. Determine the temperature at the final state, in C, and the work during the process, in kJ.\n",
+"\n",
+"//solution\n",
+"\n",
+"//variable initialization\n",
+"V = .25 // volume of tank in m3\n",
+"T1 = 100 // initial temperature in degree celcius\n",
+"p2 = 1.5 // final pressure in bars\n",
+"\n",
+"v = 1.673 // specific volume in m3/kg obtained using table A-2\n",
+"u1 = 2506.5 // specific internal energy in state 1 in KJ/Kg obtained from table A-2\n",
+"T2 = 273 // temperature in state 2 in degree celcius obtained from table A-4\n",
+"u2 = 2767.8 // specific internal energy in state 2 in KJ/Kg obtained from table A-4\n",
+"m = V/v // mass of the system in kg\n",
+"DeltaU = m*(u2-u1) // change in internal energy in KJ\n",
+"W = - DeltaU // from energy balance\n",
+"printf('the temperature at the final state in degree celcius is:\n T2 = %f',T2);\n",
+"printf('\nthe work during the process in KJ is:\n\tW = %f',W); "
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.4: Example_4.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// (3.4) Water contained in a piston–cylinder assembly undergoes two processes in series from an initial state where the pressure is 10 bar and the temperature is 400C.Process 1–2: The water is cooled as it is compressed at a constant pressure of 10 bar to the saturated vapor state. Process 2–3: The water is cooled at constant volume to 150C.(a) Sketch both processes on T–v and p–v diagrams.(b) For the overall process determine the work, in kJ/kg. (c) For the overall process determine the heat transfer, in kJ/kg.\n",
+"\n",
+"//solution\n",
+"\n",
+"//variable initialization\n",
+"P1 = 10*(10^5) //initial pressure in pascal\n",
+"T1 = 400 // initial temperature in degree celcius\n",
+"\n",
+"v1 = .3066 // specific volume in state 1 in m3/kg obtained from table A-4\n",
+"u1 = 2957.3 // specific internal energy in state 1 in KJ/Kg obtained from table A-4\n",
+"v2 = .1944 // specific volume in state 2 in m3/kg obtained from table A-3\n",
+"w1to2 = (P1*(v2-v1))/1000 // work in KJ/Kg in process 1-2\n",
+"w2to3 = 0 // work in process 2-3\n",
+"W = w1to2 + w2to3 // net work in KJ/kg\n",
+"\n",
+"v3 = v2\n",
+"vf3 = 1.0905*10^(-3) // specific volume of fluid in state 3 from table A-2\n",
+"vg3 = .3928 // specific volume of gas in state 3 from table A-2\n",
+"x3 = (v3-vf3)/(vg3-vf3)\n",
+"uf3 = 631.68 // specific internal energy for fluid in state 3 from table A-2\n",
+"ug3 = 2559.5 // specific internal energy for gas in state 3 from table A-2\n",
+"u3 = uf3+x3*(ug3-uf3) // specific internal energy in state 3 in Kj/Kg\n",
+"q = (u3-u1) + W // heat transfer in Kj/Kg\n",
+"printf(' the work done in the overall process in KJ/Kg is:\n\t W = %f',W);\n",
+"printf(' \nthe heat transfer in the overall process in KJ/Kg is:\n\t Q = %f',q);"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.5: Example_5.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//(3.5) For the system of Example 3.1, plot the heat transfer, in kJ, and the mass of saturated vapor present, in kg, each versus pressure at state 2 ranging from 1 to 2 bar. Discuss the results.\n",
+" printf('The problem is solved by using the software referred to in the book. The data can be retrieved from that software');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.6: Example_6.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// (3.6) A closed, rigid tank filled with water vapor, initially at 20 MPa, 520C, is cooled until its temperature reaches 400C. Using the compressibility chart, determine. (a) the specific volume of the water vapor in m3/kg at the initial state.(b) the pressure in MPa at the final state.Compare the results of parts (a) and (b) with the values obtained from the superheated vapor table, Table A-4.\n",
+"\n",
+"//solution\n",
+"\n",
+"//variable initialization\n",
+"p1 = 20 //initial pressure in MPa\n",
+"T1 = 520 // initial temperature in degree celcius\n",
+"T2 = 400 // final temperature in degree celcius\n",
+"\n",
+"//part(a)\n",
+"//from table A-1\n",
+"Tc = 647.3 //critical temperature in kelvin\n",
+"pc = 22.09 //critical pressure in MPa\n",
+"\n",
+"Tr = (T1+273)/Tc //reduced temperature\n",
+"Pr = p1/pc //reduced pressure \n",
+"Z1 = .83 //compressibility factor\n",
+"R = 8.314 //universal gas constant in SI unit \n",
+"n = 1000/18.02 //number of moles in a kg of water\n",
+"v1 = (Z1*n*R*(T1+273))/(p1*10^6)\n",
+"printf('the specific volume in state1 in m3/Kg is:\n\t v1 = %f',v1)\n",
+"printf('\n and the corresponding value obtained from table A-4 is .01551 m^3/Kg')\n",
+"\n",
+"//part(b)\n",
+"vr = v1*(pc*10^6)/(n*R*Tc)\n",
+"Tr2 = (T2+273)/Tc\n",
+"//at above vr and Tr2\n",
+"PR = .69\n",
+"P2 = pc*PR\n",
+"printf('\n\n the pressure in MPa in the final state is: \n\t P2 = %f',P2)\n",
+"printf('\n and the corresponding value from the table is 15.16Mpa')\n",
+"\n",
+"\n",
+"\n",
+"\n",
+"\n",
+"\n",
+"\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.7: Example_7.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//(3.7) One pound of air undergoes a thermodynamic cycle consisting of three processes.Process 1–2: constant specific volume Process 2–3: constant-temperature expansion Process 3–1: constant-pressure compression. At state 1, the temperature is 300K, and the pressure is 1 bar. At state 2, the pressure is 2 bars. Employing the ideal gas equation of state, (a) sketch the cycle on p–v coordinates. (b) determine the temperature at state 2, in K; (c) determine the specific volume at state 3, in m3/kg.\n",
+"\n",
+"//solution\n",
+"\n",
+"//variable initialization\n",
+"T1 = 300 //temperature in state 1 in kelvin\n",
+"P1 = 1 //pressure in state 1 in bar\n",
+"P2 = 2 //pressure in state 2 in bar\n",
+"\n",
+"R = 287 //gas constant of air in SI units\n",
+"v1 = (R*T1)/(P1*10^5) //specific volume in state 1\n",
+"P = linspace(1,2,100)\n",
+"for i = 1:100\n",
+" v(1,i) = v1\n",
+"end\n",
+"\n",
+"plot2d(v,P,rect=[0,0,5,2.5]);\n",
+"\n",
+"T2 = (P2*10^5*v1)/R\n",
+"v3 = (R*T2)/(P1*10^5)\n",
+"vv = linspace(v1,v3,100)\n",
+"plot(vv,P1)\n",
+"\n",
+"function[out]= f(inp)\n",
+" out = (R*T2)/inp\n",
+"endfunction\n",
+"\n",
+"VV = linspace(v1,v3,100)\n",
+"for j = 1:100\n",
+" pp(1,j) = f(VV(1,j))/(10^5)\n",
+"end\n",
+"plot2d(VV,pp)\n",
+"xtitle('','v','p(bar)')\n",
+"\n",
+"printf('the temperature in kelvin in state 2 is:\n\t T2 = %f',T2)\n",
+"printf('\n\nthe specific volume in state 3 in m^3/kg is \n\t v = %f',v3)\n",
+"\n",
+"\n",
+"\n",
+"\n",
+"\n",
+"\n",
+" \n",
+" \n",
+" \n",
+" \n",
+" \n",
+" \n",
+" \n",
+" "
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.8: Example_8.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//(3.8) A piston–cylinder assembly contains 0.9 kg of air at a temperature of 300K and a pressure of 1 bar. The air is compressed to a state where the temperature is 470K and the pressure is 6 bars. During the compression, there is a heat transfer from the air to the surroundings equal to 20 kJ. Using the ideal gas model for air, determine the work during the process, in kJ.\n",
+"\n",
+"//solutiion\n",
+"\n",
+"//variable initialization\n",
+"m = .9 // mass of air in kg\n",
+"T1 = 300 // initial temperature in kelvin\n",
+"P1 = 1 // initial pressure in bar\n",
+"T2 = 470 // final temperature in kelvin\n",
+"P2 = 6 // final pressure in bar\n",
+"Q = -20 // heat transfer in kj\n",
+"\n",
+"//from table A-22 \n",
+"u1 = 214.07 // in KJ/kg\n",
+"u2 = 337.32 // in KJ/Kg\n",
+"deltaU = m*(u2-u1) // change in internal energy in kj\n",
+"W = Q - deltaU // in KJ/kg\n",
+"printf('the work during the process in KJ is \n\t W = %f',W)"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.9: Example_9.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// (3.9) Two tanks are connected by a valve. One tank contains 2 kg of carbon monoxide gas at 77C and 0.7 bar. The other tank holds 8 kg of the same gas at 27C and 1.2 bar. The valve is opened and the gases are allowed to mix while receiving energy byheat transfer from the surroundings. The final equilibrium temperature is 42C. Using the ideal gas model, determine (a) the final equilibrium pressure, in bar (b) the heat transfer for the process, in kJ.\n",
+"\n",
+"//solution\n",
+"\n",
+"//variable initialization\n",
+"\n",
+"m1 = 2 //initial mass of gas in tank 1 in kg\n",
+"T1 = 350 //initial temperature in kelvin in tank1\n",
+"p1 = .7 //initial pressure in bar in tank 1\n",
+"m2 = 8 //initial mass of gas in tank 2 in kg\n",
+"T2 = 300 //initial temperature in kelvin in tank 2\n",
+"p2 = 1.2 //initial pressure in bar in tank 2\n",
+"Tf = 315 //final equilibrium temperature in kelvin\n",
+"\n",
+"pf = ((m1+m2)*Tf)/((m1*T1/p1)+(m2*T2/p2)) \n",
+"\n",
+"printf('the final equilibrium pressure in bar is: \n\t pf = %f',pf)\n",
+"\n",
+"//from table A-20\n",
+"Cv = .745 //in KJ/Kg.k\n",
+"Ui = (m1*Cv*T1)+(m2*Cv*T2)\n",
+"Uf = (m1+m2)*Cv*Tf\n",
+"deltaU = Uf-Ui\n",
+"Q = deltaU\n",
+"printf('\n\nthe heat transfer for the process in KJ is :\n\t Q = %f',Q)"
+ ]
+ }
+],
+"metadata": {
+ "kernelspec": {
+ "display_name": "Scilab",
+ "language": "scilab",
+ "name": "scilab"
+ },
+ "language_info": {
+ "file_extension": ".sce",
+ "help_links": [
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "scilab",
+ "version": "0.7.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}