Upscaling is essential step when we dealing with Reservoir Simulation because the data we get from core samples is in few inches and in Reservoir Simulation we deal with grids that have minimum dimensions(10 meters by 10 meters).
So let’s start and upload some Data.
data<-read.csv("C:/Users/Lenovo/Desktop/shahed2/karpur.csv",header=T)
summary(data)## depth caliper ind.deep ind.med
## Min. :5667 Min. :8.487 Min. : 6.532 Min. : 9.386
## 1st Qu.:5769 1st Qu.:8.556 1st Qu.: 28.799 1st Qu.: 27.892
## Median :5872 Median :8.588 Median :217.849 Median :254.383
## Mean :5873 Mean :8.622 Mean :275.357 Mean :273.357
## 3rd Qu.:5977 3rd Qu.:8.686 3rd Qu.:566.793 3rd Qu.:544.232
## Max. :6083 Max. :8.886 Max. :769.484 Max. :746.028
## gamma phi.N R.deep R.med
## Min. : 16.74 Min. :0.0150 Min. : 1.300 Min. : 1.340
## 1st Qu.: 40.89 1st Qu.:0.2030 1st Qu.: 1.764 1st Qu.: 1.837
## Median : 51.37 Median :0.2450 Median : 4.590 Median : 3.931
## Mean : 53.42 Mean :0.2213 Mean : 24.501 Mean : 21.196
## 3rd Qu.: 62.37 3rd Qu.:0.2640 3rd Qu.: 34.724 3rd Qu.: 35.853
## Max. :112.40 Max. :0.4100 Max. :153.085 Max. :106.542
## SP density.corr density phi.core
## Min. :-73.95 Min. :-0.067000 Min. :1.758 Min. :15.70
## 1st Qu.:-42.01 1st Qu.:-0.016000 1st Qu.:2.023 1st Qu.:23.90
## Median :-32.25 Median :-0.007000 Median :2.099 Median :27.60
## Mean :-30.98 Mean :-0.008883 Mean :2.102 Mean :26.93
## 3rd Qu.:-19.48 3rd Qu.: 0.002000 3rd Qu.:2.181 3rd Qu.:30.70
## Max. : 25.13 Max. : 0.089000 Max. :2.387 Max. :36.30
## k.core Facies
## Min. : 0.42 Length:819
## 1st Qu.: 657.33 Class :character
## Median : 1591.22 Mode :character
## Mean : 2251.91
## 3rd Qu.: 3046.82
## Max. :15600.00
First step is to see if there is a direct relationship between (Q = porosity) ’Q.Core” and “Q.Log”
Q.core <- data$phi.core/100
par(mfrow=c(1,1))
model1 <- lm(Q.core ~ data$phi.N)
coef(model1)## (Intercept) data$phi.N
## 0.3096232 -0.1820696
plot(data$phi.N,Q.core, xlab = 'Q.Log ',ylab='Q.Core')
abline(model1, lwd=2, col='red' )summary(model1)##
## Call:
## lm(formula = Q.core ~ data$phi.N)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.135237 -0.030779 0.009432 0.033563 0.104025
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.30962 0.00485 63.846 <2e-16 ***
## data$phi.N -0.18207 0.02080 -8.753 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.04368 on 817 degrees of freedom
## Multiple R-squared: 0.08573, Adjusted R-squared: 0.08462
## F-statistic: 76.61 on 1 and 817 DF, p-value: < 2.2e-16
Now according to the values of Multiple R-squared: 0.08573, Adjusted R-squared: 0.08462 , there is no relationship between ’Q.Core” and “Q.Log”, so we can’t use Simple linear regression, so we will use Multiple Linear Regression, but before that we should know the Coefficients that influence on relationship between ’Q.Core” and “Q.Log”.
model1 <- lm((data$phi.core)/100 ~., data = data)summary(model1)##
## Call:
## lm(formula = (data$phi.core)/100 ~ ., data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.099073 -0.008962 0.000796 0.008740 0.090767
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.613e+00 2.577e-01 6.261 6.24e-10 ***
## depth -3.948e-05 2.686e-05 -1.470 0.142023
## caliper -8.627e-02 1.484e-02 -5.812 8.90e-09 ***
## ind.deep 5.081e-05 3.492e-05 1.455 0.146104
## ind.med -3.357e-05 3.839e-05 -0.874 0.382160
## gamma 3.993e-05 9.246e-05 0.432 0.665963
## phi.N 1.368e-01 2.141e-02 6.392 2.78e-10 ***
## R.deep -1.528e-04 9.406e-05 -1.624 0.104683
## R.med 1.954e-04 1.377e-04 1.419 0.156296
## SP -4.974e-06 4.686e-05 -0.106 0.915504
## density.corr -1.546e-01 7.125e-02 -2.170 0.030298 *
## density -1.865e-01 1.618e-02 -11.531 < 2e-16 ***
## k.core 4.240e-06 5.037e-07 8.418 < 2e-16 ***
## FaciesF10 -4.419e-02 5.120e-03 -8.631 < 2e-16 ***
## FaciesF2 -7.517e-02 8.238e-03 -9.126 < 2e-16 ***
## FaciesF3 -2.873e-02 4.868e-03 -5.900 5.35e-09 ***
## FaciesF5 -3.388e-02 4.964e-03 -6.824 1.75e-11 ***
## FaciesF7 -5.684e-02 8.290e-03 -6.857 1.41e-11 ***
## FaciesF8 -1.282e-02 5.849e-03 -2.193 0.028630 *
## FaciesF9 -2.453e-02 6.515e-03 -3.765 0.000179 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.01874 on 799 degrees of freedom
## Multiple R-squared: 0.8354, Adjusted R-squared: 0.8315
## F-statistic: 213.4 on 19 and 799 DF, p-value: < 2.2e-16
Now we see that R-squared and Adjusted R-squared become 0.8354, 0.8315 respectively which indcate a good relationship,therefore, we have 13 parameters influence in the relationship between ’Q.Core” and “Q.Log”. So lets write the multiple linear regression to find “Q.CoreL”
model1 <- lm((Q.core) ~caliper+phi.N+density.corr+density+k.core+Facies, data = data)
summary(model1)##
## Call:
## lm(formula = (Q.core) ~ caliper + phi.N + density.corr + density +
## k.core + Facies, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.099953 -0.009649 -0.000134 0.009053 0.090382
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.231e+00 8.952e-02 13.746 < 2e-16 ***
## caliper -6.540e-02 9.916e-03 -6.595 7.68e-11 ***
## phi.N 1.579e-01 1.770e-02 8.918 < 2e-16 ***
## density.corr -1.667e-01 7.013e-02 -2.376 0.0177 *
## density -1.974e-01 1.540e-02 -12.819 < 2e-16 ***
## k.core 3.996e-06 4.363e-07 9.158 < 2e-16 ***
## FaciesF10 -4.517e-02 5.037e-03 -8.967 < 2e-16 ***
## FaciesF2 -7.914e-02 8.051e-03 -9.829 < 2e-16 ***
## FaciesF3 -3.000e-02 4.684e-03 -6.404 2.57e-10 ***
## FaciesF5 -3.794e-02 3.788e-03 -10.018 < 2e-16 ***
## FaciesF7 -6.198e-02 7.222e-03 -8.582 < 2e-16 ***
## FaciesF8 -1.863e-02 3.765e-03 -4.948 9.11e-07 ***
## FaciesF9 -2.693e-02 3.821e-03 -7.047 3.92e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.0189 on 806 degrees of freedom
## Multiple R-squared: 0.8312, Adjusted R-squared: 0.8287
## F-statistic: 330.7 on 12 and 806 DF, p-value: < 2.2e-16
par(mfrow=c(2,2))
plot(model1,lwd=3)Predict and plot the “Q.CoreL”
Q.CoreL<-predict(model1,data)
plot(Q.CoreL,xlab='Number of Samples (n)',ylab='Q.CoreL') #cbind(data$k.core,Q.CoreL)Now we have “Q.CoreL” let’s make relationship between it and K.core by using simple linear regression to find “K.coreL”
model2 <- lm(data$k.core ~ Q.CoreL)
plot(Q.CoreL,data$k.core,xlab ='Q.CoreL',ylab='K.core (md)')
abline(model2, lwd=3, col='red' )model3 <- lm(data$k.core ~., data = data)
summary(model3)##
## Call:
## lm(formula = data$k.core ~ ., data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5585.6 -568.9 49.2 476.5 8928.4
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -6.783e+04 1.760e+04 -3.853 0.000126 ***
## depth 8.544e+00 1.785e+00 4.786 2.02e-06 ***
## caliper 1.413e+03 1.019e+03 1.387 0.165789
## ind.deep -2.418e-01 2.354e+00 -0.103 0.918220
## ind.med 1.224e+00 2.585e+00 0.473 0.636062
## gamma -4.583e+01 6.010e+00 -7.626 6.88e-14 ***
## phi.N -2.010e+03 1.476e+03 -1.362 0.173540
## R.deep -2.344e+01 6.288e+00 -3.727 0.000207 ***
## R.med 5.643e+01 9.065e+00 6.225 7.76e-10 ***
## SP -7.125e+00 3.145e+00 -2.266 0.023736 *
## density.corr -2.567e+03 4.809e+03 -0.534 0.593602
## density 2.319e+03 1.173e+03 1.976 0.048458 *
## phi.core 1.921e+02 2.282e+01 8.418 < 2e-16 ***
## FaciesF10 8.921e+02 3.590e+02 2.485 0.013157 *
## FaciesF2 9.243e+02 5.818e+02 1.589 0.112514
## FaciesF3 4.393e+02 3.344e+02 1.313 0.189394
## FaciesF5 7.411e+02 3.428e+02 2.162 0.030908 *
## FaciesF7 -4.152e+01 5.742e+02 -0.072 0.942377
## FaciesF8 -1.179e+03 3.927e+02 -3.002 0.002770 **
## FaciesF9 -2.969e+03 4.298e+02 -6.908 1.00e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1262 on 799 degrees of freedom
## Multiple R-squared: 0.6889, Adjusted R-squared: 0.6815
## F-statistic: 93.12 on 19 and 799 DF, p-value: < 2.2e-16
model3.red <- lm(data$k.core~Q.CoreL+depth+gamma+R.deep+R.med+SP+density+Q.core+Facies, data =data)
coef(model3.red)## (Intercept) Q.CoreL depth gamma R.deep
## -41763.397880 116464.432647 -5.431412 -77.510493 -16.847085
## R.med SP density Q.core FaciesF10
## 19.043411 -2.609740 22033.559000 1319.447344 5237.387181
## FaciesF2 FaciesF3 FaciesF5 FaciesF7 FaciesF8
## 8244.241790 3419.732335 3647.957858 4752.532284 -775.751582
## FaciesF9
## 876.817847
par(mfrow=c(2,2))
plot(model3.red,lwd=3)K.coreL <- predict(model3.red,data)
plot(K.coreL,xlab='Number of Samples (n)',ylab='K.coreL (md)')AdjR.sq2 <- 1-sum((K.coreL - data$k.core)^2)/sum((data$k.core-mean(data$k.core))^2)
AdjR.sq2## [1] 0.8219384
rmse.model3 <- sqrt(sum((K.coreL - data$k.core)^2)/nrow(data))
rmse.model3## [1] 942.7917
Add our new data “K.coreL” to the file karpur.csv
karpur2<-cbind(data,K.coreL)
write.csv(karpur2,"karpur2.csv")head(karpur2)## 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 K.coreL
## 1 -0.033 2.205 33.9000 2442.590 F1 4757.604
## 2 -0.067 2.040 33.4131 3006.989 F1 4581.700
## 3 -0.064 1.888 33.1000 3370.000 F1 3884.732
## 4 -0.053 1.794 34.9000 2270.000 F1 2621.163
## 5 -0.054 1.758 35.0644 2530.758 F1 2377.844
## 6 -0.058 1.759 35.3152 2928.314 F1 2520.201
Now lts’s plot our final work
par(mfrow=(c(1,5)))
plot(Q.core,data$depth,ylim =rev(c(5667,6083)), xlim=c(0.35,0.15)
,type="l",col="blue", lwd=2, xlab='Q.Core' ,ylab='depth (m)')
plot(data$phi.N,data$depth,ylim =rev(c(5667,6083)), xlim=c(0.35,0.15)
,type="l",col="darkred", lwd=2, xlab='Q.Log' ,ylab='depth (m)')
plot(Q.CoreL,data$depth,ylim =rev(c(5667,6083)), xlim=c(0.35,0.15)
,type="l",col="yellow", lwd=2, xlab='Q.CoreL' ,ylab='depth (m)')
plot(data$k.core,data$depth,ylim =rev(c(5667,6083)), xlim=c(0.42,15600.00) ,type="l",col="red", lwd=2, xlab='K.core (md)' ,ylab='depth (m)')
plot(K.coreL,data$depth,ylim =rev(c(5667,6083)), xlim=c(0.42,15600.00),type="l",col="green", lwd=2, xlab='K.coreL (md)' ,ylab='depth (m)')par(mfrow=c(1,1))
boxplot(data$depth~data$Facies,col="300" ,xlab='Facies',
ylab='Depth (m)',cex=1.5, cex.lab=1.5, cex.axis=1.2,col.axis="100",col.lab="darkgreen")
grid(nx= NULL, ny= NULL, lty=3,col="red",lwd=2)