This commit is contained in:
Ian Bell
2014-07-25 23:46:21 -04:00
69 changed files with 2478 additions and 1639 deletions

View File

@@ -84,7 +84,7 @@
0.00000e+00
],
[
-3.72520e-09,
-3.72522e-09,
1.04478e-06,
-4.39116e-06,
0.00000e+00,

View File

@@ -47,7 +47,7 @@
0.00000e+00
],
[
-4.12990e-09,
-4.12992e-09,
1.03566e-08,
4.48548e-08,
0.00000e+00,
@@ -136,7 +136,7 @@
0.00000e+00
],
[
5.92070e-09,
5.92069e-09,
-3.28861e-08,
2.92178e-07,
0.00000e+00,

View File

@@ -136,7 +136,7 @@
0.00000e+00
],
[
1.98700e-10,
1.98685e-10,
1.82859e-07,
3.74653e-08,
0.00000e+00,

View File

@@ -47,7 +47,7 @@
0.00000e+00
],
[
-8.72900e-09,
-8.72899e-09,
7.36889e-08,
-1.23574e-07,
0.00000e+00,

View File

@@ -84,8 +84,8 @@
0.00000e+00
],
[
-5.17730e-09,
9.67320e-09,
-5.17733e-09,
9.67318e-09,
3.36886e-07,
0.00000e+00,
0.00000e+00,

View File

@@ -3,23 +3,17 @@
"coeffs": "null",
"type": "notdefined"
},
"Tbase": 2.82500e+02,
"Tmax": 3.00000e+02,
"Tmin": 2.65000e+02,
"TminPsat": 3.00000e+02,
"Tbase": 2.73150e+02,
"Tmax": 3.03150e+02,
"Tmin": -10,
"TminPsat": 3.03150e+02,
"conductivity": {
"coeffs": [
[
5.28100e-01
5.14259e-01
],
[
1.48192e-03
],
[
1.90476e-07
],
[
4.04040e-09
1.48300e-03
]
],
"type": "polynomial"
@@ -27,21 +21,21 @@
"density": {
"coeffs": [
[
1.08810e+03
1.09000e+03
],
[
-2.00000e-01
],
[
-2.08722e-14
1.66533e-16
],
[
4.41257e-17
-1.89735e-18
]
],
"type": "polynomial"
},
"description": "Aspen Temper -10",
"description": "Aspen Temper -10, Potassium acetate/formate",
"mass2input": {
"coeffs": "null",
"type": "notdefined"
@@ -51,7 +45,7 @@
"type": "notdefined"
},
"name": "AS10",
"reference": "SecCool Software",
"reference": "Aspen Petroleum AB, SecCool software",
"saturation_pressure": {
"coeffs": "null",
"type": "notdefined"
@@ -59,16 +53,13 @@
"specific_heat": {
"coeffs": [
[
3.55947e+03
3.54183e+03
],
[
1.76000e+00
2.01000e+00
],
[
-1.32857e-02
],
[
1.54329e-16
-1.32589e-02
]
],
"type": "polynomial"
@@ -76,26 +67,26 @@
"viscosity": {
"coeffs": [
[
-6.21580e+00
2.80155e+00
],
[
-3.38953e-02
-1.06314e-01
],
[
2.81937e-04
2.35381e-03
],
[
4.96872e-06
-2.11481e-05
]
],
"type": "exppolynomial"
"type": "polynomial"
},
"volume2input": {
"coeffs": "null",
"type": "notdefined"
},
"xbase": 0.00000e+00,
"xid": 4,
"xid": 3,
"xmax": 1.00000e+00,
"xmin": 0.00000e+00
}

View File

@@ -3,23 +3,17 @@
"coeffs": "null",
"type": "notdefined"
},
"Tbase": 2.77500e+02,
"Tmax": 3.00000e+02,
"Tmin": 2.55000e+02,
"TminPsat": 3.00000e+02,
"Tbase": 2.73150e+02,
"Tmax": 3.03150e+02,
"Tmin": -20,
"TminPsat": 3.03150e+02,
"conductivity": {
"coeffs": [
[
4.86600e-01
4.80766e-01
],
[
1.34588e-03
],
[
-2.16840e-19
],
[
-7.77001e-09
1.34200e-03
]
],
"type": "polynomial"
@@ -27,21 +21,21 @@
"density": {
"coeffs": [
[
1.14603e+03
1.14700e+03
],
[
-2.33284e-01
-2.21429e-01
],
[
-1.50000e-03
-1.42857e-03
],
[
-4.66200e-07
2.98156e-19
]
],
"type": "polynomial"
},
"description": "Aspen Temper -20",
"description": "Aspen Temper -20, Potassium acetate/formate",
"mass2input": {
"coeffs": "null",
"type": "notdefined"
@@ -51,7 +45,7 @@
"type": "notdefined"
},
"name": "AS20",
"reference": "SecCool Software",
"reference": "Aspen Petroleum AB, SecCool software",
"saturation_pressure": {
"coeffs": "null",
"type": "notdefined"
@@ -59,16 +53,13 @@
"specific_heat": {
"coeffs": [
[
3.27473e+03
3.26252e+03
],
[
2.75248e+00
2.86000e+00
],
[
-1.21970e-02
],
[
2.33100e-06
-1.22673e-02
]
],
"type": "polynomial"
@@ -76,16 +67,16 @@
"viscosity": {
"coeffs": [
[
-5.84183e+00
1.35858e+00
],
[
-3.57059e-02
-4.17551e-02
],
[
3.09079e-04
8.14818e-05
],
[
1.63314e-06
1.60342e-07
]
],
"type": "exppolynomial"
@@ -95,7 +86,7 @@
"type": "notdefined"
},
"xbase": 0.00000e+00,
"xid": 4,
"xid": 3,
"xmax": 1.00000e+00,
"xmin": 0.00000e+00
}

View File

@@ -3,23 +3,17 @@
"coeffs": "null",
"type": "notdefined"
},
"Tbase": 2.72500e+02,
"Tmax": 3.00000e+02,
"Tmin": 2.45000e+02,
"TminPsat": 3.00000e+02,
"Tbase": 2.73150e+02,
"Tmax": 3.03150e+02,
"Tmin": -30,
"TminPsat": 3.03150e+02,
"conductivity": {
"coeffs": [
[
4.59588e-01
4.60388e-01
],
[
1.25588e-03
],
[
-4.49550e-08
],
[
5.18001e-10
1.25600e-03
]
],
"type": "polynomial"
@@ -27,21 +21,21 @@
"density": {
"coeffs": [
[
1.18406e+03
1.18386e+03
],
[
-3.08366e-01
-3.10859e-01
],
[
-1.05495e-03
-1.03896e-03
],
[
1.57472e-05
1.76768e-05
]
],
"type": "polynomial"
},
"description": "Aspen Temper -30",
"description": "Aspen Temper -30, Potassium acetate/formate",
"mass2input": {
"coeffs": "null",
"type": "notdefined"
@@ -51,7 +45,7 @@
"type": "notdefined"
},
"name": "AS30",
"reference": "SecCool Software",
"reference": "Aspen Petroleum AB, SecCool software",
"saturation_pressure": {
"coeffs": "null",
"type": "notdefined"
@@ -59,16 +53,13 @@
"specific_heat": {
"coeffs": [
[
3.07310e+03
3.07504e+03
],
[
3.02664e+00
2.99000e+00
],
[
-2.70639e-02
],
[
-3.41880e-06
-2.70232e-02
]
],
"type": "polynomial"
@@ -76,16 +67,16 @@
"viscosity": {
"coeffs": [
[
-5.50368e+00
1.55518e+00
],
[
-4.05991e-02
-4.51874e-02
],
[
3.65397e-04
9.74090e-05
],
[
2.17072e-06
1.86342e-07
]
],
"type": "exppolynomial"
@@ -95,7 +86,7 @@
"type": "notdefined"
},
"xbase": 0.00000e+00,
"xid": 4,
"xid": 3,
"xmax": 1.00000e+00,
"xmin": 0.00000e+00
}

View File

@@ -3,23 +3,17 @@
"coeffs": "null",
"type": "notdefined"
},
"Tbase": 2.67500e+02,
"Tmax": 3.00000e+02,
"Tmin": 2.35000e+02,
"TminPsat": 3.00000e+02,
"Tbase": 2.73150e+02,
"Tmax": 3.03150e+02,
"Tmin": -40,
"TminPsat": 3.03150e+02,
"conductivity": {
"coeffs": [
[
4.37153e-01
4.43327e-01
],
[
1.09943e-03
],
[
-6.04396e-08
],
[
-1.20664e-09
1.09900e-03
]
],
"type": "polynomial"
@@ -27,21 +21,21 @@
"density": {
"coeffs": [
[
1.21692e+03
1.21484e+03
],
[
-3.64871e-01
-3.78199e-01
],
[
-1.37912e-03
-1.09307e-03
],
[
1.73591e-05
1.68350e-05
]
],
"type": "polynomial"
},
"description": "Aspen Temper -40",
"description": "Aspen Temper -40, Potassium acetate/formate",
"mass2input": {
"coeffs": "null",
"type": "notdefined"
@@ -51,7 +45,7 @@
"type": "notdefined"
},
"name": "AS40",
"reference": "SecCool Software",
"reference": "Aspen Petroleum AB, SecCool software",
"saturation_pressure": {
"coeffs": "null",
"type": "notdefined"
@@ -59,16 +53,13 @@
"specific_heat": {
"coeffs": [
[
2.96376e+03
2.97788e+03
],
[
2.71943e+00
2.28000e+00
],
[
-3.87363e-02
],
[
-1.20664e-06
-3.87227e-02
]
],
"type": "polynomial"
@@ -76,16 +67,16 @@
"viscosity": {
"coeffs": [
[
-5.05918e+00
1.73307e+00
],
[
-4.11341e-02
-5.42737e-02
],
[
4.27271e-04
2.78602e-04
],
[
-4.66582e-06
4.99909e-07
]
],
"type": "exppolynomial"
@@ -95,7 +86,7 @@
"type": "notdefined"
},
"xbase": 0.00000e+00,
"xid": 4,
"xid": 3,
"xmax": 1.00000e+00,
"xmin": 0.00000e+00
}

View File

@@ -3,23 +3,20 @@
"coeffs": "null",
"type": "notdefined"
},
"Tbase": 2.60000e+02,
"Tmax": 3.00000e+02,
"Tmin": 2.20000e+02,
"TminPsat": 3.00000e+02,
"Tbase": 2.73150e+02,
"Tmax": 3.03150e+02,
"Tmin": -55,
"TminPsat": 3.03150e+02,
"conductivity": {
"coeffs": [
[
4.13854e-01
4.25799e-01
],
[
8.78212e-04
9.37902e-04
],
[
2.28225e-06
],
[
-2.06398e-10
2.28700e-06
]
],
"type": "polynomial"
@@ -27,21 +24,21 @@
"density": {
"coeffs": [
[
1.25576e+03
1.24975e+03
],
[
-4.34815e-01
-4.76296e-01
],
[
-1.94014e-03
-1.17189e-03
],
[
1.94358e-05
1.98824e-05
]
],
"type": "polynomial"
},
"description": "Aspen Temper -55",
"description": "Aspen Temper -55, Potassium acetate/formate",
"mass2input": {
"coeffs": "null",
"type": "notdefined"
@@ -51,7 +48,7 @@
"type": "notdefined"
},
"name": "AS55",
"reference": "SecCool Software",
"reference": "Aspen Petroleum AB, SecCool software",
"saturation_pressure": {
"coeffs": "null",
"type": "notdefined"
@@ -59,16 +56,13 @@
"specific_heat": {
"coeffs": [
[
2.80543e+03
2.83985e+03
],
[
2.94466e+00
2.29000e+00
],
[
-2.48679e-02
],
[
-4.12797e-07
-2.48618e-02
]
],
"type": "polynomial"
@@ -76,16 +70,16 @@
"viscosity": {
"coeffs": [
[
-4.48837e+00
1.79891e+00
],
[
-4.78803e-02
-6.30089e-02
],
[
5.15321e-04
4.30552e-04
],
[
-8.21971e-06
7.31131e-07
]
],
"type": "exppolynomial"
@@ -95,7 +89,7 @@
"type": "notdefined"
},
"xbase": 0.00000e+00,
"xid": 4,
"xid": 3,
"xmax": 1.00000e+00,
"xmin": 0.00000e+00
}

View File

@@ -1,4 +1,4 @@
from __future__ import division, absolute_import, print_function
from __future__ import division, print_function
import numpy as np
from scipy.optimize._minimize import minimize
from scipy.optimize.minpack import curve_fit

View File

@@ -0,0 +1,36 @@
from __future__ import division, print_function
import numpy as np
from CPIncomp.DataObjects import CoefficientData,PureData
class NitrateSalt(PureData,CoefficientData):
"""
Heat transfer fluid based on 60% NaNO3 and 40% KNO3
"""
def __init__(self):
PureData.__init__(self)
CoefficientData.__init__(self)
self.name = "NaK"
self.description = "NitrateSalt"
self.reference = "Solar Power Tower Design Basis Document, Alexis B. Zavoico, Sandia Labs, USA"
self.Tmin = 300 + 273.15
self.Tmax = 600 + 273.15
self.TminPsat = self.Tmax
self.Tbase = 273.15
#self.temperature.data = self.getTrange()
#self.concentration.data = np.array([ 0 ]) # mass fraction
self.density.type = self.density.INCOMPRESSIBLE_POLYNOMIAL
self.density.coeffs = np.array([[2090],[-0.636]])
self.specific_heat.type = self.specific_heat.INCOMPRESSIBLE_POLYNOMIAL
self.specific_heat.coeffs = np.array([[1443],[+0.172]])
self.conductivity.type = self.conductivity.INCOMPRESSIBLE_POLYNOMIAL
self.conductivity.coeffs = np.array([[0.443],[+1.9e-4]])
self.viscosity.type = self.viscosity.INCOMPRESSIBLE_POLYNOMIAL
self.viscosity.coeffs = np.array([[22.714],[-0.120],[2.281 * 1e-4],[-1.474 * 1e-7]])/1e3

View File

@@ -1,342 +0,0 @@
import numpy as np
from CPIncomp.DataObjects import SolutionData
class CoefficientData(SolutionData):
"""
A class to convert parameter arrays from different other sources
"""
def __init__(self):
SolutionData.__init__(self)
self.reference = "Some other software"
def convertSecCoolArray(self, array):
if len(array)!=18:
raise ValueError("The lenght is not equal to 18!")
self.reference = "SecCool software"
array = np.array(array)
tmp = np.zeros((4,6))
tmp[0][0] = array[0]
tmp[0][1] = array[1]
tmp[0][2] = array[2]
tmp[0][3] = array[3]
tmp[0][4] = array[4]
tmp[0][5] = array[5]
tmp[1][0] = array[6]
tmp[1][1] = array[7]
tmp[1][2] = array[8]
tmp[1][3] = array[9]
tmp[1][4] = array[10]
#tmp[1][5] = array[11]
tmp[2][0] = array[11]
tmp[2][1] = array[12]
tmp[2][2] = array[13]
tmp[2][3] = array[14]
#tmp[2][4] = array[4]
#tmp[2][5] = array[5]
tmp[3][0] = array[15]
tmp[3][1] = array[16]
tmp[3][2] = array[17]
#tmp[3][3] = array[3]
#tmp[3][4] = array[4]
#tmp[3][5] = array[5]
# Concentration is no longer handled in per cent!
for i in range(6):
tmp.T[i] *= 100.0**i
return tmp
def convertSecCoolTfreeze(self, array):
expo = -1.0
for i in range(len(array)):
array[i] = array[i]*np.power(100.0,expo+i)
array[1] = array[1] + 273.15
#self.T_freeze.type = self.T_freeze.INCOMPRESSIBLE_POLYOFFSET
return array
def convertMelinderArray(self, array):
"""The same function as the SecCool converter,
the original source code is slightly different though.
That is why the implementation is in a transposed form..."""
if len(array)!=18:
raise ValueError("The lenght is not equal to 18!")
self.reference = "Melinder Book"
array = np.array(array)
tmp = np.zeros((6,4))
tmp[0][0] = array[0]
tmp[0][1] = array[6]
tmp[0][2] = array[11]
tmp[0][3] = array[15]
tmp[1][0] = array[1]
tmp[1][1] = array[7]
tmp[1][2] = array[12]
tmp[1][3] = array[16]
tmp[2][0] = array[2]
tmp[2][1] = array[8]
tmp[2][2] = array[13]
tmp[2][3] = array[17]
tmp[3][0] = array[3]
tmp[3][1] = array[9]
tmp[3][2] = array[14]
tmp[4][0] = array[4]
tmp[4][1] = array[10]
tmp[5][0] = array[5]
# Concentration is no longer handled in per cent!
for i in range(6):
tmp[i] *= 100.0**i
return tmp.T
def convertMelinderMatrix(self, array):
"""Function to convert the full coefficient array
from the very first CoolProp implementation
based on the book by Melinder"""
if len(array)!=18:
raise ValueError("The lenght is not equal to 18!")
if len(array[0])!=5:
raise ValueError("The lenght is not equal to 5!")
array = np.array(array)
tmp = np.zeros((18,5))
for j in range(5):
tmp[ 0][j] = array[ 0][j]
tmp[ 1][j] = array[ 4][j]
tmp[ 2][j] = array[ 8][j]
tmp[ 3][j] = array[12][j]
tmp[ 4][j] = array[15][j]
tmp[ 5][j] = array[17][j]
tmp[ 6][j] = array[ 1][j]
tmp[ 7][j] = array[ 5][j]
tmp[ 8][j] = array[ 9][j]
tmp[ 9][j] = array[13][j]
tmp[10][j] = array[16][j]
tmp[11][j] = array[ 2][j]
tmp[12][j] = array[ 6][j]
tmp[13][j] = array[10][j]
tmp[14][j] = array[14][j]
tmp[15][j] = array[ 3][j]
tmp[16][j] = array[ 7][j]
tmp[17][j] = array[11][j]
return tmp
def setMelinderMatrix(self, matrix):
# matrix = np.array([
# [-26.29 , 958.1 ,3887 , 0.4175 , 1.153 ],
# [ -0.000002575 , -0.4151 , 7.201 , 0.0007271 , -0.03866 ],
# [ -0.000006732 , -0.002261 , -0.08979 , 0.0000002823 , 0.0002779 ],
# [ 0.000000163 , 0.0000002998 , -0.000439 , 0.000000009718 , -0.000001543 ],
# [ -1.187 , -1.391 , -18.5 , -0.004421 , 0.005448 ],
# [ -0.00001609 , -0.0151 , 0.2984 , -0.00002952 , 0.0001008 ],
# [ 0.000000342 , 0.0001113 , -0.001865 , 0.00000007336 , -0.000002809 ],
# [ 0.0000000005687, -0.0000003264 , -0.00001718 , 0.0000000004328 , 0.000000009811 ],
# [ -0.01218 , -0.01105 , -0.03769 , 0.00002044 , -0.0005552 ],
# [ 0.0000003865 , 0.0001828 , -0.01196 , 0.0000003413 , 0.000008384 ],
# [ 0.000000008768 , -0.000001641 , 0.00009801 , -0.000000003665 , -0.00000003997 ],
# [ -0.0000000002095, 0.0000000151 , 0.000000666 , -0.00000000002791 , -0.0000000003466 ],
# [ -0.00006823 , -0.0001208 , -0.003776 , 0.0000002943 , 0.000003038 ],
# [ 0.00000002137 , 0.000002992 , -0.00005611 , -0.0000000009646 , -0.00000007435 ],
# [ -0.0000000004271, 0.000000001455, -0.0000007811, 0.00000000003174 , 0.0000000007442 ],
# [ 0.0000001297 , 0.000004927 , -0.0001504 , -0.0000000008666 , 0.00000006669 ],
# [ -0.0000000005407, -0.0000001325 , 0.000007373 , -0.0000000000004573, -0.0000000009105 ],
# [ 0.00000002363 , -0.00000007727 , 0.000006433 , -0.0000000002033 , -0.0000000008472 ]
# ])
coeffs = self.convertMelinderMatrix(matrix).T
self.T_freeze.type = self.T_freeze.INCOMPRESSIBLE_POLYNOMIAL
self.T_freeze.coeffs = self.convertMelinderArray(coeffs[0])
self.density.type = self.density.INCOMPRESSIBLE_POLYNOMIAL
self.density.coeffs = self.convertMelinderArray(coeffs[1])
self.specific_heat.type = self.specific_heat.INCOMPRESSIBLE_POLYNOMIAL
self.specific_heat.coeffs = self.convertMelinderArray(coeffs[2])
self.conductivity.type = self.conductivity.INCOMPRESSIBLE_POLYNOMIAL
self.conductivity.coeffs = self.convertMelinderArray(coeffs[3])
self.viscosity.type = self.viscosity.INCOMPRESSIBLE_POLYNOMIAL
self.viscosity.coeffs = self.convertMelinderArray(coeffs[4])
class SecCoolExample(CoefficientData):
"""
Ethanol-Water mixture according to Melinder book
Source: SecCool Software
"""
def __init__(self):
CoefficientData.__init__(self)
self.name = "ExampleSecCool"
self.description = "Methanol solution"
#self.reference = "SecCool software"
self.Tmax = 20 + 273.15
self.Tmin = -50 + 273.15
self.xmax = 0.5
self.xmin = 0.0
self.xid = self.ifrac_mass
self.TminPsat = 20 + 273.15
self.Tbase = -4.48 + 273.15
self.xbase = 31.57 / 100.0
self.density.type = self.density.INCOMPRESSIBLE_POLYNOMIAL
self.density.coeffs = self.convertSecCoolArray(np.array([
960.24665800,
-1.2903839100,
-0.0161042520,
-0.0001969888,
1.131559E-05,
9.181999E-08,
-0.4020348270,
-0.0162463989,
0.0001623301,
4.367343E-06,
1.199000E-08,
-0.0025204776,
0.0001101514,
-2.320217E-07,
7.794999E-08,
9.937483E-06,
-1.346886E-06,
4.141999E-08]))
self.specific_heat.type = self.specific_heat.INCOMPRESSIBLE_POLYNOMIAL
self.specific_heat.coeffs = self.convertSecCoolArray(np.array([
3822.9712300,
-23.122409500,
0.0678775826,
0.0022413893,
-0.0003045332,
-4.758000E-06,
2.3501449500,
0.1788839410,
0.0006828000,
0.0002101166,
-9.812000E-06,
-0.0004724176,
-0.0003317949,
0.0001002032,
-5.306000E-06,
4.242194E-05,
2.347190E-05,
-1.894000E-06]))
self.conductivity.type = self.conductivity.INCOMPRESSIBLE_POLYNOMIAL
self.conductivity.coeffs = self.convertSecCoolArray(np.array([
0.4082066700,
-0.0039816870,
1.583368E-05,
-3.552049E-07,
-9.884176E-10,
4.460000E-10,
0.0006629321,
-2.686475E-05,
9.039150E-07,
-2.128257E-08,
-5.562000E-10,
3.685975E-07,
7.188416E-08,
-1.041773E-08,
2.278001E-10,
4.703395E-08,
7.612361E-11,
-2.734000E-10]))
self.viscosity.type = self.viscosity.INCOMPRESSIBLE_EXPPOLYNOMIAL
self.viscosity.coeffs = self.convertSecCoolArray(np.array([
1.4725525500,
0.0022218998,
-0.0004406139,
6.047984E-06,
-1.954730E-07,
-2.372000E-09,
-0.0411841566,
0.0001784479,
-3.564413E-06,
4.064671E-08,
1.915000E-08,
0.0002572862,
-9.226343E-07,
-2.178577E-08,
-9.529999E-10,
-1.699844E-06,
-1.023552E-07,
4.482000E-09]))
self.T_freeze.type = self.T_freeze.INCOMPRESSIBLE_POLYOFFSET
self.T_freeze.coeffs = self.convertSecCoolTfreeze(np.array([
27.755555600,
-22.973221700,
-1.1040507200,
-0.0120762281,
-9.343458E-05]))
class MelinderExample(CoefficientData):
"""
Methanol-Water mixture according to Melinder book
Source: Book
"""
def __init__(self):
CoefficientData.__init__(self)
self.name = "ExampleMelinder"
self.description = "Methanol solution"
self.reference = "Melinder-BOOK-2010"
self.Tmax = 40 + 273.15
self.Tmin = -50 + 273.15
self.xmax = 0.6
self.xmin = 0.0
self.xid = self.ifrac_mass
self.TminPsat = self.Tmax
self.Tbase = 3.5359 + 273.15;
self.xbase = 30.5128 / 100.0
coeffs = np.array([
[-26.29 , 958.1 ,3887 , 0.4175 , 1.153 ],
[ -0.000002575 , -0.4151 , 7.201 , 0.0007271 , -0.03866 ],
[ -0.000006732 , -0.002261 , -0.08979 , 0.0000002823 , 0.0002779 ],
[ 0.000000163 , 0.0000002998 , -0.000439 , 0.000000009718 , -0.000001543 ],
[ -1.187 , -1.391 , -18.5 , -0.004421 , 0.005448 ],
[ -0.00001609 , -0.0151 , 0.2984 , -0.00002952 , 0.0001008 ],
[ 0.000000342 , 0.0001113 , -0.001865 , 0.00000007336 , -0.000002809 ],
[ 0.0000000005687, -0.0000003264 , -0.00001718 , 0.0000000004328 , 0.000000009811 ],
[ -0.01218 , -0.01105 , -0.03769 , 0.00002044 , -0.0005552 ],
[ 0.0000003865 , 0.0001828 , -0.01196 , 0.0000003413 , 0.000008384 ],
[ 0.000000008768 , -0.000001641 , 0.00009801 , -0.000000003665 , -0.00000003997 ],
[ -0.0000000002095, 0.0000000151 , 0.000000666 , -0.00000000002791 , -0.0000000003466 ],
[ -0.00006823 , -0.0001208 , -0.003776 , 0.0000002943 , 0.000003038 ],
[ 0.00000002137 , 0.000002992 , -0.00005611 , -0.0000000009646 , -0.00000007435 ],
[ -0.0000000004271, 0.000000001455, -0.0000007811, 0.00000000003174 , 0.0000000007442 ],
[ 0.0000001297 , 0.000004927 , -0.0001504 , -0.0000000008666 , 0.00000006669 ],
[ -0.0000000005407, -0.0000001325 , 0.000007373 , -0.0000000000004573, -0.0000000009105 ],
[ 0.00000002363 , -0.00000007727 , 0.000006433 , -0.0000000002033 , -0.0000000008472 ]
])
self.setMelinderMatrix(coeffs)

View File

@@ -1,8 +1,8 @@
from __future__ import division, absolute_import, print_function
from __future__ import division, print_function
import numpy as np
from scipy import interpolate
from CPIncomp.BaseObjects import IncompressibleData
import os, CPIncomp, math
import os, math
from BaseObjects import IncompressibleData
from abc import ABCMeta
class SolutionData(object):
"""
@@ -11,6 +11,7 @@ class SolutionData(object):
put in your data and add some documentation for where the
information came from.
"""
__metaclass__ = ABCMeta
def __init__(self):
self.ifrac_mass = 0
self.ifrac_mole = 1
@@ -176,6 +177,7 @@ class PureData(SolutionData):
An extension of the solution data that makes it
easier to gather data for pure fluids.
"""
__metaclass__ = ABCMeta
def __init__(self):
SolutionData.__init__(self)
self.xid = self.ifrac_pure
@@ -211,11 +213,12 @@ class DigitalData(SolutionData):
easier to generate fitting data from fluids available
as Python packages.
"""
__metaclass__ = ABCMeta
def __init__(self):
SolutionData.__init__(self)
def getFile(self, data):
return os.path.join(CPIncomp.__path__[0], 'data', self.name+"_"+data+".txt")
return os.path.join(os.path.dirname(__file__), 'data', self.name+"_"+data+".txt")
def getFromFile(self, data):
fullPath = self.getFile(data)
@@ -254,20 +257,20 @@ class DigitalData(SolutionData):
if self.temperature.data==None or self.concentration.data==None: # no data set, try to get it from file
if self.temperature.data!=None: raise ValueError("Temperature is not None, but concentration is.")
if self.concentration.data!=None: raise ValueError("Concentration is not None, but temperature is.")
if (os.path.isfile(self.getFile(data))): # File found
if (data!=None and os.path.isfile(self.getFile(data))): # File found
fileArray = self.getFromFile(data)
self.temperature.data = np.copy(fileArray[1:,0])
self.concentration.data = np.copy(fileArray[0,1:])
readFromFile = True
else:
raise ValueError("No temperature and concentration data given and no readable file found.")
raise ValueError("No temperature and concentration data given and no readable file found for {0}".format(data))
tData = self.round(self.temperature.data)[:,0]
xData = self.round(self.concentration.data)[:,0]
baseArray = np.zeros( (len(tData)+1,len(xData)+1) )
if (os.path.isfile(self.getFile(data)) and not forceUpdate): # File found and no update wanted
if (data!=None and os.path.isfile(self.getFile(data)) and not forceUpdate): # File found and no update wanted
if fileArray==None: fileArray = self.getFromFile(data)
# tFile = fileArray[1:,0]
@@ -316,132 +319,190 @@ class DigitalData(SolutionData):
baseArray[0,0] = np.NaN
baseArray[1:,0] = np.copy(self.temperature.data)
baseArray[0,1:] = np.copy(self.concentration.data)
self.writeToFile(data, baseArray)
if data!=None: self.writeToFile(data, baseArray)
return np.copy(baseArray.T[1:].T[1:]) # Remove the first column and row and return
class PureExample(PureData):
def __init__(self):
PureData.__init__(self)
self.name = "ExamplePure"
self.description = "Heat transfer fluid TherminolD12 by Solutia"
self.reference = "Solutia data sheet"
self.Tmax = 150 + 273.15
self.Tmin = 50 + 273.15
self.TminPsat = self.Tmax
self.temperature.data = np.array([ 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150])+273.15 # Kelvin
self.density.data = np.array([ 740, 733, 726, 717, 710, 702, 695, 687, 679, 670, 662]) # kg/m3
self.specific_heat.data = np.array([ 2235, 2280, 2326, 2361, 2406, 2445, 2485, 2528, 2571, 2607, 2645]) # J/kg-K
self.viscosity.data = np.array([0.804, 0.704, 0.623, 0.556, 0.498, 0.451, 0.410, 0.374, 0.346, 0.317, 0.289]) # Pa-s
self.conductivity.data = np.array([0.105, 0.104, 0.102, 0.100, 0.098, 0.096, 0.095, 0.093, 0.091, 0.089, 0.087]) # W/m-K
self.saturation_pressure.data = np.array([ 0.5, 0.9, 1.4, 2.3, 3.9, 6.0, 8.7, 12.4, 17.6, 24.4, 33.2]) # Pa
self.reshapeAll()
class SolutionExample(SolutionData):
class CoefficientData(SolutionData):
"""
A class to convert parameter arrays from different other sources
"""
__metaclass__ = ABCMeta
def __init__(self):
SolutionData.__init__(self)
self.name = "ExampleSolution"
self.description = "Ethanol ice slurry"
self.reference = "Some other software"
def convertSecCoolArray(self, array):
if len(array)!=18:
raise ValueError("The lenght is not equal to 18!")
self.reference = "SecCool software"
array = np.array(array)
tmp = np.zeros((4,6))
self.temperature.data = np.array([ -45 , -40 , -35 , -30 , -25 , -20 , -15 , -10])+273.15 # Kelvin
self.concentration.data = np.array([ 5 , 10 , 15 , 20 , 25 , 30 , 35 ])/100.0 # mass fraction
tmp[0][0] = array[0]
tmp[0][1] = array[1]
tmp[0][2] = array[2]
tmp[0][3] = array[3]
tmp[0][4] = array[4]
tmp[0][5] = array[5]
self.density.data = np.array([
[1064.0, 1054.6, 1045.3, 1036.3, 1027.4, 1018.6, 1010.0],
[1061.3, 1052.1, 1043.1, 1034.3, 1025.6, 1017.0, 1008.6],
[1057.6, 1048.8, 1040.1, 1031.5, 1023.1, 1014.8, 1006.7],
[1053.1, 1044.6, 1036.2, 1028.0, 1019.9, 1012.0, 1004.1],
[1047.5, 1039.4, 1031.5, 1023.7, 1016.0, 1008.4, 1000.9],
[1040.7, 1033.2, 1025.7, 1018.4, 1011.2, 1004.0, 997.0],
[1032.3, 1025.3, 1018.5, 1011.7, 1005.1, 998.5, 992.0],
[1021.5, 1015.3, 1009.2, 1003.1, 997.1, 991.2, 985.4]]) # kg/m3
tmp[1][0] = array[6]
tmp[1][1] = array[7]
tmp[1][2] = array[8]
tmp[1][3] = array[9]
tmp[1][4] = array[10]
#tmp[1][5] = array[11]
self.specific_heat.data = np.copy(self.density.data)
tmp[2][0] = array[11]
tmp[2][1] = array[12]
tmp[2][2] = array[13]
tmp[2][3] = array[14]
#tmp[2][4] = array[4]
#tmp[2][5] = array[5]
self.Tmax = np.max(self.temperature.data)
self.Tmin = np.min(self.temperature.data)
self.xmax = np.max(self.concentration.data)
self.xmin = np.min(self.concentration.data)
self.xid = self.ifrac_mass
self.TminPsat = self.Tmax
tmp[3][0] = array[15]
tmp[3][1] = array[16]
tmp[3][2] = array[17]
#tmp[3][3] = array[3]
#tmp[3][4] = array[4]
#tmp[3][5] = array[5]
# self.density.data = np.array([
# [np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan],
# [np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan],
# [np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan],
# [np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan],
# [np.nan, np.nan, np.nan, np.nan, 1016.0, 1008.4, np.nan],
# [np.nan, 1033.2, np.nan, np.nan, np.nan, np.nan, np.nan],
# [np.nan, 1025.3, 1018.5, np.nan, np.nan, 998.5, 992.0],
# [np.nan, np.nan, 1009.2, np.nan, np.nan, np.nan, np.nan]]) # kg/m3
# Concentration is no longer handled in per cent!
for i in range(6):
tmp.T[i] *= 100.0**i
return tmp
def convertSecCoolTfreeze(self, array):
expo = -1.0
for i in range(len(array)):
array[i] = array[i]*np.power(100.0,expo+i)
array[1] = array[1] + 273.15
#self.T_freeze.type = self.T_freeze.INCOMPRESSIBLE_POLYOFFSET
return array
class DigitalExample(DigitalData):
def __init__(self):
DigitalData.__init__(self)
self.name = "ExampleDigital"
self.description = "some fluid"
self.reference = "none"
def convertMelinderArray(self, array):
"""The same function as the SecCool converter,
the original source code is slightly different though.
That is why the implementation is in a transposed form..."""
self.Tmin = 273.00;
self.Tmax = 500.00;
self.xmax = 1.0
self.xmin = 0.0
self.xid = self.ifrac_mass
self.TminPsat = self.Tmin;
if len(array)!=18:
raise ValueError("The lenght is not equal to 18!")
self.temperature.data = self.getTrange()
self.concentration.data = self.getxrange()
self.reference = "Melinder Book"
array = np.array(array)
tmp = np.zeros((6,4))
def funcRho(T,x):
return T + x*100.0 + T*(x+0.5)
self.density.data = self.getArray(funcRho,"rho")
tmp[0][0] = array[0]
tmp[0][1] = array[6]
tmp[0][2] = array[11]
tmp[0][3] = array[15]
def funcCp(T,x):
return T + x*50.0 + T*(x+0.6)
self.specific_heat.data = self.getArray(funcCp,"cp")
tmp[1][0] = array[1]
tmp[1][1] = array[7]
tmp[1][2] = array[12]
tmp[1][3] = array[16]
if __name__ == '__main__':
pass
## An example with a pure fluid
# obj = PureExample()
# obj.density.type = obj.density.INCOMPRESSIBLE_POLYNOMIAL
# obj.density.coeffs = np.zeros((4,6))
# print(obj.density.coeffs)
# obj.density.fitCoeffs(obj.temperature.data)
# print(obj.density.coeffs)
# obj.saturation_pressure.type = obj.density.INCOMPRESSIBLE_EXPPOLYNOMIAL
# obj.saturation_pressure.coeffs = np.zeros((4,6))
# print(obj.saturation_pressure.coeffs)
# obj.saturation_pressure.fitCoeffs(obj.temperature.data)
# print(obj.saturation_pressure.coeffs)
# print(obj.density.data[2][0],obj.rho(obj.temperature.data[2],10e5,obj.concentration.data[0]))
# print(obj.density.data[5][0],obj.rho(obj.temperature.data[5],10e5,obj.concentration.data[0]))
# print(obj.saturation_pressure.data[2][0],obj.psat(obj.temperature.data[2],obj.concentration.data[0]))
# print(obj.saturation_pressure.data[5][0],obj.psat(obj.temperature.data[5],obj.concentration.data[0]))
## An example with a solution
# obj = SolutionExample()
# obj.density.type = obj.density.INCOMPRESSIBLE_POLYNOMIAL
# obj.density.coeffs = np.ones((3,5))
# print(obj.density.coeffs)
# obj.density.fitCoeffs(obj.temperature.data,obj.concentration.data)
# print(obj.density.coeffs)
# print(obj.density.data[2][0],obj.rho(obj.temperature.data[2],10e5,obj.concentration.data[0]))
# print(obj.density.data[2][2],obj.rho(obj.temperature.data[2],10e5,obj.concentration.data[2]))
## An example with a digital fluid
# obj = DigitalExample()
# obj.density.type = obj.density.INCOMPRESSIBLE_POLYNOMIAL
# obj.density.coeffs = np.ones((3,5))
# print(obj.density.coeffs)
# obj.density.fitCoeffs(obj.temperature.data,obj.concentration.data)
# print(obj.density.coeffs)
# print(obj.density.data[2][0],obj.rho(obj.temperature.data[2],10e5,obj.concentration.data[0]))
# print(obj.density.data[2][2],obj.rho(obj.temperature.data[2],10e5,obj.concentration.data[2]))
tmp[2][0] = array[2]
tmp[2][1] = array[8]
tmp[2][2] = array[13]
tmp[2][3] = array[17]
tmp[3][0] = array[3]
tmp[3][1] = array[9]
tmp[3][2] = array[14]
tmp[4][0] = array[4]
tmp[4][1] = array[10]
tmp[5][0] = array[5]
# Concentration is no longer handled in per cent!
for i in range(6):
tmp[i] *= 100.0**i
return tmp.T
def convertMelinderMatrix(self, array):
"""Function to convert the full coefficient array
from the very first CoolProp implementation
based on the book by Melinder"""
if len(array)!=18:
raise ValueError("The lenght is not equal to 18!")
if len(array[0])!=5:
raise ValueError("The lenght is not equal to 5!")
array = np.array(array)
tmp = np.zeros((18,5))
for j in range(5):
tmp[ 0][j] = array[ 0][j]
tmp[ 1][j] = array[ 4][j]
tmp[ 2][j] = array[ 8][j]
tmp[ 3][j] = array[12][j]
tmp[ 4][j] = array[15][j]
tmp[ 5][j] = array[17][j]
tmp[ 6][j] = array[ 1][j]
tmp[ 7][j] = array[ 5][j]
tmp[ 8][j] = array[ 9][j]
tmp[ 9][j] = array[13][j]
tmp[10][j] = array[16][j]
tmp[11][j] = array[ 2][j]
tmp[12][j] = array[ 6][j]
tmp[13][j] = array[10][j]
tmp[14][j] = array[14][j]
tmp[15][j] = array[ 3][j]
tmp[16][j] = array[ 7][j]
tmp[17][j] = array[11][j]
return tmp
def setMelinderMatrix(self, matrix):
# matrix = np.array([
# [-26.29 , 958.1 ,3887 , 0.4175 , 1.153 ],
# [ -0.000002575 , -0.4151 , 7.201 , 0.0007271 , -0.03866 ],
# [ -0.000006732 , -0.002261 , -0.08979 , 0.0000002823 , 0.0002779 ],
# [ 0.000000163 , 0.0000002998 , -0.000439 , 0.000000009718 , -0.000001543 ],
# [ -1.187 , -1.391 , -18.5 , -0.004421 , 0.005448 ],
# [ -0.00001609 , -0.0151 , 0.2984 , -0.00002952 , 0.0001008 ],
# [ 0.000000342 , 0.0001113 , -0.001865 , 0.00000007336 , -0.000002809 ],
# [ 0.0000000005687, -0.0000003264 , -0.00001718 , 0.0000000004328 , 0.000000009811 ],
# [ -0.01218 , -0.01105 , -0.03769 , 0.00002044 , -0.0005552 ],
# [ 0.0000003865 , 0.0001828 , -0.01196 , 0.0000003413 , 0.000008384 ],
# [ 0.000000008768 , -0.000001641 , 0.00009801 , -0.000000003665 , -0.00000003997 ],
# [ -0.0000000002095, 0.0000000151 , 0.000000666 , -0.00000000002791 , -0.0000000003466 ],
# [ -0.00006823 , -0.0001208 , -0.003776 , 0.0000002943 , 0.000003038 ],
# [ 0.00000002137 , 0.000002992 , -0.00005611 , -0.0000000009646 , -0.00000007435 ],
# [ -0.0000000004271, 0.000000001455, -0.0000007811, 0.00000000003174 , 0.0000000007442 ],
# [ 0.0000001297 , 0.000004927 , -0.0001504 , -0.0000000008666 , 0.00000006669 ],
# [ -0.0000000005407, -0.0000001325 , 0.000007373 , -0.0000000000004573, -0.0000000009105 ],
# [ 0.00000002363 , -0.00000007727 , 0.000006433 , -0.0000000002033 , -0.0000000008472 ]
# ])
coeffs = self.convertMelinderMatrix(matrix).T
self.T_freeze.type = self.T_freeze.INCOMPRESSIBLE_POLYNOMIAL
self.T_freeze.coeffs = self.convertMelinderArray(coeffs[0])
self.density.type = self.density.INCOMPRESSIBLE_POLYNOMIAL
self.density.coeffs = self.convertMelinderArray(coeffs[1])
self.specific_heat.type = self.specific_heat.INCOMPRESSIBLE_POLYNOMIAL
self.specific_heat.coeffs = self.convertMelinderArray(coeffs[2])
self.conductivity.type = self.conductivity.INCOMPRESSIBLE_POLYNOMIAL
self.conductivity.coeffs = self.convertMelinderArray(coeffs[3])
self.viscosity.type = self.viscosity.INCOMPRESSIBLE_POLYNOMIAL
self.viscosity.coeffs = self.convertMelinderArray(coeffs[4])

View File

@@ -9,43 +9,8 @@ from the equations from the publication to the standard
parameter form.
"""
import numpy as np
from CPIncomp.DataObjects import DigitalData
from CPIncomp.DataObjects import PureData
class NitrateSalt(PureData,DigitalData):
"""
Heat transfer fluid based on 60% NaNO3 and 40% KNO3
"""
def __init__(self):
DigitalData.__init__(self)
PureData.__init__(self)
self.name = "NaK"
self.description = "NitrateSalt"
self.reference = "Solar Power Tower Design Basis Document, Alexis B. Zavoico, Sandia Labs, USA"
self.Tmin = 300 + 273.15
self.Tmax = 600 + 273.15
self.TminPsat = self.Tmax
self.temperature.data = self.getTrange()
self.concentration.data = np.array([ 0 ]) # mass fraction
def f_rho( T,x):
return 2090 - 0.636 * (T-273.15)
def f_cp( T,x):
return 1443 + 0.172 * (T-273.15)
def f_mu( T,x):
return ( 22.714 - 0.120 * (T-273.15) + 2.281 * 1e-4 * (T-273.15)*(T-273.15) - 1.474 * 1e-7 * (T-273.15)*(T-273.15)*(T-273.15) )/1e3
def f_lam( T,x):
return 0.443 + 1.9e-4 * (T-273.15)
self.density.data = self.getArray(f_rho,'D')
self.specific_heat.data = self.getArray(f_cp ,'C')
self.viscosity.data = self.getArray(f_mu ,'V')
self.conductivity.data = self.getArray(f_lam,'L')
from __future__ import division, print_function
from CPIncomp.DataObjects import DigitalData
class LiBrData(DigitalData):
"""
@@ -60,12 +25,12 @@ class LiBrData(DigitalData):
self.description = "Lithium-Bromide solution from Patek2006"
self.reference = "Patek2006"
self.Tmin = 273.00;
self.Tmax = 500.00;
self.Tmin = 273.00
self.Tmax = 500.00
self.xmax = 0.75
self.xmin = 0.00
self.xid = self.ifrac_mass
self.TminPsat = self.Tmin;
self.TminPsat = self.Tmin
self.temperature.data = self.getTrange()
self.concentration.data = self.getxrange()
@@ -95,5 +60,3 @@ class LiBrData(DigitalData):
return CP.PropsSI(key,'T',T,'P',1e8,self.name+"-{0:.4f}%".format(x*100.0))
self.saturation_pressure.data = self.getArray(funcP,key)

View File

@@ -0,0 +1,240 @@
from __future__ import division, print_function
import numpy as np
from CPIncomp.DataObjects import PureData, SolutionData, DigitalData,\
CoefficientData
class PureExample(PureData):
def __init__(self):
PureData.__init__(self)
self.name = "ExamplePure"
self.description = "Heat transfer fluid TherminolD12 by Solutia"
self.reference = "Solutia data sheet"
self.Tmax = 150 + 273.15
self.Tmin = 50 + 273.15
self.TminPsat = self.Tmax
self.temperature.data = np.array([ 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150])+273.15 # Kelvin
self.density.data = np.array([ 740, 733, 726, 717, 710, 702, 695, 687, 679, 670, 662]) # kg/m3
self.specific_heat.data = np.array([ 2235, 2280, 2326, 2361, 2406, 2445, 2485, 2528, 2571, 2607, 2645]) # J/kg-K
self.viscosity.data = np.array([0.804, 0.704, 0.623, 0.556, 0.498, 0.451, 0.410, 0.374, 0.346, 0.317, 0.289]) # Pa-s
self.conductivity.data = np.array([0.105, 0.104, 0.102, 0.100, 0.098, 0.096, 0.095, 0.093, 0.091, 0.089, 0.087]) # W/m-K
self.saturation_pressure.data = np.array([ 0.5, 0.9, 1.4, 2.3, 3.9, 6.0, 8.7, 12.4, 17.6, 24.4, 33.2]) # Pa
self.reshapeAll()
class SolutionExample(SolutionData):
def __init__(self):
SolutionData.__init__(self)
self.name = "ExampleSolution"
self.description = "Ethanol ice slurry"
self.reference = "SecCool software"
self.temperature.data = np.array([ -45 , -40 , -35 , -30 , -25 , -20 , -15 , -10])+273.15 # Kelvin
self.concentration.data = np.array([ 5 , 10 , 15 , 20 , 25 , 30 , 35 ])/100.0 # mass fraction
self.density.data = np.array([
[1064.0, 1054.6, 1045.3, 1036.3, 1027.4, 1018.6, 1010.0],
[1061.3, 1052.1, 1043.1, 1034.3, 1025.6, 1017.0, 1008.6],
[1057.6, 1048.8, 1040.1, 1031.5, 1023.1, 1014.8, 1006.7],
[1053.1, 1044.6, 1036.2, 1028.0, 1019.9, 1012.0, 1004.1],
[1047.5, 1039.4, 1031.5, 1023.7, 1016.0, 1008.4, 1000.9],
[1040.7, 1033.2, 1025.7, 1018.4, 1011.2, 1004.0, 997.0],
[1032.3, 1025.3, 1018.5, 1011.7, 1005.1, 998.5, 992.0],
[1021.5, 1015.3, 1009.2, 1003.1, 997.1, 991.2, 985.4]]) # kg/m3
self.specific_heat.data = np.copy(self.density.data)
self.Tmax = np.max(self.temperature.data)
self.Tmin = np.min(self.temperature.data)
self.xmax = np.max(self.concentration.data)
self.xmin = np.min(self.concentration.data)
self.xid = self.ifrac_mass
self.TminPsat = self.Tmax
class DigitalExample(DigitalData):
def __init__(self):
DigitalData.__init__(self)
self.name = "ExampleDigital"
self.description = "some fluid"
self.reference = "none"
self.Tmin = 273.00;
self.Tmax = 500.00;
self.xmax = 1.0
self.xmin = 0.0
self.xid = self.ifrac_mass
self.TminPsat = self.Tmin;
self.temperature.data = self.getTrange()
self.concentration.data = self.getxrange()
def funcRho(T,x):
return T + x*100.0 + T*(x+0.5)
self.density.data = self.getArray(funcRho,"rho")
def funcCp(T,x):
return T + x*50.0 + T*(x+0.6)
self.specific_heat.data = self.getArray(funcCp,"cp")
class SecCoolExample(CoefficientData):
"""
Ethanol-Water mixture according to Melinder book
Source: SecCool Software
"""
def __init__(self):
CoefficientData.__init__(self)
self.name = "ExampleSecCool"
self.description = "Methanol solution"
#self.reference = "SecCool software"
self.Tmax = 20 + 273.15
self.Tmin = -50 + 273.15
self.xmax = 0.5
self.xmin = 0.0
self.xid = self.ifrac_mass
self.TminPsat = 20 + 273.15
self.Tbase = -4.48 + 273.15
self.xbase = 31.57 / 100.0
self.density.type = self.density.INCOMPRESSIBLE_POLYNOMIAL
self.density.coeffs = self.convertSecCoolArray(np.array([
960.24665800,
-1.2903839100,
-0.0161042520,
-0.0001969888,
1.131559E-05,
9.181999E-08,
-0.4020348270,
-0.0162463989,
0.0001623301,
4.367343E-06,
1.199000E-08,
-0.0025204776,
0.0001101514,
-2.320217E-07,
7.794999E-08,
9.937483E-06,
-1.346886E-06,
4.141999E-08]))
self.specific_heat.type = self.specific_heat.INCOMPRESSIBLE_POLYNOMIAL
self.specific_heat.coeffs = self.convertSecCoolArray(np.array([
3822.9712300,
-23.122409500,
0.0678775826,
0.0022413893,
-0.0003045332,
-4.758000E-06,
2.3501449500,
0.1788839410,
0.0006828000,
0.0002101166,
-9.812000E-06,
-0.0004724176,
-0.0003317949,
0.0001002032,
-5.306000E-06,
4.242194E-05,
2.347190E-05,
-1.894000E-06]))
self.conductivity.type = self.conductivity.INCOMPRESSIBLE_POLYNOMIAL
self.conductivity.coeffs = self.convertSecCoolArray(np.array([
0.4082066700,
-0.0039816870,
1.583368E-05,
-3.552049E-07,
-9.884176E-10,
4.460000E-10,
0.0006629321,
-2.686475E-05,
9.039150E-07,
-2.128257E-08,
-5.562000E-10,
3.685975E-07,
7.188416E-08,
-1.041773E-08,
2.278001E-10,
4.703395E-08,
7.612361E-11,
-2.734000E-10]))
self.viscosity.type = self.viscosity.INCOMPRESSIBLE_EXPPOLYNOMIAL
self.viscosity.coeffs = self.convertSecCoolArray(np.array([
1.4725525500,
0.0022218998,
-0.0004406139,
6.047984E-06,
-1.954730E-07,
-2.372000E-09,
-0.0411841566,
0.0001784479,
-3.564413E-06,
4.064671E-08,
1.915000E-08,
0.0002572862,
-9.226343E-07,
-2.178577E-08,
-9.529999E-10,
-1.699844E-06,
-1.023552E-07,
4.482000E-09]))
self.T_freeze.type = self.T_freeze.INCOMPRESSIBLE_POLYOFFSET
self.T_freeze.coeffs = self.convertSecCoolTfreeze(np.array([
27.755555600,
-22.973221700,
-1.1040507200,
-0.0120762281,
-9.343458E-05]))
class MelinderExample(CoefficientData):
"""
Methanol-Water mixture according to Melinder book
Source: Book
"""
def __init__(self):
CoefficientData.__init__(self)
self.name = "ExampleMelinder"
self.description = "Methanol solution"
self.reference = "Melinder-BOOK-2010"
self.Tmax = 40 + 273.15
self.Tmin = -50 + 273.15
self.xmax = 0.6
self.xmin = 0.0
self.xid = self.ifrac_mass
self.TminPsat = self.Tmax
self.Tbase = 3.5359 + 273.15;
self.xbase = 30.5128 / 100.0
coeffs = np.array([
[-26.29 , 958.1 ,3887 , 0.4175 , 1.153 ],
[ -0.000002575 , -0.4151 , 7.201 , 0.0007271 , -0.03866 ],
[ -0.000006732 , -0.002261 , -0.08979 , 0.0000002823 , 0.0002779 ],
[ 0.000000163 , 0.0000002998 , -0.000439 , 0.000000009718 , -0.000001543 ],
[ -1.187 , -1.391 , -18.5 , -0.004421 , 0.005448 ],
[ -0.00001609 , -0.0151 , 0.2984 , -0.00002952 , 0.0001008 ],
[ 0.000000342 , 0.0001113 , -0.001865 , 0.00000007336 , -0.000002809 ],
[ 0.0000000005687, -0.0000003264 , -0.00001718 , 0.0000000004328 , 0.000000009811 ],
[ -0.01218 , -0.01105 , -0.03769 , 0.00002044 , -0.0005552 ],
[ 0.0000003865 , 0.0001828 , -0.01196 , 0.0000003413 , 0.000008384 ],
[ 0.000000008768 , -0.000001641 , 0.00009801 , -0.000000003665 , -0.00000003997 ],
[ -0.0000000002095, 0.0000000151 , 0.000000666 , -0.00000000002791 , -0.0000000003466 ],
[ -0.00006823 , -0.0001208 , -0.003776 , 0.0000002943 , 0.000003038 ],
[ 0.00000002137 , 0.000002992 , -0.00005611 , -0.0000000009646 , -0.00000007435 ],
[ -0.0000000004271, 0.000000001455, -0.0000007811, 0.00000000003174 , 0.0000000007442 ],
[ 0.0000001297 , 0.000004927 , -0.0001504 , -0.0000000008666 , 0.00000006669 ],
[ -0.0000000005407, -0.0000001325 , 0.000007373 , -0.0000000000004573, -0.0000000009105 ],
[ 0.00000002363 , -0.00000007727 , 0.000006433 , -0.0000000002033 , -0.0000000008472 ]
])
self.setMelinderMatrix(coeffs)

View File

@@ -1,6 +1,6 @@
from __future__ import division, print_function
import numpy as np
from CPIncomp.CoefficientObjects import CoefficientData
from CPIncomp.DataObjects import PureData
from CPIncomp.DataObjects import PureData,CoefficientData
class DEBLiquidClass(CoefficientData,PureData):

View File

@@ -1,7 +1,6 @@
from __future__ import division, print_function
import numpy as np
from CPIncomp.DataObjects import PureData
from CPIncomp.DataObjects import PureData
class TherminolD12(PureData):
"""
@@ -50,26 +49,12 @@ class Therminol66(PureData):
"""
def __init__(self):
PureData.__init__(self)
temp = np.linspace(0, 380, 30) # Celsius temperaure
def f_rho( T_C):
return -0.614254 * T_C - 0.000321 * T_C**2 + 1020.62
def f_cp( T_C):
return 0.003313 * T_C + 0.0000008970785 * T_C**2 + 1.496005
def f_mu( T_C):
return np.exp(586.375/(T_C+62.5) -2.2809 )
def f_lam( T_C):
return -0.000033 * T_C - 0.00000015 * T_C**2 + 0.118294
def f_psa( T_C):
return np.exp(-9094.51/(T_C+340) + 17.6371 )
self.temperature.data = temp + 273.15 # Kelvin
self.density.data = f_rho(temp) # kg/m3
self.specific_heat.data = f_cp(temp)*1e3 # J/kg-K
self.conductivity.data = f_lam(temp) # W/m-K
# Viscosity: Pa-s (dynamic = kinematic * rho)
# mm2/s /1e6 -> m2/s * kg/m3 = kg/s/m = Pa s
self.viscosity.data = f_mu(temp)/1e6 * self.density.data
self.saturation_pressure.data = f_psa(temp) * 1e3 # Pa
self.temperature.data = np.array([2.7315E+02, 2.8315E+02, 2.9315E+02, 3.0315E+02, 3.1315E+02, 3.2315E+02, 3.3315E+02, 3.4315E+02, 3.5315E+02, 3.6315E+02, 3.7315E+02, 3.8315E+02, 3.9315E+02, 4.0315E+02, 4.1315E+02, 4.2315E+02, 4.3315E+02, 4.4315E+02, 4.5315E+02, 4.6315E+02, 4.7315E+02, 4.8315E+02, 4.9315E+02, 5.0315E+02, 5.1315E+02, 5.2315E+02, 5.3315E+02, 5.4315E+02, 5.5315E+02, 5.6315E+02, 5.7315E+02, 5.8315E+02, 5.9315E+02, 6.0315E+02, 6.1315E+02, 6.2315E+02, 6.3315E+02, 6.4315E+02, 6.5315E+02])
self.density.data = np.array([1.0215E+03, 1.0149E+03, 1.0084E+03, 1.0018E+03, 9.9520E+02, 9.8860E+02, 9.8190E+02, 9.7520E+02, 9.6850E+02, 9.6180E+02, 9.5500E+02, 9.4820E+02, 9.4140E+02, 9.3450E+02, 9.2760E+02, 9.2060E+02, 9.1360E+02, 9.0660E+02, 8.9950E+02, 8.9230E+02, 8.8510E+02, 8.7780E+02, 8.7040E+02, 8.6300E+02, 8.5550E+02, 8.4790E+02, 8.4030E+02, 8.3250E+02, 8.2460E+02, 8.1660E+02, 8.0850E+02, 8.0030E+02, 7.9200E+02, 7.8350E+02, 7.7480E+02, 7.6590E+02, 7.5690E+02, 7.4770E+02, 7.3820E+02])
self.specific_heat.data = np.array([1.4950E+03, 1.5290E+03, 1.5620E+03, 1.5960E+03, 1.6300E+03, 1.6650E+03, 1.6990E+03, 1.7330E+03, 1.7680E+03, 1.8030E+03, 1.8370E+03, 1.8730E+03, 1.9080E+03, 1.9430E+03, 1.9780E+03, 2.0140E+03, 2.0500E+03, 2.0860E+03, 2.1220E+03, 2.1580E+03, 2.1950E+03, 2.2310E+03, 2.2680E+03, 2.3050E+03, 2.3420E+03, 2.3790E+03, 2.4170E+03, 2.4550E+03, 2.4920E+03, 2.5310E+03, 2.5690E+03, 2.6080E+03, 2.6470E+03, 2.6860E+03, 2.7260E+03, 2.7660E+03, 2.8060E+03, 2.8470E+03, 2.8890E+03])
self.conductivity.data = np.array([1.1800E-01, 1.1800E-01, 1.1800E-01, 1.1700E-01, 1.1700E-01, 1.1600E-01, 1.1600E-01, 1.1500E-01, 1.1500E-01, 1.1400E-01, 1.1400E-01, 1.1300E-01, 1.1200E-01, 1.1100E-01, 1.1100E-01, 1.1000E-01, 1.0900E-01, 1.0800E-01, 1.0700E-01, 1.0700E-01, 1.0600E-01, 1.0500E-01, 1.0400E-01, 1.0300E-01, 1.0200E-01, 1.0000E-01, 9.9000E-02, 9.8000E-02, 9.7000E-02, 9.6000E-02, 9.5000E-02, 9.3000E-02, 9.2000E-02, 9.1000E-02, 8.9000E-02, 8.8000E-02, 8.6000E-02, 8.5000E-02, 8.4000E-02])
self.viscosity.data = np.array([1.3249E+00, 3.4426E-01, 1.2347E-01, 5.5600E-02, 2.9500E-02, 1.7640E-02, 1.1530E-02, 8.0600E-03, 5.9300E-03, 4.5500E-03, 3.6000E-03, 2.9200E-03, 2.4200E-03, 2.0500E-03, 1.7500E-03, 1.5200E-03, 1.3400E-03, 1.1800E-03, 1.0600E-03, 9.5000E-04, 8.6000E-04, 7.8000E-04, 7.2000E-04, 6.6000E-04, 6.1000E-04, 5.7000E-04, 5.3000E-04, 4.9000E-04, 4.6000E-04, 4.4000E-04, 4.1000E-04, 3.9000E-04, 3.7000E-04, 3.5000E-04, 3.4000E-04, 3.2000E-04, 3.1000E-04, 3.0000E-04, 2.8000E-04])
self.saturation_pressure.data = np.array([ np.NAN, np.NAN, np.NAN, np.NAN, np.NAN, np.NAN, np.NAN, 1.0000E+01, 2.0000E+01, 3.0000E+01, 5.0000E+01, 8.0000E+01, 1.2000E+02, 1.8000E+02, 2.7000E+02, 4.0000E+02, 5.8000E+02, 8.3000E+02, 1.1700E+03, 1.6200E+03, 2.2300E+03, 3.0200E+03, 4.0600E+03, 5.3900E+03, 7.1000E+03, 9.2500E+03, 1.1950E+04, 1.5310E+04, 1.9460E+04, 2.4550E+04, 3.0730E+04, 3.8220E+04, 4.7200E+04, 5.7940E+04, 7.0680E+04, 8.5740E+04, 1.0342E+05, 1.2409E+05, 1.4813E+05])
self.Tmin = np.min(self.temperature.data)
self.Tmax = np.max(self.temperature.data)
self.TminPsat = 70+273.15
@@ -287,206 +272,3 @@ class HC10(PureData):
self.reference = "Dynalene data sheet"
self.reshapeAll()
#
#class AS10(PureData):
# """
# Heat transfer fluid Aspen Temper -10 by Aspen Petroleum
# """
# def __init__(self):
# PureData.__init__(self)
# self.temperature.data = np.array([2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02]) # Kelvin
# self.density.data = np.array([1.09160E+03, 1.09060E+03, 1.08960E+03, 1.08860E+03, 1.08760E+03, 1.08660E+03, 1.08560E+03, 1.08460E+03]) # kg/m3
# self.specific_heat.data = np.array([3.52460E+03, 3.53540E+03, 3.54550E+03, 3.55500E+03, 3.56380E+03, 3.57190E+03, 3.57940E+03, 3.58620E+03]) # J/kg-K
# self.conductivity.data = np.array([5.02200E-01, 5.09600E-01, 5.17000E-01, 5.24400E-01, 5.31800E-01, 5.39200E-01, 5.46700E-01, 5.54100E-01]) # W/m-K
# self.viscosity.data = np.array([3.83600E-03, 3.16000E-03, 2.61300E-03, 2.17700E-03, 1.83700E-03, 1.57700E-03, 1.38200E-03, 1.23500E-03]) # Pa-s
# self.Tmin = np.min(self.temperature.data)
# self.Tmax = np.max(self.temperature.data)
# self.TminPsat = self.Tmax
# self.name = "AS10"
# self.description = "Aspen Temper -10"
# self.reference = "SecCool Software"
# self.reshapeAll()
#
#
#class AS20(PureData):
# """
# Heat transfer fluid Aspen Temper -20 by Aspen Petroleum
# """
# def __init__(self):
# PureData.__init__(self)
# self.temperature.data = np.array([2.55000E+02, 2.60000E+02, 2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02]) # Kelvin
# self.density.data = np.array([1.15050E+03, 1.14970E+03, 1.14870E+03, 1.14770E+03, 1.14660E+03, 1.14540E+03, 1.14420E+03, 1.14290E+03, 1.14150E+03, 1.14000E+03]) # kg/m3
# self.specific_heat.data = np.array([3.20660E+03, 3.22280E+03, 3.23840E+03, 3.25340E+03, 3.26780E+03, 3.28150E+03, 3.29470E+03, 3.30720E+03, 3.31920E+03, 3.33050E+03]) # J/kg-K
# self.conductivity.data = np.array([4.56400E-01, 4.63100E-01, 4.69800E-01, 4.76500E-01, 4.83200E-01, 4.90000E-01, 4.96700E-01, 5.03400E-01, 5.10100E-01, 5.16800E-01]) # W/m-K
# self.viscosity.data = np.array([7.43800E-03, 5.91400E-03, 4.74900E-03, 3.85900E-03, 3.17900E-03, 2.65900E-03, 2.26100E-03, 1.95800E-03, 1.72500E-03, 1.54800E-03]) # Pa-s
# self.Tmin = np.min(self.temperature.data)
# self.Tmax = np.max(self.temperature.data)
# self.TminPsat = self.Tmax
# self.name = "AS20"
# self.description = "Aspen Temper -20"
# self.reference = "SecCool Software"
# self.reshapeAll()
#
#
#class AS30(PureData):
# """
# Heat transfer fluid Aspen Temper -30 by Aspen Petroleum
# """
# def __init__(self):
# PureData.__init__(self)
# self.temperature.data = np.array([2.45000E+02, 2.50000E+02, 2.55000E+02, 2.60000E+02, 2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02]) # Kelvin
# self.density.data = np.array([1.19140E+03, 1.19030E+03, 1.18910E+03, 1.18770E+03, 1.18630E+03, 1.18480E+03, 1.18330E+03, 1.18170E+03, 1.18010E+03, 1.17840E+03, 1.17680E+03, 1.17510E+03]) # kg/m3
# self.specific_heat.data = np.array([2.96950E+03, 2.99130E+03, 3.01190E+03, 3.03100E+03, 3.04890E+03, 3.06540E+03, 3.08050E+03, 3.09430E+03, 3.10670E+03, 3.11770E+03, 3.12750E+03, 3.13580E+03]) # J/kg-K
# self.conductivity.data = np.array([4.25000E-01, 4.31300E-01, 4.37600E-01, 4.43900E-01, 4.50200E-01, 4.56400E-01, 4.62700E-01, 4.69000E-01, 4.75300E-01, 4.81600E-01, 4.87800E-01, 4.94100E-01]) # W/m-K
# self.viscosity.data = np.array([1.56400E-02, 1.19300E-02, 9.17800E-03, 7.14000E-03, 5.62900E-03, 4.50900E-03, 3.67900E-03, 3.06400E-03, 2.60800E-03, 2.27000E-03, 2.01900E-03, 1.83400E-03]) # Pa-s
# self.Tmin = np.min(self.temperature.data)
# self.Tmax = np.max(self.temperature.data)
# self.TminPsat = self.Tmax
# self.name = "AS30"
# self.description = "Aspen Temper -30"
# self.reference = "SecCool Software"
# self.reshapeAll()
#
#
#class AS40(PureData):
# """
# Heat transfer fluid Aspen Temper -40 by Aspen Petroleum
# """
# def __init__(self):
# PureData.__init__(self)
# self.temperature.data = np.array([2.35000E+02, 2.40000E+02, 2.45000E+02, 2.50000E+02, 2.55000E+02, 2.60000E+02, 2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02]) # Kelvin
# self.density.data = np.array([1.22670E+03, 1.22560E+03, 1.22420E+03, 1.22280E+03, 1.22120E+03, 1.21960E+03, 1.21780E+03, 1.21600E+03, 1.21410E+03, 1.21220E+03, 1.21020E+03, 1.20820E+03, 1.20620E+03, 1.20420E+03]) # kg/m3
# self.specific_heat.data = np.array([2.83450E+03, 2.85970E+03, 2.88300E+03, 2.90430E+03, 2.92370E+03, 2.94120E+03, 2.95670E+03, 2.97030E+03, 2.98200E+03, 2.99170E+03, 2.99950E+03, 3.00530E+03, 3.00920E+03, 3.01120E+03]) # J/kg-K
# self.conductivity.data = np.array([4.01400E-01, 4.06900E-01, 4.12400E-01, 4.17900E-01, 4.23400E-01, 4.28900E-01, 4.34400E-01, 4.39900E-01, 4.45400E-01, 4.50900E-01, 4.56400E-01, 4.61800E-01, 4.67300E-01, 4.72800E-01]) # W/m-K
# self.viscosity.data = np.array([4.43400E-02, 3.01000E-02, 2.10800E-02, 1.52600E-02, 1.14300E-02, 8.84100E-03, 7.03900E-03, 5.74200E-03, 4.77600E-03, 4.03200E-03, 3.44300E-03, 2.96300E-03, 2.56600E-03, 2.23100E-03]) # Pa-s
# self.Tmin = np.min(self.temperature.data)
# self.Tmax = np.max(self.temperature.data)
# self.TminPsat = self.Tmax
# self.name = "AS40"
# self.description = "Aspen Temper -40"
# self.reference = "SecCool Software"
# self.reshapeAll()
#
#
#class AS55(PureData):
# """
# Heat transfer fluid Aspen Temper -55 by Aspen Petroleum
# """
# def __init__(self):
# PureData.__init__(self)
# self.temperature.data = np.array([2.20000E+02, 2.25000E+02, 2.30000E+02, 2.35000E+02, 2.40000E+02, 2.45000E+02, 2.50000E+02, 2.55000E+02, 2.60000E+02, 2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02]) # Kelvin
# self.density.data = np.array([1.26880E+03, 1.26780E+03, 1.26650E+03, 1.26510E+03, 1.26350E+03, 1.26180E+03, 1.25990E+03, 1.25790E+03, 1.25580E+03, 1.25350E+03, 1.25120E+03, 1.24890E+03, 1.24640E+03, 1.24400E+03, 1.24150E+03, 1.23900E+03, 1.23650E+03]) # kg/m3
# self.specific_heat.data = np.array([2.64790E+03, 2.67190E+03, 2.69470E+03, 2.71630E+03, 2.73660E+03, 2.75570E+03, 2.77350E+03, 2.79010E+03, 2.80540E+03, 2.81950E+03, 2.83240E+03, 2.84400E+03, 2.85440E+03, 2.86350E+03, 2.87140E+03, 2.87800E+03, 2.88340E+03]) # J/kg-K
# self.conductivity.data = np.array([3.82400E-01, 3.85900E-01, 3.89600E-01, 3.93300E-01, 3.97200E-01, 4.01200E-01, 4.05300E-01, 4.09500E-01, 4.13900E-01, 4.18300E-01, 4.22900E-01, 4.27500E-01, 4.32300E-01, 4.37200E-01, 4.42300E-01, 4.47400E-01, 4.52600E-01]) # W/m-K
# self.viscosity.data = np.array([2.93600E-01, 1.62700E-01, 9.44200E-02, 5.79500E-02, 3.78300E-02, 2.62200E-02, 1.91500E-02, 1.45600E-02, 1.14000E-02, 9.10600E-03, 7.36900E-03, 6.01200E-03, 4.93000E-03, 4.05600E-03, 3.34300E-03, 2.75900E-03, 2.27800E-03]) # Pa-s
# self.Tmin = np.min(self.temperature.data)
# self.Tmax = np.max(self.temperature.data)
# self.TminPsat = self.Tmax
# self.name = "AS55"
# self.description = "Aspen Temper -55"
# self.reference = "SecCool Software"
# self.reshapeAll()
#
#
#class ZS10(PureData):
# """
# Heat transfer fluid Zitrec S -10 by Arteco
# """
# def __init__(self):
# PureData.__init__(self)
# self.temperature.data = np.array([2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02, 3.05000E+02, 3.10000E+02, 3.15000E+02, 3.20000E+02, 3.25000E+02, 3.30000E+02, 3.35000E+02, 3.40000E+02, 3.45000E+02, 3.50000E+02, 3.55000E+02, 3.60000E+02]) # Kelvin
# self.density.data = np.array([1.10250E+03, 1.10020E+03, 1.09790E+03, 1.09550E+03, 1.09320E+03, 1.09090E+03, 1.08860E+03, 1.08630E+03, 1.08390E+03, 1.08160E+03, 1.07930E+03, 1.07700E+03, 1.07470E+03, 1.07230E+03, 1.07000E+03, 1.06770E+03, 1.06540E+03, 1.06300E+03, 1.06070E+03, 1.05840E+03]) # kg/m3
# self.specific_heat.data = np.array([3.54260E+03, 3.55520E+03, 3.56720E+03, 3.57880E+03, 3.59000E+03, 3.60070E+03, 3.61090E+03, 3.62060E+03, 3.62990E+03, 3.63870E+03, 3.64710E+03, 3.65500E+03, 3.66240E+03, 3.66940E+03, 3.67590E+03, 3.68190E+03, 3.68750E+03, 3.69260E+03, 3.69720E+03, 3.70140E+03]) # J/kg-K
# self.conductivity.data = np.array([4.99700E-01, 5.06300E-01, 5.13000E-01, 5.19600E-01, 5.26200E-01, 5.32800E-01, 5.39400E-01, 5.45900E-01, 5.52500E-01, 5.59000E-01, 5.65500E-01, 5.72000E-01, 5.78500E-01, 5.84900E-01, 5.91400E-01, 5.97800E-01, 6.04300E-01, 6.10700E-01, 6.17100E-01, 6.23400E-01]) # W/m-K
# self.viscosity.data = np.array([4.51900E-03, 3.75000E-03, 3.14500E-03, 2.66500E-03, 2.28200E-03, 1.97200E-03, 1.72000E-03, 1.51300E-03, 1.34200E-03, 1.20000E-03, 1.08100E-03, 9.80000E-04, 8.94000E-04, 8.21000E-04, 7.58000E-04, 7.03000E-04, 6.56000E-04, 6.14000E-04, 5.77000E-04, 5.44000E-04]) # Pa-s
# self.Tmin = np.min(self.temperature.data)
# self.Tmax = np.max(self.temperature.data)
# self.TminPsat = self.Tmax
# self.name = "ZS10"
# self.description = "Zitrec S -10"
# self.reference = "SecCool Software"
# self.reshapeAll()
#
#
#class ZS25(PureData):
# """
# Heat transfer fluid Zitrec S -25 by Arteco
# """
# def __init__(self):
# PureData.__init__(self)
# self.temperature.data = np.array([2.50000E+02, 2.55000E+02, 2.60000E+02, 2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02, 3.05000E+02, 3.10000E+02, 3.15000E+02, 3.20000E+02, 3.25000E+02, 3.30000E+02, 3.35000E+02, 3.40000E+02, 3.45000E+02, 3.50000E+02, 3.55000E+02, 3.60000E+02]) # Kelvin
# self.density.data = np.array([1.20620E+03, 1.20360E+03, 1.20090E+03, 1.19820E+03, 1.19560E+03, 1.19290E+03, 1.19030E+03, 1.18760E+03, 1.18490E+03, 1.18230E+03, 1.17960E+03, 1.17690E+03, 1.17430E+03, 1.17160E+03, 1.16890E+03, 1.16630E+03, 1.16360E+03, 1.16100E+03, 1.15830E+03, 1.15560E+03, 1.15300E+03, 1.15030E+03, 1.14760E+03]) # kg/m3
# self.specific_heat.data = np.array([3.17680E+03, 3.17880E+03, 3.18090E+03, 3.18290E+03, 3.18500E+03, 3.18710E+03, 3.18920E+03, 3.19130E+03, 3.19340E+03, 3.19550E+03, 3.19760E+03, 3.19980E+03, 3.20200E+03, 3.20410E+03, 3.20630E+03, 3.20850E+03, 3.21070E+03, 3.21290E+03, 3.21520E+03, 3.21740E+03, 3.21970E+03, 3.22200E+03, 3.22420E+03]) # J/kg-K
# self.conductivity.data = np.array([4.43000E-01, 4.49600E-01, 4.56200E-01, 4.62700E-01, 4.69200E-01, 4.75600E-01, 4.81900E-01, 4.88200E-01, 4.94400E-01, 5.00600E-01, 5.06700E-01, 5.12700E-01, 5.18700E-01, 5.24600E-01, 5.30400E-01, 5.36200E-01, 5.42000E-01, 5.47700E-01, 5.53300E-01, 5.58800E-01, 5.64300E-01, 5.69800E-01, 5.75200E-01]) # W/m-K
# self.viscosity.data = np.array([1.06800E-02, 8.37400E-03, 6.68600E-03, 5.42800E-03, 4.47800E-03, 3.74900E-03, 3.18300E-03, 2.73800E-03, 2.38400E-03, 2.10000E-03, 1.86800E-03, 1.67800E-03, 1.52000E-03, 1.38800E-03, 1.27500E-03, 1.17900E-03, 1.09500E-03, 1.02100E-03, 9.55000E-04, 8.95000E-04, 8.40000E-04, 7.89000E-04, 7.40000E-04]) # Pa-s
# self.Tmin = np.min(self.temperature.data)
# self.Tmax = np.max(self.temperature.data)
# self.TminPsat = self.Tmax
# self.name = "ZS25"
# self.description = "Zitrec S -25"
# self.reference = "SecCool Software"
# self.reshapeAll()
#
#
#class ZS40(PureData):
# """
# Heat transfer fluid Zitrec S -40 by Arteco
# """
# def __init__(self):
# PureData.__init__(self)
# self.temperature.data = np.array([2.35000E+02, 2.40000E+02, 2.45000E+02, 2.50000E+02, 2.55000E+02, 2.60000E+02, 2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02, 3.05000E+02, 3.10000E+02, 3.15000E+02, 3.20000E+02, 3.25000E+02, 3.30000E+02, 3.35000E+02, 3.40000E+02, 3.45000E+02, 3.50000E+02, 3.55000E+02, 3.60000E+02]) # Kelvin
# self.density.data = np.array([1.28360E+03, 1.28080E+03, 1.27800E+03, 1.27510E+03, 1.27230E+03, 1.26940E+03, 1.26660E+03, 1.26380E+03, 1.26090E+03, 1.25810E+03, 1.25530E+03, 1.25240E+03, 1.24960E+03, 1.24680E+03, 1.24390E+03, 1.24110E+03, 1.23820E+03, 1.23540E+03, 1.23260E+03, 1.22970E+03, 1.22690E+03, 1.22410E+03, 1.22120E+03, 1.21840E+03, 1.21550E+03, 1.21270E+03]) # kg/m3
# self.specific_heat.data = np.array([2.69640E+03, 2.70500E+03, 2.71320E+03, 2.72100E+03, 2.72850E+03, 2.73570E+03, 2.74260E+03, 2.74940E+03, 2.75600E+03, 2.76250E+03, 2.76900E+03, 2.77540E+03, 2.78190E+03, 2.78850E+03, 2.79530E+03, 2.80220E+03, 2.80930E+03, 2.81670E+03, 2.82440E+03, 2.83250E+03, 2.84100E+03, 2.85000E+03, 2.85950E+03, 2.86950E+03, 2.88010E+03, 2.89140E+03]) # J/kg-K
# self.conductivity.data = np.array([4.15100E-01, 4.20500E-01, 4.25800E-01, 4.31200E-01, 4.36500E-01, 4.41800E-01, 4.47200E-01, 4.52500E-01, 4.57800E-01, 4.63100E-01, 4.68400E-01, 4.73600E-01, 4.78900E-01, 4.84200E-01, 4.89400E-01, 4.94700E-01, 4.99900E-01, 5.05200E-01, 5.10400E-01, 5.15600E-01, 5.20800E-01, 5.26000E-01, 5.31200E-01, 5.36400E-01, 5.41600E-01, 5.46800E-01]) # W/m-K
# self.viscosity.data = np.array([3.10200E-02, 2.28600E-02, 1.72100E-02, 1.32300E-02, 1.03600E-02, 8.26100E-03, 6.70400E-03, 5.53000E-03, 4.63200E-03, 3.93600E-03, 3.38900E-03, 2.95500E-03, 2.60700E-03, 2.32300E-03, 2.09100E-03, 1.89800E-03, 1.73500E-03, 1.59700E-03, 1.47900E-03, 1.37500E-03, 1.28400E-03, 1.20200E-03, 1.12700E-03, 1.05800E-03, 9.93000E-04, 9.30000E-04]) # Pa-s
# self.Tmin = np.min(self.temperature.data)
# self.Tmax = np.max(self.temperature.data)
# self.TminPsat = self.Tmax
# self.name = "ZS40"
# self.description = "Zitrec S -40"
# self.reference = "SecCool Software"
# self.reshapeAll()
#
#
#class ZS45(PureData):
# """
# Heat transfer fluid Zitrec S -45 by Arteco
# """
# def __init__(self):
# PureData.__init__(self)
# self.temperature.data = np.array([2.30000E+02, 2.35000E+02, 2.40000E+02, 2.45000E+02, 2.50000E+02, 2.55000E+02, 2.60000E+02, 2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02, 3.05000E+02, 3.10000E+02, 3.15000E+02, 3.20000E+02, 3.25000E+02, 3.30000E+02, 3.35000E+02, 3.40000E+02, 3.45000E+02, 3.50000E+02, 3.55000E+02, 3.60000E+02]) # Kelvin
# self.density.data = np.array([1.30590E+03, 1.30320E+03, 1.30040E+03, 1.29760E+03, 1.29490E+03, 1.29210E+03, 1.28940E+03, 1.28660E+03, 1.28380E+03, 1.28110E+03, 1.27830E+03, 1.27550E+03, 1.27280E+03, 1.27000E+03, 1.26730E+03, 1.26450E+03, 1.26170E+03, 1.25900E+03, 1.25620E+03, 1.25340E+03, 1.25070E+03, 1.24790E+03, 1.24520E+03, 1.24240E+03, 1.23960E+03, 1.23690E+03, 1.23410E+03]) # kg/m3
# self.specific_heat.data = np.array([2.55240E+03, 2.56350E+03, 2.57450E+03, 2.58550E+03, 2.59650E+03, 2.60760E+03, 2.61860E+03, 2.62960E+03, 2.64070E+03, 2.65170E+03, 2.66270E+03, 2.67370E+03, 2.68480E+03, 2.69580E+03, 2.70680E+03, 2.71790E+03, 2.72890E+03, 2.73990E+03, 2.75090E+03, 2.76200E+03, 2.77300E+03, 2.78400E+03, 2.79510E+03, 2.80610E+03, 2.81710E+03, 2.82810E+03, 2.83920E+03]) # J/kg-K
# self.conductivity.data = np.array([4.06200E-01, 4.11100E-01, 4.15900E-01, 4.20900E-01, 4.25800E-01, 4.30700E-01, 4.35700E-01, 4.40600E-01, 4.45600E-01, 4.50600E-01, 4.55700E-01, 4.60700E-01, 4.65800E-01, 4.70900E-01, 4.76000E-01, 4.81100E-01, 4.86200E-01, 4.91400E-01, 4.96600E-01, 5.01700E-01, 5.07000E-01, 5.12200E-01, 5.17400E-01, 5.22700E-01, 5.28000E-01, 5.33300E-01, 5.38600E-01]) # W/m-K
# self.viscosity.data = np.array([4.97400E-02, 3.53200E-02, 2.57000E-02, 1.91400E-02, 1.45700E-02, 1.13300E-02, 8.99200E-03, 7.27000E-03, 5.98200E-03, 5.00500E-03, 4.25200E-03, 3.66500E-03, 3.20000E-03, 2.82800E-03, 2.52700E-03, 2.28000E-03, 2.07500E-03, 1.90300E-03, 1.75600E-03, 1.62900E-03, 1.51800E-03, 1.41800E-03, 1.32800E-03, 1.24400E-03, 1.16500E-03, 1.08900E-03, 1.01600E-03]) # Pa-s
# self.Tmin = np.min(self.temperature.data)
# self.Tmax = np.max(self.temperature.data)
# self.TminPsat = self.Tmax
# self.name = "ZS45"
# self.description = "Zitrec S -45"
# self.reference = "SecCool Software"
# self.reshapeAll()
#
#
#class ZS55(PureData):
# """
# Heat transfer fluid Zitrec S -55 by Arteco
# """
# def __init__(self):
# PureData.__init__(self)
# self.temperature.data = np.array([2.20000E+02, 2.25000E+02, 2.30000E+02, 2.35000E+02, 2.40000E+02, 2.45000E+02, 2.50000E+02, 2.55000E+02, 2.60000E+02, 2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02, 3.05000E+02, 3.10000E+02, 3.15000E+02, 3.20000E+02, 3.25000E+02, 3.30000E+02, 3.35000E+02, 3.40000E+02, 3.45000E+02, 3.50000E+02, 3.55000E+02, 3.60000E+02]) # Kelvin
# self.density.data = np.array([1.35580E+03, 1.35280E+03, 1.34980E+03, 1.34680E+03, 1.34380E+03, 1.34070E+03, 1.33770E+03, 1.33470E+03, 1.33170E+03, 1.32870E+03, 1.32560E+03, 1.32260E+03, 1.31960E+03, 1.31660E+03, 1.31350E+03, 1.31050E+03, 1.30750E+03, 1.30450E+03, 1.30150E+03, 1.29840E+03, 1.29540E+03, 1.29240E+03, 1.28940E+03, 1.28630E+03, 1.28330E+03, 1.28030E+03, 1.27730E+03, 1.27430E+03, 1.27120E+03]) # kg/m3
# self.specific_heat.data = np.array([2.43970E+03, 2.44650E+03, 2.45350E+03, 2.46070E+03, 2.46810E+03, 2.47580E+03, 2.48380E+03, 2.49190E+03, 2.50030E+03, 2.50900E+03, 2.51780E+03, 2.52700E+03, 2.53630E+03, 2.54590E+03, 2.55570E+03, 2.56580E+03, 2.57610E+03, 2.58660E+03, 2.59740E+03, 2.60840E+03, 2.61970E+03, 2.63120E+03, 2.64290E+03, 2.65480E+03, 2.66700E+03, 2.67950E+03, 2.69210E+03, 2.70500E+03, 2.71820E+03]) # J/kg-K
# self.conductivity.data = np.array([3.93100E-01, 3.97000E-01, 4.01000E-01, 4.05100E-01, 4.09100E-01, 4.13200E-01, 4.17300E-01, 4.21400E-01, 4.25600E-01, 4.29700E-01, 4.33900E-01, 4.38200E-01, 4.42400E-01, 4.46700E-01, 4.51000E-01, 4.55400E-01, 4.59700E-01, 4.64100E-01, 4.68500E-01, 4.73000E-01, 4.77500E-01, 4.82000E-01, 4.86500E-01, 4.91000E-01, 4.95600E-01, 5.00200E-01, 5.04800E-01, 5.09500E-01, 5.14200E-01]) # W/m-K
# self.viscosity.data = np.array([1.44300E-01, 9.52000E-02, 6.46500E-02, 4.51300E-02, 3.23400E-02, 2.37700E-02, 1.78900E-02, 1.37800E-02, 1.08400E-02, 8.69800E-03, 7.11600E-03, 5.92500E-03, 5.01500E-03, 4.31100E-03, 3.75700E-03, 3.31700E-03, 2.96200E-03, 2.67300E-03, 2.43300E-03, 2.23300E-03, 2.06300E-03, 1.91500E-03, 1.78600E-03, 1.67000E-03, 1.56500E-03, 1.46600E-03, 1.37300E-03, 1.28300E-03, 1.19400E-03]) # Pa-s
# self.Tmin = np.min(self.temperature.data)
# self.Tmax = np.max(self.temperature.data)
# self.TminPsat = self.Tmax
# self.name = "ZS55"
# self.description = "Zitrec S -55"
# self.reference = "SecCool Software"
# self.reshapeAll()

View File

@@ -1,11 +1,8 @@
from __future__ import division, absolute_import, print_function
from __future__ import division, print_function
import numpy as np
from CPIncomp.CoefficientObjects import CoefficientData
from CPIncomp.BaseObjects import IncompressibleData
from CPIncomp.DataObjects import DigitalData
import os, CPIncomp
from BaseObjects import IncompressibleData
from DataObjects import DigitalData, PureData
import os, sys
class SecCoolSolutionData(DigitalData):
"""
@@ -162,7 +159,8 @@ class SecCoolSolutionData(DigitalData):
# Redefine some functions to avoid data loss
def getFile(self, data):
return os.path.join(CPIncomp.__path__[0], 'data','SecCool', self.sFolder, self.sFile+"_"+data+".txt")
return os.path.join(os.path.dirname(__file__), 'data','SecCool', self.sFolder, self.sFile+"_"+data+".txt")
def getFromFile(self, data):
fullPath = self.getFile(data)
@@ -179,7 +177,7 @@ class SecCoolSolutionData(DigitalData):
if not self.allowNegativeData and nu<0:
nu = np.NAN # invalid entries
except (ValueError, TypeError) as ve:
#print "Could not convert entry: {0}".format(ve)
if False: print("Could not convert entry: {0}".format(ve))
if i==0: nu = 0.0 # Dummy for tables without concentration (TFreeze and Vol2Mass)
pass
numbers[i,j] = nu
@@ -262,7 +260,7 @@ class SecCoolSolutionData(DigitalData):
sec += [SecCoolSolutionData(sFile='VDI, Sodium Chloride' ,sFolder='xMass',name='VNA' ,desc='VDI, Sodium Chloride' ,ref='VDI Waermeatlas 9th Edition 2002, SecCool software')]
print(", {0}".format(sec[-1].name), end="")
sec += [SecCoolSolutionData(sFile='HFE-7100' ,sFolder='xPure',name='HFE' ,desc='HFE-7100, Hydrofluoroether' ,ref='3M Novec, SecCool software')]
sec += [SecCoolSolutionData(sFile='HFE-7100' ,sFolder='xPure',name='HFE2' ,desc='HFE-7100, Hydrofluoroether' ,ref='3M Novec, SecCool software')]
print(", {0}".format(sec[-1].name), end="")
sec += [SecCoolSolutionData(sFile='NBS, Water' ,sFolder='xPure',name='NBS' ,desc='NBS, Water' ,ref='Properties of Water and Steam in SI-Units, 2nd Revised and Updated Printing, Springer 1979, pp. 175 ff., SecCool software')]
print(", {0}".format(sec[-1].name), end="")
@@ -288,12 +286,750 @@ class SecCoolSolutionData(DigitalData):
print(", {0}".format(sec[-1].name), end="")
sec += [SecCoolSolutionData(sFile='Zitrec S55' ,sFolder='xPure',name='ZS55',desc='Zitrec S55, Potassium formate/Sodium propionate' ,ref='Arteco, SecCool software')]
print(", {0}".format(sec[-1].name), end="")
sec += [SecCoolSolutionData(sFile='Syltherm XLT' ,sFolder='xPure',name='XLT2',desc='Syltherm XLT, Polydimethylsiloxan' ,ref='Dow Chemicals, SecCool software')]
print(", {0}".format(sec[-1].name), end="")
sec += [SecCoolSolutionData(sFile='Dowtherm J' ,sFolder='xPure',name='DowJ2',desc='Dowtherm J, Diethylbenzene mixture' ,ref='Dow Chemicals, SecCool software')]
print(", {0}".format(sec[-1].name), end="")
sec += [SecCoolSolutionData(sFile='Dowtherm Q' ,sFolder='xPure',name='DowQ2',desc='Dowtherm Q, Diphenylethane/alkylated aromatics' ,ref='Dow Chemicals, SecCool software')]
print(", {0}".format(sec[-1].name), end="")
sec += [ThermogenVP1869()]
print(", {0}".format(sec[-1].name), end="")
sec += [Freezium()]
print(", {0}".format(sec[-1].name), end="")
sec += [AS10()]
print(", {0}".format(sec[-1].name), end="")
sec += [AS20()]
print(", {0}".format(sec[-1].name), end="")
sec += [AS30()]
print(", {0}".format(sec[-1].name), end="")
sec += [AS40()]
print(", {0}".format(sec[-1].name), end="")
sec += [AS55()]
print(", {0}".format(sec[-1].name), end="")
print(" ... done")
return sec
class ThermogenVP1869(PureData,DigitalData):
"""
Source: SecCool Software
"""
def __init__(self):
PureData.__init__(self)
DigitalData.__init__(self)
self.name = "TVP1869"
self.description = "Thermogen VP 1869"
self.reference = "Hoechst, SecCool software"
self.Tmax = 20 + 273.15
self.Tmin = -80 + 273.15
self.TminPsat = self.Tmax
self.Tbase = 0.00 + 273.15
self.density.type = self.density.INCOMPRESSIBLE_POLYNOMIAL
self.density.coeffs = np.array([[945.5454545],[-1.054545455]])
self.specific_heat.type = self.specific_heat.INCOMPRESSIBLE_POLYNOMIAL
self.specific_heat.coeffs = np.array([[2.322218182],[0.003843636]])*1000
self.conductivity.type = self.conductivity.INCOMPRESSIBLE_POLYNOMIAL
self.conductivity.coeffs = np.array([[0.15],[-0.000154545]])
self.temperature.data = self.getTrange()
self.concentration.data = np.array([0]) # mass fraction
def fitFluid(self):
key = 'Mu'
def funcMu(T,x):
T = T-self.Tbase
return (341.3688975+T*(-0.713408301+0.017723992*T))/ \
(1+T*(0.034502393+T*(0.000401319+1.57288E-06*T)))*1e-2
self.viscosity.data = self.getArray(funcMu,key)
self.viscosity.type = self.viscosity.INCOMPRESSIBLE_EXPPOLYNOMIAL
try:
self.viscosity.coeffs = np.zeros((4,6))
self.viscosity.fitCoeffs(self.temperature.data,self.concentration.data,self.Tbase,self.xbase)
except (ValueError, AttributeError, TypeError, RuntimeError) as e:
if self.viscosity.DEBUG: print("{0}: Could not fit polynomial {1} coefficients: {2}".format(self.name,'viscosity',e))
pass
class Freezium(DigitalData):
def __init__(self):
DigitalData.__init__(self)
self.name = "FRE"
self.description = "Freezium, Potassium Formate"
self.reference = "Kemira Chemicals OY, SecCool software"
self.Tmin = -40 + 273.00
self.Tmax = +40 + 273.00
self.xmax = 0.50
self.xmin = 0.19
self.xid = self.ifrac_mass
self.TminPsat = self.Tmax
self.Tbase = 273.15
self.xbase = 0.0
self.temperature.data = self.getTrange()
self.concentration.data = self.getxrange()
self.density.type = self.conductivity.INCOMPRESSIBLE_POLYNOMIAL
self.density.coeffs = np.array([[1015,462,406],[-40/100.0,0.0,0.0]])
self.conductivity.type = self.conductivity.INCOMPRESSIBLE_POLYNOMIAL
self.conductivity.coeffs = np.array([[0.55,-0.15],[0.18/100.0,-0.16/100.0]])
def fitFluid(self):
key = 'Cp'
def funcCp(T,x):
T = (T-self.Tbase)/100.0
return (4.15*np.exp(-0.9*x)+0.63*T*x)*1000.0
self.specific_heat.data = self.getArray(funcCp,key)
self.specific_heat.type = self.viscosity.INCOMPRESSIBLE_POLYNOMIAL
try:
self.specific_heat.coeffs = np.zeros((4,6))
self.specific_heat.fitCoeffs(self.temperature.data,self.concentration.data,self.Tbase,self.xbase)
except (ValueError, AttributeError, TypeError, RuntimeError) as e:
if self.specific_heat.DEBUG: print("{0}: Could not fit polynomial {1} coefficients: {2}".format(self.name,'specific heat',e))
pass
funcCp = None
key = 'Mu'
def funcMu(T,x):
Tr = (T-self.Tbase)/100.0
result = 0.32+x*(-0.70+x*2.26)+Tr*(-1.26+Tr*(1.12-Tr*0.894))
return self.rho(T, 1e6, x)*np.power(10,result)*1E-3;
self.viscosity.data = self.getArray(funcMu,key)
self.viscosity.type = self.viscosity.INCOMPRESSIBLE_EXPPOLYNOMIAL
try:
self.viscosity.coeffs = np.zeros((4,6))
self.viscosity.fitCoeffs(self.temperature.data,self.concentration.data,self.Tbase,self.xbase)
except (ValueError, AttributeError, TypeError, RuntimeError) as e:
if self.viscosity.DEBUG: print("{0}: Could not fit polynomial {1} coefficients: {2}".format(self.name,'viscosity',e))
pass
funcMu = None
# Changed the coefficient order for TFreeze
key = 'Tfreeze'
def funcTf(x,T):
x = x * 100.0
a = 0.03422039835160944
b = -0.05425629002714395
c = -0.007991085555390726
d = 0.001036937163846157
e = 0.0003268582531827402
f = -7.721483884155584E-06
g = -4.841293026057464E-06
h = 1.216929917247388E-08
i = 2.41704396074865E-08
j = 4.314861246570078E-11
return ((a+x*(c+x*(e+x*(g+i*x))))/(1+x*(b+x*(d+x*(f+x*(h+j*x)))))*100)+273.15
# Change the coefficients for TFreeze
self.temperature.data = self.getxrange()
self.concentration.data = np.array([0.0])
self.T_freeze.data = self.getArray(funcTf,key)
self.temperature.data = self.getTrange()
self.concentration.data = self.getxrange()
self.T_freeze.type = self.viscosity.INCOMPRESSIBLE_POLYNOMIAL
try:
self.T_freeze.coeffs = np.zeros((4,6))
self.T_freeze.type = self.T_freeze.INCOMPRESSIBLE_POLYNOMIAL
self.T_freeze.fitCoeffs(self.concentration.data,0.0,self.xbase,0.0)
except (ValueError, AttributeError, TypeError, RuntimeError) as e:
if self.T_freeze.DEBUG: print("{0}: Could not fit polynomial {1} coefficients: {2}".format(self.name,'T freeze',e))
pass
funcTf = None
class AS10(PureData,DigitalData):
def __init__(self):
PureData.__init__(self)
DigitalData.__init__(self)
self.name = "AS10"
self.description = "Aspen Temper -10, Potassium acetate/formate"
self.reference = "Aspen Petroleum AB, SecCool software"
self.Tmax = 30 + 273.15
self.Tmin = -10
self.TminPsat = self.Tmax
self.Tbase = 0.00 + 273.15
self.temperature.data = self.getTrange()
self.concentration.data = np.array([0]) # mass fraction
self.density.type = self.density.INCOMPRESSIBLE_POLYNOMIAL
self.density.coeffs = np.array([[-1.89735e-18],[+ 1.66533e-16],[- 0.2],[+ 1090]])[::-1]
self.specific_heat.type = self.specific_heat.INCOMPRESSIBLE_POLYNOMIAL
self.specific_heat.coeffs = np.array([[-0.0132589],[+ 2.01],[+ 3541.83]])[::-1]
self.conductivity.type = self.conductivity.INCOMPRESSIBLE_POLYNOMIAL
self.conductivity.coeffs = np.array([[0.001483],[+ 0.514259]])[::-1]
self.viscosity.type = self.viscosity.INCOMPRESSIBLE_POLYNOMIAL
self.viscosity.coeffs = np.array([[-2.11481e-5],[+ 0.00235381],[- 0.10631376],[+ 2.80154921]])[::-1]
def fitFluid(self):
pass
class AS20(PureData,DigitalData):
def __init__(self):
PureData.__init__(self)
DigitalData.__init__(self)
self.name = "AS20"
self.description = "Aspen Temper -20, Potassium acetate/formate"
self.reference = "Aspen Petroleum AB, SecCool software"
self.Tmax = 30 + 273.15
self.Tmin = -20
self.TminPsat = self.Tmax
self.Tbase = 0.00 + 273.15
self.temperature.data = self.getTrange()
self.concentration.data = np.array([0]) # mass fraction
self.density.type = self.density.INCOMPRESSIBLE_POLYNOMIAL
self.density.coeffs = np.array([[2.98156e-19],[- 0.00142857],[- 0.22142857],[+ 1147]])[::-1]
self.specific_heat.type = self.specific_heat.INCOMPRESSIBLE_POLYNOMIAL
self.specific_heat.coeffs = np.array([[-0.0122673],[+ 2.86],[+ 3262.52]])[::-1]
self.conductivity.type = self.conductivity.INCOMPRESSIBLE_POLYNOMIAL
self.conductivity.coeffs = np.array([[0.001342],[+ 0.480766]])[::-1]
def fitFluid(self):
key = 'Mu'
def funcMu(T,x):
T = (T-self.Tbase)
return 2.43708721027941*np.exp(-0.0537593944541809*T) + 0.97244
self.viscosity.data = self.getArray(funcMu,key)
self.viscosity.type = self.viscosity.INCOMPRESSIBLE_EXPPOLYNOMIAL
try:
self.viscosity.coeffs = np.zeros((4,6))
self.viscosity.fitCoeffs(self.temperature.data,self.concentration.data,self.Tbase,self.xbase)
except (ValueError, AttributeError, TypeError, RuntimeError) as e:
if self.viscosity.DEBUG: print("{0}: Could not fit polynomial {1} coefficients: {2}".format(self.name,'viscosity',e))
pass
funcMu = None
class AS30(PureData,DigitalData):
def __init__(self):
PureData.__init__(self)
DigitalData.__init__(self)
self.name = "AS30"
self.description = "Aspen Temper -30, Potassium acetate/formate"
self.reference = "Aspen Petroleum AB, SecCool software"
self.Tmax = 30 + 273.15
self.Tmin = -30
self.TminPsat = self.Tmax
self.Tbase = 0.00 + 273.15
self.temperature.data = self.getTrange()
self.concentration.data = np.array([0]) # mass fraction
self.density.type = self.density.INCOMPRESSIBLE_POLYNOMIAL
self.density.coeffs = np.array([[1.76768e-5],[- 0.00103896],[- 0.31085859],[+ 1183.85930736]])[::-1]
self.specific_heat.type = self.specific_heat.INCOMPRESSIBLE_POLYNOMIAL
self.specific_heat.coeffs = np.array([[-0.0270232],[+ 2.99],[+ 3075.04]])[::-1]
self.conductivity.type = self.conductivity.INCOMPRESSIBLE_POLYNOMIAL
self.conductivity.coeffs = np.array([[0.001256],[+ 0.460388]])[::-1]
def fitFluid(self):
key = 'Mu'
def funcMu(T,x):
T = (T-self.Tbase)
return 2.65653950695888*np.exp(-0.0598806339442954*T) + 1.30143
self.viscosity.data = self.getArray(funcMu,key)
self.viscosity.type = self.viscosity.INCOMPRESSIBLE_EXPPOLYNOMIAL
try:
self.viscosity.coeffs = np.zeros((4,6))
self.viscosity.fitCoeffs(self.temperature.data,self.concentration.data,self.Tbase,self.xbase)
except (ValueError, AttributeError, TypeError, RuntimeError) as e:
if self.viscosity.DEBUG: print("{0}: Could not fit polynomial {1} coefficients: {2}".format(self.name,'viscosity',e))
pass
funcMu = None
class AS40(PureData,DigitalData):
def __init__(self):
PureData.__init__(self)
DigitalData.__init__(self)
self.name = "AS40"
self.description = "Aspen Temper -40, Potassium acetate/formate"
self.reference = "Aspen Petroleum AB, SecCool software"
self.Tmax = 30 + 273.15
self.Tmin = -40
self.TminPsat = self.Tmax
self.Tbase = 0.00 + 273.15
self.temperature.data = self.getTrange()
self.concentration.data = np.array([0]) # mass fraction
self.density.type = self.density.INCOMPRESSIBLE_POLYNOMIAL
self.density.coeffs = np.array([[1.6835e-5],[- 0.00109307],[- 0.37819865],[+ 1214.83982684]])[::-1]
self.specific_heat.type = self.specific_heat.INCOMPRESSIBLE_POLYNOMIAL
self.specific_heat.coeffs = np.array([[-0.0387227],[+ 2.28],[+ 2977.88]])[::-1]
self.conductivity.type = self.conductivity.INCOMPRESSIBLE_POLYNOMIAL
self.conductivity.coeffs = np.array([[0.001099],[+ 0.443327]])[::-1]
def fitFluid(self):
key = 'Mu'
def funcMu(T,x):
T = (T-self.Tbase)
return 0.714976365635003*np.exp(-0.100050525515385*T) + 4.38768154440393*np.exp(-0.0260039000649317*T)
self.viscosity.data = self.getArray(funcMu,key)
self.viscosity.type = self.viscosity.INCOMPRESSIBLE_EXPPOLYNOMIAL
try:
self.viscosity.coeffs = np.zeros((4,6))
self.viscosity.fitCoeffs(self.temperature.data,self.concentration.data,self.Tbase,self.xbase)
except (ValueError, AttributeError, TypeError, RuntimeError) as e:
if self.viscosity.DEBUG: print("{0}: Could not fit polynomial {1} coefficients: {2}".format(self.name,'viscosity',e))
pass
funcMu = None
class AS55(PureData,DigitalData):
def __init__(self):
PureData.__init__(self)
DigitalData.__init__(self)
self.name = "AS55"
self.description = "Aspen Temper -55, Potassium acetate/formate"
self.reference = "Aspen Petroleum AB, SecCool software"
self.Tmax = 30 + 273.15
self.Tmin = -55
self.TminPsat = self.Tmax
self.Tbase = 0.00 + 273.15
self.temperature.data = self.getTrange()
self.concentration.data = np.array([0]) # mass fraction
self.density.type = self.density.INCOMPRESSIBLE_POLYNOMIAL
self.density.coeffs = np.array([[1.98824e-5],[- 0.00117189],[- 0.47629615],[+ 1249.7534665]])[::-1]
self.specific_heat.type = self.specific_heat.INCOMPRESSIBLE_POLYNOMIAL
self.specific_heat.coeffs = np.array([[-0.0248618],[+ 2.29],[+ 2839.85]])[::-1]
self.conductivity.type = self.conductivity.INCOMPRESSIBLE_POLYNOMIAL
self.conductivity.coeffs = np.array([[2.287e-6],[+ 0.000937902],[+ 0.425799423]])[::-1]
def fitFluid(self):
key = 'Mu'
def funcMu(T,x):
T = (T-self.Tbase)
return 0.159583223482554*np.exp(-0.138097704125669*T) + 6.3176967296442*np.exp(-0.0380509974688477*T)
self.viscosity.data = self.getArray(funcMu,key)
self.viscosity.type = self.viscosity.INCOMPRESSIBLE_EXPPOLYNOMIAL
try:
self.viscosity.coeffs = np.zeros((4,6))
self.viscosity.fitCoeffs(self.temperature.data,self.concentration.data,self.Tbase,self.xbase)
except (ValueError, AttributeError, TypeError, RuntimeError) as e:
if self.viscosity.DEBUG: print("{0}: Could not fit polynomial {1} coefficients: {2}".format(self.name,'viscosity',e))
pass
funcMu = None
if __name__ == '__main__':
print("The main method converts the AspenTemper coefficients from SecCool")
names = []
descs = []
refs = []
Tmax = []
Tmin = []
TminPsat = []
Tbase = []
cond = []
cp = []
mu = []
rho = []
ID = 10
names.append("AS{0}".format(ID))
descs.append("Aspen Temper -{0}, Potassium acetate/formate".format(ID))
refs.append ("Aspen Petroleum AB, SecCool software")
Tmax.append("30 + 273.15")
Tmin.append("-{0}".format(ID))
TminPsat.append("self.Tmax")
Tbase.append("0.00 + 273.15")
cond.append ("0.001483*(273+T)+0.1094")
cp.append ("1000*(3.54183+T*(0.00201-0.0000132589*T))")
mu.append ("2.80154921+T*(-0.10631376+T*(0.00235381-0.0000211481*T))")
rho.append ("1090+T*(-0.2+T*(1.66533E-16-1.89735E-18*T))")
ID = 20
names.append("AS{0}".format(ID))
descs.append("Aspen Temper -{0}, Potassium acetate/formate".format(ID))
refs.append ("Aspen Petroleum AB, SecCool software")
Tmax.append("30 + 273.15")
Tmin.append("-{0}".format(ID))
TminPsat.append("self.Tmax")
Tbase.append("0.00 + 273.15")
cond.append ("0.001342*(273+T)+0.1144")
cp.append ("1000*(3.26252+T*(0.00286-0.0000122673*T))")
mu.append ("(0.97244+(7.14199*exp((-20-T)/18.6014)))")
rho.append ("1147+T*(-0.22142857+T*(-0.00142857+2.98156E-19*T))")
ID = 30
names.append("AS{0}".format(ID))
descs.append("Aspen Temper -{0}, Potassium acetate/formate".format(ID))
refs.append ("Aspen Petroleum AB, SecCool software")
Tmax.append("30 + 273.15")
Tmin.append("-{0}".format(ID))
TminPsat.append("self.Tmax")
Tbase.append("0.00 + 273.15")
cond.append ("0.001256*(273+T)+0.1175")
cp.append ("1000*(3.07504+T*(0.00299-0.0000270232*T))")
mu.append ("(1.30143+(16.01368*exp((-30-T)/16.69989)))")
rho.append ("1183.85930736+T*(-0.31085859+T*(-0.00103896+0.0000176768*T))")
ID = 40
names.append("AS{0}".format(ID))
descs.append("Aspen Temper -{0}, Potassium acetate/formate".format(ID))
refs.append ("Aspen Petroleum AB, SecCool software")
Tmax.append("30 + 273.15")
Tmin.append("-{0}".format(ID))
cond.append ("0.001099*(273+T)+0.1433")
cp.append ("1000*(2.97788+T*(0.00228-0.0000387227*T))")
mu.append ("(39.11536*exp((-40-T)/9.99495)+(12.41564*exp((-40-T)/38.45577)))")
rho.append ("1214.83982684+T*(-0.37819865+T*(-0.00109307+0.000016835*T))")
ID = 55
names.append("AS{0}".format(ID))
descs.append("Aspen Temper -{0}, Potassium acetate/formate".format(ID))
refs.append ("Aspen Petroleum AB, SecCool software")
Tmax.append("30 + 273.15")
Tmin.append("-{0}".format(ID))
TminPsat.append("self.Tmax")
Tbase.append("0.00 + 273.15")
cond.append ("(273+T)*(0.000002287*(273+T)-0.0003108)+0.3402")
cp.append ("1000*(2.83985+T*(0.00229-0.0000248618*T))")
mu.append ("(317.40673*exp((-55-T)/7.24125)+(51.22151*exp((-55-T)/26.28052)))")
rho.append ("1249.7534665+T*(-0.47629615+T*(-0.00117189+0.0000198824*T))")
spa = " "
from sympy import symbols, expand
x, T = symbols('x T')
for i in range(len(names)):
print("class {0}(PureData):\n def __init__(self):".format(names[i]))
print("{0}PureData.__init__(self)".format(spa))
print("{0}self.name = \"{1}\"".format(spa,names[i]))
print("{0}self.description = \"{1}\"".format(spa,descs[i]))
print("{0}self.reference = \"{1}\"".format(spa,refs[i]))
print("")
print("{0}self.Tmax = {1}".format(spa,Tmax[i]))
print("{0}self.Tmin = {1}".format(spa,Tmin[i]))
print("{0}self.TminPsat = self.Tmax".format(spa))
print("{0}self.Tbase = 0.00 + 273.15".format(spa))
print("")
print("{0}self.density.type = self.density.INCOMPRESSIBLE_POLYNOMIAL".format(spa))
print("{0}self.density.coeffs = np.array([{1}])[::-1]".format(spa,expand(rho[i])))
print("")
print("{0}self.specific_heat.type = self.specific_heat.INCOMPRESSIBLE_POLYNOMIAL".format(spa))
print("{0}self.specific_heat.coeffs = np.array([{1}])[::-1]".format(spa,expand(cp[i])))
print("")
print("{0}self.conductivity.type = self.conductivity.INCOMPRESSIBLE_POLYNOMIAL".format(spa))
print("{0}self.conductivity.coeffs = np.array([{1}])[::-1]".format(spa,expand(cond[i])))
print("")
print("{0}self.viscosity.type = self.viscosity.INCOMPRESSIBLE_EXPPOLYNOMIAL".format(spa))
print("{0}self.viscosity.coeffs = np.array([{1}])[::-1]".format(spa,expand(mu[i])))
print("")
print("{0}def fitFluid(self):".format(" "))
print("{0}key = \"Mu\"".format(spa))
print("{0}def funcMu(T,x):".format(spa))
print("")
print("")
print("{0}funcMu=None".format(spa))
print("")
print("")
print("")
print("")
# PureData.__init__(self)
# self.name = "AS10"
# self.description = "Aspen Temper -10, Potassium acetate/formate"
# self.reference = "Aspen Petroleum AB, SecCool software"
#
# self.Tmax = 30 + 273.15
# self.Tmin = -10 + 273.15
# self.TminPsat = self.Tmax
#
# self.Tbase = 0.00 + 273.15
#
# self.density.type = self.density.INCOMPRESSIBLE_POLYNOMIAL
# self.density.coeffs = np.array([[945.5454545],[-1.054545455]])
#
# self.specific_heat.type = self.specific_heat.INCOMPRESSIBLE_POLYNOMIAL
# self.specific_heat.coeffs = np.array([[2.322218182],[0.003843636]])*1000
#
# self.conductivity.type = self.conductivity.INCOMPRESSIBLE_POLYNOMIAL
# self.conductivity.coeffs = np.array([[0.001483*273.15+0.1094],[0.001483]])
#
# self.temperature.data = self.getTrange()
# self.concentration.data = np.array([0]) # mass fraction
#
#
#{ THyCool_20 }
#
#constructor THyCool_20.Create;
#begin
# inherited;
# TFreeze := -20;
# FluidType := 'Potassium Formate';
# TradeName := 'HYCOOL 20';
# Reference := 'Hydro Chemicals';
# TMin := -20;
# TMax := 50;
#end;
#
#function THyCool_20.GetCondT(T: Double): Double;
#begin
# if T <= 20 then
# Result := 0.001978*T+0.5172
# else
# Result := 0.001005*T+0.5368;
#end;
#
#function THyCool_20.GetCpT(T: Double): Double;
#begin
# Result := 1000*(0.0023*T+2.955);
#end;
#
#function THyCool_20.GetMuT(T: Double): Double;
#begin
# if T <= 20 then
# Result := 0.07190*exp(524.75/(T+142.05))
# else
# Result := T*(0.0005524*T - 0.06281)+2.8536;
#end;
#
#function THyCool_20.GetRhoT(T: Double): Double;
#begin
# Result := -0.429180*T+1202.2;
#end;
#
#{ THyCool_30 }
#
#constructor THyCool_30.Create;
#begin
# inherited;
# TFreeze := -30;
# FluidType := 'Potassium Formate';
# TradeName := 'HYCOOL 30';
# Reference := 'Hydro Chemicals';
# TMin := -30;
# TMax := 50;
#end;
#
#function THyCool_30.GetCondT(T: Double): Double;
#begin
# if T <= 20 then
# Result := 0.001840*T+0.4980
# else
# Result := 0.001000*T+0.514;
#end;
#
#function THyCool_30.GetCpT(T: Double): Double;
#begin
# Result := 1000*(0.0023*T+2.783);
#end;
#
#function THyCool_30.GetMuT(T: Double): Double;
#begin
# if T <= 20 then
# Result := 0.11100*exp(408.17/(T+123.15))
# else
# Result := T*(0.000295*T - 0.0441)+2.6836;
#end;
#
#function THyCool_30.GetRhoT(T: Double): Double;
#begin
# Result := -0.475350*T+1257.5;
#end;
#
#{ THyCool_40 }
#
#constructor THyCool_40.Create;
#begin
# inherited;
# TFreeze := -40;
# FluidType := 'Potassium Formate';
# TradeName := 'HYCOOL 40';
# Reference := 'Hydro Chemicals';
# TMin := -40;
# TMax := 20;
#end;
#
#function THyCool_40.GetCondT(T: Double): Double;
#begin
# Result := 0.001730*T+0.4826;
#end;
#
#function THyCool_40.GetCpT(T: Double): Double;
#begin
# Result := 1000*(0.0023*T+2.646);
#end;
#
#function THyCool_40.GetMuT(T: Double): Double;
#begin
# Result := 0.07830*exp(498.13/(T+130.25));
#end;
#
#function THyCool_40.GetRhoT(T: Double): Double;
#begin
# Result := -0.512290*T+1304.5;
#end;
#
#{ THyCool_45 }
#
#constructor THyCool_45.Create;
#begin
# inherited;
# TFreeze := -45;
# FluidType := 'Potassium Formate';
# TradeName := 'HYCOOL 45';
# Reference := 'Hydro Chemicals';
# TMin := -40;
# TMax := 20;
#end;
#
#function THyCool_45.GetCondT(T: Double): Double;
#begin
# Result := 0.001674*T+0.4750;
#end;
#
#function THyCool_45.GetCpT(T: Double): Double;
#begin
# Result := 1000*(0.0023*T+2.578);
#end;
#
#function THyCool_45.GetMuT(T: Double): Double;
#begin
# Result := 0.08990*exp(479.09/(T+126.55));
#end;
#
#function THyCool_45.GetRhoT(T: Double): Double;
#begin
# Result := -0.530754*T+1328.7;
#end;
#
#{ THyCool_50 }
#
#constructor THyCool_50.Create;
#begin
# inherited;
# TFreeze := -50;
# FluidType := 'Potassium Formate';
# TradeName := 'HYCOOL 50';
# Reference := 'Hydro Chemicals';
# TMin := -50;
# TMax := 20;
#end;
#
#function THyCool_50.GetCondT(T: Double): Double;
#begin
# Result := 0.001610*T+0.4660;
#end;
#
#function THyCool_50.GetCpT(T: Double): Double;
#begin
# Result := 1000*(0.0023*T+2.498);
#end;
#
#function THyCool_50.GetMuT(T: Double): Double;
#begin
# Result := 0.0491*exp(581.12/(T+129.05));
# if T > -10 then
# Result := Result+0.2;
#end;
#
#function THyCool_50.GetRhoT(T: Double): Double;
#begin
# Result := -0.552300*T+1359.0;
#end;
#
#
#
#
#
#
#
#
#
#
#
#
#
#

View File

@@ -1,15 +1,7 @@
from __future__ import division, print_function
import numpy as np
from CPIncomp.BaseObjects import IncompressibleData
import CPIncomp.DataObjects as DO
import CPIncomp.CoefficientObjects as CO
from CoolProp.CoolProp import FluidsList
import CoolProp.CoolProp as CP
import hashlib
import os, CPIncomp
import json
import hashlib, os, json
class SolutionDataWriter(object):
"""
@@ -21,15 +13,15 @@ class SolutionDataWriter(object):
def __init__(self):
pass
def fitAll(self, data):
T = data.temperature.data
x = data.concentration.data
fluid = data.name
def fitAll(self, fluidObject):
if data.Tbase==0.0:
data.Tbase = (np.min(T) + np.max(T)) / 2.0
if data.xbase==0.0:
data.xbase = (np.min(x) + np.max(x)) / 2.0
tempData = fluidObject.temperature.data
concData = fluidObject.concentration.data
if fluidObject.Tbase==0.0 or fluidObject.Tbase==None:
fluidObject.Tbase = (np.min(tempData) + np.max(tempData)) / 2.0
if fluidObject.xbase==0.0 or fluidObject.xbase==None:
fluidObject.xbase = (np.min(concData) + np.max(concData)) / 2.0
# Set the standard order for polynomials
std_xorder = 3+1
@@ -38,115 +30,76 @@ class SolutionDataWriter(object):
errList = (ValueError, AttributeError, TypeError, RuntimeError)
polyDict = {}
polyDict["density"] = data.density
polyDict["specific heat"] = data.specific_heat
# polyDict["viscosity"] = self.viscosity
polyDict["conductivity"] = data.conductivity
# polyDict["saturation_pressure"] = self.saturation_pressure
# polyDict["T_freeze"] = self.T_freeze
expDict = {}
expDict["viscosity"] = data.viscosity
expDict["saturation pressure"] = data.saturation_pressure
for name,entry in polyDict.iteritems():
try:
entry.coeffs = np.copy(std_coeffs)
entry.type = entry.INCOMPRESSIBLE_POLYNOMIAL
entry.fitCoeffs(T,x,data.Tbase,data.xbase)
except errList as ve:
if entry.DEBUG: print("{0}: Could not fit polynomial {1} coefficients: {2}".format(fluid,name,ve))
pass
for name,entry in expDict.iteritems():
try:
entry.coeffs = np.copy(std_coeffs)
entry.type = entry.INCOMPRESSIBLE_EXPPOLYNOMIAL
entry.fitCoeffs(T,x,data.Tbase,data.xbase)
except errList as ve:
if entry.DEBUG: print("{0}: Could not fit exponential {1} coefficients: {2}".format(fluid,name,ve))
pass
try:
data.T_freeze.coeffs = np.copy(std_coeffs)
data.T_freeze.type = data.T_freeze.INCOMPRESSIBLE_POLYNOMIAL
data.T_freeze.fitCoeffs(x,0.0,data.xbase,0.0)
try:
fluidObject.density.coeffs = np.copy(std_coeffs)
fluidObject.density.type = fluidObject.density.INCOMPRESSIBLE_POLYNOMIAL
fluidObject.density.fitCoeffs(tempData,concData,fluidObject.Tbase,fluidObject.xbase)
except errList as ve:
if data.T_freeze.DEBUG: print("{0}: Could not fit {1} coefficients: {2}".format(fluid,"T_freeze",ve))
if fluidObject.density.DEBUG: print("{0}: Could not fit polynomial {1} coefficients: {2}".format(fluidObject.name,'density',ve))
pass
# try:
# data.density.coeffs = np.copy(std_coeffs)
# data.density.type = data.density.INCOMPRESSIBLE_POLYNOMIAL
# data.density.fit(T,x,data.Tbase,data.xbase)
# except errList as ve:
# if self.verbose: print(name, ": Could not fit density coefficients: ", ve)
# pass
#
# try:
# data.specific_heat.coeffs = np.copy(std_coeffs)
# data.specific_heat.type = data.specific_heat.INCOMPRESSIBLE_POLYNOMIAL
# data.specific_heat.fit(T,x,data.Tbase,data.xbase)
# except errList as ve:
# if self.verbose: print(name, ": Could not fit specific heat coefficients: ", ve)
# pass
#
# try:
# data.viscosity.coeffs = np.copy(std_coeffs)
# data.viscosity.type = data.viscosity.INCOMPRESSIBLE_EXPPOLYNOMIAL
# data.viscosity.fit(T,x,data.Tbase,data.xbase)
# except errList as ve:
# if self.verbose: print(name, ": Could not fit viscosity coefficients: ", ve)
# pass
#
# try:
# data.conductivity.coeffs = np.copy(std_coeffs)
# data.conductivity.type = data.conductivity.INCOMPRESSIBLE_POLYNOMIAL
# data.conductivity.fit(T,x,data.Tbase,data.xbase)
# except errList as ve:
# if self.verbose: print(name, ": Could not fit conductivity coefficients: ", ve)
# pass
#
# try:
# data.saturation_pressure.coeffs = np.copy(std_coeffs)
# data.saturation_pressure.type = data.saturation_pressure.INCOMPRESSIBLE_EXPPOLYNOMIAL
# data.saturation_pressure.fit(T,x,data.Tbase,data.xbase)
# except errList as ve:
# if self.verbose: print(name, ": Could not fit saturation pressure coefficients: ", ve)
# pass
#
# try:
# data.T_freeze.coeffs = np.copy(std_coeffs)
# data.T_freeze.type = data.T_freeze.INCOMPRESSIBLE_POLYNOMIAL
# data.T_freeze.fit(0.0,x,0.0,data.xbase)
# except errList as ve:
# if self.verbose: print(name, ": Could not fit TFreeze coefficients: ", ve)
# pass
try:
fluidObject.specific_heat.coeffs = np.copy(std_coeffs)
fluidObject.specific_heat.type = fluidObject.specific_heat.INCOMPRESSIBLE_POLYNOMIAL
fluidObject.specific_heat.fitCoeffs(tempData,concData,fluidObject.Tbase,fluidObject.xbase)
except errList as ve:
if fluidObject.specific_heat.DEBUG: print("{0}: Could not fit polynomial {1} coefficients: {2}".format(fluidObject.name,'specific heat',ve))
pass
try:
fluidObject.conductivity.coeffs = np.copy(std_coeffs)
fluidObject.conductivity.type = fluidObject.conductivity.INCOMPRESSIBLE_POLYNOMIAL
fluidObject.conductivity.fitCoeffs(tempData,concData,fluidObject.Tbase,fluidObject.xbase)
except errList as ve:
if fluidObject.conductivity.DEBUG: print("{0}: Could not fit polynomial {1} coefficients: {2}".format(fluidObject.name,'conductivity',ve))
pass
try:
fluidObject.viscosity.coeffs = np.copy(std_coeffs)
fluidObject.viscosity.type = fluidObject.viscosity.INCOMPRESSIBLE_EXPPOLYNOMIAL
fluidObject.viscosity.fitCoeffs(tempData,concData,fluidObject.Tbase,fluidObject.xbase)
except errList as ve:
if fluidObject.viscosity.DEBUG: print("{0}: Could not fit polynomial {1} coefficients: {2}".format(fluidObject.name,'viscosity',ve))
pass
# reset data for getArray and read special files
if fluidObject.xid!=fluidObject.ifrac_pure and fluidObject.xid!=fluidObject.ifrac_undefined:
try:
fluidObject.T_freeze.coeffs = np.copy(std_coeffs)
fluidObject.T_freeze.type = fluidObject.T_freeze.INCOMPRESSIBLE_POLYNOMIAL
fluidObject.T_freeze.fitCoeffs(concData,0.0,fluidObject.xbase,0.0)
except errList as ve:
if fluidObject.T_freeze.DEBUG: print("{0}: Could not fit {1} coefficients: {2}".format(fluidObject.name,"T_freeze",ve))
pass
#
# # reset data for getArray again
# if fluidObject.xid==fluidObject.ifrac_volume:
# try:
# fluidObject.mass2input.coeffs = np.copy(std_coeffs)
# fluidObject.mass2input.type = fluidObject.mass2input.INCOMPRESSIBLE_POLYNOMIAL
# fluidObject.mass2input.fitCoeffs([fluidObject.Tbase],massData,fluidObject.Tbase,fluidObject.xbase)
# except errList as ve:
# if fluidObject.mass2input.DEBUG: print("{0}: Could not fit {1} coefficients: {2}".format(fluidObject.name,"mass2input",ve))
# pass
# elif fluidObject.xid==fluidObject.ifrac_mass:
# _,_,fluidObject.volume2input.data = IncompressibleData.shfluidObject.ray(massData,axs=1)
# #_,_,volData = IncompressibleData.shapeArray(volData,axs=1)
# try:
# fluidObject.volume2input.coeffs = np.copy(std_coeffs)
# fluidObject.volume2input.type = fluidObject.volume2input.INCOMPRESSIBLE_POLYNOMIAL
# fluidObject.volume2input.fitCoeffs([fluidObject.Tbase],volData,fluidObject.Tbase,fluidObject.xbase)
# except errList as ve:
# if fluidObject.volume2input.DEBUG: print("{0}: Could not fit {1} coefficients: {2}".format(fluidObject.name,"volume2input",ve))
# pass
# else:
# raise ValueError("Unknown xid specified.")
# try:
# data.volume2mass.coeffs = np.copy(std_coeffs)
# data.volume2mass.type = data.volume2mass.INCOMPRESSIBLE_POLYNOMIAL
# data.volume2mass.fit(T,x,data.Tbase,data.xbase)
# except errList as ve:
# if self.verbose: print(name, ": Could not fit V2M coefficients: ", ve)
# pass
#
# try:
# data.mass2mole.coeffs = np.copy(std_coeffs)
# data.mass2mole.type = data.mass2mole.INCOMPRESSIBLE_POLYNOMIAL
# data.mass2mole.fit(T,x,data.Tbase,data.xbase)
# except errList as ve:
# if self.verbose: print(name, ": Could not fit M2M coefficients: ", ve)
# pass
def get_hash(self,data):
return hashlib.sha224(data).hexdigest()
def get_hash_file(self):
return os.path.join(CPIncomp.__path__[0], 'data', "hashes.json")
return os.path.join(os.path.dirname(__file__), 'data', "hashes.json")
def load_hashes(self):
hashes_fname = self.get_hash_file()
@@ -196,8 +149,9 @@ class SolutionDataWriter(object):
#print json.dumps(1.0001)
stdFmt = " .{0}e".format(int(data.significantDigits-1))
#pr = np.finfo(float).eps * 10.0
pr = np.finfo(float).precision - 2 # stay away from numerical precision
json.encoder.FLOAT_REPR = lambda o: format(np.around(o,decimals=pr), stdFmt)
#pr = np.finfo(float).precision - 2 # stay away from numerical precision
#json.encoder.FLOAT_REPR = lambda o: format(np.around(o,decimals=pr), stdFmt)
json.encoder.FLOAT_REPR = lambda o: format(o, stdFmt)
dump = json.dumps(jobj, indent = 2, sort_keys = True)
json.encoder.FLOAT_REPR = original_float_repr
@@ -222,7 +176,62 @@ class SolutionDataWriter(object):
if not quiet: print(" ({0})".format("i"), end="")
def printStatusID(self, fluidObjs, obj):
#obj = fluidObjs[num]
if obj==fluidObjs[0]:
print(" {0}".format(obj.name), end="")
elif obj==fluidObjs[-1]:
print(", {0}".format(obj.name), end="")
else:
print(", {0}".format(obj.name), end="")
return
def fitFluidList(self, fluidObjs):
print("Fitting normal fluids:", end="")
for obj in fluidObjs:
self.printStatusID(fluidObjs, obj)
try:
self.fitAll(obj)
except (TypeError, ValueError) as e:
print("An error occurred for fluid: {0}".format(obj.name))
print(obj)
print(e)
pass
print(" ... done")
return
def fitSecCoolList(self, fluidObjs):
print("Fitting SecCool fluids:", end="")
for obj in fluidObjs:
self.printStatusID(fluidObjs, obj)
try:
obj.fitFluid()
except (TypeError, ValueError) as e:
print("An error occurred for fluid: {0}".format(obj.name))
print(obj)
print(e)
pass
print(" ... done")
return
def writeFluidList(self, fluidObjs):
print("Legend: FluidName (w) | (i) -> (w)=written, (i)=ignored, unchanged coefficients")
print("Writing fluids to JSON:", end="")
for obj in fluidObjs:
self.printStatusID(fluidObjs, obj)
try:
self.toJSON(obj)
except (TypeError, ValueError) as e:
print("An error occurred for fluid: {0}".format(obj.name))
print(obj)
print(e)
pass
print(" ... done")
return
#class FitGraphWriter(object):

View File

@@ -6,10 +6,144 @@ readme.md - General instructions and copyright information / credits.
"""
from __future__ import division, absolute_import, print_function
import inspect
from . import DataObjects,ExampleObjects,PureFluids,CoefficientFluids,DigitalFluids,MelinderFluids
from CPIncomp.SecCoolFluids import SecCoolSolutionData
def getBaseClassNames():
"""
Returns a list of names of the abstract base
classes that should not be instantiated. Can
be used to build an ignore list.
"""
ignList = []
for i in inspect.getmembers(DataObjects):
if inspect.isclass(i[1]):
ignList.append(i[0])
return ignList
def getExampleNames(obj=False):
"""
Returns a list of names of the example fluid
classes that should not be treated like the
normal fluids. Can be used to build an ignore
list.
Use the obj switch to return the objects instead
of the names.
"""
ignList = getBaseClassNames()
outList = []
for i in inspect.getmembers(ExampleObjects):
if inspect.isclass(i[1]):
if i[0] not in ignList:
if obj: outList.append(i[1]())
else: outList.append(i[0])
return outList
def getIgnoreNames():
"""
Returns a list of names of classes that should
not be treated like the normal fluids.
"""
ignList = []
ignList += getBaseClassNames()
ignList += getExampleNames()
return ignList
def getCoefficientFluids():
"""
Returns a list of CoefficientData objects, which
already contain all coefficients. These objects
can be written to JSON without further processing.
"""
classes = []
ignList = getIgnoreNames()
for name, obj in inspect.getmembers(CoefficientFluids):
if inspect.isclass(obj):
#print(name)
if not name in ignList: # Ignore the base classes
classes.append(obj())
return classes
def getDigitalFluids():
"""
Returns a list of DigitalData objects, which
contain data for the fitting. These objects
only hold the data and you still have to call
the fitting routines.
a) Data in these classes is based on equations
that cannot be converted to the forms available
in CoolProp.
b) There are no equations available, but the
fluid data can be accessed from python in the
form of another library.
c) There are data files that contain the experimental
data. The fit has to be done after laoding the fluids.
"""
classes = []
ignList = getIgnoreNames()
for name, obj in inspect.getmembers(DigitalFluids):
if inspect.isclass(obj):
#print(name)
if not name in ignList: # Ignore the base classes
classes.append(obj())
return classes
def getMelinderFluids():
"""
Returns a list of CoefficientData objects, which
already contain all coefficients. These objects
can be written to JSON without further processing.
All coefficients are taken from the same reference:
"Properties of Secondary Working Fluids for Indirect Systems"
written by Aake Melinder and published in 2010 by IIR
"""
classes = []
ignList = getIgnoreNames()
for name, obj in inspect.getmembers(MelinderFluids):
if inspect.isclass(obj):
#print(name)
if not name in ignList: # Ignore the base classes
classes.append(obj())
return classes
def getPureFluids():
"""
Returns a list of SolutionData objects, which
contain data for fitting pure fluids. These
objects only hold the data and you still have
to call the fitting routines.
"""
classes = []
ignList = getIgnoreNames()
for name, obj in inspect.getmembers(PureFluids):
if inspect.isclass(obj):
#print(name)
if not name in ignList: # Ignore the base classes
classes.append(obj())
return classes
def getSecCoolFluids():
"""
Returns a list of DigitalData objects, which
contain data for the fits. All objects here
implement the fitFluid() function, which can
be called to set the coefficients before writing
the JSON files.
"""
return SecCoolSolutionData.factory()
def get_version():
return 0.1
return 0.5
if __name__ == "__main__":
print('You are using version %s of the Python package for incompressible liquids in CoolProp.'%(get_version()))

View File

@@ -16,10 +16,10 @@
-2.12843e-04
],
[
-3.45330e-09
-3.45327e-09
],
[
3.58000e-11
3.58008e-11
]
],
"type": "polynomial"
@@ -53,21 +53,8 @@
"name": "DowJ",
"reference": "Dow Chemicals data sheet",
"saturation_pressure": {
"coeffs": [
[
1.01299e+01
],
[
3.44363e-02
],
[
-1.14945e-04
],
[
2.27823e-07
]
],
"type": "exppolynomial"
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [

View File

@@ -0,0 +1,101 @@
{
"T_freeze": {
"coeffs": "null",
"type": "notdefined"
},
"Tbase": 3.94150e+02,
"Tmax": 5.88150e+02,
"Tmin": 2.00150e+02,
"TminPsat": 5.88150e+02,
"conductivity": {
"coeffs": [
[
1.24483e-01
],
[
-8.22866e-05
],
[
-4.62392e-10
],
[
1.31218e-11
]
],
"type": "polynomial"
},
"density": {
"coeffs": [
[
7.84467e+02
],
[
-8.44939e-01
],
[
-8.67323e-04
],
[
-2.16321e-06
]
],
"type": "polynomial"
},
"description": "Dowtherm J, Diethylbenzene mixture",
"mass2input": {
"coeffs": "null",
"type": "notdefined"
},
"mole2input": {
"coeffs": "null",
"type": "notdefined"
},
"name": "DowJ2",
"reference": "Dow Chemicals, SecCool software",
"saturation_pressure": {
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [
[
2.16675e+03
],
[
3.62360e+00
],
[
3.14590e-03
],
[
2.11429e-08
]
],
"type": "polynomial"
},
"viscosity": {
"coeffs": [
[
-3.39705e+00
],
[
-6.04223e-03
],
[
3.01309e-05
],
[
-1.02852e-07
]
],
"type": "exppolynomial"
},
"volume2input": {
"coeffs": "null",
"type": "notdefined"
},
"xbase": 0.00000e+00,
"xid": 4,
"xmax": 0.00000e+00,
"xmin": 0.00000e+00
}

View File

@@ -19,7 +19,7 @@
-6.16856e-08
],
[
2.01700e-10
2.01708e-10
]
],
"type": "polynomial"
@@ -53,21 +53,8 @@
"name": "DowQ",
"reference": "Dow Chemicals data sheet",
"saturation_pressure": {
"coeffs": [
[
8.46954e+00
],
[
4.13813e-02
],
[
-1.60482e-04
],
[
3.63562e-07
]
],
"type": "exppolynomial"
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [

View File

@@ -0,0 +1,101 @@
{
"T_freeze": {
"coeffs": "null",
"type": "notdefined"
},
"Tbase": 4.20650e+02,
"Tmax": 6.03150e+02,
"Tmin": 2.38150e+02,
"TminPsat": 6.03150e+02,
"conductivity": {
"coeffs": [
[
1.12964e-01
],
[
-1.66747e-04
],
[
-2.56024e-07
],
[
1.77943e-09
]
],
"type": "polynomial"
},
"density": {
"coeffs": [
[
8.73686e+02
],
[
-7.65340e-01
],
[
-1.03470e-05
],
[
1.08805e-07
]
],
"type": "polynomial"
},
"description": "Dowtherm Q, Diphenylethane/alkylated aromatics",
"mass2input": {
"coeffs": "null",
"type": "notdefined"
},
"mole2input": {
"coeffs": "null",
"type": "notdefined"
},
"name": "DowQ2",
"reference": "Dow Chemicals, SecCool software",
"saturation_pressure": {
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [
[
2.05210e+03
],
[
3.05246e+00
],
[
-5.70581e-04
],
[
-2.39204e-07
]
],
"type": "polynomial"
},
"viscosity": {
"coeffs": [
[
-2.92247e+00
],
[
-8.56067e-03
],
[
4.48552e-05
],
[
-1.85248e-07
]
],
"type": "exppolynomial"
},
"volume2input": {
"coeffs": "null",
"type": "notdefined"
},
"xbase": 0.00000e+00,
"xid": 4,
"xmax": 0.00000e+00,
"xmin": 0.00000e+00
}

View File

@@ -38,9 +38,9 @@
0.00000e+00
],
[
4.11400e-10,
6.05000e-11,
-3.13820e-09,
4.11437e-10,
6.05259e-11,
-3.13824e-09,
0.00000e+00,
0.00000e+00,
0.00000e+00
@@ -90,9 +90,9 @@
0.00000e+00
],
[
2.67400e-10,
7.86400e-10,
-8.08000e-11,
2.67434e-10,
7.86405e-10,
-8.08087e-11,
0.00000e+00,
0.00000e+00,
0.00000e+00

View File

@@ -19,7 +19,7 @@
-1.16550e-07
],
[
-9.71300e-10
-9.71251e-10
]
],
"type": "polynomial"
@@ -53,21 +53,8 @@
"name": "ExamplePure",
"reference": "Solutia data sheet",
"saturation_pressure": {
"coeffs": [
[
1.75841e+00
],
[
4.16305e-02
],
[
-1.42983e-04
],
[
7.70986e-08
]
],
"type": "exppolynomial"
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [

View File

@@ -25,7 +25,7 @@
],
[
6.62932e-04,
-2.68647e-03,
-2.68648e-03,
9.03915e-03,
-2.12826e-02,
-5.56200e-02,
@@ -41,7 +41,7 @@
],
[
4.70340e-08,
7.61240e-09,
7.61236e-09,
-2.73400e-06,
0.00000e+00,
0.00000e+00,

View File

@@ -0,0 +1,148 @@
{
"T_freeze": {
"coeffs": [
[
2.98106e+02
],
[
-3.00133e+02
],
[
8.29125e+02
],
[
-1.12384e+03
]
],
"type": "polynomial"
},
"Tbase": 2.73150e+02,
"Tmax": 3.13000e+02,
"Tmin": 2.33000e+02,
"TminPsat": 3.13000e+02,
"conductivity": {
"coeffs": [
[
5.50000e-01,
-1.50000e-01
],
[
1.80000e-03,
-1.60000e-03
]
],
"type": "polynomial"
},
"density": {
"coeffs": [
[
1.01500e+03,
4.62000e+02,
4.06000e+02
],
[
-4.00000e-01,
0.00000e+00,
0.00000e+00
]
],
"type": "polynomial"
},
"description": "Freezium, Potassium Formate",
"mass2input": {
"coeffs": "null",
"type": "notdefined"
},
"mole2input": {
"coeffs": "null",
"type": "notdefined"
},
"name": "FRE",
"reference": "Kemira Chemicals OY, SecCool software",
"saturation_pressure": {
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [
[
4.15007e+03,
-3.73615e+03,
1.68816e+03,
-5.26984e+02,
1.46310e+02,
-3.66773e+01
],
[
1.32829e-04,
6.29744e+00,
1.56653e-02,
-3.77733e-02,
3.04456e-02,
0.00000e+00
],
[
1.08670e-05,
-1.09058e-04,
3.48881e-04,
-3.60016e-04,
0.00000e+00,
0.00000e+00
],
[
-6.37982e-08,
3.55343e-07,
-3.13279e-07,
0.00000e+00,
0.00000e+00,
0.00000e+00
]
],
"type": "polynomial"
},
"viscosity": {
"coeffs": [
[
7.51689e-01,
-1.15630e+00,
5.49895e+00,
-1.50202e-01,
1.17346e-03,
1.79702e-02
],
[
-2.94067e-02,
1.79238e-04,
7.88887e-05,
-1.18318e-04,
4.34013e-05,
0.00000e+00
],
[
2.57819e-04,
6.73569e-09,
1.82979e-07,
-1.77535e-07,
0.00000e+00,
0.00000e+00
],
[
-2.05848e-06,
-3.34246e-10,
5.46707e-10,
0.00000e+00,
0.00000e+00,
0.00000e+00
]
],
"type": "exppolynomial"
},
"volume2input": {
"coeffs": "null",
"type": "notdefined"
},
"xbase": 0.00000e+00,
"xid": 0,
"xmax": 5.00000e-01,
"xmin": 1.90000e-01
}

View File

@@ -11,7 +11,7 @@
-1.12821e+02
],
[
-4.40000e-12
-4.64500e-12
]
],
"type": "polynomial"
@@ -47,9 +47,9 @@
0.00000e+00
],
[
3.15900e-10,
3.15934e-10,
-2.03580e-09,
2.52200e-10,
2.52243e-10,
0.00000e+00,
0.00000e+00,
0.00000e+00
@@ -84,9 +84,9 @@
0.00000e+00
],
[
-1.10100e-10,
-3.79500e-10,
4.11110e-09,
-1.10111e-10,
-3.79497e-10,
4.11111e-09,
0.00000e+00,
0.00000e+00,
0.00000e+00
@@ -145,8 +145,8 @@
0.00000e+00
],
[
-4.61000e-11,
6.20200e-10,
-4.60535e-11,
6.20175e-10,
-2.37499e-08,
0.00000e+00,
0.00000e+00,

View File

@@ -16,10 +16,10 @@
1.00000e-03
],
[
-0.00000e+00
-1.15938e-19
],
[
0.00000e+00
8.15799e-20
]
],
"type": "polynomial"
@@ -53,21 +53,8 @@
"name": "HC10",
"reference": "Dynalene data sheet",
"saturation_pressure": {
"coeffs": [
[
1.14446e+01
],
[
3.62426e-02
],
[
-1.09889e-04
],
[
1.78998e-07
]
],
"type": "exppolynomial"
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [

View File

@@ -19,7 +19,7 @@
0.00000e+00
],
[
-0.00000e+00
2.49882e-20
]
],
"type": "polynomial"
@@ -53,21 +53,8 @@
"name": "HC20",
"reference": "Dynalene data sheet",
"saturation_pressure": {
"coeffs": [
[
1.10195e+01
],
[
3.82431e-02
],
[
-1.11777e-04
],
[
1.45814e-07
]
],
"type": "exppolynomial"
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [
@@ -81,7 +68,7 @@
-7.60109e-06
],
[
1.87680e-09
1.87681e-09
]
],
"type": "polynomial"

View File

@@ -16,10 +16,10 @@
1.00000e-03
],
[
-0.00000e+00
1.11067e-19
],
[
-0.00000e+00
1.15402e-19
]
],
"type": "polynomial"
@@ -53,21 +53,8 @@
"name": "HC30",
"reference": "Dynalene data sheet",
"saturation_pressure": {
"coeffs": [
[
1.07398e+01
],
[
3.95291e-02
],
[
-1.21447e-04
],
[
1.91992e-07
]
],
"type": "exppolynomial"
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [

View File

@@ -16,10 +16,10 @@
1.00000e-03
],
[
-0.00000e+00
-2.42754e-19
],
[
-0.00000e+00
-1.70889e-19
]
],
"type": "polynomial"
@@ -53,21 +53,8 @@
"name": "HC40",
"reference": "Dynalene data sheet",
"saturation_pressure": {
"coeffs": [
[
1.02325e+01
],
[
4.17548e-02
],
[
-1.25669e-04
],
[
3.46399e-07
]
],
"type": "exppolynomial"
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [

View File

@@ -16,10 +16,10 @@
1.00076e-03
],
[
-6.84180e-09
-6.84182e-09
],
[
-1.06400e-10
-1.06428e-10
]
],
"type": "polynomial"
@@ -53,21 +53,8 @@
"name": "HC50",
"reference": "Dynalene data sheet",
"saturation_pressure": {
"coeffs": [
[
1.00994e+01
],
[
4.20796e-02
],
[
-1.15969e-04
],
[
1.04830e-07
]
],
"type": "exppolynomial"
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [

View File

@@ -3,23 +3,17 @@
"coeffs": "null",
"type": "notdefined"
},
"Tbase": 2.65120e+02,
"Tmax": 3.37420e+02,
"Tmin": 1.92820e+02,
"TminPsat": 3.37420e+02,
"Tbase": 0.00000e+00,
"Tmax": 3.73150e+02,
"Tmin": 1.93150e+02,
"TminPsat": 3.73150e+02,
"conductivity": {
"coeffs": [
[
7.52837e-02
9.92958e-05
],
[
-1.95480e-04
],
[
-0.00000e+00
],
[
0.00000e+00
-8.33333e-08
]
],
"type": "polynomial"
@@ -27,21 +21,15 @@
"density": {
"coeffs": [
[
1.55652e+03
1.82237e+03
],
[
-2.26900e+00
],
[
0.00000e+00
],
[
0.00000e+00
-9.18485e-01
]
],
"type": "polynomial"
},
"description": "HFE-7100, Hydrofluoroether",
"description": "Hydrofluoroether - HFE-7100 3M Novec",
"mass2input": {
"coeffs": "null",
"type": "notdefined"
@@ -51,7 +39,7 @@
"type": "notdefined"
},
"name": "HFE",
"reference": "3M Novec, SecCool software",
"reference": "Melinder-BOOK-2010",
"saturation_pressure": {
"coeffs": "null",
"type": "notdefined"
@@ -59,16 +47,10 @@
"specific_heat": {
"coeffs": [
[
1.11694e+03
8.71834e+02
],
[
2.00000e+00
],
[
-0.00000e+00
],
[
-0.00000e+00
8.58788e+05
]
],
"type": "polynomial"
@@ -76,16 +58,13 @@
"viscosity": {
"coeffs": [
[
-5.75185e-01
-4.22878e+00
],
[
-1.47112e-02
-1.14765e-02
],
[
1.03197e-04
],
[
-7.16839e-07
7.39823e-06
]
],
"type": "exppolynomial"
@@ -96,6 +75,6 @@
},
"xbase": 0.00000e+00,
"xid": 4,
"xmax": 0.00000e+00,
"xmax": 1.00000e+00,
"xmin": 0.00000e+00
}

View File

@@ -0,0 +1,101 @@
{
"T_freeze": {
"coeffs": "null",
"type": "notdefined"
},
"Tbase": 2.65120e+02,
"Tmax": 3.37420e+02,
"Tmin": 1.92820e+02,
"TminPsat": 3.37420e+02,
"conductivity": {
"coeffs": [
[
7.52837e-02
],
[
-1.95480e-04
],
[
-2.46523e-14
],
[
6.92101e-16
]
],
"type": "polynomial"
},
"density": {
"coeffs": [
[
1.55652e+03
],
[
-2.26900e+00
],
[
7.67087e-16
],
[
2.36356e-17
]
],
"type": "polynomial"
},
"description": "HFE-7100, Hydrofluoroether",
"mass2input": {
"coeffs": "null",
"type": "notdefined"
},
"mole2input": {
"coeffs": "null",
"type": "notdefined"
},
"name": "HFE2",
"reference": "3M Novec, SecCool software",
"saturation_pressure": {
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [
[
1.11694e+03
],
[
2.00000e+00
],
[
-6.23186e-16
],
[
-4.44414e-16
]
],
"type": "polynomial"
},
"viscosity": {
"coeffs": [
[
-5.75185e-01
],
[
-1.47112e-02
],
[
1.03197e-04
],
[
-7.16839e-07
]
],
"type": "exppolynomial"
},
"volume2input": {
"coeffs": "null",
"type": "notdefined"
},
"xbase": 0.00000e+00,
"xid": 4,
"xmax": 0.00000e+00,
"xmin": 0.00000e+00
}

View File

@@ -60,41 +60,8 @@
"name": "LiBr",
"reference": "Patek2006",
"saturation_pressure": {
"coeffs": [
[
1.15244e+01,
-3.37704e+00,
-1.10273e+01,
-1.51593e+01,
1.67989e+01,
4.91412e+01
],
[
3.33901e-02,
1.03465e-02,
5.96766e-02,
2.26493e-02,
-2.19262e-01,
0.00000e+00
],
[
-1.07910e-04,
-2.74284e-05,
-9.95198e-05,
-5.30377e-05,
0.00000e+00,
0.00000e+00
],
[
3.08284e-07,
5.25306e-08,
2.54930e-07,
0.00000e+00,
0.00000e+00,
0.00000e+00
]
],
"type": "exppolynomial"
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [

View File

@@ -39,7 +39,7 @@
0.00000e+00
],
[
-4.27920e-09,
-4.27916e-09,
-1.96645e-06,
1.31080e-05,
-1.43900e-05,
@@ -174,7 +174,7 @@
],
[
-2.03612e-06,
2.38836e-05,
2.38837e-05,
-1.32900e-04,
0.00000e+00,
0.00000e+00,

View File

@@ -48,7 +48,7 @@
],
[
2.43480e-08,
9.72000e-10,
9.71959e-10,
-1.34900e-06,
0.00000e+00,
0.00000e+00,

View File

@@ -47,7 +47,7 @@
0.00000e+00
],
[
6.62830e-09,
6.62831e-09,
1.21694e-07,
-1.29800e-06,
0.00000e+00,

View File

@@ -47,9 +47,9 @@
0.00000e+00
],
[
-0.00000e+00,
2.00000e-13,
1.30000e-12,
-2.55098e-14,
1.71522e-13,
1.25528e-12,
0.00000e+00,
0.00000e+00,
0.00000e+00
@@ -84,9 +84,9 @@
0.00000e+00
],
[
-5.60000e-12,
-1.94400e-10,
7.76700e-10,
-5.55556e-12,
-1.94655e-10,
7.53285e-10,
0.00000e+00,
0.00000e+00,
0.00000e+00
@@ -136,9 +136,9 @@
0.00000e+00
],
[
4.30000e-12,
-3.31300e-10,
2.01960e-09,
5.14655e-12,
-3.24640e-10,
1.94452e-09,
0.00000e+00,
0.00000e+00,
0.00000e+00
@@ -173,9 +173,9 @@
0.00000e+00
],
[
0.00000e+00,
-2.00000e-13,
-1.20000e-12,
2.78289e-14,
-2.58351e-13,
3.89584e-14,
0.00000e+00,
0.00000e+00,
0.00000e+00

View File

@@ -27,29 +27,29 @@
-7.67724e-02,
-8.09524e-02,
-3.14700e-01,
-1.55801e-06,
2.87682e-06
-1.55803e-06,
2.87644e-06
],
[
1.71496e-03,
-1.78802e-03,
-4.24099e-04,
-2.35453e-08,
-3.50987e-08,
-2.35457e-08,
-3.50997e-08,
0.00000e+00
],
[
-2.93800e-06,
3.24400e-05,
-1.19100e-10,
1.04370e-09,
-1.19112e-10,
1.04374e-09,
0.00000e+00,
0.00000e+00
],
[
-0.00000e+00,
-4.00000e-13,
3.50000e-12,
-2.81927e-14,
-3.55745e-13,
3.54493e-12,
0.00000e+00,
0.00000e+00,
0.00000e+00
@@ -84,9 +84,9 @@
0.00000e+00
],
[
1.40000e-12,
4.00000e-11,
2.07890e-09,
1.39433e-12,
4.00279e-11,
2.07893e-09,
0.00000e+00,
0.00000e+00,
0.00000e+00
@@ -116,29 +116,29 @@
-3.56560e+03,
9.11467e+03,
-1.95900e+04,
2.16411e-03,
2.84027e-02
2.16470e-03,
2.84182e-02
],
[
1.81882e+00,
1.02123e+01,
-1.45800e+02,
3.28504e-05,
-1.82975e-04,
3.28624e-05,
-1.82868e-04,
0.00000e+00
],
[
9.72271e-04,
-1.46700e-01,
1.42468e-07,
-1.28505e-06,
1.42678e-07,
-1.28493e-06,
0.00000e+00,
0.00000e+00
],
[
2.49000e-11,
3.04100e-10,
-5.25400e-09,
2.58740e-11,
3.02493e-10,
-5.25396e-09,
0.00000e+00,
0.00000e+00,
0.00000e+00
@@ -153,29 +153,29 @@
2.19764e+00,
5.39636e+00,
-2.52400e+00,
-1.27793e-06,
1.50530e-05
-1.27832e-06,
1.50408e-05
],
[
-2.94380e-02,
-3.05515e-03,
-9.97400e-02,
-1.29429e-08,
1.94605e-07,
-1.29488e-08,
1.94596e-07,
0.00000e+00
],
[
2.35927e-04,
4.41900e-04,
-4.03000e-11,
7.12100e-10,
-4.04495e-11,
7.12017e-10,
0.00000e+00,
0.00000e+00
],
[
-0.00000e+00,
-0.00000e+00,
2.00000e-12,
-1.96395e-14,
-3.32034e-14,
2.03196e-12,
0.00000e+00,
0.00000e+00,
0.00000e+00

View File

@@ -3,23 +3,17 @@
"coeffs": "null",
"type": "notdefined"
},
"Tbase": 7.23150e+02,
"Tbase": 2.73150e+02,
"Tmax": 8.73150e+02,
"Tmin": 5.73150e+02,
"TminPsat": 8.73150e+02,
"conductivity": {
"coeffs": [
[
5.28500e-01
4.43000e-01
],
[
1.90000e-04
],
[
0.00000e+00
],
[
0.00000e+00
]
],
"type": "polynomial"
@@ -27,16 +21,10 @@
"density": {
"coeffs": [
[
1.80380e+03
2.09000e+03
],
[
-6.36008e-01
],
[
0.00000e+00
],
[
7.94000e-11
-6.36000e-01
]
],
"type": "polynomial"
@@ -59,16 +47,10 @@
"specific_heat": {
"coeffs": [
[
1.52040e+03
1.44300e+03
],
[
1.72016e-01
],
[
-0.00000e+00
],
[
-1.28840e-09
1.72000e-01
]
],
"type": "polynomial"
@@ -76,26 +58,26 @@
"viscosity": {
"coeffs": [
[
-6.50576e+00
2.27140e-02
],
[
-2.89370e-03
-1.20000e-04
],
[
9.26676e-06
2.28100e-07
],
[
-4.76840e-08
-1.47400e-10
]
],
"type": "exppolynomial"
"type": "polynomial"
},
"volume2input": {
"coeffs": "null",
"type": "notdefined"
},
"xbase": 0.00000e+00,
"xid": 4,
"xid": 3,
"xmax": 1.00000e+00,
"xmin": 0.00000e+00
}

View File

@@ -16,10 +16,10 @@
-7.51021e-05
],
[
-4.30300e-10
-4.30265e-10
],
[
8.73000e-11
8.72844e-11
]
],
"type": "polynomial"
@@ -36,7 +36,7 @@
0.00000e+00
],
[
-0.00000e+00
1.25037e-16
]
],
"type": "polynomial"

View File

@@ -47,9 +47,9 @@
0.00000e+00
],
[
4.65100e-10,
-4.23160e-09,
7.54050e-09,
4.65113e-10,
-4.23164e-09,
7.54048e-09,
0.00000e+00,
0.00000e+00,
0.00000e+00
@@ -84,9 +84,9 @@
0.00000e+00
],
[
4.24000e-11,
-5.21300e-10,
8.92800e-10,
4.24384e-11,
-5.21252e-10,
8.92799e-10,
0.00000e+00,
0.00000e+00,
0.00000e+00

View File

@@ -41,13 +41,13 @@
[
-1.33437e-07,
1.11111e-07,
7.85358e-08,
7.85357e-08,
-2.39585e-06,
0.00000e+00,
0.00000e+00
],
[
-5.03100e-10,
-5.03131e-10,
-2.03410e-09,
2.08002e-08,
0.00000e+00,
@@ -70,7 +70,7 @@
[
-5.39777e-04,
-9.21193e-04,
-8.07528e-06,
-8.07529e-06,
-1.05105e-04,
5.16302e-04,
0.00000e+00
@@ -84,9 +84,9 @@
0.00000e+00
],
[
-1.97000e-11,
-4.50100e-10,
-1.84810e-09,
-1.96639e-11,
-4.50111e-10,
-1.84811e-09,
0.00000e+00,
0.00000e+00,
0.00000e+00
@@ -145,8 +145,8 @@
0.00000e+00
],
[
1.02310e-09,
-6.97340e-09,
1.02315e-09,
-6.97342e-09,
2.41415e-08,
0.00000e+00,
0.00000e+00,

View File

@@ -19,7 +19,7 @@
3.12739e-08
],
[
-3.80000e-12
-3.78807e-12
]
],
"type": "polynomial"

View File

@@ -10,16 +10,16 @@
"conductivity": {
"coeffs": [
[
1.06609e-01
1.06583e-01
],
[
-9.00000e-05
-9.17879e-05
],
[
-1.50000e-07
-1.57373e-07
],
[
0.00000e+00
1.36159e-11
]
],
"type": "polynomial"
@@ -27,16 +27,16 @@
"density": {
"coeffs": [
[
8.92324e+02
8.92465e+02
],
[
-7.36234e-01
-7.18248e-01
],
[
-3.21000e-04
-3.39150e-04
],
[
-0.00000e+00
-7.43451e-07
]
],
"type": "polynomial"
@@ -53,35 +53,22 @@
"name": "T66",
"reference": "Therminol Heat Transfer Reference Disk",
"saturation_pressure": {
"coeffs": [
[
7.41771e+00
],
[
3.22041e-02
],
[
-6.91773e-05
],
[
1.35334e-07
]
],
"type": "exppolynomial"
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [
[
2.15786e+03
2.15782e+03
],
[
3.65389e+00
3.63011e+00
],
[
8.97079e-04
9.17109e-04
],
[
0.00000e+00
1.00446e-06
]
],
"type": "polynomial"
@@ -89,16 +76,16 @@
"viscosity": {
"coeffs": [
[
-7.16246e+00
-7.14791e+00
],
[
-7.74899e-03
-7.74160e-03
],
[
7.41735e-05
7.25121e-05
],
[
-3.64192e-07
-3.62299e-07
]
],
"type": "exppolynomial"

View File

@@ -16,10 +16,10 @@
-1.21312e-04
],
[
-4.10000e-11
-4.09811e-11
],
[
-1.70000e-12
-1.66940e-12
]
],
"type": "polynomial"
@@ -53,21 +53,8 @@
"name": "T72",
"reference": "Therminol Heat Transfer Reference Disk",
"saturation_pressure": {
"coeffs": [
[
1.01243e+01
],
[
1.63872e-02
],
[
-1.58443e-06
],
[
1.41000e-11
]
],
"type": "exppolynomial"
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [
@@ -81,7 +68,7 @@
-6.76773e-07
],
[
4.27170e-09
4.27171e-09
]
],
"type": "polynomial"

View File

@@ -19,7 +19,7 @@
-1.60843e-07
],
[
4.60000e-12
4.55571e-12
]
],
"type": "polynomial"
@@ -53,21 +53,8 @@
"name": "TD12",
"reference": "Therminol Heat Transfer Reference Disk",
"saturation_pressure": {
"coeffs": [
[
7.66531e+00
],
[
4.72056e-02
],
[
-2.78327e-04
],
[
1.18284e-06
]
],
"type": "exppolynomial"
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [
@@ -98,7 +85,7 @@
8.65429e-05
],
[
-5.74823e-07
-5.74824e-07
]
],
"type": "exppolynomial"

View File

@@ -19,7 +19,7 @@
-1.72984e-07
],
[
3.50000e-12
3.52351e-12
]
],
"type": "polynomial"
@@ -53,21 +53,8 @@
"name": "TVP1",
"reference": "Therminol Heat Transfer Reference Disk",
"saturation_pressure": {
"coeffs": [
[
1.02917e+01
],
[
2.77329e-02
],
[
-9.22368e-05
],
[
2.53513e-07
]
],
"type": "exppolynomial"
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [

View File

@@ -0,0 +1,83 @@
{
"T_freeze": {
"coeffs": "null",
"type": "notdefined"
},
"Tbase": 2.73150e+02,
"Tmax": 2.93150e+02,
"Tmin": 1.93150e+02,
"TminPsat": 2.93150e+02,
"conductivity": {
"coeffs": [
[
1.50000e-01
],
[
-1.54545e-04
]
],
"type": "polynomial"
},
"density": {
"coeffs": [
[
9.45545e+02
],
[
-1.05455e+00
]
],
"type": "polynomial"
},
"description": "Thermogen VP 1869",
"mass2input": {
"coeffs": "null",
"type": "notdefined"
},
"mole2input": {
"coeffs": "null",
"type": "notdefined"
},
"name": "TVP1869",
"reference": "Hoechst, SecCool software",
"saturation_pressure": {
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [
[
2.32222e+03
],
[
3.84364e+00
]
],
"type": "polynomial"
},
"viscosity": {
"coeffs": [
[
1.25642e+00
],
[
-3.57244e-02
],
[
1.07130e-04
],
[
-5.10205e-06
]
],
"type": "exppolynomial"
},
"volume2input": {
"coeffs": "null",
"type": "notdefined"
},
"xbase": 0.00000e+00,
"xid": 3,
"xmax": 1.00000e+00,
"xmin": 0.00000e+00
}

View File

@@ -19,7 +19,7 @@
-1.45409e-08
],
[
1.39500e-10
1.39476e-10
]
],
"type": "polynomial"
@@ -53,21 +53,8 @@
"name": "TX22",
"reference": "Texaco data sheet",
"saturation_pressure": {
"coeffs": [
[
2.41277e+00
],
[
6.23844e-02
],
[
-1.41831e-04
],
[
-8.17047e-08
]
],
"type": "exppolynomial"
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [

View File

@@ -33,10 +33,10 @@
-4.00000e-01
],
[
-0.00000e+00
-3.77465e-16
],
[
0.00000e+00
1.09433e-16
]
],
"type": "polynomial"
@@ -65,7 +65,7 @@
2.53770e+00
],
[
0.00000e+00
1.49468e-15
],
[
-5.55556e-04

View File

@@ -16,10 +16,10 @@
7.00000e-04
],
[
0.00000e+00
1.08420e-19
],
[
0.00000e+00
2.10218e-20
]
],
"type": "polynomial"
@@ -33,10 +33,10 @@
-4.00000e-01
],
[
0.00000e+00
9.99201e-16
],
[
-0.00000e+00
-1.40061e-17
]
],
"type": "polynomial"

View File

@@ -19,7 +19,7 @@
-1.08225e-07
],
[
8.41800e-10
8.41751e-10
]
],
"type": "polynomial"
@@ -33,10 +33,10 @@
-4.00000e-01
],
[
0.00000e+00
4.43981e-17
],
[
-0.00000e+00
-1.11239e-17
]
],
"type": "polynomial"

View File

@@ -16,10 +16,10 @@
6.12252e-04
],
[
1.78241e-07
1.78240e-07
],
[
9.18760e-09
9.18762e-09
]
],
"type": "polynomial"
@@ -33,10 +33,10 @@
-4.00000e-01
],
[
-0.00000e+00
-1.80811e-16
],
[
0.00000e+00
2.31477e-17
]
],
"type": "polynomial"

View File

@@ -19,7 +19,7 @@
-1.43952e-07
],
[
1.12000e-10
1.12031e-10
]
],
"type": "polynomial"
@@ -36,7 +36,7 @@
1.63389e-07
],
[
1.03680e-09
1.03681e-09
]
],
"type": "polynomial"
@@ -68,7 +68,7 @@
7.71754e-07
],
[
-0.00000e+00
-2.55438e-16
]
],
"type": "polynomial"

View File

@@ -0,0 +1,101 @@
{
"T_freeze": {
"coeffs": "null",
"type": "notdefined"
},
"Tbase": 3.53150e+02,
"Tmax": 5.33150e+02,
"Tmin": 1.73150e+02,
"TminPsat": 5.33150e+02,
"conductivity": {
"coeffs": [
[
9.72756e-02
],
[
-2.34228e-04
],
[
-1.44018e-07
],
[
1.15366e-10
]
],
"type": "polynomial"
},
"density": {
"coeffs": [
[
7.93649e+02
],
[
-1.02715e+00
],
[
9.21421e-09
],
[
-1.27044e-10
]
],
"type": "polynomial"
},
"description": "Syltherm XLT, Polydimethylsiloxan",
"mass2input": {
"coeffs": "null",
"type": "notdefined"
},
"mole2input": {
"coeffs": "null",
"type": "notdefined"
},
"name": "XLT2",
"reference": "Dow Chemicals, SecCool software",
"saturation_pressure": {
"coeffs": "null",
"type": "notdefined"
},
"specific_heat": {
"coeffs": [
[
1.89800e+03
],
[
2.10000e+00
],
[
0.00000e+00
],
[
1.12598e-16
]
],
"type": "polynomial"
},
"viscosity": {
"coeffs": [
[
-5.36830e-01
],
[
-1.00016e-02
],
[
5.15899e-05
],
[
-1.95815e-07
]
],
"type": "exppolynomial"
},
"volume2input": {
"coeffs": "null",
"type": "notdefined"
},
"xbase": 0.00000e+00,
"xid": 4,
"xmax": 0.00000e+00,
"xmin": 0.00000e+00
}

View File

@@ -48,7 +48,7 @@
],
[
-1.30580e-08,
-8.68960e-09,
-8.68958e-09,
2.34356e-07,
0.00000e+00,
0.00000e+00,
@@ -137,7 +137,7 @@
],
[
-1.70764e-04,
-8.07733e-05,
-8.07732e-05,
8.57711e-04,
0.00000e+00,
0.00000e+00,
@@ -174,7 +174,7 @@
],
[
6.99728e-07,
-3.78444e-08,
-3.78445e-08,
4.53519e-06,
0.00000e+00,
0.00000e+00,

View File

@@ -47,7 +47,7 @@
0.00000e+00
],
[
6.20500e-10,
6.20534e-10,
-1.24452e-08,
1.58213e-08,
0.00000e+00,

View File

@@ -11,7 +11,7 @@
-9.21429e+01
],
[
9.80000e-12
1.24962e-12
]
],
"type": "polynomial"

View File

@@ -53,10 +53,10 @@
-4.64311e-01
],
[
-1.25000e-11
-1.24609e-11
],
[
-2.00000e-13
-2.08576e-13
]
],
"type": "polynomial"

View File

@@ -53,10 +53,10 @@
-5.32663e-01
],
[
0.00000e+00
1.11022e-16
],
[
5.00000e-13
5.13778e-13
]
],
"type": "polynomial"

View File

@@ -53,10 +53,10 @@
-5.67309e-01
],
[
2.90000e-12
2.85305e-12
],
[
5.00000e-13
4.71224e-13
]
],
"type": "polynomial"

View File

@@ -53,10 +53,10 @@
-5.52465e-01
],
[
-3.10000e-12
-3.09230e-12
],
[
0.00000e+00
3.81225e-14
]
],
"type": "polynomial"

View File

@@ -19,7 +19,7 @@
5.28035e-07
],
[
-1.10000e-12
-1.14497e-12
]
],
"type": "polynomial"
@@ -33,10 +33,10 @@
-6.04429e-01
],
[
-5.70000e-12
-5.66853e-12
],
[
-0.00000e+00
-3.81547e-15
]
],
"type": "polynomial"

View File

@@ -1,203 +1,71 @@
from __future__ import division, absolute_import, print_function
import inspect
import numpy as np
import itertools,scipy.interpolate
import CoolProp.CoolProp as CP
import CPIncomp.DataObjects
import CPIncomp.CoefficientObjects
import CPIncomp.PureFluids
import CPIncomp.MelinderFluids
import CPIncomp.DigitalFluids
from CPIncomp.WriterObjects import SolutionDataWriter
from CPIncomp.DataObjects import PureExample, SolutionExample, DigitalExample
from CPIncomp.CoefficientObjects import SecCoolExample, MelinderExample
from CPIncomp.SecCoolFluids import SecCoolSolutionData
from CPIncomp import getExampleNames, getPureFluids, getCoefficientFluids,\
getDigitalFluids, getSecCoolFluids, getMelinderFluids
import sys
def getExampleData():
return [PureExample(), SolutionExample(), DigitalExample()]
def getExampleCoef():
return [SecCoolExample(), MelinderExample()]
def getExampleObjects():
return getExampleData() + getExampleCoef()
def getBaseClassNames():
ignList = []
for i in inspect.getmembers(CPIncomp.DataObjects):
ignList.append(i[0])
for i in inspect.getmembers(CPIncomp.CoefficientObjects):
ignList.append(i[0])
return ignList
def getPureDataObjects():
classes = []
ignList = getBaseClassNames()
for name, obj in inspect.getmembers(CPIncomp.PureFluids):
if inspect.isclass(obj):
#print(name)
if not name in ignList: # Ignore the base classes
classes += [obj()]
return classes
def getSolutionDataObjects():
return []
classes = []
ignList = getBaseClassNames()
for name, obj in inspect.getmembers(CPIncomp.SolutionFluids):
if inspect.isclass(obj):
#print(name)
if not name in ignList: # Ignore the base classes
classes += [obj()]
return classes
def getDigitalDataObjects():
classes = []
ignList = getBaseClassNames()
for name, obj in inspect.getmembers(CPIncomp.DigitalFluids):
if inspect.isclass(obj):
#print(name)
if not name in ignList: # Ignore the base classes
classes += [obj()]
return classes
def getCoefficientObjects():
classes = []
ignList = getBaseClassNames()
for name, obj in inspect.getmembers(CPIncomp.MelinderFluids):
if inspect.isclass(obj):
#print(name)
if not name in ignList: # Ignore the base classes
classes += [obj()]
# for name, obj in inspect.getmembers(CPIncomp.SecCoolFluids):
# if inspect.isclass(obj):
# #print(name)
# if not name in ignList: # Ignore the base classes
# classes += [obj()]
return classes
def fitFluidList(fluidObjs):
for obj in fluidObjs:
if obj==fluidObjs[0]:
print(" {0}".format(obj.name), end="")
elif obj==fluidObjs[-1]:
print(", {0}".format(obj.name), end="")
else:
print(", {0}".format(obj.name), end="")
try:
writer.fitAll(obj)
except (TypeError, ValueError) as e:
print("An error occurred for fluid: {0}".format(obj.name))
print(obj)
print(e)
pass
return
def fitSecCoolList(fluidObjs):
for obj in fluidObjs:
if obj==fluidObjs[0]:
print(" {0}".format(obj.name), end="")
elif obj==fluidObjs[-1]:
print(", {0}".format(obj.name), end="")
else:
print(", {0}".format(obj.name), end="")
try:
obj.fitFluid()
except (TypeError, ValueError) as e:
print("An error occurred for fluid: {0}".format(obj.name))
print(obj)
print(e)
pass
return
def writeFluidList(fluidObjs):
for obj in fluidObjs:
if obj==fluidObjs[0]:
print("{0}".format(obj.name), end="")
elif obj==fluidObjs[-1]:
print(", {0}".format(obj.name), end="")
else:
print(", {0}".format(obj.name), end="")
try:
writer.toJSON(obj)
except (TypeError, ValueError) as e:
print("An error occurred for fluid: {0}".format(obj.name))
print(obj)
print(e)
pass
return
if __name__ == '__main__':
writer = SolutionDataWriter()
doneObjs = []
dataObjs = getExampleData()
for obj in dataObjs:
writer.fitAll(obj)
doneObjs += dataObjs[:]
doneObjs += getExampleCoef()
print("Writing coefficients for example fluids: ", end="")
writeFluidList(doneObjs)
print(" ... done")
# To debug single fluids
#writer.fitSecCoolList([Freezium()])
#sys.exit(0)
fluidObjs = getExampleNames(obj=True)
examplesToFit = ["ExamplePure","ExampleSolution","ExampleDigital"]
for obj in fluidObjs:
if obj.name in examplesToFit:
writer.fitAll(obj)
doneObjs += fluidObjs[:]
print("\nProcessing example fluids")
writer.writeFluidList(doneObjs)
# If the examples did not cause any errors,
# we can proceed to the real data.
doneObjs = []
dataObjs = getPureDataObjects()
print("Fitting pure fluids:", end="")
fitFluidList(dataObjs)
print(" ... done")
doneObjs += dataObjs[:]
dataObjs = getSolutionDataObjects()
print("Fitting solutions:", end="")
fitFluidList(dataObjs)
print(" ... done")
doneObjs += dataObjs[:]
print("\nProcessing fluids with given coefficients")
fluidObjs = getCoefficientFluids()
doneObjs += fluidObjs[:]
dataObjs = getDigitalDataObjects()
print("Fitting digital fluids:", end="")
fitFluidList(dataObjs)
print(" ... done")
doneObjs += dataObjs[:]
print("\nProcessing digital fluids")
fluidObjs = getDigitalFluids()
writer.fitFluidList(fluidObjs)
doneObjs += fluidObjs[:]
dataObjs = SecCoolSolutionData.factory()
print("Fitting SecCool fluids:", end="")
fitSecCoolList(dataObjs)
print(" ... done")
doneObjs += dataObjs[:]
#doneObjs += getCoefficientObjects()[:]
print("\nProcessing Melinder fluids")
fluidObjs = getMelinderFluids()
doneObjs += fluidObjs[:]
print("\nProcessing pure fluids")
fluidObjs = getPureFluids()
writer.fitFluidList(fluidObjs)
doneObjs += fluidObjs[:]
print("\nProcessing SecCool fluids")
fluidObjs = getSecCoolFluids()
writer.fitSecCoolList(fluidObjs)
doneObjs += fluidObjs[:]
print("\nAll {0} fluids processed, all coefficients should be set.".format(len(doneObjs)))
print("Checking the list of fluid objects.")
#doneObjs += getCoefficientObjects()[:]
doneObjs = sorted(doneObjs, key=lambda x: x.name)
oldName = ''
for obj in doneObjs:
if obj.name==oldName:
raise ValueError("Two elements have the same name, that does not work: {0}".format(oldName))
else:
oldName = obj.name
for i in range(len(doneObjs)-1):
if doneObjs[i].name==doneObjs[i+1].name:
print("Conflict between {0} and {1}, aborting".format(doneObjs[i],doneObjs[i+1]))
raise ValueError("Two elements have the same name, that does not work: {0}".format(doneObjs[i].name))
print("Writing coefficients for fluids: ", end="")
print("FluidName (w) | (i) -> (w)=written, (i)=ignored")
writeFluidList(doneObjs)
print(" ... done")
print("All checks passed, going to write to disk.")
writer.writeFluidList(doneObjs)
print("All done, bye")
sys.exit(0)
# data = SecCoolExample()
# writer.toJSON(data)