Numerical Recipes applied

Binodal curve

The equation of the real gas can be rewritten like:


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:

Binodal curve

In other words:


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.