usnistgov / REFPROP-issues

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

Wrong molar mass in English units #423

Closed ianhbell closed 3 years ago

ianhbell commented 3 years ago

In the ENGLISH and MOLAR ENGLISH unit systems, the incorrect molar mass is returned from REFPROPdll. The units are correct, but the value is in g/mol.

from ctREFPROP.ctREFPROP import REFPROPFunctionLibrary
root = 'C:/Program Files (x86)/REFPROP'
RP = REFPROPFunctionLibrary(root)
print('version:', RP.RPVersion())

systems = ['DEFAULT','MOLAR SI','MASS SI','SI WITH C','MOLAR BASE SI','MASS BASE SI','ENGLISH','MOLAR ENGLISH','MKS','CGS','MIXED','MEUNITS']
for system in systems:
    units = RP.GETENUMdll(0, system).iEnum
    r = RP.REFPROPdll("PROPANE", "", "M", units, 0,0,101325,0,[1])
    print(system, r.Output[0], r.hUnits)

yields

version: 10.0.0.02
DEFAULT 44.09562 g/mol
MOLAR SI 44.09562 g/mol
MASS SI 44.09562 g/mol
SI WITH C 44.09562 g/mol
MOLAR BASE SI 0.044095619999999995 kg/mol
MASS BASE SI 0.044095619999999995 kg/mol
ENGLISH 44.09562 lbm/lbmol
MOLAR ENGLISH 44.09562 lbm/lbmol
MKS 44.09562 g/mol
CGS 44.09562 g/mol
MIXED 44.09562 g/mol
MEUNITS 44.09562 g/mol
nist-aharvey commented 3 years ago

This is actually OK. The pound-mole is defined such that if a gram-mole (ordinary SI mole) of something has mass N grams, a pound-mole has mass N pounds mass. The conversion factor between the two is just the conversion between grams and pounds, about 454, so the molar mass in lbm/lbmol is an identical number to that in g/mol. One can do this with any mass unit, so you would get the same number for a molar mass in slugs per slug-mole, stone per stone-mole, ounce per ounce-mole, kg per kg-mole, tons per ton-mole, drachmas per drachma-mole, etc. Better to use SI units, of course.

There is a related joke about the number of guacas in a guaca-mole. The factor, of course, is Avocado's number.

ianhbell commented 3 years ago

@nist-aharvey I really like the joke :) Thanks for the comprehensive explanation of something that was unclear to me. This is in the -1*-1=1 category