usnistgov / REFPROP-issues

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

Excess Volumes exceeding available phase volumes #403

Closed jenstam closed 3 years ago

jenstam commented 3 years ago

Description

For the argon-nitrogen system, the calculated excess volumes exceed the actual volumes of the two phases by 3 orders of magnitudes during VLE calculation.

Steps to Reproduce

  1. Define a new mixture with argon and nitrogen.
  2. Choose T,p, volume, excess volume and composition as properties.
  3. Change units to those ones in the table in the attachments.
  4. Calculate a saturation table at 95 K with variation of liquid phase composition.

Expected behavior: Excess volumes about -.1 cm^3/mol

Actual behavior: Excess volumes ranging from -292 to -1178 cm^3/mol

Versions

REFPROP Version: 10.0 Operating System and Version: Windows 10 Access Method: regular REFPROP GUI

Additional Information

excess_volumes

ianhbell commented 3 years ago

Where do your values of -0.1 cm^3/mol come from? I tried with both REFPROP and CoolProp and I get the same answers, which gives me some confidence in the values from REFPROP.

from ctREFPROP.ctREFPROP import REFPROPFunctionLibrary
import pandas, matplotlib.pyplot as plt
import numpy as np

root = 'C:/Program Files (x86)/REFPROP'
RP = REFPROPFunctionLibrary(root)
import CoolProp.CoolProp as CP

def with_REFPROP():
    o = []
    for z0 in np.linspace( 1-0.001, 0.001, 100):
        RP.SETFLUIDSdll('Nitrogen*Argon')
        z = [z0, 1-z0]
        RP.SATSPLNdll(z)
        r = RP.REFPROPdll("", "QT", "VE;D", RP.MOLAR_BASE_SI, 0,0, 0,95,z)
        Vex,D = r.Output[0:2]
        if r.ierr != 0:
            print(r.ierr, r.herr)
        o.append({'vE / m^3/mol': Vex, 'z0/molar':z0, 'v / m^3/mol': 1/D})
    df = pandas.DataFrame(o)
    return df 

def with_CoolProp():
    o = []
    AS = CP.AbstractState('HEOS', 'Nitrogen&Argon')
    for z0 in np.linspace( 1-0.001, 0.001, 100):
        AS.set_mole_fractions([z0,1-z0])
        AS.update(CP.QT_INPUTS, 0, 95)
        o.append({'vE / m^3/mol': AS.volumemolar_excess(), 'z0/molar':z0, 'v / m^3/mol': 1/AS.rhomolar()})
    df = pandas.DataFrame(o)
    return df 

for df in [with_REFPROP(), with_CoolProp()]:
    plt.plot(df['z0/molar'], df['vE / m^3/mol']*100**3)
plt.gca().set(ylabel='$v_E$ / cm$^3$/mol', xlabel='$z_1$ / mole frac.')
plt.savefig('vE_ArN2.pdf')
plt.show()

for df in [with_REFPROP(), with_CoolProp()]:
    plt.plot(df['z0/molar'], df['v / m^3/mol']*100**3)
plt.gca().set(ylabel='$v$ / cm$^3$/mol', xlabel='$z_1$ / mole frac.')
plt.savefig('v_ArN2.pdf')
plt.show()

yielding v_ArN2.pdf vE_ArN2.pdf

ianhbell commented 3 years ago

I wonder whether it makes sense to talk about excess volumes in this case. I think the state of aggregation of at least one of the components at this T,p state point is not liquid. So you get something that seems weird.

jenstam commented 3 years ago

I took that value from https://doi.org/10.1016/0021-9614(77)90089-1

It is weird that the magnitude of the excess is so much bigger than the actual liquid phase volume.

Should I only apply it to T,p far away from saturation then?

ianhbell commented 3 years ago

Right. The constituent pure fluids also need to be liquids at the same T,p state point for excess properties to make sense.