summaryrefslogtreecommitdiff
path: root/1379/CH2/EX2.1.1/example2_1.sce
blob: 1cc9f25565925c01b9e4f10e93d4d0d5a4c17618 (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
35


//exapple 2.1 
clc; funcprot(0);
// Initialization of Variable
pi=3.1428;
mmm=16.04/1000;//molar mass of methane
mV=22.414/1000;//molar volume
R=8.314;
mu=1.08/10^5;
r=4.2/100;//radius
rr=0.026/2/r;//relative roughness
Pfinal=560*1000;
tfinal=273+24;
l=68.5;
m=2.35;//mass flow rate
//calculation
A=pi*r^2;
A=round(A*10^5)/10^5;
rho=mmm/mV;
rho24=mmm*Pfinal*273/mV/101.3/tfinal;//density at 24'C
u=m/rho24/A;
Re=u*rho24*2*r/mu;
//from graph
phi=0.0032;
//for solving using fsolve we copy numerical value of constant terms
//using back calculation
//as pressure maintained should be more than Pfinal so guessed value is Pfinal;
function[y]=eqn(x)
    y=m^2/A^2*log(x/Pfinal)+(Pfinal^2-x^2)/2/R/tfinal*mmm+4*phi*l/2/r*m^2/A^2;
endfunction
[x,v,info]=fsolve(560*10^3,eqn);
disp(x/1000,"pressure maintained at compressor in (kN/m^2):");