Simulate well test response using analytical solutions

R Well testing

Using Stehfest Numerical Laplace Inversion algorithm to simulate well pressure response.

Rigoberto Chandomi Vazquez https://www.linkedin.com/in/rigoberto-chandomi-v%C3%A1zquez-79038495/
10-31-2021

Through the stehfest numerical inverse transformation method (1976), we can calculate dimensionless wellbore pressure in real space. The Laplace transform method can be given by (1)

\[ V(i) = (-1)^{\frac{N}{2}+i}\sum_{k=\frac{i+1}{2}}^{min\left(i,\frac{N}{2} \right)} \frac{k^\frac{N}{2}(2k)!}{\left(\frac{N}{2}-k \right)!(k)!(k-1)!(i-k)!(2k-i)!}\] where \[f(t) = \frac{ln(2)}{t}\sum_{i=1}^{N}V(i)\overline{f}(s)\] \[s=i\frac{ln(2)}{t}\] The variable N could be one of the even numbers from 6 to 18. In this case we use the \(V(i)\) with Stehfest parameter \(N=8\)

\(V(1)\) \(V(2)\) \(V(3)\) \(V(4)\) \(V(5)\) \(V(6)\) \(V(7)\) \(V(8)\)
-0.3333 48.3333 -906 5464.6667 -14376.66667 18730 -11946.6667 2986.6667

Using the stehfest algorithm in the infinite acting reservoir with WBS and skin equation (2), we can get dimensionless pressure in real space.

\[ \overline{P_{wD}}=\frac{1}{u}\left[\frac{K_0(\sqrt{u})+s\sqrt{u}K_1(\sqrt{u})}{\sqrt{u}K_1(\sqrt{u})+C_Du[K_0(\sqrt{u})+s\sqrt{u}K_1(\sqrt{u}])}\right]\]

In EOF units, the dimensionless variables are defined as:

pressure \[p_D = \frac{kh}{141.2qB \mu}\] time \[t_D = \frac{0.000264k}{\phi \mu c_tr_w^2}\] wellbore storage \[C_D = \frac{0.8936}{\phi c_t h r_w^2}\] radial distance \[r_D = \frac{r}{r_w}\]

Taking results from type curve post, Pressure response is simulated the response and compared with data. First load the data to take the time elapse.

library(plotly)
library(dplyr)
library(DT)

data.DD <- read.csv("ex1_DD.csv") 

datatable(data.DD)
plot_pwf <- plot_ly() %>%
      add_markers(data = data.DD, x = ~t, y = ~pwf, marker = list(color = "blue"), name = "Pwf") %>%
      layout(
        xaxis = list(title = "time, hr"),
        yaxis = list(title = "Pwf, psi")
      )

plot_pwf

A log-log plot is generated from pressure change and its logarithmic derivative to identify flow regime.

Qo <- 125 #STB/D
h <- 32 #ft
phi <- 0.22 #fraction
Bo <- 1.125 #RB/STB
Pi <- 2750 #psia
ct <- 0.0000109 #psia -1 
rw <- 0.25 #ft
vis <- 2.122 #cp

#Results
k <- 22.92
s <- 5.78
C <- 0.005


data.DD$dp <-  Pi-data.DD$pwf
data.DD$dpdt <- c(0,diff(data.DD$dp)/diff(log(data.DD$t)))

plot_log <- plot_ly() %>%
      add_markers(data = data.DD, x = ~t, y = ~dp, marker = list(color = "blue"), name = "dp") %>%
      add_markers(data = data.DD, x = ~t, y = ~dpdt, marker = list(color = "green"), name = "dp'") %>%
      layout(
        xaxis = list(type = "log", title = "time, hr"),
        yaxis = list(type = "log", title = "Pwf, psi")
      )

plot_log

To reuse code later Stehfest algorithm is defined as a function

#Stehfest inversion algorithm
Stehfest_inversion <- function(tD, cD, s){
  
  PwD <- 0
  
  m <- length(tD)

  V <- c(-0.3333,48.3333,-906,5464.6667,-14376.6667,18730,-11946.6667,2986.6667)
  
  for(j in 1:m){
    
    a <- log(2)/tD[j]
    i <- c(1:length(V))
    u <- (i*a)
    ru <- sqrt(u)
    aux1 <- besselK(ru,0)+s*ru*besselK(ru,1)
    aux2 <- ru*besselK(ru,1)+cD*u*(besselK(ru,0)+s*ru*besselK(ru,1))
    PwDL <- 1/u*(aux1/aux2)
    
    PwD[j] <- a*sum(V*PwDL)
    
  }
  
  return(PwD)
  
}

Now, The Stehfest_inversion() function is used with the results parameters. Fisrt, time and WBS is estimated from above equations and then they and skin are used as Stehfest_inversion() parameters functions.

In the log-log plot we can observe a difference between pressure change from data and the simulation, the different could be less adjust the k, C and s values with non-linear regression

tD <- (0.0002637*k*(data.DD$t))/(phi*vis*ct*rw^2)
cD <- (0.8936*C)/(h*phi*ct*rw^2)

PwD <- Stehfest_inversion(tD, cD, s)

data.DD$dp_cal <- (PwD*141.2*Bo*vis*Qo)/(h*k)
data.DD$pwf_cal <- Pi - data.DD$dp_cal

data.DD$dpdt_cal <- c(0,diff(data.DD$dp_cal)/diff(log(data.DD$t)))

plot_log <- plot_log %>% 
  add_lines(data = data.DD, x = ~t, y = ~dp_cal, line =  list(color = "blue"), name = "dp") %>%
  add_lines(data = data.DD, x = ~t, y = ~dpdt_cal, line = list(color = "green"), name = "dp")

plot_log

Files

References

  1. Spivey, J. & Lee, J. (2013) Applied well test interpretation. Society of petroleum engineers
  2. Lee, J., Rollins, J. & Spivey, J. (2003) Pressure transient testing. Society of petroleum engineers
  3. Sun, H. (2015) Advanced Production Decline Analysis. Gulf Professional Publishing

Citation

For attribution, please cite this work as

Vazquez (2021, Oct. 31). Chato Solutions: Simulate well test response using analytical solutions. Retrieved from https://www.chatosolutions.com/posts/2021-10-17-stephest1/

BibTeX citation

@misc{vazquez2021simulate,
  author = {Vazquez, Rigoberto Chandomi},
  title = {Chato Solutions: Simulate well test response using analytical solutions},
  url = {https://www.chatosolutions.com/posts/2021-10-17-stephest1/},
  year = {2021}
}