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
Issue calculating molar fractions of every component out the biphase zone for a custom fluid modelled with AbstractState #2308
Comments
For homogeneous state points, neither the liquid nor vapor results should
be possible. Please provide a runnable example.
|
Here you are the code I am talking about: here i define the mixture using low level intrerface
here I set the molar composition
here is a vector of temperatures (in °C) which are assumed by the mixture in a heat exchanger:
here I create a matrix containing all the molar fractions for every single component of the mixture for both the liquid fraction and the vapor fraction
after this calculation the liquid fraction results to be different from zero even if the thermodynamical working point is located in the vapor zone (should return 0). |
I rewrote in Python: import CoolProp.CoolProp as CP
AS = CP.AbstractState('HEOS', 'Nitrogen&Methane&Ethane&Propane')
AS.set_mole_fractions([0.10, 0.34, 0.41, 0.15])
AS.build_phase_envelope("")
Tmedia=[-18.79070798, -22.37212394, -25.9535399, -29.53495586, -33.11637181,
-36.69778777, -40.27920373, -43.86061969, -47.44203565, -51.02345161,
-54.60486757, -58.18628352, -61.76769948, -65.34911544, -68.9305314,
-72.51194736, -76.09336332, -79.67477928, -83.25619524, -86.83761119,
-90.41902715, -94.00044311, -97.58185907, -101.16327503, -104.74469099,
-108.32610695, -111.9075229, -115.48893886, -119.07035482, -122.65177078,
-126.23318674, -129.8146027, -133.39601866, -136.97743462, -140.55885057,
-144.14026653, -147.72168249, -151.30309845, -154.88451441, -158.46593037]
for i in range(len(Tmedia)):
AS.update(CP.PT_INPUTS, 1.5e5, Tmedia[i]+273.15)
print(AS.Q(), AS.mole_fractions_vapor(), AS.mole_fractions_liquid()) yielding
which is weird. When Q < 0 or Q >1 the liquid and vapor mole fractions should not be defined. I don't know what is going on there. |
I think a bug affects coolprop in this case. Also the fact that the vapor quality is given less than zero is not phisically realistic. Anyway making the calculations with fluidprop the vapor quality is always zero and the molar fractions for the liquid fractions are defined but calculated equal to zero. For this reason I would like to use fluidprop on python but it's not so esasy |
I recommend to plot the isopleth of the phase envelope along with your T,p points to better understand where your state points are. The value of Q is only meaningful if in [0,1], otherwise it is only very roughly providing guidance. |
Description
I am currently using Coolprop library on a python code. For my research I modeled a fluid with the function AbstractState, which is a gas refrigerant mixture (nitrogen, methane, ethane and propane). When calculting the molar fractions of every single component out of the biphase zone with the function fluidname.mole_fractions_liquid() or fluidname.mole_fractions_vapor(), the code returns values different from zero for both.
Expected behavior:
I expect that in vapor zone, molar fractions of the liquid part of the fluid is returned with zero value
Actual behavior:
In my case the value is not zero and neither is negligible.
Versions
CoolProp Version: 6.5.0
Operating System and Version: [WSL with ubunthu 22.04.2 LTS]
Access Method: [Python3]
Additional Information
The text was updated successfully, but these errors were encountered: