As with the flow of oil, we begin the derivation of diffusivity equation for compressible gas flow with a mass balance on a thin ring or *Representative Elemental Volume*, *REV*, in the reservoir as shown in **Figure 5.05**. This mass balance results in:

$$Mass\text{}In-Mass\text{}Out=Mass\text{}Accumulation$$

Equation 5.26

We can elaborate on the definitions of terms in **Equation 5.26** as:

$$Mass\text{}In=\rho {q]}_{{r}^{\prime}+dr}\text{}dt=\left({\rho}_{g}q{{}_{g}]}_{{r}^{\prime}}+\frac{\partial \left({\rho}_{g}{q}_{g}\right)}{\partial r}dr\right)dt$$

Equation 5.27

$$Mass\text{}Out=\left({\rho}_{g}{{q}_{g}]}_{{r}^{\prime}}\right)dt$$

Equation 5.28

and,

$$Mass\text{}Accumulation=\varphi {V}_{b\text{REV}}\partial {\rho}_{g}=2\pi r\text{}dr\text{}\varphi h\text{}\partial {\rho}_{\text{g}}$$

Equation 5.29

Where:

- ${\rho}_{g}$ is the gas density, lb/ft
^{3}
- ${q}_{g}$ is the gas rate, ft
^{3}/day
- $r$ is the radial coordinate in a radial-cylindrical coordinate system, ft
- $r\prime $ is the radius of the representative elemental volume, REV, ft
- $t$ is time, days
- $\varphi $ is the porosity of the reservoir, fraction
- ${V}_{b\text{REV}}$ is the bulk volume of the representative elemental volume, REV, ft
^{3}
- $h$ is the reservoir thickness, ft

Figure 5.05: Representative Elemental Volume, REV, in Radial-Cylindrical Coordinates

Source: Greg King

Substituting **Equation 5.27** through **Equation 5.29** into **Equation 5.26** results in:

$$\left[\left({\rho}_{g}{{q}_{g}]}_{{r}^{\prime}}+\frac{\partial \left({\rho}_{g}{q}_{g}\right)}{\partial r}dr\right)-{\rho}_{g}{{q}_{g}]}_{{r}^{\prime}}\right]dt=2\pi rdr\text{}\varphi \text{h}\partial {\rho}_{\text{g}}$$

Equation 5.30a

or,

$$\frac{\partial \left({\rho}_{g}{q}_{g}\right)}{\partial r}dr\text{}dt=2\pi rdr\text{}\varphi \text{h}\partial {\rho}_{\text{g}}$$

Equation 5.30b

Dividing by the term $r$ $dr$ $dt$ results in:

$$\frac{1}{r}\frac{\partial \left({\rho}_{g}{q}_{g}\right)}{\partial r}=2\pi \text{}\varphi h\frac{\partial {\rho}_{g}}{dt}$$

Equation 5.31

Now, substituting Darcy’s Law, **Equation 5.06** with $l=-r$ and without the formation volume factor, ${B}_{g}$, (we want the flow rate in reservoir ft^{3}/day not SCF/day). The unit conversion factor of 5.615 ft^{3}/bbl converts Darcy’s Law from bbl/day to ft^{3}/day:

$$\frac{1}{r}\frac{\partial}{\partial r}\left[\frac{\left(5.615\right)\left(0.001127\right){\rho}_{g}{k}_{g}\left(2\pi rh\right)}{{\mu}_{g}}\frac{\partial p}{\partial r}\right]=2\pi \text{}\varphi h\frac{\partial {\rho}_{g}}{dt}$$

Equation 5.32

If we assume that the permeability, ${k}_{g}$, and the thickness, $h$, are uniform, then we have:

$$\frac{1}{r}\frac{\partial}{\partial r}\left(r\frac{{\rho}_{g}}{{\mu}_{g}}\frac{\partial p}{\partial r}\right)=\frac{\varphi}{\left(5.615\right)\left(0.001127\right){k}_{g}}\frac{\partial {\rho}_{g}}{dt}$$

Equation 5.33a

or,

$$\frac{1}{r}\frac{\partial}{\partial r}\left(r\frac{{\rho}_{g}}{{\mu}_{g}}\frac{\partial p}{\partial r}\right)=\frac{\varphi}{0.006328\text{}{k}_{g}}\frac{\partial {\rho}_{g}}{dt}$$

Equation 5.33b

To this point, the derivation for the compressible gas equation is identical to the derivation for a slightly compressible liquid equation. This derivation will begin to deviate now. Applying the definition of density for a real gas (**Equation 3.71**):

$${\rho}_{g}=\frac{p\text{}M{W}_{g}}{ZR{T}_{r}}$$

Equation 5.34

Equation 5.34 is a direct result of the Real Gas Law. Substituting into **Equation 5.33b** results in:

$$\frac{1}{r}\frac{\partial}{\partial r}\left(r\frac{pM{W}_{g}}{{\mu}_{g}ZR{T}_{r}}\frac{\partial p}{\partial r}\right)=\frac{\varphi}{0.006328\text{}{k}_{g}}\frac{\partial}{dt}\left(\frac{pM{W}_{g}}{ZR{T}_{r}}\right)$$

Equation 5.35a

or,

$$\frac{1}{r}\frac{\partial}{\partial r}\left(r\frac{p}{{\mu}_{g}Z}\frac{\partial p}{\partial r}\right)=\frac{\varphi}{0.006328\text{}{k}_{g}}\frac{\partial}{dt}\left(\frac{p}{Z}\right)$$

Equation 5.35b

or,

$$\frac{1}{r}\frac{\partial}{\partial r}\left(r\frac{p}{{\mu}_{g}Z}\frac{\partial p}{\partial r}\right)=\frac{\varphi}{0.006328\text{}{k}_{g}}\frac{\partial}{dp}\left(\frac{p}{Z}\right)\frac{\partial p}{dt}$$

Equation 5.35c

Now, we saw in Lesson 3 that for a real gas, the definition of compressibility is (**Equation 3.70b**):

$${c}_{g}=-\frac{p}{Z}\frac{d}{dp}{\left(\frac{Z}{p}\right)]}_{T=Tr}=-\frac{p}{Z}\frac{d}{dp}{\left[{\left(\frac{p}{Z}\right)}^{-1}\right]]}_{T=Tr}=\frac{1}{p}-\frac{1}{Z}\frac{dZ}{dp}$$

Equation 5.36a

or,

$$\frac{d}{dp}{\left(\frac{p}{Z}\right)]}_{T=Tr}={c}_{g}\frac{p}{Z}$$

Equation 5.36b

Substituting into **Equation 5.35c** results in:

$$\frac{1}{r}\frac{\partial}{\partial r}\left(r\frac{p}{{\mu}_{g}Z}\frac{\partial p}{\partial r}\right)=\frac{\varphi {c}_{g}}{0.006328\text{}{k}_{g}}\frac{p}{Z}\frac{\partial p}{dt}$$

Equation 5.37

**Equation 5.37** is the nonlinear diffusivity equation describing the transient behavior of compressible (real) gases. We say that it is **Nonlinear** because of the functions of pressure appearing in the equation. In this nonlinear form, we cannot solve the equation analytically (exactly). In order to obtain analytical solutions to this equation, we must first **Linearize** it. We do this in the same manner as we linearized the stabilized flow equations: by use of the **Pressure**, the **Pressure-Squared**, and the **Pseudo-Pressure Formulations**.