You are on page 1of 3

TM4112

Project Reservoir Simulation Sem 1 2020/2021


Assignment #5; due date: 9/11/2020
1. Code a subroutine poten.f90 that compares the potential of gas and oil phases
between neighboring block. Let us identify those blocks with the notation as below:
𝑗 𝐹(𝑖, 𝑗, 𝑘 − 1)

𝑖 𝐸(𝑖, 𝑗 + 1, 𝑘)

𝑘 𝐴(𝑖, 𝑗, 𝑘
)

𝐵(𝑖 − 1, 𝑗, 𝑘) 𝐶(𝑖 + 1, 𝑗, 𝑘)

𝐷(𝑖, 𝑗 − 1, 𝑘)
𝐺(𝑖, 𝑗, 𝑘 + 1)

Since the block A trough E are in the same horizon, you do not have to worry about the
gravitational term (i.e. you just compare pressure). Also, we assume no capillary pressure,
and the relation for the oil phase holds for the gas phase. For block A, F, and G, you must
include the gravitational term and you must compare for the potentials for oil and water
phases, separately.
Make poten.f90 return 8 flags. (ibw(i,j,k), icw(i,j,k), idw(i,j,k),
iew(i,j,k), ifw(i,j,k), and igw(i,j,k) for water phase and ifo(i,j,k),
and igo(i,j,k) for oil phase) These flags must be set zero (0) if potential of block A is
higher and must be set one (1) if the potential of block A is lower than the individual block
potentials. For instance ifw(i,j,k) may be determine as:

:
do i=1,nx
do j=1,ny
do k=1,nz
! node B
!

! node C
!

! node D
!

! node E
!

! node F
!
ifw(i,j,k)=0
pkk=pk(i,j,k)
if (k>1) then
pkkm1=pk(i,j,k-1)
pka=0.5*(pkk+pkkm1)
dpkm1=pkkm1-pkk
dzkm1=depth(k-1)-depth(k)
potw=dpkm1-dnw(pka)*dzkm1
if(potw>0.0)ifw(i,j,k)=1
end if

! node G
!
! node F oil
!
! node G  oil
!

enddo
enddo
enddo

2. Test your subroutine with the main program as:

implicit none
!
:
!
call init
!
do k=1,nz
do j=1,ny
do i=1,nx
if (i/=2*(i/2)) pk(i,j,k)=pk(i,j,k)+10.
if (j/=2*(j/2)) pk(i,j,k)=pk(i,j,k)+10.
if (k/=2*(k/2)) pk(i,j,k)=pk(i,j,k)+10.
enddo
enddo
enddo
!
call poten
!
do k=1,nz
do j=1,ny
do i=1,nx
n1=n1+ibw(i,j,k)+icw(i,j,k)+idw(i,j,k)+iew(i,j,k)
n2=n2+ifw(i,j,k)+igw(i,j,k)+ifo(i,j,k)+igo(i,j,k)
n3=n3+ibw(i,j,k)*igw(i,j,k)+icw(i,j,k)*ifw(i,j,k)
n4=n4+idw(i,j,k)*igo(i,j,k)+iew(i,j,k)*ifo(i,j,k)
enddo
enddo
enddo

write(6,*) n1, n2, n3, n4

Submit the source code poten.f90 and your solution for n1, n2, n3, and n4.
Also solution for:
ibw(1,2,3), icw(2,3,4), idw(4,3,2), iew(3,2,1),
ifw(5,1,5), igw(4,2,4), ifw(3,3,3), igw(2,2,2).

You might also like