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
REFPROP should not be reloaded after every call to PropsSI #431
Comments
So, the issues are:
|
@jowr I've been thinking about this quite a bit, and am at an impasse. What is the best way to go about this? Hold onto the last state class created using a shared_ptr, and only reset it if the fluid string changes? |
Yes, that sounds like the easiest solution. I am not sure how much it takes to implement this, but I reckon that this is the "cheapest" solution for now. |
Yet another idea, when the REFPROP class calls its destructor, store the On Tue, Feb 3, 2015 at 3:18 AM, Jorrit Wronski notifications@github.com
|
So some info:
|
Not possible on windows. Bummer. http://stackoverflow.com/questions/1587176/load-multiple-copies-of-dll-in-same-process |
We have a problem with master. This (windows, python27, x64) crashes, but not until returning the same critical temperature (that of nitrogen) for BOTH states !!!! Which is clearly wrong! For some reason the second nitrogen call causes a crash. The problem is that there is only one instance floating around, and the second instantiation calls setup and sets the variables internally. import CoolProp
Water = CoolProp.AbstractState('REFPROP', 'WATER')
N2 = CoolProp.AbstractState('REFPROP', 'NITROGEN')
print Water.keyed_output(CoolProp.iT_critical), N2.keyed_output(CoolProp.iT_critical)
N2 = CoolProp.AbstractState('REFPROP', 'NITROGEN')
Water = CoolProp.AbstractState('REFPROP', 'WATER')
print Water.keyed_output(CoolProp.iT_critical), N2.keyed_output(CoolProp.iT_critical) |
Now this works properly: import CoolProp
Water = CoolProp.AbstractState('REFPROP', 'WATER')
N2 = CoolProp.AbstractState('REFPROP', 'NITROGEN')
print Water.keyed_output(CoolProp.iT_critical), N2.keyed_output(CoolProp.iT_critical)
N2 = CoolProp.AbstractState('REFPROP', 'NITROGEN')
Water = CoolProp.AbstractState('REFPROP', 'WATER')
print Water.keyed_output(CoolProp.iT_critical), N2.keyed_output(CoolProp.iT_critical) yields
|
When PropsSI is called multiple times, REFPROP should not be reloaded for each one, it is much slower. What was the reason behind the destructor unloading REFPROP dll every time (https://github.com/CoolProp/CoolProp/blob/master/src/Backends/REFPROP/REFPROPMixtureBackend.cpp#L280-L303)? We could add a simple wrapper class of REFPROP (REFPROP manager) that will ensure that the REFPROP unloader gets called exactly one time when the last instance is unloaded.
This code:
yields
The text was updated successfully, but these errors were encountered: