``````

In [64]:

%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit

``````
``````

In [65]:

#Data Set 2
Sw=[0.369
,0.465
,0.527
,0.597
,0.723
,0.808
,0.836
,0.852
,0.857]
krw=[
0.000
,0.037
,0.068
,0.114
,0.206
,0.274
,0.295
,0.303
,0.324
]
kro=[
0.950
,0.640
,0.454
,0.270
,0.081
,0.028
,0.023
,0.006
,0.000
]
kro_scwo=max(kro) #Kro at Connate water Sw
krw_sorw=max(krw) #Krw at residual oil Sw
Swcr=min(Sw)    #Connate water Sw
Sorw=1-max(Sw)  #residual oil Sw

``````
``````

In [66]:

def Krw(x, Cw):
#x is Sw
return krw_sorw* ((x-Swcr)/(1-Swcr-Sorw))**Cw
def Kro(x, Co):
#x is Sw
return kro_scwo* ((1-x-Sorw)/(1-Swcr-Sorw))**Co

``````
``````

In [67]:

paras = curve_fit(Krw, Sw, krw, bounds=(1, [6.]))
Cw_fit=paras[0]
paras = curve_fit(Kro, Sw, kro, bounds=(1, [6.]))
Co_fit=paras[0]

``````
``````

In [68]:

plt.scatter(Sw, krw, color='b', label='krw')
plt.scatter(Sw, kro, color='r', label='kro')
plt.plot(Sw, [Krw(s,Cw_fit) for s in Sw], 'b-', label='krw-fitted')
plt.plot(Sw, [Kro(s,Co_fit) for s in Sw], 'r-', label='kro-fitted')

plt.title('Releative Permeability\n n_w=%s  n_o=%s'%(Cw_fit,Co_fit),fontsize=16)
plt.xlabel('Sw(%)',fontsize=16)
plt.ylabel('Krw/Kro (%)',fontsize=16)
plt.grid(True)
plt.tick_params(axis='both', which='major', labelsize=16)
plt.xlim(0, 1)
plt.ylim(-0.01, 1)
plt.legend(fontsize=13)
plt.show()

``````
``````

``````
``````

In [69]:

#Data Set 1
Sw=[
0.369
,0.431
,0.469
,0.514
,0.609
,0.659
,0.690
,0.714
,0.730
]
krw=[
0.000
,0.010
,0.015
,0.023
,0.033
,0.045
,0.068
,0.100
,0.111
]
kro=[
0.755
,0.396
,0.266
,0.196
,0.058
,0.040
,0.022
,0.013
,0.000
]
kro_scwo=max(kro) #Kro at Connate water Sw
krw_sorw=max(krw) #Krw at residual oil Sw
Swcr=min(Sw)    #Connate water Sw
Sorw=1-max(Sw)  #residual oil Sw

``````
``````

In [70]:

def Krw(x, Cw):
#x is Sw
return krw_sorw* ((x-Swcr)/(1-Swcr-Sorw))**Cw
def Kro(x, Co):
#x is Sw
return kro_scwo* ((1-x-Sorw)/(1-Swcr-Sorw))**Co

paras = curve_fit(Krw, Sw, krw, bounds=(1, [6.]))
Cw_fit=paras[0]
paras = curve_fit(Kro, Sw, kro, bounds=(1, [6.]))
Co_fit=paras[0]

``````
``````

In [71]:

plt.scatter(Sw, krw, color='b', label='krw')
plt.scatter(Sw, kro, color='r', label='kro')
plt.plot(Sw, [Krw(s,Cw_fit) for s in Sw], 'b-', label='krw-fitted')
plt.plot(Sw, [Kro(s,Co_fit) for s in Sw], 'r-', label='kro-fitted')

plt.title('Releative Permeability\n n_w=%s  n_o=%s'%(Cw_fit,Co_fit),fontsize=16)
plt.xlabel('Sw(%)',fontsize=16)
plt.ylabel('Krw/Kro (%)',fontsize=16)
plt.grid(True)
plt.tick_params(axis='both', which='major', labelsize=16)
plt.xlim(0, 1)
plt.ylim(-0.01, 1)
plt.legend(fontsize=13)
plt.show()

``````
``````

``````
``````

In [ ]:

``````
``````

In [ ]:

``````