Files
CoolProp/dev/mixtures/inject_Bell2016.py
Matthis Thorade 526cb198a4 autopep8 whitespace (#1613)
* autopep8 whitespace only:

--select="E101,W1,W2"

* revert single file: web2py_online.py

Should this be a .py file at all?

* revert file Tickets/1443.py because the diff looked strange:

maybe there is an encoding problem?

* Rename web2py_online.py to web2py_online.rst
2017-12-12 08:32:38 -07:00

42 lines
1.1 KiB
Python

import json, CoolProp.CoolProp as CP
with open('Bell2016Fluids.txt','r') as fp:
lines = fp.readlines()
name2CAS = {}
for line in lines:
Name, longname, CAS, N = line.strip().split(' ')
name2CAS[Name] = CAS
with open('Bell2016Coefficients.txt','r') as fp:
lines = fp.readlines()
with open('mixture_binary_pairs.json','r') as fp:
jj = json.load(fp)
CAS_pairs = []
for pair in jj:
CAS_pairs.append( (pair['CAS1'],pair['CAS2']) )
for line in lines:
Name1,Name2,betaT,gammaT,MARE,N = line.strip().split(' ')
CAS1 = name2CAS[Name1]
CAS2 = name2CAS[Name2]
if ((CAS1,CAS2)) not in CAS_pairs and ((CAS2,CAS1)) not in CAS_pairs:
entry = {
"BibTeX": "Bell-JCED-2016",
"CAS1": CAS1,
"CAS2": CAS2,
"F": 0.0,
"Name1": Name1,
"Name2": Name2,
"betaT": float(betaT),
"gammaT": float(gammaT),
"betaV": 1.0,
"gammaV": 1.0
}
jj.append(entry)
else:
print('Skipping', Name1, Name2)
with open('mixture_binary_pairs.json','w') as fp:
json.dump(jj, fp, indent = 2, sort_keys = True)