About two months ago I started making a web form that allowed a user to calculate thermodynamic values for saturated water as functions of either temperature and pressure. I got sidetracked for quite a while working on the graphing capability and fixing the functions themselves, but today I finally got the form nailed down with some decent functionality.

The user can enter either a temperature or a pressure and press submit to generate the function values, which are displayed. Pressure and temperature are actually fixed functions of each other, so the opposite entry field is populated in addition to the static fields for the other values below. I originally set it up so that the form would generate values based on whichever value was good between temperature and pressure, but upon trying it out I found it was weird when the form used the other value if the most recently edited one does not have a valid format. That said, the form will use the opposite value if the last editing action clears the current input. Appropriate messages are supplied if input values are out of range or incorrectly formatted.

The input values cover the entire range of saturation pressures and temperatures (and helpfully ignores those values I created for lower ranges). Testing indicates that values are accurate to within about one percent at worst, which is generally sufficient for engineering calculations. Accuracy can be improved by applying more fits over smaller ranges. I also learned that pure polynomial fits are generally smoother than fits that use inverse, square root, and logarithmic functions.