This package of functions is the beginnings of a thermodynamics package. This solves for the z values in equations of states for liquids and gases in the well-known equation PV=zRT. Equations of state can produce accurate results, but it always seemed to me that the more accurate the results, the more time-consuming and taxing it is to obtain them.
This script takes many commonly used equations of state, and reduces the work to find the z value to typing in function(inputs). However, the equation of state package is flexible because functions with the parameters P,V, and T for z can be returned, and all operations available in SpaceTime 3.0 can be performed on them such as partial derivatives, integrals, and solvers.
The following equations of states are included:
*Virial with respect to pressure
*Virial with respect to molar volume
*Virial with respect to P/RT
*Pitzer with truncated virial
*Pitzer with truncated virial correlated to critical temperature
*Van Der Waals
*Redlich/Kwong (vapor and vapor-like)
*Soave/Redlich/Kwong (vapor and vapor-like)
*Peng Robinson (vapor and vapor-like)
*Antoine's equation (find saturation pressure or temperature at a given saturation pressure)
Functions are included which return a function for P,V, or T or solves for a value of P,V, or T given two of those values and a z value.
*more equations of state
*functions to solve for V of liquid, V of vapor, and other fluid properties
*a thermodynamics package integrating equations of state
The information for this script came from Introduction to Chemical Engineering Thermodynamics, Seventh Edition by J.M. Smith, H.C. Van Ness, and M.M. Abbott
Feel free to send me a message or post through the Spacetime forums, where my name is also MrJoe, if you have any questions or suggestions.