Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inverse functions #13

Open
dogiv opened this issue Jul 28, 2021 · 3 comments
Open

Inverse functions #13

dogiv opened this issue Jul 28, 2021 · 3 comments

Comments

@dogiv
Copy link

dogiv commented Jul 28, 2021

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

  • pressure as a function of enthalpy and density
  • temperature as a function of enthalpy and pressure
    Currently the only way I can see is to do a binary search using an initial guess at the pressure/temperature, but this is very inefficient.
    Thanks!
@stevengj
Copy link

stevengj commented Feb 7, 2022

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
Copy link
Collaborator

#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
Copy link
Author

dogiv commented Apr 21, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants