# Binodal curve

The equation of the real gas can be rewritten like:

$p{v}^{3}-\left(pb+T\right){v}^{2}+av-ab=0$

This third grade polynomial provides the values of the volume at a given temperature and pressure.

To obtain the binodal curve, a temperature T is fixed, and the pressure value p0 is calculated so that areas 1 and 2 are equal in absolute value:

In other words:

$\begin{array}{ll}Area& =\left|Are{a}_{1}\right|-\left|Are{a}_{2}\right|\\ & =T\mathrm{ln}\frac{{v}_{3}-b}{{v}_{1}-b}+a\left(\frac{1}{{v}_{3}}-\frac{1}{{v}_{1}}\right)-{p}_{0}\left({v}_{3}-{v}_{1}\right)\\ & =0\end{array}$

The value of pressure given by p0 determines the values v1 and v3 of the binodal curve.

## The method of Brent

It's an adequate method to find the solution of a non-linear equation like the one to calculate the area.

Function zrhqr() also calls for other two NR routines, balanc.c and hqr.c. The real solutions are saved in rtr[] and the imaginary ones in rti[].

The files for this calculation are in folder pvdiagrams/2_binodal/. For temperatures of 415, 460 and 508.1 K, the values of p0 are 25.961, 34.153 and 46.422, respectively. At 530 K we are on the ideal region, above critical p.