CoolProp  6.6.0
An open-source fluid property and humid air property database
TestObjects.cpp
Go to the documentation of this file.
1 
8 #include "TestObjects.h"
9 #include "DataStructures.h"
10 #include "IncompressibleFluid.h"
11 #include "Eigen/Core"
12 
13 #if defined ENABLE_CATCH
14 
15 Eigen::MatrixXd CoolPropTesting::makeMatrix(const std::vector<double>& coefficients) {
16  //IncompressibleClass::checkCoefficients(coefficients,18);
17  std::vector<std::vector<double>> matrix;
18  std::vector<double> tmpVector;
19 
20  tmpVector.clear();
21  tmpVector.push_back(coefficients[0]);
22  tmpVector.push_back(coefficients[6]);
23  tmpVector.push_back(coefficients[11]);
24  tmpVector.push_back(coefficients[15]);
25  matrix.push_back(tmpVector);
26 
27  tmpVector.clear();
28  tmpVector.push_back(coefficients[1] * 100.0);
29  tmpVector.push_back(coefficients[7] * 100.0);
30  tmpVector.push_back(coefficients[12] * 100.0);
31  tmpVector.push_back(coefficients[16] * 100.0);
32  matrix.push_back(tmpVector);
33 
34  tmpVector.clear();
35  tmpVector.push_back(coefficients[2] * 100.0 * 100.0);
36  tmpVector.push_back(coefficients[8] * 100.0 * 100.0);
37  tmpVector.push_back(coefficients[13] * 100.0 * 100.0);
38  tmpVector.push_back(coefficients[17] * 100.0 * 100.0);
39  matrix.push_back(tmpVector);
40 
41  tmpVector.clear();
42  tmpVector.push_back(coefficients[3] * 100.0 * 100.0 * 100.0);
43  tmpVector.push_back(coefficients[9] * 100.0 * 100.0 * 100.0);
44  tmpVector.push_back(coefficients[14] * 100.0 * 100.0 * 100.0);
45  tmpVector.push_back(0.0);
46  matrix.push_back(tmpVector);
47 
48  tmpVector.clear();
49  tmpVector.push_back(coefficients[4] * 100.0 * 100.0 * 100.0 * 100.0);
50  tmpVector.push_back(coefficients[10] * 100.0 * 100.0 * 100.0 * 100.0);
51  tmpVector.push_back(0.0);
52  tmpVector.push_back(0.0);
53  matrix.push_back(tmpVector);
54 
55  tmpVector.clear();
56  tmpVector.push_back(coefficients[5] * 100.0 * 100.0 * 100.0 * 100.0 * 100.0);
57  tmpVector.push_back(0.0);
58  tmpVector.push_back(0.0);
59  tmpVector.push_back(0.0);
60  matrix.push_back(tmpVector);
61 
62  tmpVector.clear();
63  return CoolProp::vec_to_eigen(matrix).transpose();
64 }
65 
66 CoolProp::IncompressibleFluid CoolPropTesting::incompressibleFluidObject() {
67 
68  std::string tmpStr;
69  std::vector<double> tmpVector;
70  std::vector<std::vector<double>> tmpMatrix;
71 
72  tmpVector.clear();
73  tmpVector.push_back(960.24665800);
74  tmpVector.push_back(-1.2903839100);
75  tmpVector.push_back(-0.0161042520);
76  tmpVector.push_back(-0.0001969888);
77  tmpVector.push_back(1.131559E-05);
78  tmpVector.push_back(9.181999E-08);
79  tmpVector.push_back(-0.4020348270);
80  tmpVector.push_back(-0.0162463989);
81  tmpVector.push_back(0.0001623301);
82  tmpVector.push_back(4.367343E-06);
83  tmpVector.push_back(1.199000E-08);
84  tmpVector.push_back(-0.0025204776);
85  tmpVector.push_back(0.0001101514);
86  tmpVector.push_back(-2.320217E-07);
87  tmpVector.push_back(7.794999E-08);
88  tmpVector.push_back(9.937483E-06);
89  tmpVector.push_back(-1.346886E-06);
90  tmpVector.push_back(4.141999E-08);
93  density.coeffs = makeMatrix(tmpVector);
94 
95  tmpVector.clear();
96  tmpVector.push_back(3822.9712300);
97  tmpVector.push_back(-23.122409500);
98  tmpVector.push_back(0.0678775826);
99  tmpVector.push_back(0.0022413893);
100  tmpVector.push_back(-0.0003045332);
101  tmpVector.push_back(-4.758000E-06);
102  tmpVector.push_back(2.3501449500);
103  tmpVector.push_back(0.1788839410);
104  tmpVector.push_back(0.0006828000);
105  tmpVector.push_back(0.0002101166);
106  tmpVector.push_back(-9.812000E-06);
107  tmpVector.push_back(-0.0004724176);
108  tmpVector.push_back(-0.0003317949);
109  tmpVector.push_back(0.0001002032);
110  tmpVector.push_back(-5.306000E-06);
111  tmpVector.push_back(4.242194E-05);
112  tmpVector.push_back(2.347190E-05);
113  tmpVector.push_back(-1.894000E-06);
114  CoolProp::IncompressibleData specific_heat;
116  specific_heat.coeffs = makeMatrix(tmpVector);
117 
118  tmpVector.clear();
119  tmpVector.push_back(0.4082066700);
120  tmpVector.push_back(-0.0039816870);
121  tmpVector.push_back(1.583368E-05);
122  tmpVector.push_back(-3.552049E-07);
123  tmpVector.push_back(-9.884176E-10);
124  tmpVector.push_back(4.460000E-10);
125  tmpVector.push_back(0.0006629321);
126  tmpVector.push_back(-2.686475E-05);
127  tmpVector.push_back(9.039150E-07);
128  tmpVector.push_back(-2.128257E-08);
129  tmpVector.push_back(-5.562000E-10);
130  tmpVector.push_back(3.685975E-07);
131  tmpVector.push_back(7.188416E-08);
132  tmpVector.push_back(-1.041773E-08);
133  tmpVector.push_back(2.278001E-10);
134  tmpVector.push_back(4.703395E-08);
135  tmpVector.push_back(7.612361E-11);
136  tmpVector.push_back(-2.734000E-10);
137  CoolProp::IncompressibleData conductivity;
139  conductivity.coeffs = makeMatrix(tmpVector);
140 
141  tmpVector.clear();
142  tmpVector.push_back(1.4725525500);
143  tmpVector.push_back(0.0022218998);
144  tmpVector.push_back(-0.0004406139);
145  tmpVector.push_back(6.047984E-06);
146  tmpVector.push_back(-1.954730E-07);
147  tmpVector.push_back(-2.372000E-09);
148  tmpVector.push_back(-0.0411841566);
149  tmpVector.push_back(0.0001784479);
150  tmpVector.push_back(-3.564413E-06);
151  tmpVector.push_back(4.064671E-08);
152  tmpVector.push_back(1.915000E-08);
153  tmpVector.push_back(0.0002572862);
154  tmpVector.push_back(-9.226343E-07);
155  tmpVector.push_back(-2.178577E-08);
156  tmpVector.push_back(-9.529999E-10);
157  tmpVector.push_back(-1.699844E-06);
158  tmpVector.push_back(-1.023552E-07);
159  tmpVector.push_back(4.482000E-09);
162  viscosity.coeffs = makeMatrix(tmpVector);
163 
164  tmpVector.clear();
165  tmpVector.push_back(27.755555600 / 100.0); // reference concentration in per cent
166  tmpVector.push_back(-22.973221700 + 273.15);
167  tmpVector.push_back(-1.1040507200 * 100.0);
168  tmpVector.push_back(-0.0120762281 * 100.0 * 100.0);
169  tmpVector.push_back(-9.343458E-05 * 100.0 * 100.0 * 100.0);
172  T_freeze.coeffs = CoolProp::vec_to_eigen(tmpVector);
173  T_freeze.coeffs.transposeInPlace();
174 
175  // After preparing the coefficients, we have to create the objects
177  CH3OH.setName("CH3OH-testing");
178  CH3OH.setDescription("Methanol solution");
179  CH3OH.setReference("SecCool software");
180  CH3OH.setTmax(20 + 273.15);
181  CH3OH.setTmin(-50 + 273.15);
182  CH3OH.setxmax(0.5);
183  CH3OH.setxmin(0.0);
185  CH3OH.setTminPsat(20 + 273.15);
186 
187  CH3OH.setTbase(-4.48 + 273.15);
188  CH3OH.setxbase(31.57 / 100.0);
189 
191  CH3OH.setDensity(density);
192  CH3OH.setSpecificHeat(specific_heat);
193  CH3OH.setViscosity(viscosity);
194  CH3OH.setConductivity(conductivity);
195  //CH3OH.setPsat(saturation_pressure);
196  CH3OH.setTfreeze(T_freeze);
197  //CH3OH.setVolToMass(volume2mass);
198  //CH3OH.setMassToMole(mass2mole);
199 
201  CH3OH.validate();
202 
203  return CH3OH;
204 }
205 //CoolProp::IncompressibleBackend CoolProp::Testing::incompressibleBackendObject(){
206 // return CoolProp::IncompressibleBackend(CoolProp::Testing::incompressibleFluidObject());
207 //}
208 
209 #endif // ENABLE_CATCH