Closed aqeelahmed168 closed 6 years ago
units = RP.GETENUMdll("DEFAULT").iEnum
RP.REFPROPdll("Dodecane * nitrogen","PQ","D",units,0,0,101.325,0,[0.5,0.5])
for z0 in np.linspace(0,1):
RP.REFPROPdll("Dodecane * nitrogen","","PC;TC;DC;",units,0,1,101.325,0,[z0,1-z0])
The 1
turns on the saturation splines
Does that answer your questions?
Thanks for the response.
I will explain here again. I have given pressure P, temperature T, and mole fraction of Dodecane x. In a mixture of Dodecane and Nitrogen, I would like to predict the density of final mixture, where I also want to compute the state of final mixture either it is liquid or vapor or two-phase. Also if it is two phase, how much vapor of Dodecane is present in the whole mixture and how much is the Dodecane liquid.
From you previous reply:
units = r.GETENUMdll("DEFAULT").iEnum # this does not work
units = r.GETENUMdll(0,"DEFAULT").iEnum # this works
z0 = np.linspace(0,1,100) # 100 points works, 500 points fails
t = np.zeros((len(z0),3))
for i in range(0,len(z0)):
RP_Prop = r.REFPROPdll("Dodecane * nitrogen","","PC;TC;DC;",units,0,1,101.325,0,[z0[i],1-z0[i]])
t[i,:] = RP_Prop.Output[0:3]
# print(t)
plt.plot(z0,t[:,0])
plt.figure()
plt.plot(z0,t[:,1])
plt.figure()
plt.plot(t[:,1],t[:,0], "+-")
Yes, that was a typo on my side.
This mixture is not Type I, I believe. That is why you do not have a continuous critical line between pure fluid endpoints. See for instance my paper in FPE: https://www.sciencedirect.com/science/article/pii/S0378381216305349 . In the future, please copy-paste the entire script, rather than just a snippet. Otherwise, you have done a good job of specifying your question.
With regards to your question, here it is:
import ctREFPROP.ctREFPROP as ct
import os
os.environ['RPPREFIX'] = r'D:\REFPROP'
root = os.environ['RPPREFIX']
r = ct.REFPROPFunctionLibrary(os.path.join(root, 'REFPRP64.dll'))
r.SETPATHdll(root)
units = r.GETENUMdll(0,'DEFAULT').iEnum
o = r.REFPROPdll("Dodecane * nitrogen","TP","D;Qmole",units,0,0,300,101.325,[0.4, 0.6])
print(o)
with
Output=[0.06732759598608312, 0.5997394529521832, ....
The density is 0.067327 mol/L and the vapor quality (on a molar basis) is 0.6(ish). Therefore, two-phase.
Thanks for the support.
I have uploaded the experimental data. criticalLocusDodecanN2_Exp.txt
import ctREFPROP.ctREFPROP as ct
import os
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
os.environ['RPPREFIX'] = r'C:\Program Files (x86)\REFPROP'
root = os.environ['RPPREFIX']
print("RP installation dir: ", root)
r = ct.REFPROPFunctionLibrary(os.path.join(root, 'REFPRP64.dll'))
r.SETPATHdll(root)
print("RP version: ", r.RPVersion())
units = r.GETENUMdll(0,"DEFAULT").iEnum
def getCriticalStates(noOfPoints):
z0 = np.linspace(0,1,noOfPoints)
t = np.zeros((len(z0),3))
for i in range(0,len(z0)):
RP_Prop = r.REFPROPdll("Dodecane * nitrogen","","PC;TC;DC;",units,0,1,101.325,0,[z0[i],1-z0[i]])
t[i,:] = RP_Prop.Output[0:3]
return z0, t
z0, t = getCriticalStates(190)
print("Experimental data from [García-Córdova et al., 2011]")
data = pd.read_csv('criticalLocusDodecanN2_Exp.txt', delimiter='\t', skiprows=0, usecols=(0,1,2))
data.columns = ["Critical Temperature [K]", "Critical Pressure [MPa]", "Mole Fraction N2 [-]"]
print(data)
plt.figure()
plt.plot(t[:,1],t[:,0]*1e3/1e6, "+-", label="REFPROP")
plt.plot(data.iloc[:,0].values, data.iloc[:,1].values, "or", label="Exp")
plt.legend()
plt.xlim(100,700)
plt.xlabel("Temperature [K]")
plt.ylabel("Pressure [MPa]")
plt.legend()
plt.savefig("CriticalLocus_N2Dodecane.png")
plt.show()
Can you please insert the figure?
Nice figure! Yes, our interaction parameters for this mixture clearly miss the critical locus. This is a sad reality for many mixtures in REFPROP. If you wanted to help fit a new departure function that did this better, we could help you do that. Asymmetric mixtures like these are tricky to get right.
Thanks. I am quite new to this mixture thermodynamics. If you can suggest some literature I can work on that. Just for reference in this paper [2] Fig 6, PR-EOS combined with mixing rules, does seem to predict the critical locus, still not perfectly.
[2] Daniel T. Banuti et al. Phase separation analysis in supercritical injection using large-eddy simulation and vapor-liquid equilibrium
In short, mixtures are complicated, and critical loci, even more so :) So do not feel overwhelmed and take things slowly. PR does in general a pretty ok job with some mixtures like this (see, again, my paper in FPE).
Thanks for the tip. Have a good day.
If I have (sort of) answered your question, can you please close this issue?
Hi,
I am trying to study a mixture of Dodecane and Nitrogen. From the graphical user interface I am able to extract the saturation states as a fucntion of mole fraction and pressure. Please see attached files. I would like to use Python to get the same data. nDodecaneNitrogenPx.pdf nDodecaneNitrogen0.5_0.5.pdf
I started with the example of a mixture setup as psuedo-pure fluid. My inputs are T and P so this works well for single phase. However, I am looking for mixture where "Dodecane" could exist as vapor or liquid, while Nitrogen is always vapor for my conditions. Could you please produce an example case for such a system.
There is an example for two-phase system in REFPROP.xls file provided in the installation directory. How can I use a call in excel via Python, meaning what is the corresponding call in Python. Forexample, in excel for two phase system the call for mixture density at bubble point is REPFROP('D', 'mixture', 'Pliq', 'SI', 0.1325) what is the equivalent call in Python.
Lastly, is there any way to obtain the critical locus for the mixture as a function of pressure and mol fraction of each fluid, as reported in this paper [1] Figure 4.
[1] García-Córdova et al. Vapor-liquid equilibrium data for the nitrogen + dodecane system at temperatures from (344 to 593) K and at pressures up to 60 MPa