The fugacity calculator uses JavaScript to determine the molar volume and fugacity of pure water from the Pitzer and Sterner (1994) equation of state. The Dekker method is employed to solve numerically for volume as a function of pressure and temperature. Fugacity is calculated using the analytical solution presented in Sterner and Pitzer (1994):

ln *f* = [ln*ρ* + *A*^{res}/R*T*
+ *P*/*ρ*R*T*]_{P,T} + ln(R*T*)
- 1,

where *f* is fugacity, *A*^{res} is residual
Helmholtz energy, *ρ* is 'molar' density (*n*/*V*)
and *P*, *T*, R are pressure, temperature and the universal gas
constant, respectively.

Python functions to caculate volume and fugacity can be found here

The code is based on a JavaScript root finding
algorithm adapted from a Fortran routine written by Shapine and Watts ( fzero.f
, part of the SLATEC library of
programs). Any errors that have been introduced are due to my bastardisation
of the code. I don't guarantee that it works! I'm at least reassured that
my independently coded numerical integration of the Pitzer and Sterner EOS
gives the same results as this JavaScript implementation of the analytical
solution. You can always check by calculating the fugacity for yourself, using
the equations in Pitzer and Sterner (1994).
#### References

Dekker, T.J. Finding a Zero by Means of Successive Linear Interpolation.In: Constructive Aspects of the Fundamental Theorem of Algebra. Ed. B. Dejon and P. Henrici. Wiley-Interscience, 1969. Pitzer, K.S. and Sterner, S.M. (1994). Equations of state valid continuously from zero to extreme pressures for H2O and CO2.Journal of Chemical Physics.101:3111-3116. Shampine, L.F. and Watts, H.A.(1970). FZERO, A Root-solving Code. Report SC-TM-70-631, Sandia Laboratories.

Sterner, S.M. and Pitzer, K.S. (1994). An equation of state for carbon dioxide valid from zero to extreme pressures. Contributions to Mineralogy and Petrology.117:362-374.