The ThermodynamicData functions allow the user to lookup values by specifying a temperature and pressure, I wanted to write some routines where, for example, pressure and enthalpy could be specified. Using FindRoot is the chosen method. The idea is that given an pressure and enthalpy of interest, use FindRoot to find the corresponding temperature. Then any required property could be found using the given pressure and the temperature determined by FindRoot.
Somehow, FindRoot is returning an unexpected result. (Perhaps user error.)
Test code is below. For the test, an enthalpy is determined at a given pressure and temperature, then FindRoot is asked to find the temperature, given the pressure and enthalpy.
p0 = Quantity[3500, "psi"];
t0 = Quantity[1000, "DegreesFahrenheit"];
h0 = ThermodynamicData["Water", "Enthalpy", {"Pressure" -> p0, "Temperature" -> t0}]
tmin = Quantity[900, "DegreesFahrenheit"];
tmax = Quantity[1100, "DegreesFahrenheit"];
FindRoot[ h0 == ThermodynamicData["Water", "Enthalpy", {"Pressure" -> p0, "Temperature" -> tx}], {tx, tmin , tmax}]
(* result: {tx -> Quantity[611.111, ("Kelvins")^2]}*)
There appear to be two problems with the result from FindRoot:
- the result has units of temperature squared. It should have units of temperature
- the result does not correspond to 1000 Fahrenheit.
Any help would be appreciated.