summaryrefslogtreecommitdiff
path: root/1919/CH4/EX4.10/Ex4_10.sce
blob: 68b4b7c81dbe8bcb1694f40ea9b398a47f04eb94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

// Theory and Problems of Thermodynamics
// Chapter 4
// Energy Analysis of Process
// Example 10

clear ;clc;

//Given data
V = 2                   // volume in m^3
gam = 1.67              // gamma ideal gas coefficient
P0 = 0.1                // Initial Pressure in MPa  
T0 = 300                // Initial Temperature in K
Pf = 3                  // Final Pressure in MPa  
T1 = 500                // Final Temperature in K
R = 8.314               // Gas constant

// Calculation
// the first law of thermodynamics for a transient flow and after rewriting 
Tf = Pf/(((Pf-P0)/(gam*T1))+(P0/T0))        // Final temperature

Pf = Pf * 1e6           // units conversion from MPa to Pa
P0 = P0 * 1e6           // units conversion from MPa to Pa

q = (V/R)*(Pf/Tf - P0/T0)

// Output Results
mprintf('Temperature of helium in the tank = %6.2f K',Tf)
mprintf('\nQuantity of helium entered into tank = %6.2f mol',q)