Dykstra-Parsons coefficient The Dykstra-Parsons method involves plotting the frequency distribution of the permeability on a log-normal probability graph paper. This is done by arranging the permeability values in descending order and then calculating for each permeability, the percent of the samples with permeability greater than that value. to avoid values of zero or 100%, the percent greater than or equal to value is normalized by n+1, where n it is the number of samples.

data = read.csv("karpur.csv")
kcore= data$k.core 
depth=data$depth

make sort the permeability in decreasing order

sorted_k = sort(kcore,decreasing = TRUE)
head(sorted_k)
## [1] 15600.00 14225.31 13544.98 13033.53 11841.74 11117.40
n = length(sorted_k)

# find the percent for each permeability 
k_percent = c(1:n)/(n+1)
summary(k_percent)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## 0.00122 0.25061 0.50000 0.50000 0.74939 0.99878
# plot best strighat line between sorted permeability and permeability percentage
mod1=lm(log10(sorted_k) ~ k_percent)
plot(k_percent, sorted_k, log="y", lwd = 2)
abline(mod1)

The Dykstra-Parsons coefficient of permeability variation (V) is determined from the graph as:

V=(k50−k84.1)/k50

k50=10^predict(mod1,data.frame(k_percent=c(0.5)))
k84.1=10^predict(mod1,data.frame(k_percent=c(0.841)))

V=(k50 - k84.1)/(k50)
print(V)
##         1 
## 0.7661618

Lorenz coefficient The Lorenz coefficient of permeability variation is obtained by plotting a graph of cumulative kh versus cumulative phi*h, sometimes called a flow capacity plot.

calculate the thickness from the differences in depths

thickness = depth[2:n]-depth[1:n-1]
summary(thickness)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.5000  0.5000  0.5000  0.5086  0.5000  1.0000
thickness=append(thickness, 0.5)
ta=data.frame(data)
ta["thickness"]=thickness
j=ta[order(kcore, decreasing = TRUE),]
# make table contain (thickness,phi.core,k.core)
ta['kh']= j$k.core * j$thickness
ta['sum_kh']=cumsum(ta['kh'])
ta['sum_kh/total']=ta['sum_kh']/ta[n, 'sum_kh']

ta['phih']           = j$phi.core * j$thickness
ta['sum_phih']       = cumsum(ta['phih'])
ta['sum_phih/total'] = ta['sum_phih']/ta[n, 'sum_phih']

plot(ta['sum_phih/total'][1:n,1], ta['sum_kh/total'][1:n,1], xlab = "fraction of total volume (phih)", 
  ylab = "fraction of total flow capacity (kh)")

x  = c(ta['sum_phih/total'][1:n,1])
dx = x[2:n] - x[1:n-1]

y1 = c(ta['sum_kh/total'][1:n,1])[1:n-1]
y2 = c(ta['sum_kh/total'][1:n,1])[2:n]

lower_area = sum(y1*dx) #Reduce("+", y1*dx)
upper_area = sum(y2*dx) #Reduce("+", y2*dx)

AUC = (lower_area + upper_area)/2

print(AUC)
## [1] 0.7247318

Lorenz coefficient=(AUC−0.5)/0.5

Lorenz_coefficient = (AUC - 0.5)/0.5
print(Lorenz_coefficient)
## [1] 0.4494636