Heterogeneity is a function of horizontal permeability, and can be quantified by two techniques:

*Dykstra-Parsons

*Lorenz Coefficient

Let’s load Data.

data = read.csv("karpur.csv")
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

1- Dykstra-Parsons Dykstra-Parsons have presented a method of quantifying the degree of heterogeneity of a reservoir based on permeability data from core analysis.

So let’s choose K.core from our data

Here I am arrange the core samles of data-set in descending order than spliting cored permeability as an individual vector:

#arrange BASED ON K CORE

data = data[order(data$k.core, decreasing = TRUE), ]
K = data$k.core

Next step: creating another vector containing the number of samples ≥ k, while the order of data is descending the first K will has only one permeability greater or equals to its value while the last K has 819 (number of samples) of permeability values greater or equals to its value.

sample= c(1:819)

For each sample, we will calculate the percentage of thickness with permeability greater than this sample.Note that to avoid values of zero or 100%, the percent greater than or equal to value is normalized by n+1, where n is the number of samples.

k_percent = (sample * 100) / 820

Next Step: plot permeability values on the log scale and the % of thickness on the probability scale.

xlab = "PORTION OF TOTAL SAMPLE HAVING HIGHER PERMEABILITY "
ylab = "SAMPLE PERMEABILITY (md)"
plot(k_percent, K, log =  'y', xlab = xlab, ylab = ylab, pch = 16, cex = 0.5, col = "black")

Now We Will Draw the best straight line through the points by using lm() function used to build linear regression model:

log_k = log(K)
model = lm(log_k ~ k_percent)
plot(k_percent,log_k, xlab = xlab, ylab = ylab, pch = 16, cex = 0.5, col = "black")
abline(model, col = 'red', lwd = 3)

summary(model)
## 
## Call:
## lm(formula = log_k ~ k_percent)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -5.8697 -0.2047  0.1235  0.3150  0.4280 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  9.2584172  0.0377994  244.94   <2e-16 ***
## k_percent   -0.0426137  0.0006549  -65.07   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5404 on 817 degrees of freedom
## Multiple R-squared:  0.8382, Adjusted R-squared:  0.838 
## F-statistic:  4234 on 1 and 817 DF,  p-value: < 2.2e-16

Our model has good R2 value which is obvious from the plot. abline is just adding the fitted line.

Next step:Read the corresponding permeability values at 84.1% and 50% of thickness by define new data frame that contains the required values:

new_data = data.frame(k_percent  = c(50, 84.1))

Next Step: predict () function to predict from given model:

predicted_values = predict(model, new_data)

so the logarithmic permeability of K50 = 7.13 & K84.1 = 5.67

to calculate heterogeneity index:

V=(K50-K84.1)/(K50)

heterogenity_index = (predicted_values[1] - predicted_values[2]) / predicted_values[1]

heterogenity_index
##         1 
## 0.2038692

Due to the low heterogeneity value, a homogeneous model may be used with the least amount of error. The heterogeneity index is 0.204, indicating a slightly heterogeneous class of permeability distribution.

2- 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.

For the same data:

data = read.csv("karpur.csv")

Calculation Steps: 1-Tabulate thickness , permeability , and porosity

permeability , and porosity ready but We must determine each permeability’s thickness based on Depth[n] - Depth[n-1] before updating the data and categorizing it based on Permeability.core:

#thickness calculation
thickness = c(0.5)
for (n in 2:819) {
  h = data$depth[n] - data$depth[n-1]
  thickness = append(thickness, h)}


data = data[order(data$k.core, decreasing = TRUE), ]

Step2:Calculate the cumulative permeability capacity and cumulative capacity volume using cumsum() function.

KH = thickness * data$k.core
PH = thickness * data$phi.core
cum_sum_kh = cumsum(KH)
cum_sum_ph = cumsum(PH)

Step3:Calculate the normalized cumulative capacities cum.k.core=(∑(kh)i/∑(kh)t) cum.phi.core=(∑(PHI* h)i/∑(PHI *h)t)

frac_TOTAL_VOLUME = (cum_sum_ph/100) / max(cum_sum_ph/100) #to convert phi between (0,1)
frac_TOTAL_FLOW_CAPACITY = cum_sum_kh / max(cum_sum_kh)

Step4:plotting the FRACTION OF TOTAL VOLUME on X-axis and the FRACTION OF TOTAL FLOW CAPACITY on Y-axis plot a straight diagonal from the beginning of curve till its end:

plot(frac_TOTAL_VOLUME,frac_TOTAL_FLOW_CAPACITY, pch = 16, cex = 0.5, col = "black", text(0.4, 0.8, "B"))
text(0,0, "A", pos = 2)
text(1,1, "D", pos = 1)
text(1,0, "C", pos = 4)
abline(0,1, col = 'red', lwd = 3)

We must now calculate the area under the curve(ABCDA).

utilizing the numerical method known as trapezoid, which approximates the area under a curve using the AUC() function:

require("DescTools")
## Loading required package: DescTools
library(DescTools)

area = AUC(frac_TOTAL_VOLUME, frac_TOTAL_FLOW_CAPACITY, method="trapezoid")

The formula of Lorenz Coefficient:

Lorenz Coefficient=[area(ABDA)-area(ACDA)]/[area(ACDA)]

Since area(ACDA)=0.5 So:

Lorenz_Coefficient  = (area - 0.5) / 0.5

The heterogeneity Index:

Lorenz_Coefficient
## [1] 0.4524741

The reservoir is considered to have a uniform permeability distribution if Lk ~ 0.

The reservoir is considered to be completely heterogeneous if Lk ~ 1.

So the current value(0.45) considers as heterogeneous or high heterogeneous reservoir.