braamvandyk / SteamTables.jl

Julia implementation of steam tables according to IAPWS Industrial Formulation (1997)
Other
12 stars 4 forks source link

Inverse functions #13

Open dogiv opened 3 years ago

dogiv commented 3 years ago

Is there a good way to do reverse lookups of the values? For instance, I need to get:

stevengj commented 2 years ago

You could do root finding (usually not by binary search!) at a sequence of points, and then build an interpolation table.

It's not completely clear how you define e.g. the inverse function T(H, P) since SpecificH(T, P) is discontinuous across phase transitions, though…

longemen3000 commented 5 months ago

24 adds Temperature_Ph and Temperature_Ps. IF-97 actually has backward equations for some of those ranges, but i added a root-finding strategy for those regions that don't have one. on the phase transition, the enthalpy varies, but the temperature remains constants, so if P < Pc and hl(Tsat(P)) <= h <= hv(Tsat(P)), then the temperature is Tsat(P).

dogiv commented 5 months ago

Thanks! Also good reminder for me to pick this project up again :)