Hopefully, we have convinced you that the use of cubic equations of state can represent a very meaningful and advantageous way of modeling the PVT behavior of petroleum fluids. What we need now are the tools that will allow us to get the information that we want out of them. Even though cubic equations of state are explicit in pressure, pressure is not the common unknown to be calculated in the typical problem. In the most common problem, pressure and temperature are known and we want either molar volume (or its reciprocal, molar density) or compressibility factor (the most likely case). Therefore, we are faced very often with the need to solve for the roots of a cubic expression. Here we present a number of approaches that may be followed.
Given the cubic polynomial with real coefficients: x^{3} + ax^{2} + bx + c = 0, the first step is to calculate the parameters:
$$Q=\frac{{a}^{2}-3b}{9}\text{andR=}\frac{2{a}^{3}-9ab+27c}{54}$$ (11.5)
Now let M = R^{2} – Q^{3} be the discriminant. We then consider the following cases:
If M < 0 (R^{2} < Q^{3}), the polynomial has three real roots. For this case, compute $\theta =\mathrm{arccos}\left(\frac{R}{\sqrt{{Q}^{3}}}\right)$ and calculate the three distinct real roots as:
$${x}_{1}=-\left(2\sqrt{Q}\mathrm{cos}\frac{\theta}{3}\right)-\frac{a}{3}$$ (11.6a)
$${x}_{2}=-\left(2\sqrt{Q}\mathrm{cos}\frac{\theta +2\pi}{3}\right)-\frac{a}{3}$$ (11.6b)
$${x}_{3}=-\left(2\sqrt{Q}\mathrm{cos}\frac{\theta -2\pi}{3}\right)-\frac{a}{3}$$ (11.6c)
Note that x_{1}, x_{2}, x_{3} are not given in any special order, and that $\theta $ has to be calculated in radians.
If M > 0 (R^{2} > Q^{3}), the polynomial has only one real root. Compute:
$$S=\sqrt[3]{-R+\sqrt{M}}$$ (11.7a)
$$T=\sqrt[3]{-R-\sqrt{M}}$$ (11.7b)
and calculate the real root as follows:$${x}_{1}=S+T-\frac{a}{3}$$ (11.7c)
Two complex roots (complex conjugates) may be found as well. However, they are of no interest for our purposes, and thus no formulas are provided. Such formulas can be found in the following suggested readings:
Sometimes, the equations for S and T listed above cause problems while programming. This usually happens whenever the computer/calculator performs the cubic root of a negative quantity. If you want to avoid such a situation, you may compute S’ and T’ instead:
$$S\text{'}=-sign\left(R\right)\sqrt[3]{abs\left(R\right)+\sqrt{M}}$$ $T\text{'}=Q/S\text{'}$ (making T’=0 when S’=0)
where:
abs(R) = Absolute value of R
and
sign(R) = (+1) or (– 1) if R is positive or negative respectively.
It may be defined as:
sign(R) = R/Abs(R)
and then the real root is:
$${x}_{1}=S\text{'}+T\text{'}-\frac{a}{3}$$
Keep in mind the following useful relationships among the roots of any cubic expression:
$${x}_{1}+{x}_{2}+{x}_{3}=-a$$ (11.8a)
$${x}_{1}{x}_{2}+{x}_{2}{x}_{3}+{x}_{3}{x}_{1}=+b$$ (11.8b)
$${x}_{1}{x}_{2}{x}_{3}=-c$$ (11.8c)
Test your understanding of cubic root calculations by analytical means by solving the following examples.
With general cubic expressions,
$$\begin{array}{l}{x}^{3}-6{x}^{2}+11x-6=0\Rightarrow \hfill \\ {x}_{1}=1\hfill \\ {x}_{2}=2\hfill \\ {x}_{3}=3\hfill \end{array}$$with EOS in terms of volume (v), for a pure component,
$${v}^{3}-7.8693{v}^{2}+13.3771v-6.5354=0$$with EOS in terms of the compressibility factor (z), for a pure component,
$${z}^{3}-1.0595{z}^{2}+0.2215z-0.01317=0$$The Newton-Raphson method provides a useful scheme for solving for a non-explicit variable from any form of equation (not only cubic ones). Newton-Raphson is an iterative procedure with a fast convergence, although it is not always capable of providing an answer — because a first guess close enough to the actual answer must be provided.
In solving for “x” in any equation of the type f(x)=0, the method provides a new estimate (new guess) closer to the actual answer, based on the previous estimate (old guess). This is written as follows:
$${x}_{new}={x}_{old}-\frac{f\left({x}_{old}\right)}{f\text{'}\left({x}_{old}\right)}$$ (11.9)
Considering a cubic equation $f\left(x\right)={x}^{3}+a{x}^{2}+bx+c=0$ , the previous equation takes the form:
$${x}_{new}={x}_{old}-\frac{{x}_{old}^{3}+a{x}_{old}^{2}+b{x}_{old}+c}{3{x}_{old}^{2}+2a{x}_{old}+b}$$ (11.10)
The iterations continue until no significant improvement for “x_{new}” is achieved, i.e., | x_{new} – x_{old} | < tolerance. An educated guess must be provided as the starting value for the iterations. If you are solving a cubic equation in Z (compressibility factor), it is usually recommend to take Z = bP/RT as the starting guess for the compressibility of the liquid phase and Z = 1 for the vapor root.
Semi-analytical Scheme
If you used the previous numerical approach to calculate one of the roots of the cubic expression, the semi-analytical scheme can give you the other two real roots (when they exist). By using the relationships given before, with the value ‘x_{1}’ as the root already known, the other two roots are calculated by solving the system of equations:
$${x}_{2}+{x}_{3}=-a-{x}_{1}$$ (11.11a)
$${x}_{2}{x}_{3}=-c/{x}_{1}$$ (11.11b)
which leads to a quadratic expression.This procedure can be reduced to the following steps:
Let ${x}^{3}+a{x}^{2}+bx+c=0$ be the original cubic polynomial and “E” the root which is already known (x_{1} = E). Then, we may factorize such a cubic expression as:
$$\left(x-E\right)\left({x}^{2}+Fx+G\right)=0$$ (11.12a)
where:$$F=a+E$$ (11.12b)
$$G=-c/E$$ (11.12c)
Solve for x_{2}, x_{3} by using the quadratic expression formulae,
$${x}_{1}=E$$ (11.13a)
$${x}_{2}=\frac{-F+\sqrt{{F}^{2}-4G}}{2}$$ (11.13b)
$${x}_{3}=\frac{-F-\sqrt{{F}^{2}-4G}}{2}$$ (11.13c)