Physics Informed Deep Learning for Well Test Analysis Balakrishna DR1 , Kamalkumar Rathinasamy1 , Avijit Das1 , Keerthi Ashwin1 , Vani Sivasankaran1 , Soundararajan Rajendran2 1 Infosys Limited 2 RKM Vivekananda College BalaKDR@infosys.com, Kamalkumar R@infosys.com, Avijit.das@infosys.com, Keerthi Ashwin@infosys.com, Vani.s@infosys.com, Soundararajan.Rajendran@gmail.com Abstract and linearizing it for various boundary conditions. In one study, the non-linear diffusivity equation was transformed Well Test Analysis is a section of reservoir engineering that into a linear diffusivity equation of dimensionless form, best describes the reservoir characteristics with principles of fluid flow in porous media using pressure transient analysis. by substituting the variables like pressure (p(r, t)), radius The transient pressure distribution for fluid flowing through of investigation(r), and time(t) with their dimensionless the wellbore, across the porous reservoir model, at a constant forms (pd ), (rd ) and (td ) respectively (Ahmed and McKin- terminal flow rate can be determined by solving the partial ney 2005). (Van Everdingen, Hurst et al. 1949) proposed differential equation- diffusivity equation, along with the set an analytical solution for this linearized diffusivity equa- of boundary conditions that define the reservoir model. Since tion for a specified list of assumptions. This work was ex- the diffusivity equation has a non-linear quadratic term, it panded by (Chatas 1953) and (Lee 1982) for two cases, is either solved analytically by ignoring the quadratic term viz infinite-acting reservoir and finite-radial reservoir. In an- and thus compromising the model accuracy or solved using other study, (Matthews and Russell 1967) proposed an ex- numerical approaches that is complex and time-consuming. ponential integral (Ei) function solution to the linear diffu- This study provides an alternative and simpler approach to de- termine the pressure distribution using the Neural Networks sivity equation for the constant terminal rate scenario, which method. This method could be applied to any type of reservoir is further simplified in (Ahmed and McKinney 2005) for a that has a defined diffusivity equation and boundary condi- specific range of Ei parameter value by log approximation. tions to predict the pressure distribution with good accuracy. Similarly, there have also been studies on analyzing the To validate this approach and demonstrate the accuracy of pressure distribution problem using the diffusivity equation the neural network with a greater level of confidence, for the without ignoring the quadratic gradient term. (Odeh, Babu purpose of this study, we have chosen to validate against ana- et al. 1988) had arrived with the approximate solutions for lytical solution as it could be applied to all types of reservoir models in generic form. the nonlinear PDE for three cases and compared the result with the solutions of the linear equation. Another notable Typical neural network-based approaches, however, were not yielding good results for Well Test Analysis as it needed bulk work by (Chakrabarty, Ali, and Tortike 1993) solved the ra- data since they typically ignored physical insights from the dial nonlinear PDE for a variety of boundary conditions to scientific system under consideration. In this paper, this prob- analyze the pressure distribution around a large diameter in- lem is resolved by Physics informed neural networks that are jection well, and presented the results for both constant pres- trained to solve supervised learning tasks while honoring any sure and constant discharge-rate (with wellbore storage) in- given physics law. ner boundary conditions; the outer boundary conditions may be infinite, closed, or constant pressure. Similar work carried out by (Xu-long, Deng-ke, and Rui-he 2004) determined a Introduction solution to the nonlinear real space flow equation for both The measurement of transient pressure distribution in a constant rate and constant pressure production using Weber single-phase homogeneous reservoir is significant to the re- Transform. They also solved the flow equation for a finite searchers in the area of petroleum reservoir engineering, as circular reservoir case using Henkel Transform and inferred this is the foundation for the Well Test Analysis, which helps that the difference between the nonlinear and the linear pres- in the determination of permeability distribution in the reser- sure solutions may reach about 8% in the long time. (Liu voir. This pressure distribution can be derived for a transient et al. 2016) further demonstrated Well Testing with Non- fluid flow through porous media by a non-linear diffusivity Linear PDE for a one-dimensional seepage flow problem equation. with threshold pressure gradient, that represents the uncon- There have been several studies in solving this diffusiv- ventional reservoir with low permeability and porosity, by ity equation analytically, by ignoring the non-linear term constructing a moving boundary. Copyright © 2021 for this paper by its authors. Use permitted under (Raissi, Perdikaris, and Karniadakis 2017b), (Raissi, Creative Commons License Attribution 4.0 International (CC BY Perdikaris, and Karniadakis 2017a) and (Raissi, Perdikaris, 4.0). and Karniadakis 2019), introduced physics informed neural networks that are trained to solve supervised learning tasks McKinney 2005) as: while honoring any given physics law described by general " ! # PDEs. Driven by this work, we built a physics informed 162.6Qo µo Bo kt deep learning model for Well Test Analysis that enables the p(r, t) = pi − log 2 −3.23 (4) kh φµct rw synergistic combination of physics law, which is diffusivity equation, and data, for regularizing the training in small data where t > 9.48 ∗ 104 φµct r2 /k regimes to predict pressure. The pressure distribution dataset obtained from equation 4 is considered as reference for computing the performance of Mathematical Considerations the typical neural network and the physics informed neural The constant terminal rate solution is a very important as- network in the following sections. Precisely, starting from an pect of most of the transient test analysis methodologies, initial condition p(r, t = 1), r[0.25, 15.25], and assuming e.g., drawdown and pressure buildup analysis. The well is periodic boundary conditions, we integrate equation up till adjusted to produce at a constant flow rate and the pressure final time t = 120 to generate the data set. The entire dataset values i.e., p(r, t) are measured as a function of time, in most is used as test data (29k) whereas the training dataset (0.1k) of these tests (Ahmed and McKinney 2005). For the purpose is a subset of initial and boundary condition data. of the experiment, the Ei function solution for constant ter- Alternately, when the non-linear term is considered, the minal flow rate has been considered to generate the data set. diffusivity equation could not be simplified to an analytical form and could be solved only using numerical methods. For The system is assumed to follow the radial flow model this condition, the parameters of the diffusivity equation, and where the slightly compressible fluid flows radially towards its boundary conditions should be altered to best describe the the fully penetrating vertical well at a constant terminal flow reservoir conditions, to obtain the accurate pressure distribu- rate Qo (STB/day) from a homogeneous reservoir of con- tion confined to the considered reservoir model. stant radius re (ft) and uniform thickness h (ft) and per- meability k (md). The radius of investigation is r (ft). The reservoir is considered to be at constant reservoir pressure Model Architecture pi (psi) at initial time (t = 0) and there is no flow across Neural network architecture was adopted from (Raissi, the reservoir boundary. By combining the continuity equa- Perdikaris, and Karniadakis 2017b) and (Raissi, Perdikaris, tion, transport equation, and compressibility equation with and Karniadakis 2017a). Network1 is implemented using the boundary conditions, the non-linear diffusivity equation Tensorflow and is set up with 10 layers with 20 neurons per could be attained (Ahmed and McKinney 2005): hidden layer. The hyperbolic tangent function is used as an !2 activation function in all hidden layers. L-BFGS-B method ∂ 2 p 1 ∂p ∂p 1 ∂p is used to optimize the loss function. 2 + + βf = (1) ∂r r ∂r ∂r c ∂t Data Informed Model −1 where βf = Fluid compressibility (psi ) and c = Dif- The pressure of the reservoir at any given radius (r) and time fusivity constant (Equation (1) from (Chakrabarty, Ali, and (t) can be predicted by typical neural networks but needs to Tortike 1993)). be trained on huge volume of high-quality historical data. The quadratic gradient term is ignored, and the linear With smaller training datasets, the model tends to overfit diffusivity equation is expressed from equation (1.2.64) training data exhibiting poorer accuracy during extrapola- of (Ahmed and McKinney 2005) as: tion. Given a set of Np = 100 randomly distributed initial and ∂ 2 p 1 ∂p 1 ∂p boundary data, from the data generated from equation 4, 2 + = (2) ∂r r ∂r c ∂t this model learns the latent solution p(r, t) using the mean Solving equation 2 through the form of Ei function arrived squared error loss of equation 5. Root Mean Square Error at the following line source solution (Matthews and Russell (RMSE) of this model is 1.69. 1967) which is expressed from equation (1.2.66) of (Ahmed Np and McKinney 2005) as: 1 X M SE = |p(ri , ti ) − pi |2 (5) " # " # Np i=1 70.6Qo µBo −948φµct r2 p(r, t) = pi + Ei (3) kh kt Physics Informed Model Physics informed surrogate models for Well Test Analysis where Ct = Total compressibility (psi−1 ), µ = Viscosity (cp), using linear diffusivity equation is built to predict pressure. Bo = Oil Formation Volume factor (bbl/STB) and φ = Poros- This approach is made possible by support from Tensor- ity (fraction). flow on automatic differentiation which differentiates neu- The exponential integral, Ei, can be approximated for ral networks with respect to their input variables and model the range of values with x < 0.001 and the final equa- parameters. The idea of utilizing prior domain knowledge tion (Ahmed and McKinney 2005) of the form could be 1 derived as mentioned in equation (1.2.70) of (Ahmed and https://github.com/maziarraissi/PINNs in a neural network by exploiting automatic differentia- tion (Baydin et al. 2017) to differentiate neural networks is derived from (Raissi, Perdikaris, and Karniadakis 2017b) and (Raissi, Perdikaris, and Karniadakis 2017a). Given a set of Nf = 500 collocation points, from the data generated from equation 4, this model learns the latent so- lution p(r, t), obeying linear diffusivity equation which is represented as f (r, t). M SEf acts as a normalization mech- anism that disciplines solutions to equation 6. f (r, t) is given by: Figure 2: Prediction Error 1 1 f := prr + ∗ pr − ∗ pt (6) r c where c = 0.0002637k/φµct The trainable parameters shared between the neural net- works p(r, t) and f (r, t) are learned by minimizing the mean squared error loss (Equation (4) from (Raissi, Perdikaris, and Karniadakis 2017b)): M SE = M SEp + M SEf (7) Np 1 Figure 3: Nonconformity to PDE |p(ri , ti ) − pi |2 and M SEf = P where M SEp = Np i=1 N Pf 1 Nf |f (rfi , tif )|2 , Conclusion i=1 This study confirms that the physics informed neural net- p(r, t) denotes the data informed solution and f (r, t) de- work can model Well Test Analysis for pressure drawdown notes physics informed solution, using generic linear diffusivity equation with commendable ri , ti , pi for i = {1, Np } denotes the initial and boundary accuracy. Apparently, PINN can model well testing using training data on p(r, t), linear or non-linear PDE. Thus, the physics informed neural rfi , tif for i = {1, Nf } specifies the collocations points for network model could be a simple and well-behaved alterna- f (r, t). tive approach for pressure transient studies of any reservoir Even with smaller training datasets, the model does not variant, given that the linear or non-linear diffusivity equa- overfit training data exhibiting good accuracy during extrap- tion, its parameters and boundary conditions are defined. olation. Root Mean Square Error (RMSE) of this model is 0.28. References Ahmed, T.; and McKinney, P. 2005. Advanced Reservoir Engineering . Baydin, A. G.; Pearlmutter, B. A.; Radul, A. A.; and Siskind, J. M. 2017. Automatic differentiation in machine learning: a survey. The Journal of Machine Learning Research 18(1): 5595–5637. Chakrabarty, C.; Ali, S. F.; and Tortike, W. 1993. Analyt- ical solutions for radial pressure distribution including the effects of the quadratic-gradient term. Water resources re- Figure 1: Model Performance at a randomly chosen radius search 29(4): 1171–1177. (r = 8.5) for different time instants Chatas, A. 1953. A practical treatment of non-steady-state flow problems in reservoir systems, Part 3 Pet. Eng., pp. At a randomly chosen radius (r = 8.5) for different time Technical report, B-44-B-56. instants, Figure 1 displays model performance, Figure 2 dis- Lee, W. 1982. Well Testing: Dallas. TX, Society of Petroleum plays Prediction error (|ppred − pactual |) and Figure 3 dis- Engineers of AIME . plays Nonconformity (|f (r, t)|) to linear diffusivity equa- tion. Figure 1 shows that the pressure value predicted by the Liu, W.; Yao, J.; Chen, Z.; and Liu, Y. 2016. Effect of Physics informed model is closer to the actual value. Fig- quadratic pressure gradient term on a one-dimensional mov- ure 2 shows the absolute error between the predicted and ing boundary problem based on modified Darcy’s law. Acta actual values from Figure 1. It is observed that the trends Mechanica Sinica 32(1): 38–53. of Figure 2 and Figure 3 are similar indicating that the non- Matthews, C.; and Russell, D. 1967. Pressure buildup and conformity to fundamental physics law impacts the models’ flow tests in wells: Dallas. TX, Society of Petroleum Engi- performance. neers Monograph Series (1). Odeh, A.; Babu, D.; et al. 1988. Comparison of solutions of the nonlinear and linearized diffusion equations. SPE Reser- voir Engineering 3(04): 1–202. Raissi, M.; Perdikaris, P.; and Karniadakis, G. 2017a. Physics informed deep learning (Part II): Data-driven dis- covery of nonlinear partial differential equations. arXiv preprint arXiv:1711.10566 . Raissi, M.; Perdikaris, P.; and Karniadakis, G. E. 2017b. Physics informed deep learning (part i): Data-driven so- lutions of nonlinear partial differential equations. arXiv preprint arXiv:1711.10561 . Raissi, M.; Perdikaris, P.; and Karniadakis, G. E. 2019. Physics-informed neural networks: A deep learning frame- work for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Compu- tational Physics 378: 686–707. Van Everdingen, A.; Hurst, W.; et al. 1949. The applica- tion of the Laplace transformation to flow problems in reser- voirs. Journal of Petroleum Technology 1(12): 305–324. URL https://doi.org/10.2118/949305-G. Xu-long, C.; Deng-ke, T.; and Rui-he, W. 2004. Exact solutions for nonlinear transient flow model including a quadratic gradient term. Applied Mathematics and Mechan- ics 25(1): 102–109.