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

Triple point for abstract class - density out of range issue #10

Open
matlawicebox opened this issue May 14, 2024 · 6 comments
Open

Triple point for abstract class - density out of range issue #10

matlawicebox opened this issue May 14, 2024 · 6 comments

Comments

@matlawicebox
Copy link

I have some code that works great but I'm trying to add in some fluids that are mixtures and am now getting an error from within set_isoline_defaults.

My fluid is defined as:
self.state = CP.AbstractState('REFPROP','R1234yf&R134a'); self.state.set_mole_fractions([0.56,0.44])

And I get this error upon running:

File "/opt/miniconda3/envs/CondaHP/lib/python3.8/site-packages/fluprodia/fluid_property_diagram.py", line 360, in set_isoline_defaults
    self.p_trip = self.state.trivial_keyed_output(CP.iP_triple)
  File "CoolProp/AbstractState.pyx", line 227, in CoolProp.CoolProp.AbstractState.trivial_keyed_output
  File "CoolProp/AbstractState.pyx", line 229, in CoolProp.CoolProp.AbstractState.trivial_keyed_output
ValueError: [TQFLSH error 2] One or more inputs are out of range; Density above upper limit: D = 14.6560 mol/L, Dmax = 14.4635 mol/L.

this works fine when the state is defined as a single fluid:
self.state = CP.AbstractState('HEOS', self.fluid)

It looks like it's not a problem with any of my inputs but something to do with mixtures and triple points. Any ideas how I can get past this? Thanks!

@fwitte
Copy link
Owner

fwitte commented May 14, 2024

Hi @matlawicebox,

Thank you for reporting the issue. Unfortunately, I have designed this library to work with pure fluids, I actually never tried using mixtures. So right now I am not sure, as what must be done to make it work with mixtures. If you are interested in investigating this, let me know, I would be happy to assist you where I can. Also, I currently do not have access to a REFPROP license to reproduce the issue...

Best

Francesco

@matlawicebox
Copy link
Author

matlawicebox commented May 14, 2024 via email

@matlawicebox
Copy link
Author

matlawicebox commented May 14, 2024 via email

@matlawicebox
Copy link
Author

matlawicebox commented May 15, 2024 via email

@fwitte
Copy link
Owner

fwitte commented May 17, 2024

Any ideas what could be the issue or if there's something I could do
to debug how/where it's hanging?

I think, the mixture routines are quite slow. Fluprodia calculates the lines on 200 datapoints. For pure fluids, this routine might take a second or two, on mixtures this can go way beyond. Maybe try it by changing the number of datapoints and see, if that does anything. You could also benchmark the calls in a different script to get a feel for the time used.

Edit: You could write a small script and call the functions as done in this function, but with less enthalpy lines and with smaller points on the iterator.

def _isenthalpic(self):
"""Calculate an isoline of constant specific enthalpy."""
isolines = self.enthalpy['isolines']
iterator = 1 / np.append(
np.geomspace(self.v_min, self.v_intermediate, 100, endpoint=False),
np.geomspace(self.v_intermediate, self.v_max, 100)
)
for h in isolines.round(8):
self.enthalpy[h] = self._single_isenthalpic(
iterator, np.ones(len(iterator)) * h
)

@matlawicebox
Copy link
Author

matlawicebox commented May 17, 2024 via email

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

2 participants