term project 2 pte 508 numerical simulation of subsurface ... · pdf filepte 508 numerical...
TRANSCRIPT
TERM PROJECT 2
PTE 508 Numerical Simulation of Subsurface Flow and Transport Process
2-D 2-PHASE STUDY OF A RESERVOIR BY NUMERICAL SIMULATION AND
PARTIAL DIFFERENTIAL DISCRETIZATION
Thomas John, Nithin
USC ID: 5988 3597 37
PROJECT REVIEW
A 2-D 2-Phase 1-Layer reservoir was numerically simulated with partial differential
equations (PEDs) in MATLAB to study the performance of five wells (A, B, C, D, E) under
two given scenarios; primary recovery and secondary recovery.
The simulation was run through three primary tests to account for pressure and saturation
conditions. These included the LeakProofTest, SymmetryTest and MaterialBalanceTest.
In addition to the tests, primary recovery included producing the five wells at a constant
rate and bottom-hole pressure (BHP) until the field production went below 1.0 STB/day.
Secondary mechanism involved making a well; Well-C as an injector, and producing the
other wells at a BHP of 1000 psia. The mechanism was run for 10,000 days or when
water cut in Well A increased above 95%.
MATLAB Coding was extensively used for successful culmination of the project. Pertinent
plots and MATLAB codes are provided for delineation.
The reservoir description and filed contour map are given below:
With the given reservoir parameters and field location for each well, various tests were
performed prior to initiating the primary and secondary recovery mechanisms.
7. Calculation of initial reservoir parameters
A MATLAB code was generated to calculate initial reservoir parameters such as; Bo, Bw,
phi, krw, kro, So and Sw.
Both kro and krw were plotted against Sw in the same graph. Moreover, Bo and Bw were
also plotted with respect to pressure, P.
8. Leak-Proof Tests
A leak-proof test was conducted by setting the well rate to 0 for all the five wells and by
running a 100-day simulation with a time step of 10 days. Both pressure leak proof and
saturation leak proof tests were conducted and the results were plotted. In pressure leak
proof, the pressure was equal to the initial reservoir pressure. In saturation leak proof test,
both oil and water saturations were unchanged.
Figure: Pressure Leak Proof Test
Figure: Saturation Leak Proof Test
9. Symmetry Tests
A symmetric test was performed by setting bottom hole flowing pressure (BHFP) to 1000
psia and by running a 100 day simulation with a time step of 10 days. The pressure
distribution was made to be symmetric with the middle point of the grid system. The
pressure distributions were plotted for t = 0 days, 50 days and 100 days.
Figure: Symmetry Test for 0 days
Table: Symmetry Test Results for 0 days
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000
2 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000
3 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000
4 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000
5 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000
6 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000
7 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000
8 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000
9 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000
10 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000
11 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000
Figure: Symmetry Test for 50 days
Table: Symmetry Test Results for 50 days
Figure: Symmetry Test for 100 days
Table: Symmetry Test Results for 100 days
10. Material Balance Test
The MBE Test is done to compare volumetric calculation of initial oil in place (OOIP) and
simulated OOIP. A tolerance level of 0.1% is accepted for accuracy.
The following equations were used to calculate Np and OOIP.
Tolerance Level (Error %) = ((Npn+1 + OIPn+1)/OOIP) – 1
A 100-day long simulation was run with time steps of 10 days and all the five wells were
made to produce at 1000 psia. For each step, the cumulative production and OIP were
calculated to account for accuracy.
Initial Oil in Place = OOIP = 1.9866E+06 STB
Time, t (days)
Original Oil in Place, OOIP (STB)
Cumulative Oil
Production, Np (STB)
Tolerance Level (%)
10 1986557.7 12728.34 0
20 1978251.4 6676.62 0.222596
30 1974425.2 5412.17 0.144087
40 1971280.2 4540.30 0.114831
50 1968603.9 3870.02 0.094558
60 1966295.2 3339.27 0.079307
70 1964280.8 2910.38 0.067381
80 1962505.9 2558.02 0.057807
90 1960928.4 2264.46 0.049963
100 1959515.6 2016.93 0.043429
11. i. Primary Recovery Study
A primary recovery study was initiated by calculating the initial oil in place (OIIP). The five
wells are made into producers by setting their BHFPs to 1000 psia. The reservoir is
produced until the production of Well A falls below 1.0 STB/d. Both oil production and
water production rates for the five wells are calculated and plotted at this time.
The cumulative reservoir production and recovery factor (RF) are calculated and plotted.
Finally, the reservoir pressure distribution for t = 0, 100, 200, 300, 400 and 500 days are
plotted.
OOIP =
It was found that the production rate of Well A falls below 1.0 STB/d after t = 530 days.
At this time, primary recovery is stopped and corresponding plots are generated from
MATLAB.
Figure: Oil Production Rate Vs Time_PrimaryRecovery
Figure: Water Production Rate Vs Time_PrimaryRecovery
Figure: Cumulative Production Rate Vs Time_PrimaryRecovery
Figure: Recovery Factor Vs Time_PrimaryRecovery
The cumulative oil production was NP = 6.984E+4 STB
Recovery Factor (RF) of the reservoir = RF = 3.46
Figure: Pressure Distribution Plots
ii. Secondary Recovery Study
A secondary recovery study was conducted on the reservoir. All the five wells were made
to produce until the oil production of Well A fell below 1.0 STB/d. Well C was made into
an injector by setting it’s BHFP to 2950 psia. The simulation is run until water cut is greater
than 95% or the simulation time reaches 10,000 days.
The oil saturation and pressure distribution of Well C was plotted. The cumulative
production and recovery factor were also plotted.
The secondary recovery was run for 10,000 days and the following pressure distribution
was observed. We also observe that water injection has begun at t = 550 days
The cumulative oil production was NP = 7.895E+05 STB
Recovery Factor (RF) of the reservoir = RF = 38.6160
CONCLUSIONS & SUGGESTIONS
From the reservoir simulation study conducted, we observe that secondary recovery
mechanism by water injection greatly increases the recovery factor and cumulative oil
production from the reservoir.
The RF increased from 3% to 35% from primary to secondary recovery. This was
achieved by making Well C as an injector to maintain the pressure inside the reservoir.
This was one of the most riveting and challenging term projects I have come across in
my academic study. It was interesting and greatly enhanced my coding skills in MATLAB.
I personally feel that a much more professional approach to MATLAB should be first
taught in class before moving on to the term project.
In sum, I’m satisfied with my work in the term project for PTE 508.
MATLAB CODES
P = 3000:-10:1000; %Pressure Range Swc = 0.2; %Connate Water Saturation So = 0.75:-0.01:0; %Oil Saturation Sw = 1-So; %Water Saturation Sn = (1-So-Swc)/(1-Swc); %Correy's Correlation
Cp = 2*10^-6; %Rock Compressibility Co = 10^-5; %Oil Compressibility Cw = 10^-6; %Water Compressibility
krw = Sn.^4; %Relative Permeability_water kro = ((1-Sn^2)).*(1-((Sn)))^2; %Relative Permeability_oil figure; plot(Sw,krw); hold on; plot(Sw,kro);
phi = 0.22*exp(Cp*(P-1000)); %Porosity
Bo = 1.25 * exp(-Co*(P-1000)); %Oil FVF Bw = 1.02 * exp(-Cw*(P-1000)); %Water FVF figure; plot(P,Bo); figure; plot(P,Bw); figure; plot(P,phi);
clc; clear all;
%Given Reservoir Data Lx = 1500; %length along x_axis in ft Ly = 1100; %length along y_axis in ft deltaz = 50; %thickness in ft k = 11; %reservoir permeability in mD rw = 0.25; %wellbore radius in ft muo = 5; muw = 1; %viscosity in cP; 'o' stands for oil and 'w' denotes water
nx = 15; %number of simulation rows ny = 11; %number of simulation columns nxy = nx*ny; Ones = ones(nxy,1); %initialization
dx = Lx/nx; dy = Ly/ny; deltat = 10; %time steps re = 0.14*(dx^2 + dy^2)^0.5; %drainage radius in ft
A = 34; B = 42; C = 83; D = 124; E = 132; %well locations
Soi(1:nxy) = 0.75; %initial oil saturation So(1:nxy) = 0.75; %oil saturation
Swi(1:nxy) = 0.25; %initial water saturation Sw(1:nxy) = 0.25; %water saturation
Sor = 0; %residual oil saturation Swc = 0.2; %connate water saturation Sn = (1-So-Swc)/(1-Swc); %Corey's correlation
Pwf = 1000; %BHFP in psia Pwfinj = 1000; %Injection Pressure in psia constant = 1;
P(1:nxy) = 3000; %reservoir pressure in psia Po(1:nxy) = 3000; %reservoir pressure in psia Pr(1:nxy) = 3000; %reservoir pressure in psia
Co = 10^-5; %oil compressibility in psia^-1 Cw = 10^-6; %water compressibility in psia^-1 Cphi = 2*10^-6 ; %rock compressibility in psia^-1
Boi(1:nxy)=1.25*exp(-Co*(P(1:nxy)-1000)); %oil FVF in RB/STB Bwi(1:nxy)=1.02*exp(-Cw*(P(1:nxy)-1000)); %water FVF in RB/STB
Phi_ini(1:nxy) = 0.22*exp(-Cphi*(P(1:nxy)-1000)); %porosity as a function of
pressure
VB = (Lx*Lx*deltaz)/5.615; %bulk volume in cu.ft VPi=VB*Phi_ini(1); %pore volume in cu.ft OIIP = VPi*Soi(1)/Boi(1); %oil in place in BBL
%matrix cell allocation Sm = Ones; Nm = Ones; Wm = Ones; Em = Ones; Cm = Ones; Rm = Ones; Smo = Ones; Nmo = Ones; Wmo = Ones; Cmo = Ones; Emo = Ones; O_ON=1; W_ON=1;
for t = 1:10 for a = 1:50
for i = 1:nx; for j = 1:ny; m = (j-1)*nx+i; if t>50 constant = 0; Pwfinj = 2950; end if t == 1 if a == 1 Bo(t,m) = 1.25*exp(-Co*(Po(m)-1000)); Bw(t,m) = 1.02*exp(-Cw*(Po(m)-1000));
So(t,m) = So(m); Sw(t,m) = 1-So(m); phi(t,m) = 0.2*exp(-Cphi*(Po(m)-1000));
elseif a>1 Bo(t,m) = 1.25*exp(-Co*(P(t,m)-1000)); Bw(t,m) = 1.02*exp(-Cw*(P(t,m)-1000)); So(t,m) = So(t,m); Sw(t,m) = 1-So(t,m); phi(t,m) = 0.2*exp(-Cphi*(P(t,m)-1000));
end
else if a == 1 Bo(t,m) = 1.25*exp(-Co*(P(t-1,m)-1000)); Bw(t,m) = 1.02*exp(-Cw*(P(t-1,m)-1000)); So(t,m) = So(t-1,m); Sw(t,m) = 1-So(t-1,m); phi(t,m) = 0.2*exp(-Cphi*(P(t-1,m)-1000));
elseif a>1 Bo(t,m) = 1.25*exp(-Co*(P(t,m)-1000)); Bw(t,m) = 1.02*exp(-Cw*(P(t,m)-1000)); So(t,m) = So(t,m); Sw(t,m) = 1-So(t,m); phi(t,m) = 0.2*exp(-Cphi*(P(t,m)-1000));
end end end end
for i = 1:nx for j = 1:ny m = (j-1)*(nx)+i; Sn(t,m)=(1-So(t,m)-Swc)/(1-Swc);
if Sw(t,m)>Swc; krw(t,m) = Sn(t,m)^4; %relative permeability of water
else krw(t,m) = 0; end
if So(t,m)>Sor; kro(t,m) = (1-Sn(t,m)^2)*(1-Sn(t,m))^2; %oil relative
permeability else kro(t,m)=0; end
lmbdo(t,m)=k*kro(t,m)/(muo); %mobility of oil lmbdw(t,m)=k*krw(t,m)/(muw); %mobility of water
Ce(m)=(Cphi+(1-So(t,m))*Cw+So(t,m)*Co); Jo(m)=O_ON*(7.08E-
3*k*kro(t,m)*deltaz)/(muo*Bo(t,m)*2.302585*log(re/rw)); %PI of oil Jw(m)=W_ON*(7.08E-
3*k*krw(t,m)*deltaz)/(muw*Bw(t,m)*2.302585*log(re/rw)); %PI of water
end end
for i = 1:nx; for j = 1:ny; m = (j-1)*nx+i; if t == 1 if a == 1 P(t,m) = Po(m); elseif a>1 P(t,m) = P(t,m); end
else if a == 1 P(t,m) = P(t-1,m); elseif a>1 P(t,m) = P(t,m); end end
if i == nx; %boundary condition (east) lmdEo(m) = (k*kro(t,m)/(muo))/Bo(t,m); lmdEw(m)= (k*krw(t,m)/(muw))/Bw(t,m); else if P(t,m+1)>P(t,m); lmdEo(m)=lmbdo(t,m+1)/(0.5*(Bo(t,m)+Bo(t,m+1))); lmdEw(m)=lmbdw(t,m+1)/(0.5*(Bw(t,m)+Bw(t,m+1))); else lmdEo(m)=lmbdo(t,m)/(0.5*(Bo(t,m)+Bo(t,m+1))); lmdEw(m)=lmbdw(t,m)/(0.5*(Bw(t,m)+Bw(t,m+1))); end end
if i == 1; %boundary condition (west) lmdWo(m)=lmbdo(t,m)/Bo(t,m); lmdWw(m)=lmbdw(t,m)/Bw(t,m); else if P(t,m-1)>P(t,m) lmdWo(m)=lmbdo(t,m-1)/(0.5*(Bo(t,m)+Bo(t,m-1))); lmdWw(m)=lmbdw(t,m-1)/(0.5*(Bw(t,m)+Bw(t,m-1))); else lmdWo(m)=lmbdo(t,m)/(0.5*(Bo(t,m)+Bo(t,m-1))); lmdWw(m)=lmbdw(t,m)/(0.5*(Bw(t,m)+Bw(t,m-1))); end end
if j == 1; %boundary condition (south) lmdSo(m)=lmbdo(t,m)/Bo(t,m); lmdSw(m)=lmbdw(t,m)/Bw(t,m);
else if P(t,m-nx)>P(t,m) lmdSo(m)=lmbdo(t,m-nx)/(0.5*(Bo(t,m)+Bo(t,m-nx))); lmdSw(m)=lmbdw(t,m-nx)/(0.5*(Bw(t,m)+Bw(t,m-nx))); else lmdSo(m)=lmbdo(t,m)/(0.5*(Bo(t,m)+Bo(t,m-nx))); lmdSw(m)=lmbdw(t,m)/(0.5*(Bw(t,m)+Bw(t,m-nx))); end end
if j == ny; %boundary condition (north) lmdNo(m)=lmbdo(t,m)/Bo(t,m); lmdNw(m)=lmbdw(t,m)/Bw(t,m); else if P(t,m+nx)>P(t,m) lmdNo(m)=lmbdo(t,m+nx)/(0.5*(Bo(t,m)+Bo(t,m+nx))); lmdNw(m)=lmbdw(t,m+nx)/(0.5*(Bw(t,m)+Bw(t,m+nx))); else lmdNo(m)=lmbdo(t,m)/(0.5*(Bo(t,m)+Bo(t,m+nx))); lmdNw(m)=lmbdw(t,m)/(0.5*(Bw(t,m)+Bw(t,m+nx))); end end end end
for i = 1:nx; for j = 1:ny; m = (j-1)*nx+i; Cmo(m) = -Bo(t,m)*(lmdWo(m)+lmdEo(m)+lmdNo(m)+lmdSo(m)); Nmo(m) = Bo(t,m)*lmdNo(m); Smo(m) = Bo(t,m)*lmdSo(m); Emo(m) = Bo(t,m)*lmdEo(m); Wmo(m) = Bo(t,m)*lmdWo(m); end end i = nx; %boundary condition (east) for j = [1:ny]; m = (j-1)*nx+i; Cmo(m) = Cmo(m)+Emo(m); Emo(m) = 0; end
i=1; %boundary condition (west) for j = [1:ny]; m = (j-1)*nx+i; Cmo(m) = Cmo(m)+Wmo(m); Wmo(m) = 0; end
j = 1; %boundary condition (south) for i = [1:nx]; m = (j-1)*nx+i; Cmo(m) = Cmo(m)+Smo(m); Smo(m) = 0; end
j = ny; %boundary condition (north) for i = [1:nx]; m = (j-1)*nx+i; Cmo(m) = Cmo(m)+Nmo(m); Nmo(m) = 0; end
i = nx; %boundary condition (east) for j = [2:ny-1]; m = (j-1)*nx+i; Cmo(m) = Cmo(m)+Emo(m); Emo(m) = 0; end
i=1; %boundary condition (west) for j = [2:ny-1]; m =(j-1)*nx+i; Cmo(m) = Cmo(m)+Wmo(m); Wmo(m) = 0; end
for i=1:nx; for j=1:ny; m=(j-1)*nx+i; Em(m)=Emo(m)+Bw(t,m)*lmdEw(m); Wm(m)=Wmo(m)+Bw(t,m)*lmdWw(m); Sm(m)=Smo(m)+Bw(t,m)*lmdSw(m); Nm(m)=Nmo(m)+Bw(t,m)*lmdNw(m); Cm(m)=Cmo(m)-Bw(t,m)*(lmdWw(m)+lmdEw(m) + lmdNw(m) +
lmdSw(m))-(158*dx^2/deltat)*phi(t,m)*Ce(m); end end
i = nx; %boundary condition (east) for j = [1:ny]; m = (j-1)*nx+i; Cm(m) = Cm(m)+Em(m); Em(m) = 0; end
i = 1; %boundary condition (west) for j = [1:ny]; m = (j-1)*nx+i; Cm(m) = Cm(m)+Wm(m); Wm(m) = 0; end
j=1; %boundary condition (south) for i = [1:nx]; m = (j-1)*nx+i; Cm(m) = Cm(m)+Sm(m); Sm(m) = 0; end
j=ny; %boundary condition (north) for i = [1:nx]; m = (j-1)*nx+i; Cm(m) = Cm(m)+Nm(m); Nm(m) = 0; end
i = nx; %boundary condition (east) for j = [2:ny-1]; m = (j-1)*nx+i; Cm(m) = Cm(m)+Em(m); Em(m) = 0; end
i=1; %boundary condition (west) for j = [2:ny-1]; m = (j-1)*nx+i; Cm(m) = Cm(m)+Wm(m); Wm(m) = 0; end
for i = 1:nx; for j = 1:ny; m = (j-1)*nx+i; if m == A Cm(m) = Cm(m)-
887.53*dx*(Bo(t,m)*Jo(m)+Bw(t,m)*Jw(m))/(dy*deltaz); elseif m == B Cm(m) = Cm(m)-
887.53*dx*(Bo(t,m)*Jo(m)+Bw(t,m)*Jw(m))/(dy*deltaz); elseif m == C Cm(m) = Cm(m)-
887.53*dx*(constant*Bo(t,m)*Jo(m)+Bw(t,m)*Jw(m))/(dy*deltaz); elseif m == D Cm(m)=Cm(m)-
887.53*dx*(Bo(t,m)*Jo(m)+Bw(t,m)*Jw(m))/(dy*deltaz); elseif m == E Cm(m) = Cm(m)-
887.53*dx*(Bo(t,m)*Jo(m)+Bw(t,m)*Jw(m))/(dy*deltaz); else Cm(m) = Cm(m); end end end
for i = 1:nx; for j = 1:ny; m = (j-1)*nx+i; if t == 1 Pr(t,m)=Po(m); elseif t>1 Pr(t,m)=P(t-1,m); end
if m == A
Rm (m)= -158*(dx^2/deltat) * Ce(m)*phi(t,m) * Pr(t,m)-
887.53 * Pwf*dx * (Bo(t,m) * Jo(m) + Bw(t,m) * Jw(m))/(dy*deltaz); elseif m==B Rm (m)= -158*(dx^2/deltat)*Ce(m)*phi(t,m)*Pr(t,m)-
887.53*Pwf*dx*(Bo(t,m)*Jo(m)+Bw(t,m)*Jw(m))/(dy*deltaz); elseif m==C Rm (m)= -158*(dx^2/deltat)*Ce(m)*phi(t,m)*Pr(t,m)-
887.53*Pwfinj*dx*(Bo(t,m)*constant*Jo(m)+Bw(t,m)*Jw(m))/(dy*deltaz); elseif m==D Rm (m)=-158*(dx^2/deltat)*Ce(m)*phi(t,m)*Pr(t,m)-
887.53*Pwf*dx*(Bo(t,m)*Jo(m)+Bw(t,m)*Jw(m))/(dy*deltaz); elseif m==E Rm (m)=-158*(dx^2/deltat)*Ce(m)*phi(t,m)*Pr(t,m)-
887.53*Pwf*dx*(Bo(t,m)*Jo(m)+Bw(t,m)*Jw(m))/(dy*deltaz); else Rm (m)=-158*(dx^2/deltat)*Ce(m)*phi(t,m)*Pr(t,m); end end end
for m = nxy-1:-1:1 Em(m+1) = Em(m); end for m = 2:nxy Wm(m-1) = Wm(m); end for m = 1:nxy-nx Sm(m) = Sm(m+nx); end for m = nxy-nx:-1:1 Nm(m+nx) = Nm(m); end
matrixsol = spdiags([Sm, Wm, Cm, Em, Nm],[-nx -1 0 +1 +nx],nxy,nxy); y = full(matrixsol);
Ptemp = matrixsol\Rm; %temporary pressure solution for m = 1:nxy Ptemp2(t,m) = Ptemp(m); %temporary pressure solution 2 end
if a>1 if max(abs(Ptemp2(t,1:nxy)-P(t,1:nxy)))<0.001; break
else for m = 1:nxy; P(t,m) = Ptemp2(t,m); end end else P(t,m)=Ptemp2(t,m); end
%%Rate Calculation for m = 1:nxy
if m == A qA_o(t,m)=Jo(m)*(P(t,m)-Pwf); qA_w(t,m)=Jw(m)*(P(t,m)-Pwf); elseif m == B qB_o(t,m)=Jo(m)*(P(t,m)-Pwf); qB_w(t,m)=Jw(m)*(P(t,m)-Pwf); elseif m == C qC_o(t,m)=constant*Jo(m)*(P(t,m)-Pwf); qC_w(t,m)=Jw(m)*(P(t,m)-Pwf); elseif m == D qD_o(t,m) = Jo(m)*(P(t,m)-Pwf); qD_w(t,m) = Jw(m)*(P(t,m)-Pwf); elseif m==E qE_o(t,m)=Jo(m)*(P(t,m)-Pwf); qE_w(t,m)=Jw(m)*(P(t,m)-Pwf); else qA_o(t,m)=0; qA_w(t,m)=0; qB_o(t,m)=0; qB_w(t,m)=0; qC_o(t,m)=0; qC_w(t,m)=0; qD_o(t,m)=0; qD_w(t,m)=0; qE_o(t,m)=0; qE_w(t,m)=0; end end
for m = 1:nxy if m == A && m==B && m==C && m==D && m==E
Cum_oil(t,m)=887.53*dx*(qA_o(t,m)+qB_o(t,m)+qC_o(t,m)+qD_o(t,m)+qE_o(t,m))/(d
y*deltaz); else Cum_oil(t,m)=0; end end
%RateFlux Calculations for i = 1:nx for j = 1:ny m = (j-1)*nx+i; if i == 1 if j == 1 OilFlux(t,m) =
Cmo(m)*P(t,m)+Emo(m)*P(t,m+1)+Nmo(m)*P(t,m+nx); elseif j == ny OilFlux(t,m) = Smo(m)*P(t,m-
nx)+Cmo(m)*P(t,m)+Emo(m)*P(t,m+1); else OilFlux(t,m) = Smo(m)*P(t,m-
nx)+Cmo(m)*P(t,m)+Emo(m)*P(t,m+1)+Nmo(m)*P(t,m+nx); end
elseif i == nx
if j == 1 OilFlux(t,m)=Wmo(m)*P(t,m-
1)+Cmo(m)*P(t,m)+Nmo(m)*P(t,m+nx); elseif j == ny OilFlux(t,m) = Smo(m)*P(t,m-nx)+Wmo(m)*P(t,m-
1)+Cmo(m)*P(t,m); else OilFlux(t,m) = Smo(m)*P(t,m-nx)+Wmo(m)*P(t,m-
1)+Cmo(m)*P(t,m)+Nmo(m)*P(t,m+nx); end
elseif j == 1 if i == 1 OilFlux(t,m) =
Cmo(m)*P(t,m)+Emo(m)*P(t,m+1)+Nmo(m)*P(t,m+nx); elseif i == nx OilFlux(t,m) = Wmo(m)*P(t,m-
1)+Cmo(m)*P(t,m)+Nmo(m)*P(t,m+nx); else OilFlux(t,m) = Wmo(m)*P(t,m-
1)+Cmo(m)*P(t,m)+Emo(m)*P(t,m+1)+Nmo(m)*P(t,m+nx); end
elseif j == ny if i == 1 OilFlux(t,m) = Smo(m)*P(t,m-
nx)+Cmo(m)*P(t,m)+Emo(m)*P(t,m+1); elseif i == nx OilFlux(t,m) = Smo(m)*P(t,m-nx)+Wmo(m)*P(t,m-
1)+Cmo(m)*P(t,m); else OilFlux(t,m) = Smo(m)*P(t,m-nx)+Wmo(m)*P(t,m-
1)+Cmo(m)*P(t,m)+Emo(m)*P(t,m+1); end else OilFlux(t,m) = Smo(m)*P(t,m-nx)+Wmo(m)*P(t,m-
1)+Cmo(m)*P(t,m)+Emo(m)*P(t,m+1)+Nmo(m)*P(t,m+nx); end end end
%% %Saturation Calculations for m = 1:nxy; X(t,m) = (OilFlux(t,m)-Cum_oil(t,m))/(158*dx^2/deltat); if t == 1 Y(t,m) = ((Phi_ini(m)*Soi(m))/(Boi(m))); else Y(t,m) = ((phi(t-1,m)*So(t-1,m))/(Bo(t-1,m))); end So(t,m) = (Bo(t,m)/phi(t,m))*(Y(t,m)+X(t,m)); Sw(t,m) = 1-So(t,m); end end
for m = 1:nxy;
OOIP_EntireGrid(t,m)=dx*dy*deltaz*phi(t,m)*So(t,m)/(5.6145835*Bo(t,m)); end
for m = 1:nxy; qTotal(t)=(qA_o(t,A)+qB_o(t,B)+qC_o(t,C)+qD_o(t,D)+qE_o(t,E));
if t == 1; CumA_o(t) = qA_o(t,A)*deltat; CumB_o(t) = qB_o(t,B)*deltat; CumC_o(t) = qC_o(t,C)*deltat; CumD_o(t) = qD_o(t,D)*deltat; CumE_o(t) = qE_o(t,E)*deltat; CumTotal(t) = CumA_o(t)+CumB_o(t)+CumC_o(t)+CumD_o(t)+CumE_o(t); elseif t >1; CumA_o(t) = qA_o(t,A)*deltat+CumA_o(t-1); CumB_o(t) = qB_o(t,B)*deltat+CumB_o(t-1); CumC_o(t) = qC_o(t,C)*deltat+CumC_o(t-1); CumD_o(t) = qD_o(t,D)*deltat+CumD_o(t-1); CumE_o(t) = qE_o(t,E)*deltat+CumE_o(t-1); CumTotal(t) = CumTotal(t-1)+qTotal(t)*deltat; end end
OOIP_Reservoir = sum(OOIP_EntireGrid,2); ProductionRate_Reservoir(t) =
(qA_o(t,A)+qB_o(t,B)+qC_o(t,C)+qD_o(t,D)+qE_o(t,E))* deltat; CumulativeOil_Reservoir(t,1) = sum(ProductionRate_Reservoir,2); MBE(t) = (OOIP_Reservoir(t,1)+CumTotal(t))/OIIP; RF(t) = CumulativeOil_Reservoir(t,1)/OIIP; if qTotal(t)<1; break end
end