{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 4: First law of thermodynamics" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.1: Calculation_of_change_in_internal_energy_of_gas.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "V1 = 0.3; // Initial volume in m3\n", "V2 = 0.15; // Final volume in m3\n", "P = 0.105e06; // Pressure in Pa\n", "Q = -37.6e03; // Heat tranferred in J\n", "W = P*(V2-V1); // Work done\n", "U = Q-W; // Internal energy change\n", "disp('Joule',U,'Change in the internal energy of the system is')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.2: Calculations_on_PV_cycle.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "Qacb = 84e03;\n", "Wacb = 32e03;\n", "Uba = Qacb-Wacb; // Ub-Ua\n", "// Part (a)\n", "Wadb = 10.5e03; \n", "Qadb = Uba+Wadb; \n", "disp('J',Qadb,'The heat flow into the system along the path adb');\n", "// Part (b)\n", "Wb_a = -21e03;\n", "Uab = - Uba;\n", "Qb_a = Uab+Wb_a;\n", "disp('J',Qb_a,'The heat liberated along the path b-a is')\n", "// Part (c)\n", "Wdb = 0; // Constant volume\n", "Wad = 10.4e03; \n", "Wadb = Wdb-Wad; \n", "Ud = 42e03;\n", "Ua = 0;\n", "Qad = Ud-Ua+Wad;\n", "Qdb = Qadb-Qad; \n", "disp('J',Qdb,'and',Qad,'The heat absorbed in the path ad and db are') " ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.3: Calculation_of_net_rate_of_work_output_in_a_piston_and_cylinder_machine.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Process a-b\n", "Qab = 0;\n", "Wab = 2170; // in KJ/min\n", "Eab = Qab-Wab; \n", "// Process b-c\n", "Qbc = 21000;\n", "Wbc = 0; \n", "Ebc = Qbc-Wbc;\n", "// Process c-d\n", "Qcd = -2100;\n", "Ecd = -36600; \n", "Wcd = Qcd-Ecd;\n", "// Process d-a\n", "Q = -17000; // Total heat transfer\n", "Qda = Q-Qab-Qbc-Qcd; \n", "Eda = -Eab-Ebc-Ecd;\n", "Wda = Qda-Eda;\n", "M = [Qab Wab Eab ; Qbc Wbc Ebc; Qcd Wcd Ecd; Qda Wda Eda];\n", "disp(M,'The completed table is')\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.4: Thermodynamics_calculations_of_a_substance_with_given_internal_energy_function.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Part (a)\n", "m = 3;\n", "V1 = 0.22;\n", "P1 = 500e03;\n", "P2 = 100e03;\n", "V2 = V1*(P1/P2)^(1/1.2);\n", "dU = 3.56*(P2*V2-P1*V1);\n", "gama = 1.2;\n", "W = (P2*V2-P1*V1)/(1-gama);\n", "Q = dU+W;\n", "disp('J respectively',dU,W,Q,'Q,W and dU of the quasi static process are')\n", "// Part (b)\n", "Qb = 30e03;\n", "Wb = Qb-dU; \n", "disp('Joule',Wb,'Work transfer for the process is')\n", "// Part (c)\n", "disp('Wb is not equal to integral(p*dv) since the process is not quasi static')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.5: Thermodynamics_calculations_of_a_cylinder_with_given_internal_energy_function.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "V1 = 0.03;\n", "P1 = 170e03;\n", "P2 = 400e03;\n", "V2 = 0.06;\n", "U = 3.15*(P2*V2-P1*V1);\n", "B = [P1 P2]';\n", "A = [1 V1; 1 V2];\n", "x = inv(A)*B;\n", "a = x(1); b = x(2);\n", "function P = pressure(V) \n", " P = a+b*V;\n", "endfunction;\n", "W = intg(V1,V2,pressure); \n", "Q = U+W;\n", "disp('J',W,'The work done by the system is')\n", "disp('J',U,'The internal energy change of the system is')\n", "disp('J',Q,'The heat flow into the system is')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.6: Calculation_on_PV_cycle_of_a_stationary_fluid_system.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Process 1-2\n", "Q12 = 235; // in KJ/Kg\n", "W12 = 0 ;\n", "U12 = Q12-W12;\n", "// Process 2-3\n", "Q23 = 0; \n", "U23 = -70 ;\n", "W23 = Q23-U23;\n", "// Process 3-1\n", "Q31 = - 200; \n", "U31 = -U12-U23;\n", "W31 = Q31-U31;\n", "//\n", "W = W12 + W23 + W31;\n", "Q = Q12 + Q23 + Q31;\n", "disp('KJ/Kg',Q,'Heat trasfer in the cycle is')\n", "disp('KJ/Kg',W,'Work done during the the cycle is')" ] } ], "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 }