blob: 4915ec06955771a14f6606a6fcbc4589054530a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// Given:-
p1 = 3*(10**5) // initial pressure in pascal
v1 = 0.1 // initial volume in m3
v2 = 0.2 // final volume
m = 4.0 // mass of the gas in kg
deltau = -4.6 // change in specific internal energy in KJ/Kg
// Calculations
constant = p1*(v1**1.5) // p*(v^n) = constant
function v = p(v)
v = constant/(v**1.5) // expressing pressure as function of volume
endfunction
work = intg(v1,v2,p) // integrating pdv from initial to final volume
w=work(1)/1000 // divided by 1000 to convert to KJ
deltaU = m*deltau // change in internal energy in KJ
Q = deltaU + w // neglecting kinetic and potential energy changes
// Result
printf( 'net heat transfer for the process in KJ %.2f',Q)
|