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

Patches PropsSI imposed phase for backends other than HEOS #1665

Merged
merged 1 commit into from Mar 9, 2018

Conversation

henningjp
Copy link
Contributor

Patches #1660. Mods to StripPhase() in CoolProp.cpp to handle (or reject) backends that don't have phase functions like calc_phase() and specify_phase(). Specifically REFPROP and INCOMP and IF97 backends were affected. Tests should all pass now.

Error message was something like:

In [1]: PropsSI('C','T',500,'P',101325,'INCOMP::DowQ')
ValueError: This backend does not implement calc_phase function : PropsSI("C","T",500,"P",101325,"INCOMP::DowQ")

With the patch, these backends are all passing tests:

In [4]: PropsSI('C','T',500,'P',101325,'INCOMP::DowQ')
Out[4]: 2288.1643758645673

In [7]: PropsSI("D","P",101325,"T",375,"REFPROP::Water")
Out[7]: 0.5944246707421037

In [8]: PropsSI("D","P",101325,"T|gas",375,"REFPROP::Water")
Out[8]: 0.5944246707421037

In [9]: PropsSI("D","P",101325,"T|liquid",375,"REFPROP::Water")
Out[9]: 957.0103405813556

In [10]: PropsSI("D","P",101325,"T",375,"SRK::Water")
Out[10]: 709.0245321521222

In [13]: PropsSI("D","P|gas",101325,"T",375,"SRK::Water")
Out[13]: 0.5903825428777025

In [14]: PropsSI("D","P|liquid",101325,"T",375,"SRK::Water")
Out[14]: 709.0245321521222

In [15]: PropsSI("D","P",101325,"T",375,"IF97::Water")
Out[15]: 0.5943926157152021

@ibell
Copy link
Contributor

ibell commented Mar 9, 2018

I'm going to merge this so that we can make the users/buildslaves happy again.

A question though: why do you worry about getting the phase at all? If you are talking about the high-level interface, won't the phase ALWAYS be the default phase? If my understanding is wrong, it would in any case better to just wrap the call in a try-except block, so you don't need to specialize manually. That's usually not the right solution, though it is called for in some special cases.

@ibell ibell merged commit dd8ac47 into CoolProp:master Mar 9, 2018
@ibell ibell added this to the v6.2.0 milestone Mar 9, 2018
@henningjp
Copy link
Contributor Author

Yeah, I wasn't sure. I think my initial thought was if it was already set by the first parameter, but setting anything on the second parameter will get tossed anyway.

I don't get phase() now, I just initialize the temp variable to iphase_not_imposed. Then if there's any way for it to fall through the phase checking process, the State phase will just get set to iphase_not_imposed again.

@henningjp
Copy link
Contributor Author

I also put checks in to throw errors if the user tries to enter an imposed phase on the backends where phase shouldn't be imposed.

@henningjp henningjp deleted the PropsSI_patch branch March 9, 2018 11:49
@jowr jowr modified the milestone: v6.2.0 Oct 26, 2018
zmeri pushed a commit to zmeri/CoolProp that referenced this pull request Mar 29, 2020
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

Successfully merging this pull request may close these issues.

None yet

3 participants