usnistgov / REFPROP-issues

A repository solely used for reporting issues with NIST REFPROP
26 stars 13 forks source link

z array (composition array) definition #630

Open b3pe opened 6 months ago

b3pe commented 6 months ago

Can someone please point me to a reference or source for the definition of the composition (z) array for passing in a mixture to the refpropdll function?

ianhbell commented 6 months ago

I'm not sure I follow the question. The array passed in is either an array of mass fractions or mole fractions depending on the value of iMass argument.

Olaf987 commented 6 months ago

b3pe:

I got confused by this last week as well so I decided to run some tests. I have REFPROP 10 and I used MATLAB which is calling the Python interface.

Assume a glycol-water mixture of weight fractions of z_mass = [0.8,0.2] which is equivalent to z_mole = [0.53725,0.46275] If you call:

i_mass = int8(1); % 0: molar fractions; 1: mass fractions
dummy = rp.REFPROPdll(mix_name,'TP','XMASS',i_units,i_mass,i_flag,T,p,z_mass);

You get nonsense. dummy.Output should return the same values as z_mass but that does not happen.

However if you call

i_mass = int8(1); % 0: molar fractions; 1: mass fractions
dummy = rp.REFPROPdll(mix_name,'TP','XMASS',i_units,i_mass,i_flag,T,p,z_mole);

dummy.Output returns z_mass and dummy.z also returns z_mass. This means that the z in the call is always MOLE-FRACTION

The output in z (dummy.z) depends on i_mass. When I call:

i_mass = int8(0); % 0: molar fractions; 1: mass fractions
dummy = rp.REFPROPdll(mix_name,'TP','XMASS',i_units,i_mass,i_flag,T,p,z_mole);

dummy.Output returns again z_mass but now dummy.z returns z_mole!

If you want to specify the concentration in mixture name, than it would have been: "etylene glycol;water|0.8;0.2 mass" or "etylene glycol;water|0.53725,0.46275". In both cases you have to set the input z to zeros(20,0) in MATLAB or 20*[0.0] in Python.

So if you use z for input: MOLE FRACTION

Hope this helps a bit

Olaf

b3pe commented 6 months ago

I understand that the values are either mole or mass fractions. My question is there a specific order that the values need to be passed in. For example, z(0)=methane, z(1)=ethane, etc. In other words, how does the function know which fraction value applies to which component? Pls advise if you know.

b3pe commented 6 months ago

Thank you for your response.

My question is there a specific order that the values need to be passed in. For example, z(0)=methane, z(1)=ethane, etc. In other words, how does the function know which fraction value applies to which component? Pls advise if you know.

ianhbell commented 6 months ago

Thank you for your response. My question is there a specific order that the values need to be passed in. For example, z(0)=methane, z(1)=ethane, etc. In other words, how does the function know which fraction value applies to which component? Pls advise if you know.

The order of component names matches the order of component fractions

ianhbell commented 6 months ago

b3pe:

I got confused by this last week as well so I decided to run some tests. I have REFPROP 10 and I used MATLAB which is calling the Python interface.

Assume a glycol-water mixture of weight fractions of z_mass = [0.8,0.2] which is equivalent to z_mole = [0.53725,0.46275] If you call:

i_mass = int8(1); % 0: molar fractions; 1: mass fractions dummy = rp.REFPROPdll(mix_name,'TP','XMASS',i_units,i_mass,i_flag,T,p,z_mass);

You get nonsense. dummy.Output should return the same values as z_mass but that does not happen.

However if you call

i_mass = int8(1); % 0: molar fractions; 1: mass fractions dummy = rp.REFPROPdll(mix_name,'TP','XMASS',i_units,i_mass,i_flag,T,p,z_mole);

dummy.Output returns z_mass and dummy.z also returns z_mass. This means that the z in the call is always MOLE-FRACTION

The output in z (dummy.z) depends on i_mass. When I call:

i_mass = int8(0); % 0: molar fractions; 1: mass fractions dummy = rp.REFPROPdll(mix_name,'TP','XMASS',i_units,i_mass,i_flag,T,p,z_mole);

dummy.Output returns again z_mass but now dummy.z returns z_mole!

If you want to specify the concentration in mixture name, than it would have been: "etylene glycol;water|0.8;0.2 mass" or "etylene glycol;water|0.53725,0.46275". In both cases you have to set the input z to zeros(20,0) in MATLAB or 20*[0.0] in Python.

So if you use z for input: MOLE FRACTION

Hope this helps a bit

Olaf

I recommend to only ever use mole fractions. There are a number of bugs in REFPROP 10.0 with mass fractions, and you should therefore prefer to always use mole fractions. That is what I do and I don't run into problems.

b3pe commented 3 months ago

Actual never was resolved

From: Ian Bell @.> Sent: Wednesday, May 22, 2024 2:05 PM To: usnistgov/REFPROP-issues @.> Cc: Brad Bean @.>; Author @.> Subject: Re: [usnistgov/REFPROP-issues] z array (composition array) definition (Issue #630)

Closed #630https://github.com/usnistgov/REFPROP-issues/issues/630 as completed.

— Reply to this email directly, view it on GitHubhttps://github.com/usnistgov/REFPROP-issues/issues/630#event-12900073598, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BGG6KOM7YSEZ3N6N2LPGCGLZDT257AVCNFSM6AAAAABDM5C4G6VHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJSHEYDAMBXGM2TSOA. You are receiving this because you authored the thread.Message ID: @.***>

ianhbell commented 3 months ago

Yes, for now the solution is use mole fractions. I know it is not the right resolution, but that's what we have to offer

b3pe commented 3 months ago

ok