The Dykstra-Parsons method involves plotting the frequency distribution of the permeability on a log-normal probability graph paper.
let’s import the data
data = read.csv("karpur.csv")
k_core = data$k.core
let’s take the permeability and sort in descending order
sorted_k = sort(k_core, decreasing = TRUE)
head(sorted_k)
## [1] 15600.00 14225.31 13544.98 13033.53 11841.74 11117.40
next, for each permeability, calculate the percent of the samples with permeability greater than that value. since the permeability is sorted descending order, we simply made a list with the numbers 1, 2, 3, …, n and each number in the list is divided by (n+1).
n = length(sorted_k)
k_percent = c(1:n)/(n+1)
head(k_percent)
## [1] 0.001219512 0.002439024 0.003658537 0.004878049 0.006097561 0.007317073
polt the data on a log-normal probability graph, k_percent on the x-axis, sorted_k on the y-axis
plot(
x = k_percent,
y = sorted_k,
type="l",
xlab = "% >= k",
ylab = "k",
log='y',
lwd=2
)
in the interval [0.1, 0.9] can be approximated
vary well with a straight line, so let’s fit a straight line to this portion of the data
nearly_linear_k_values = sorted_k[floor(0.1*n): floor(0.9*n)]
nearly_linear_k_percent = k_percent[floor(0.1*n): floor(0.9*n)]
linear_model = lm(log10(nearly_linear_k_values) ~ nearly_linear_k_percent)
summary(linear_model)
##
## Call:
## lm(formula = log10(nearly_linear_k_values) ~ nearly_linear_k_percent)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.19128 -0.03880 0.02148 0.04110 0.07176
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.885895 0.005010 775.7 <2e-16 ***
## nearly_linear_k_percent -1.461904 0.009112 -160.4 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.05402 on 655 degrees of freedom
## Multiple R-squared: 0.9752, Adjusted R-squared: 0.9751
## F-statistic: 2.574e+04 on 1 and 655 DF, p-value: < 2.2e-16
plot(
x = k_percent,
y = sorted_k,
type="l",
xlab = "% >= k",
ylab = "k",
log='y',
lwd=2
)
abline(linear_model, col="red", lwd=2)
The Dykstra-Parsons coefficient of permeability variation, V, is determined from the graph as
V=(k50−k84.1)/k50
where:
k50 = permeability value at %k>= 50 (log mean)
k84.1= permeability value at %k >= 84.1 (one standard deviation)
log_k50_and_84.1 = predict(
linear_model,
data.frame(nearly_linear_k_percent=c(0.50, 0.841))
)
print(10^log_k50_and_84.1)
## 1 2
## 1428.7056 453.3498
k50 = 10^log_k50_and_84.1[1]
k84.1 = 10^log_k50_and_84.1[2]
permeability_variation = (k50 - k84.1)/k50
print(permeability_variation)
## 1
## 0.682685
Lorenz Coefficient Therefore from this Value, we know that this reservoir is Extremely Heterogeneous.
data = read.csv('karpur.csv', header = TRUE)
head(data)
## depth caliper ind.deep ind.med gamma phi.N R.deep R.med SP
## 1 5667.0 8.685 618.005 569.781 98.823 0.410 1.618 1.755 -56.587
## 2 5667.5 8.686 497.547 419.494 90.640 0.307 2.010 2.384 -61.916
## 3 5668.0 8.686 384.935 300.155 78.087 0.203 2.598 3.332 -55.861
## 4 5668.5 8.686 278.324 205.224 66.232 0.119 3.593 4.873 -41.860
## 5 5669.0 8.686 183.743 131.155 59.807 0.069 5.442 7.625 -34.934
## 6 5669.5 8.686 109.512 75.633 57.109 0.048 9.131 13.222 -39.769
## density.corr density phi.core k.core Facies
## 1 -0.033 2.205 33.9000 2442.590 F1
## 2 -0.067 2.040 33.4131 3006.989 F1
## 3 -0.064 1.888 33.1000 3370.000 F1
## 4 -0.053 1.794 34.9000 2270.000 F1
## 5 -0.054 1.758 35.0644 2530.758 F1
## 6 -0.058 1.759 35.3152 2928.314 F1
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.
first, let’s calculate the thickness from the depths.
the differences in depths gives the thickness:
d = data$depth
n = length(d)
h = d[2:n]-d[1:n-1] #differences in depths
head(h)
## [1] 0.5 0.5 0.5 0.5 0.5 0.5
we need one more value to have the same number of data samples, since most of the values are 0.5, this what I’m going to add.
h = append(h, 0.5)
head(h)
## [1] 0.5 0.5 0.5 0.5 0.5 0.5
calculate the cumulative kh, and cumulative phi*h
df = data.frame(h) # we will use data frames to store the data
df['h'] = h
k = data$k.core
df['k'] = k
df['phi'] = data$phi.core
df = df[order(k, decreasing = TRUE),] #sort data such that k is in descending order
df['kh'] = df['k']*df['h'] #multiply k and h
df['sum_kh'] = cumsum(df['kh']) #calculate the cumulative sum
df['sum_kh/total'] = df['sum_kh']/df[n, 'sum_kh'] #divid by the total
# same for phi and h
df['phih'] = df['phi']*df['h']
df['sum_phih'] = cumsum(df['phih'])
df['sum_phih/total'] = df['sum_phih']/df[n, 'sum_phih']
head(df)
## h k phi kh sum_kh sum_kh/total phih sum_phih
## 809 0.5 15600.00 27.9000 7800.000 7800.00 0.008237623 13.95000 13.95000
## 808 0.5 14225.31 28.5071 7112.657 14912.66 0.015749339 14.25355 28.20355
## 810 0.5 13544.98 27.7563 6772.489 21685.15 0.022901802 13.87815 42.08170
## 807 0.5 13033.53 29.0333 6516.764 28201.91 0.029784192 14.51665 56.59835
## 806 0.5 11841.74 29.5596 5920.872 34122.78 0.036037257 14.77980 71.37815
## 811 0.5 11117.40 27.5865 5558.701 39681.48 0.041907832 13.79325 85.17140
## sum_phih/total
## 809 0.001241781
## 808 0.002510583
## 810 0.003745967
## 807 0.005038189
## 806 0.006353836
## 811 0.007581664
scatter.smooth(df['sum_phih/total'][1:n,1],df['sum_kh/total'][1:n,1],
xlab = "fraction of total volume (phih)",
ylab = "fraction of total flow capacity (kh)")
we need to calculate the area under the above graph, I wrote the fallowing code to find the area, basically this is an implementation of the trapezoid method to fined AUC.
note: I’m familiar with python, and still new to R, writing my own code actully took less time than searching for some libraries that would calculate the area for me.
x = c(df['sum_phih/total'][1:n,1])
dx = x[2:n] - x[1:n-1]
y1 = c(df['sum_kh/total'][1:n,1])[1:n-1]
y2 = c(df['sum_kh/total'][1:n,1])[2:n]
lower_area = Reduce("+", y1*dx)
upper_area = Reduce("+", y2*dx)
area = (lower_area + upper_area)/2
print(area)
## [1] 0.7247318
finally we calculate Lorenz coefficient as fallows:
Lorenz_coefficient = (area - 0.5)/0.5
print(Lorenz_coefficient)
## [1] 0.4494636