-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path03_GROSS.js
560 lines (551 loc) · 24.9 KB
/
03_GROSS.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
//Version 2.0 of routines for the calculation of thermodynamic
// properties from the AGA 8 Part 1 GROSS equation of state.
// April, 2017
//Written by Eric W. Lemmon
//Applied Chemicals and Materials Division
//National Institute of Standards and Technology (NIST)
//Boulder, Colorado, USA
//Eric.Lemmon@nist.gov
//303-497-7939
//Other contributors:
//Volker Heinemann, RMG Messtechnik GmbH
//Jason Lu, Thermo Fisher Scientific
//Ian Bell, NIST
//The publication for the AGA 8 equation of state is available from AGA
// and the Transmission Measurement Committee.
//Subroutines contained here for property calculations:
//***** Subroutine SetupGross must be called once before calling other routines. ******
//MolarMassGross(x, Mm)
//Sub PressureGross(T, D, xGrs, HCH, P, Z, ierr, herr)
//Sub DensityGross(T, P, xGrs, HCH, D, ierr, herr)
//Sub GrossHv(x, xGrs, HN, HCH)
//Sub GrossInputs(T, P, x, xGrs, Gr, HN, HCH, ierr, herr)
//Sub Bmix(T, xGrs, HCH, B, C, ierr, herr)
//Sub GrossMethod1(Th, Td, Pd, xGrs, Gr, Hv, Mm, HCH, HN, ierr, herr)
//Sub GrossMethod2(Th, Td, Pd, xGrs, Gr, Hv, Mm, HCH, HN, ierr, herr)
//Sub SetupGross()
//The compositions in the x() array use the following order and must be sent as mole fractions:
// 1 - Methane
// 2 - Nitrogen
// 3 - Carbon dioxide
// 4 - Ethane
// 5 - Propane
// 6 - Isobutane
// 7 - n-Butane
// 8 - Isopentane
// 9 - n-Pentane
// 10 - n-Hexane
// 11 - n-Heptane
// 12 - n-Octane
// 13 - n-Nonane
// 14 - n-Decane
// 15 - Hydrogen
// 16 - Oxygen
// 17 - Carbon monoxide
// 18 - Water
// 19 - Hydrogen sulfide
// 20 - Helium
// 21 - Argon
//
//For example, a mixture of 94% methane, 5% CO2, and 1% helium would be (in mole fractions):
//x(1)=0.94, x(3)=0.05, x(20)=0.01
//Variables containing the common parameters in the GROSS equations
//let MaxFlds = 21;
//let Epsilon = 0.000000000000001; //1d-15
//let dPdDsave=0;
let GROSS={
Pressure:400, //KPa
Temperature:273.15, //Kelvin
MolarMass:0, //g/mol
Density:0.04464, //mol/l
CompressibilityFactor:0,
dPdD:0,
xGrs:Array(4).fill(0),
HN:0, //kJ/mol
HCH:0, //kJ/mol
Th:298.15, //K
Td:298.15, //K
Pd:0, //kPa
Gr:0,
Hv:0, //MJ/m^3
ierr:0,
herr:'',
CalculateMolarMass(x){
//Sub MolarMassGross(x, Mm)
//Calculate molar mass of the mixture with the compositions contained in the x() input array
//
//Inputs:
// x() - Composition (mole fraction)
// Do not send mole percents or mass fractions in the x() array, otherwise the output will be incorrect.
// The sum of the compositions in the x() array must be equal to one.
// The order of the fluids in this array is given at the top of this code.
//
//Outputs:
// Mm - Molar mass (g/mol)
Mm = 0;
for (let i = 1; i <= NcGross;i++){
Mm = Mm + x[i] * MMiGross[i];
}
GROSS.MolarMass = Mm;
},
CalculatePressure(T, D, xGrs,HCH){
//Sub PressureGross(T, D, xGrs, HCH, P, Z, ierr, herr)
//Calculate pressure as a function of temperature and density. The derivative d(P)/d(D) is also calculated
//for use in the iterative DensityGross subroutine (and is only returned as a common variable).
//
//Inputs:
// T - Temperature (K)
// D - Density (mol/l)
//xGrs() - Compositions of the equivalent hydrocarbon, nitrogen, and CO2 (mole fractions)
// HCH - Molar ideal gross heating value of the equivalent hydrocarbon (kJ/mol) at 298.15 K
// ***Call subroutine GrossHv or GrossInputs first to obtain HCH.***
//
//Outputs:
// P - Pressure (kPa)
let P=0;
// Z - Compressibility factor
let Z=0;
// dPdDsave - d(P)/d(D) [kPa/(mol/l)] (at constant temperature)
// - This variable is cached in the common variables for use in the iterative density solver, but not returned as an argument.
// ierr - Error number (0 indicates no error)
let ierr;
// herr - Error message if ierr is not equal to zero
let herr;
let B=0;
let C=0;
Z = 1;
P = D * RGross * T;
[B, C, ierr, herr]=GROSS.CalculateBmix(T, xGrs, HCH);
if (ierr > 0){return};
Z = 1 + B * D + C * Math.pow(D, 2);
P = D * RGross * T * Z;
dPdDsave = RGross * T * (1 + 2 * B * D + 3 * C * Math.pow(D, 2));
if(P < 0){
ierr = -1;
herr = "Pressure is negative in the GROSS method.";
}
GROSS.Pressure = P;
GROSS.CompressibilityFactor = Z;
GROSS.ierr = ierr;
GROSS.herr = herr;
},
CalculateDensity(T,P,xGrs,HCH){
//Sub DensityGross(T, P, xGrs, HCH, D, ierr, herr)
//Calculate density as a function of temperature and pressure. This is an iterative routine that calls PressureGross
//to find the correct state point. Generally only 6 iterations at most are required.
//If the iteration fails to converge, the ideal gas density and an error message are returned.
//Inputs:
// T - Temperature (K)
// P - Pressure (kPa)
//xGrs() - Compositions of the equivalent hydrocarbon, nitrogen, and CO2 (mole fractions)
// HCH - Molar ideal gross heating value of the equivalent hydrocarbon (kJ/mol) at 298.15 K
// ***Call subroutine GrossHv or GrossInputs first to obtain HCH.***
//Outputs:
// D - Density (mol/l)
let D;
// ierr - Error number (0 indicates no error)
let ierr;
// herr - Error message if ierr is not equal to zero
let herr;
let it;
let plog;
let vlog;
let P2;
let Z;
let dpdlv;
let vdiff;
let tolr;
ierr = 0;
herr = '';
if(P < Epsilon){D = 0; return}
tolr = 0.0000001;
D = P / RGross / T; //Ideal gas estimate
plog = Math.log(P);
vlog = -Math.log(D);
for (it = 1; it <= 20; it++){
if(vlog < -7 || vlog > 100){GoToDError()}
D = Math.exp(-vlog);
GROSS.CalculatePressure(T, D, xGrs, HCH);
P2 = GROSS.Pressure;
Z = GROSS.CompressibilityFactor;
ierr = GROSS.ierr;
herr = GROSS.herr;
if (ierr > 0){GROSS.Density = D;GROSS.ierr = ierr;GROSS.herr = herr;return}
if (dPdDsave < Epsilon || P2 < Epsilon){
vlog = vlog + 0.1;
}else{
//Find the next density with a first order Newton's type iterative scheme, with
//log(P) as the known variable and log(v) as the unknown property.
//See AGA 8 publication for further information.
dpdlv = -D * dPdDsave; //d(p)/d[log(v)]
vdiff = (Math.log(P2) - plog) * P2 / dpdlv;
vlog = vlog - vdiff;
if(Math.abs(vdiff) < tolr){
if(P2 < 0){GoToDError()};
D = Math.exp(-vlog);
GROSS.dPdD = dPdDsave;
GROSS.Density = D;
GROSS.ierr = ierr;
GROSS.herr = herr;
return; //Iteration converged
}
}
}
function GoToDError(){
ierr = 10;
herr = 'Calculation failed to converge in the GROSS method, ideal gas density returned.';
D = P / RGross / T;
}
},
CalculateHv(x){
//Sub GrossHv(x, xGrs, HN, HCH)
//Calculate ideal heating values based on composition. The mole fractions in the mixture are required in this routine, not
// just xCH, xN2, and xCO2.
//
//Inputs:
// x() - Molar compositions of all components in the mixture. The order in this array is given at the top of this code.
//
//Outputs:
//xGrs() - Compositions of the equivalent hydrocarbon, nitrogen, and CO2 (mole fractions)
let xGrs=[];
// HN - Molar ideal gross heating value of the mixture (kJ/mol) at 298.15 K
let HN;
// HCH - Molar ideal gross heating value of the equivalent hydrocarbon (kJ/mol) at 298.15 K
let HCH;
xGrs[1] = 1 - x[2] - x[3];
xGrs[2] = x[2];
xGrs[3] = x[3];
HN = 0;
for(let i = 1; i <= NcGross; i++){
HN = HN + x[i] * xHN[i];
}
HCH = 0;
if (xGrs[1] > 0){HCH = HN / xGrs[1]}
GROSS.xGrs = xGrs;
GROSS.HN = HN;
GROSS.HCH = HCH;
},
CalculateInputs(T,P,x){
//Sub GrossInputs(T, P, x, xGrs, Gr, HN, HCH, ierr, herr)
//Calculate relative density and heating values based on composition. This routine should only be used to get these
// two values for use as inputs to Method 1 or Method 2, and not for the relative density for any T and P.
// All of the mole fractions in the mixture are required in this routine, not just xCH, xN2, and xCO2.
//
//Inputs:
// T - Temperature (K), generally a reference temperature for relative density
// P - Pressure (kPa), generally a reference pressure for relative density
// x() - Molar compositions of all components in the mixture. The order in this array is given at the top of this code.
//
//Outputs:
//xGrs() - Compositions of the equivalent hydrocarbon, nitrogen, and CO2 (mole fractions)
let xGrs=[];
// Gr - Relative density at T and P
let Gr;
// HN - Molar ideal gross heating value of the mixture (kJ/mol) at 298.15 K
let HN;
// HCH - Molar ideal gross heating value of the equivalent hydrocarbon (kJ/mol) at 298.15 K
let HCH;
// ierr - Error number (0 indicates no error)
let ierr;
// herr - Error message if ierr is not equal to zero
let herr;
let Bref;
let Zref;
let Mref;
let Z;
let D;
let Mm;
ierr = 0;
herr = '';
GROSS.CalculateHv(x);
xGrs=GROSS.xGrs;
HN=GROSS.HN;
HCH=GROSS.HCH;
if(HCH==0){return};
Bref = -0.12527 + 0.000591 * T - 0.000000662 * Math.pow(T , 2); //2nd virial coefficient of the reference fluid at T
Zref = 1 + Bref * P / RGross / T; //Z of the reference fluid at T and P
Mref = 28.9625;
GROSS.CalculateMolarMass(x);
Mm = GROSS.MolarMass;
GROSS.CalculateDensity(T, P, xGrs, HCH); //Density of the input fluid at T and D
D = GROSS.Density;
ierr = GROSS.ierr;
herr = GROSS.herr;
Z = P / T / D / RGross; //Z of the input fluid at T and D
Gr = Mm * Zref / Mref / Z;
GROSS.xGrs = xGrs;
GROSS.Gr = Gr;
GROSS.HN = HN;
GROSS.HCH = HCH;
GROSS.ierr = ierr;
GROSS.herr = herr;
},
CalculateBmix(T,xGrs,HCH){
//Sub Bmix(T, xGrs, HCH, B, C, ierr, herr)
//Calculate 2nd and 3rd virial coefficients for the mixture at T.
//
//Inputs:
// T - Temperature (K)
//xGrs() - Compositions of the equivalent hydrocarbon, nitrogen, and CO2 (mole fractions)
// HCH - Molar ideal gross heating value of the equivalent hydrocarbon (kJ/mol) at 298.15 K
//
//Outputs:
// B - Second virial coefficient (dm^3/mol)
let B=0;
// C - Third virial coefficient (dm^6/mol^2)
let C=0;
// ierr - Error number (0 indicates no error)
let ierr=0;
// herr - Error message if ierr is not equal to zero
let herr='';
let i;let j;let k;
let bCH=Array(3+1).fill(0);
let cCH=Array(3+1).fill(0);
BB=zeros([3, 3]);
CC=zeros([3, 3, 3]);
let onethrd;
//Temperature dependent Bi and Ci values for obtaining B(CH-CH) and C(CH-CH-CH)
for (i = 0; i <= 2; i++){
bCH[i] = bCHx[0][i] + bCHx[1][i] * T + bCHx[2][i] * Math.pow(T , 2);
cCH[i] = cCHx[0][i] + cCHx[1][i] * T + cCHx[2][i] * Math.pow(T , 2);
}
//Bij and Cijk values for nitrogen and CO2
for (i = 2; i <= 3; i++){
for (j = i ; j<= 3; j++){
BB[i][j] = b0[i][j] + b1[i][j] * T + b2[i][j] * Math.pow(T , 2);
for(k = j; k <= 3; k++){
CC[i][j][k] = c0[i][j][k] + c1[i][j][k] * T + c2[i][j][k] * Math.pow(T , 2);
}
}
}
//Bij values for use in calculating Bmix
BB[1][1] = bCH[0] + bCH[1] * HCH + bCH[2] * Math.pow(HCH , 2); //B(CH-CH) for the equivalent hydrocarbon
BB[1][2] = (0.72 + 0.00001875 * Math.pow((320 - T) , 2)) * (BB[1][1] + BB[2][2]) / 2; //B(CH-N2)
if(BB[1][1] * BB[3][3] < 0){ierr = 4; herr = "Invalid input in Bmix routine"; return[B, C, ierr, herr]};
BB[1][3] = -0.865 * Math.sqrt(BB[1][1] * BB[3][3]); //B(CH-CO2)
//Cijk values for use in calculating Cmix
onethrd = 1 / 3;
CC[1][1][1] = cCH[0] + cCH[1] * HCH + cCH[2] * Math.pow(HCH , 2); //C(CH-CH-CH) for the equivalent hydrocarbon
if(CC[1][1][1] < 0 || CC[3][3][3] < 0) {ierr = 5; herr = "Invalid input in Bmix routine"; return[B, C, ierr, herr]}
CC[1][1][2] = (0.92 + 0.0013 * (T - 270)) * Math.pow((Math.pow(CC[1][1][1] , 2) * CC[2][2][2]), onethrd); //C(CH-CH-N2)
CC[1][2][2] = (0.92 + 0.0013 * (T - 270)) * Math.pow((Math.pow(CC[2][2][2] , 2) * CC[1][1][1]), onethrd); //C(CH-N2-N2)
CC[1][1][3] = 0.92 * (Math.pow(CC[1][1][1] , 2) * Math.pow(CC[3][3][3]) , onethrd); //C(CH-CH-CO2)
CC[1][3][3] = 0.92 * (Math.pow(CC[3][3][3] , 2) * Math.pow(CC[1][1][1]) , onethrd); //C(CH-CO2-CO2)
CC[1][2][3] = 1.1 * (CC[1][1][1] * CC[2][2][2] * Math.pow(CC[3][3][3]) , onethrd); //C(CH-N2-CO2)
//Calculate Bmix and Cmix
for (i = 1 ; i<= 3;i++){
for (j = i ; j <= 3; j++){
if (i == j){
B = B + BB[i][i] * Math.pow(xGrs[i], 2);
}else{
B = B + 2 * BB[i][j] * xGrs[i] * xGrs[j];
}
for (k = j ; k <= 3; k ++){
if (i == j && j == k){
C = C + CC[i][i][i] * Math.pow(xGrs[i], 3);
}else if(i != j && j != k && i != k){
C = C + 6 * CC[i][j][k] * xGrs[i] * xGrs[j] * xGrs[k];
}else{
C = C + 3 * CC[i][j][k] * xGrs[i] * xGrs[j] * xGrs[k];
}
}
}
}
return [B, C, ierr, herr];
},
Method1(Th,Td,Pd,xGrs,Gr,Hv){
//Sub GrossMethod1(Th, Td, Pd, xGrs, Gr, Hv, Mm, HCH, HN, ierr, herr)
//Initialize variables required in the GROSS equation with Method 1 of the AGA 8 Part 1 publication.
//Method 1 requires inputs of volumetric gross heating value, relative density, and mole fraction of CO2.
//
//Inputs:
// Th - Reference temperature for heating value (K)
// Td - Reference temperature for density (K)
// Pd - Reference pressure for density (kPa)
//xGrs() - Array of size 3 with the molar composition of CO2 in the 3rd position. xCH and xN2 are returned in this array.
// Gr - Relative density at Td and Pd
// Hv - Volumetric ideal gross heating value (MJ/m^3) at Th
//
//Outputs:
//xGrs() - Compositions of the equivalent hydrocarbon, nitrogen, and CO2 (mole fractions)
// Mm - Molar mass (g/mol)
// HCH - Molar ideal gross heating value of the equivalent hydrocarbon (kJ/mol) at 298.15 K
// HN - Molar ideal gross heating value of the mixture (kJ/mol) at 298.15 K
// ierr - Error number (0 indicates no error)
// herr - Error message if ierr is not equal to zero
let xCH;let xN2;let xCO2;let Zd;let Zold;
let G1; let G2; let Bref; let Zref; let B; let C;
let HCH;let HN;
ierr = 0;
herr = '';
if (Gr < Epsilon) {ierr = 1; herr = "Invalid input for relative density"; return}
if (Hv < Epsilon) {ierr = 2; herr = "Invalid input for heating value"; return}
xCO2 = xGrs[3];
Zd = 1;
G1 = -2.709328;
G2 = 0.021062199;
Bref = -0.12527 + 0.000591 * Td - 0.000000662 * Math.pow(Td , 2); //dm^3/mol
Zref = (1 + Pd / RGross / Td * Bref);
for (let i = 1; i <= 20; i++){
Zold = Zd;
HN = Zd * RGross * Td / Pd * Hv * (1 + 0.0001027 * (Th - 298.15)); //kJ/mol at 25 C
Mm = Gr * Zd * 28.9625 / Zref; //g/mol
xCH = (Mm + (xCO2 - 1) * mN2 - xCO2 * mCO2 - G2 * HN) / (G1 - mN2);
xN2 = 1 - xCH - xCO2;
if(xN2 < 0){ierr = 3; herr = 'Negative nitrogen value in GROSS method 1 setup';GROSS.ierr = ierr;GROSS.herr = herr;return};
HCH = HN / xCH;
xGrs[1] = xCH;
xGrs[2] = xN2;
[B, C, ierr, herr]=GROSS.CalculateBmix(Td, xGrs, HCH);
if(ierr > 0) {GROSS.xGrs = xGrs;GROSS.MolarMass = Mm;GROSS.HN = HN;GROSS.ierr = ierr;GROSS.herr = herr;return}
Zd = 1 + B * Pd / RGross / Td;
if(Math.abs(Zold - Zd) < 0.0000001){break}
}
GROSS.xGrs = xGrs;
GROSS.MolarMass = Mm;
GROSS.HN = HN;
GROSS.ierr = ierr;
GROSS.herr = herr;
},
Method2(Th,Td,Pd,xGrs,Gr){
//Sub GrossMethod2(Th, Td, Pd, xGrs, Gr, Hv, Mm, HCH, HN, ierr, herr)
//Initialize variables required in the GROSS equation with Method 2 of the AGA 8 Part 1 publication.
//Method 2 requires inputs of relative density and mole fractions of nitrogen and CO2.
//Inputs:
// Th - Reference temperature for heating value (K)
// Td - Reference temperature for density (K)
// Pd - Reference pressure for density (kPa)
//xGrs() - Array of size 3 with the molar composition of N2 in the 2nd position and CO2 in the 3rd position. xCH is returned in this array.
// Gr - Relative density at Td and Pd
//
//Outputs:
//xGrs() - Compositions of the equivalent hydrocarbon, nitrogen, and CO2 (mole fractions)
// Mm - Molar mass (g/mol)
// Hv - Volumetric ideal gross heating value (MJ/m^3) at Th
// HCH - Molar ideal gross heating value of the equivalent hydrocarbon (kJ/mol) at 298.15 K
// HN - Molar ideal gross heating value of the mixture (kJ/mol) at 298.15 K
// ierr - Error number (0 indicates no error)
// herr - Error message if ierr is not equal to zero
let xCH;let Z; let Zold; let Bref ; let Zref; let MrCH;
let G1;let G2;let B;let C;let xN2;let xCO2;
let HCH; let HN;
let ierr = 0;
let herr = "";
if(Gr < Epsilon){ierr = 1; herr = "Invalid input for relative density"; return};
xN2 = xGrs[2];
xCO2 = xGrs[3];
xCH = 1 - xN2 - xCO2;
xGrs[1] = xCH;
Z = 1;
G1 = -2.709328;
G2 = 0.021062199;
Bref = -0.12527 + 0.000591 * Td - 0.000000662 * Math.pow(Td, 2);
Zref = (1 + Pd / RGross / Td * Bref);
for (let i = 1; i <= 20; i++){
Zold = Z;
Mm = Gr * Z * 28.9625 / Zref;
MrCH = (Mm - xN2 * mN2 - xCO2 * mCO2) / xCH;
HCH = (MrCH - G1) / G2;
[B, C, ierr, herr] = GROSS.CalculateBmix(Td, xGrs, HCH);
if (ierr > 0) {return}
Z = 1 + B * Pd / RGross / Td;
if (Math.abs(Zold - Z) < 0.0000001){break}
}
HN = HCH * xCH;
Hv = HN / Z / RGross / Td * Pd / (1 + 0.0001027 * (Th - 298.15));
GROSS.xGrs = xGrs;
GROSS.MolarMass = Mm;
GROSS.Hv = Hv;
GROSS.HCH = HCH;
GROSS.HN = HN;
GROSS.ierr = ierr;
GROSS.herr = herr;
},
//The following routine must be called once before any other routine.
Setup(){
//Initialize all the constants and parameters in the GROSS model.
RGross = 8.31451;
//Molar masses [g/mol]. These are the same as those in the DETAIL method.
MMiGross[1] = 16.043; //Methane
MMiGross[2] = 28.0135; //Nitrogen
MMiGross[3] = 44.01; //Carbon dioxide
MMiGross[4] = 30.07; //Ethane
MMiGross[5] = 44.097; //Propane
MMiGross[6] = 58.123; //Isobutane
MMiGross[7] = 58.123; //n-Butane
MMiGross[8] = 72.15; //Isopentane
MMiGross[9] = 72.15; //n-Pentane
MMiGross[10] = 86.177; //Hexane
MMiGross[11] = 100.204; //Heptane
MMiGross[12] = 114.231; //Octane
MMiGross[13] = 128.258; //Nonane
MMiGross[14] = 142.285; //Decane
MMiGross[15] = 2.0159; //Hydrogen
MMiGross[16] = 31.9988; //Oxygen
MMiGross[17] = 28.01; //Carbon monoxide
MMiGross[18] = 18.0153; //Water
MMiGross[19] = 34.082; //Hydrogen sulfide
MMiGross[20] = 4.0026; //Helium
MMiGross[21] = 39.948; //Argon
//Initialize constants
b0[2][2] = -0.1446; b1[2][2] = 0.00074091; b2[2][2] = -0.00000091195;
b0[2][3] = -0.339693; b1[2][3] = 0.00161176; b2[2][3] = -0.00000204429;
b0[3][3] = -0.86834; b1[3][3] = 0.0040376; b2[3][3] = -0.0000051657;
c0[2][2][2] = 0.0078498; c1[2][2][2] = -0.000039895; c2[2][2][2] = 0.000000061187;
c0[2][2][3] = 0.00552066; c1[2][2][3] = -0.0000168609; c2[2][2][3] = 0.0000000157169;
c0[2][3][3] = 0.00358783; c1[2][3][3] = 0.00000806674; c2[2][3][3] = -0.0000000325798;
c0[3][3][3] = 0.0020513; c1[3][3][3] = 0.000034888; c2[3][3][3] = -0.000000083703;
bCHx[0][0] = -0.425468; bCHx[1][0] = 0.002865; bCHx[2][0] = -0.00000462073;
bCHx[0][1] = 0.000877118; bCHx[1][1] = -0.00000556281; bCHx[2][1] = 0.0000000088151;
bCHx[0][2] = -0.000000824747; bCHx[1][2] = 0.00000000431436; bCHx[2][2] = -6.08319E-12;
cCHx[0][0] = -0.302488; cCHx[1][0] = 0.00195861; cCHx[2][0] = -0.00000316302;
cCHx[0][1] = 0.000646422; cCHx[1][1] = -0.00000422876; cCHx[2][1] = 0.00000000688157;
cCHx[0][2] = -0.000000332805; cCHx[1][2] = 0.0000000022316; cCHx[2][2] = -3.67713E-12;
//Heating values from ISO 6976 at 25 C (kJ/mol)
//xHN(1) = 890.58 'Methane
//xHN(2) = 0 'Nitrogen
//xHN(3) = 0 'Carbon dioxide
//xHN(4) = 1560.69 'Ethane
//xHN(5) = 2219.17 'Propane
//xHN(6) = 2868.2 'Isobutane
//xHN(7) = 2877.4 'n-Butane
//xHN(8) = 3528.83 'Isopentane
//xHN(9) = 3535.77 'n-Pentane
//xHN(10) = 4194.95 'Hexane
//xHN(11) = 4853.43 'Heptane
//xHN(12) = 5511.8 'Octane
//xHN(13) = 6171.15 'Nonane
//xHN(14) = 6829.77 'Decane
//xHN(15) = 285.83 'Hydrogen
//xHN(16) = 0 'Oxygen
//xHN(17) = 282.98 'Carbon monoxide
//xHN(18) = 44.013 'Water
//xHN(19) = 562.01 'Hydrogen sulfide
//xHN(20) = 0 'Helium
//xHN(21) = 0 'Argon
//Heating values from AGA-5, 2009 at 25 C (kJ/mol)
xHN[1] = 890.63; //Methane
xHN[2] = 0; //Nitrogen
xHN[3] = 0; //Carbon dioxide
xHN[4] = 1560.69; //Ethane
xHN[5] = 2219.17; //Propane
xHN[6] = 2868.2; //Isobutane
xHN[7] = 2877.4; //n-Butane
xHN[8] = 3528.83; //Isopentane
xHN[9] = 3535.77; //n-Pentane
xHN[10] = 4194.95; //Hexane
xHN[11] = 4853.43; //Heptane
xHN[12] = 5511.8; //Octane
xHN[13] = 6171.15; //Nonane
xHN[14] = 6829.77; //Decane
xHN[15] = 285.83; //Hydrogen
xHN[16] = 0; //Oxygen
xHN[17] = 282.98; //Carbon monoxide
xHN[18] = 44.016; //Water
xHN[19] = 562.01; //Hydrogen sulfide
xHN[20] = 0; //Helium
xHN[21] = 0; //Argon
mN2 = MMiGross[2];
mCO2 = MMiGross[3];
}
}