CPE 327 Reservoir Engineering I HW Due Date: 3:00PM on March 13, 2018 Generate a
ID: 3727089 • Letter: C
Question
CPE 327 Reservoir Engineering I
HW
Due Date: 3:00PM on March 13, 2018
Generate a robust programming to solve the problem below. The program can be wrote by using any computer language, e.g., Matlab, C, VB, Julia, Python.
Grading:
Bring your laptop and successfully run your program to the instructor;
Be able to answer all the technical questions given by the instructor;
Be able to run other flash calculations when the conditions are changed, e.g., different composition, pressure, temperature;
Problem:
Use the Peng-Robinson equation of state to calculate the compositions and densities of the equilibrium liquid and gas of the mixture given below at 160°F and 2000 psia. Use binary interaction coefficients of 0.02 for methane-n-butane, 0.035 for methane-n-decane, and 0.0 for n-butane-n-decane.
Component
Composition, mole fraction
Methane
0.5532
n-Butane
0.2630
n-Decane
0.1838
1.0000
Compare your answer with experimental results shown below.
Component
Composition, mole fraction
liquid
gas
Methane
0.458
0.856
n-Butane
0.304
0.130
n-Decane
0.238
0.0136
1.000
0.9996
Component
Composition, mole fraction
Methane
0.5532
n-Butane
0.2630
n-Decane
0.1838
1.0000
Explanation / Answer
clear
clc
Cc=[ 0.5532 0.2630 0.1838];
C=[ 0.458 0.304 0.238];
G=[0,856 0.130 0.016];
T=800;
R=82.06;
Tr=T/C;
beta=.37464+1.54226*G-.26992*G;
delta=(1+beta.*(1-(Tr.^5))).^2;
b=((.07780)*R*C)/Cc;
a=((.45724)*R^2*C.^2)./Cc;
P=@(Vm,R,T,b,a,delta)(R*T./(Vm-b))-(a*delta)/(Vm^2+2*b*Vm-b^2);
i=1;
j=1;
k=1;
%Methane
for Vm1=90:5:1000
P1(i)=P(Vm1,R,T,b(1),a(1),delta(1));
i=i+1;
end
v1=90:5:1000;
plot(v1,P1,'DisplayName','Methane')
legend('show')
%n-Butane
for Vm2=500:5:1500
P2(j)=P(Vm2,R,T,b(2),a(2),delta(2));
j=j+1;
end
v2=500:5:1500;
figure
plot(v2,P2,'DisplayName','n-Butane')
legend('show')
%n-Decane
for Vm3=750:5:2000
P3(k)=P(Vm3,R,T,b(3),a(3),delta(3));
k=k+1;
end
v3=750:5:2000;
figure
plot(v3,P3,'DisplayName','n-Decane')
legend('show')