-
Notifications
You must be signed in to change notification settings - Fork 31
/
IF97.h
4892 lines (4662 loc) · 213 KB
/
IF97.h
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
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#ifndef IF97HEADER_H
#define IF97HEADER_H
#include <vector>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip> // std::setprecision
#include <stdexcept>
#include <stdio.h>
enum IF97parameters {IF97_DMASS, IF97_HMASS, IF97_T, IF97_P, IF97_SMASS, IF97_UMASS, IF97_CPMASS, IF97_CVMASS, IF97_W, IF97_DRHODP,
// Transport Property enumerations
IF97_MU, IF97_K,
// Quality
IF97_Q };
enum IF97SatState {NONE, LIQUID, VAPOR}; // Saturated Liquid/Vapor state determination
enum IF97RevCase {SMOOTH, RAMP, STEP};
struct RegionIdealElement // Structure for the single indexed state equation coefficients
{
int J; ///< The first index
double n; ///< The leading numerical constant
};
struct RegionResidualElement // Structure for the double indexed state equation coefficients
{
int I, ///< The first index
J; ///< The second index
double n; ///< The leading numerical constant
};
namespace IF97
{
// Modified power function below, powi(x,i), is for integer powers of doubles only. It can be
// up to 5X faster than std::pow() when using integer powers. This can significantly spped up
// the forward IF97 functions. Transport functions and reverse funcitons require powers of
// reals and should still use std::pow().
//
inline double powi(double x, int i)
{
double ans = 1.0;
if (i < 0) {
x = 1.0 / x;
i = -i;
}
for (; i > 0; i >>= 1) {
if (i & 1) ans *= x;
x *= x;
}
return ans;
}
// CoolProp-IF97 Version Number
static char IF97VERSION [] = "v2.2.0";
// Setup Water Constants for Trivial Functions and use in Region Classes
// Constant values from:
// Revised Release on the IAPWS Industrial Formulation 1997
// for the Thermodynamic Properties of Water and Steam, August 2007
// IAPWS G5-01(2016), Guideline on the Use of Fundamental Physical Constants
// and Basic Constants of Water
// * IAPWS constants use units of MPa and kJ and are entered as such, but converted as needed to SI
// depending on the definition of IAPWS_UNITS below. Main program can define IAPWS_UNITS
// to leave all input/output values in IAPWS units, which is handy for results verification
// against values printed in the IAPWS documents. CoolProp will never use this definition.
// Converted constants below are commented with an *.
#ifdef IAPWS_UNITS
const double p_fact = 1.0; // Leaves Thermodynamic Properties in IAPWS units of MPa
const double R_fact = 1.0; // Leaves Thermodynamic Properties in IAPWS units of kJ
#else
const double p_fact = 1e6; // Converts IAPWS MPa units to Pa
const double R_fact = 1000; // Converts IAPWS kJ units to J
#endif
// IF97 Constants
const double Tcrit = 647.096; // K
const double Pcrit = 22.064*p_fact; // MPa*
const double Rhocrit = 322.0; // kg/m³
const double Scrit = 4.41202148223476*R_fact; // kJ*/kg-K (needed for backward eqn. in Region 3(a)(b)
const double Ttrip = 273.16; // K
const double Ptrip = 0.000611657*p_fact; // MPa* [Change per IAPWS R7-97(2012), p. 7, Eq. 9]
const double Tmin = 273.15; // K
const double Tmax = 1073.15; // K
const double Pmin = 0.000611213*p_fact; // MPa*
const double Pmax = 100.0*p_fact; // MPa*
const double Rgas = 0.461526*R_fact; // kJ*/kg-K : mass based!
const double MW = 0.018015268; // kg/mol
// Bounds for Region Determination
const double Text = 2273.15; // Extended (Region 5) Temperature Limit (Region 5) [K]
const double Pext = 50.0*p_fact; // Extended (Region 5) Pressure Limit (Region 5) [MPa*]
const double P23min = 16.529164252605*p_fact; // Min Pressure [MPa*] on Region23 boundary curve; Max is Pmax
const double T23min = 623.15; // Min Temperature on Region23 boundary curve
const double T23max = 863.15; // Max Temperature on Region23 boundary curve
const double P2amax = 4.0*p_fact; // Max Pressure [MPa*] on upper H2a2b boundary (straight line)
const double P2bcmin = 6.54670*p_fact; // Min Pressure [MPa*] on H2b2c boundary curve; Max is Pmax
const double S2bc = 5.85*R_fact; // Min Pressure [MPa*] on H2b2c boundary curve; Max is Pmax
// Bounds for Backward p(h,s), t(h,s) Determination
const double Smin = 0.0; // Min Entropy [kJ*/kg-K] for Backward p(h,s)
const double Smax = 11.921054825051103*R_fact; // Max Entropy [kJ*/kg-K] for Backward p(h,s)
const double STPmax = 6.04048367171238*R_fact; // S(Tmax,Pmax) [kJ*/kg-K]
const double Sgtrip = 9.155492076509681*R_fact; // Sat. Vapor Entropy [kJ*/kg-K] at Triple Point
const double Sftrip = -4.09187776773977E-7*R_fact; // Sat. Liquid Entropy [kJ*/kg-K] at Triple Point
const double Hgtrip = 2500.9109532932*R_fact; // Sat. Vapor Enthalpy [kJ*/kg] at Triple Point
const double Hftrip = 5.16837786577998E-4*R_fact; // Sat. Liquid Enthalpy [kJ*/kg] at Triple Point
const double SfT23 = 3.778281340*R_fact; // Sat. Liquid Entropy [KJ*/kg-K] at T23min
const double SgT23 = 5.210887825*R_fact; // Sat. Vapor Entropy [KJ*/kg-K] at T23min
const double S13min = 3.397782955*R_fact; // Entropy at (T13,Pmax) [kJ*/kg-K]
const double S23min = 5.048096828*R_fact; // B23 Bounding Box [kJ*/kg-K]
const double S23max = 5.260578707*R_fact; // B23 Bounding Box [kJ*/kg-K]
const double H23min = 2.563592004E3*R_fact; // B23 Bounding Box [kJ*/kg-K]
const double H23max = 2.812942061E3*R_fact; // B23 Bounding Box [kJ*/kg-K]
//
double Tsat97(double p); // Forward declaration of Tsat97 required for calls below.
double psat97(double T); // Forward declaration of psat97 required for calls below.
//
static RegionResidualElement Hresiddata[] = { // Residual H for viscosity
{0, 0, 5.20094e-1},
{1, 0, 8.50895e-2},
{2, 0, -1.08374 },
{3, 0, -2.89555e-1},
{0, 1, 2.22531e-1},
{1, 1, 9.99115e-1},
{2, 1, 1.88797 },
{3, 1, 1.26613 },
{5, 1, 1.20573e-1},
{0, 2, -2.81378e-1},
{1, 2, -9.06851e-1},
{2, 2, -7.72479e-1},
{3, 2, -4.89837e-1},
{4, 2, -2.57040e-1},
{0, 3, 1.61913e-1},
{1, 3, 2.57399e-1},
{0, 4, -3.25372e-2},
{3, 4, 6.98452e-2},
{4, 5, 8.72102e-3},
{3, 6, -4.35673e-3},
{5, 6, -5.93264e-4}
};
static RegionIdealElement Hidealdata[] = { // Ideal H for viscosity
{0, 1.67752 },
{1, 2.20462 },
{2, 0.6366564 },
{3, -0.241605 }
};
static RegionResidualElement Lresiddata[] = { // Residual L for Thermal Conductivity
{ 0, 0, 1.60397357000 },
{ 1, 0, 2.33771842000 },
{ 2, 0, 2.19650529000 },
{ 3, 0, -1.21051378000 },
{ 4, 0, -2.72033700000 },
{ 0, 1, -0.64601352300 },
{ 1, 1, -2.78843778000 },
{ 2, 1, -4.54580785000 },
{ 3, 1, 1.60812989000 },
{ 4, 1, 4.57586331000 },
{ 0, 2, 0.11144390600 },
{ 1, 2, 1.53616167000 },
{ 2, 2, 3.55777244000 },
{ 3, 2, -0.62117814100 },
{ 4, 2, -3.18369245000 },
{ 0, 3, 0.10299735700 },
{ 1, 3, -0.46304551200 },
{ 2, 3, -1.40944978000 },
{ 3, 3, 0.07163732240 },
{ 4, 3, 1.11683480000 },
{ 0, 4, -0.05041236340 },
{ 1, 4, 0.08328270190 },
{ 2, 4, 0.27541827800 },
{ 3, 4, 0.00000000000 },
{ 4, 4, -0.19268305000 },
{ 0, 5, 0.00609859258 },
{ 1, 5, -0.00719201245 },
{ 2, 5, -0.02059388160 },
{ 3, 5, 0.00000000000 },
{ 4, 5, 0.01291384200 }
};
static RegionIdealElement Lidealdata[] = { // Ideal L for thermal conductivity
{0, 2.443221E-3},
{1, 1.323095E-2},
{2, 6.770357E-3},
{3, -3.454586E-3},
{4, 4.096266E-4}
};
static double A[6][5] = {
{ 6.53786807199516, 6.52717759281799, 5.35500529896124, 1.55225959906681, 1.11999926419994 },
{ -5.61149954923348, -6.30816983387575, -3.96415689925446, 0.464621290821181, 0.595748562571649 },
{ 3.39624167361325, 8.08379285492595, 8.91990208918795, 8.93237374861479, 9.88952565078920 },
{ -2.27492629730878, -9.82240510197603, -12.03387295057900, -11.03219600611260, -10.32550511470400 },
{ 10.26318546627090, 12.13584137913950, 9.19494865194302, 6.16780999933360, 4.66861294457414 },
{ 1.97815050331519, -5.54349664571295, -2.16866274479712, -0.965458722086812, -0.503243546373828 },
};
static std::vector<RegionResidualElement> Hrdata(Hresiddata, Hresiddata + sizeof(Hresiddata)/sizeof(RegionResidualElement));
static std::vector<RegionIdealElement> H0data(Hidealdata, Hidealdata + sizeof(Hidealdata)/sizeof(RegionIdealElement));
static std::vector<RegionResidualElement> Lrdata(Lresiddata, Lresiddata + sizeof(Lresiddata)/sizeof(RegionResidualElement));
static std::vector<RegionIdealElement> L0data(Lidealdata, Lidealdata + sizeof(Lidealdata)/sizeof(RegionIdealElement));
class BaseRegion
{
public:
BaseRegion(std::vector<RegionResidualElement> resid, std::vector<RegionIdealElement> ideal) : R(Rgas){
for (std::size_t i = 0; i < resid.size(); ++i){
nr.push_back(resid[i].n);
Ir.push_back(resid[i].I);
Jr.push_back(resid[i].J);
}
for (std::size_t i = 0; i < ideal.size(); ++i){
n0.push_back(ideal[i].n);
J0.push_back(ideal[i].J);
}
for (std::size_t i = 0; i < Hrdata.size(); ++i){
munr.push_back(Hrdata[i].n);
muIr.push_back(Hrdata[i].I);
muJr.push_back(Hrdata[i].J);
}
for (std::size_t i = 0; i < H0data.size(); ++i){
mun0.push_back(H0data[i].n);
muJ0.push_back(H0data[i].J);
}
for (std::size_t i = 0; i < Lrdata.size(); ++i){
lamnr.push_back(Lrdata[i].n);
lamIr.push_back(Lrdata[i].I);
lamJr.push_back(Lrdata[i].J);
}
for (std::size_t i = 0; i < L0data.size(); ++i){
lamn0.push_back(L0data[i].n);
lamJ0.push_back(L0data[i].J);
}
}
double rhomass(double T, double p) const{
return p_star/(R*T)/(p_fact/1000.0/R_fact)/(dgamma0_dPI(T,p) + dgammar_dPI(T,p));
}
double hmass(double T, double p) const{
return R*T_star*(dgamma0_dTAU(T, p) + dgammar_dTAU(T, p));
}
double smass(double T, double p) const{
const double tau = T_star/T;
return R*(tau*(dgamma0_dTAU(T, p) + dgammar_dTAU(T, p)) - (gammar(T, p) + gamma0(T, p)));
}
double umass(double T, double p) const{
const double tau = T_star/T, PI = p/p_star;
return R*T*(tau*(dgamma0_dTAU(T, p) + dgammar_dTAU(T, p)) - PI*(dgamma0_dPI(T, p) + dgammar_dPI(T, p)));
}
double cpmass(double T, double p) const{
const double tau = T_star/T;
return -R*tau*tau*(d2gammar_dTAU2(T, p) + d2gamma0_dTAU2(T, p));
}
virtual double cvmass(double T, double p) const{
const double tau = T_star/T, PI = p/p_star;
return cpmass(T,p)-R*powi(1 + PI*dgammar_dPI(T,p) - tau*PI*d2gammar_dPIdTAU(T,p),2)/(1-PI*PI*d2gammar_dPI2(T, p));
}
virtual double speed_sound(double T, double p) const{
const double tau = T_star/T, PI = p/p_star;
const double RHS = (1 + 2*PI*dgammar_dPI(T,p) + PI*PI*powi(dgammar_dPI(T,p),2))/((1-PI*PI*d2gammar_dPI2(T,p)) +powi(1 + PI*dgammar_dPI(T,p) - tau*PI*d2gammar_dPIdTAU(T,p), 2)/(tau*tau*(d2gamma0_dTAU2(T,p) + d2gammar_dTAU2(T,p))));
return sqrt(R*(1000/R_fact)*T*RHS);
}
double visc(double T, double rho) const{
/// This base region function is valid for all IF97 regions since it is a function
/// of density, not pressure, and can be called from any region instance.
const double mu_star = 1.0E-6; // Reference viscosity [Pa-s]
const double mu2 = 1.0; // For Industrial Formulation (IF97), mu2 = 1.0
return mu_star * mu0(T) * mu1(T,rho) * mu2;
}
double tcond(double T, double p, double rho) const{
/// This base region function is valid for all IF97 regions
const double lambda_star = 0.001; // Reference conductivity [W/m-K]
const double lambda_bar = lambda0(T)*lambda1(T,rho) + lambda2(T,p,rho);
return lambda_star * lambda_bar;
}
virtual double drhodp(double T, double p) const{
/// Only valid for regions 2 and 5. Will be overridden in Regions 1 and 3.
/// Derived from IAPWS Revised Advisory Note No. 3 (See Table 2, Section 4.1 & 4.3)
const double PI = p/p_star;
return (rhomass(T,p)/p) * ( (1.0 - PI*PI*d2gammar_dPI2(T,p)) / (1.0 + PI*dgammar_dPI(T,p)) );
}
double delTr(double rho) const{
/// This is the IF97 correlation for drhodp at the reducing temperature, Tr
const double rhobar = rho/Rhocrit;
double summer = 0;
int j;
//
if (rhobar <= 0.310559006) j = 0;
else if (rhobar <= 0.776397516) j = 1;
else if (rhobar <= 1.242236025) j = 2;
else if (rhobar <= 1.863354037) j = 3;
else j = 4;
//
for (int i=0; i < 6; i++)
summer += A[i][j]*powi(rhobar,i);
return 1.0/summer;
}
virtual double PIrterm(double) const = 0;
virtual double TAUrterm(double) const = 0;
virtual double TAU0term(double) const = 0;
double output(IF97parameters key, double T, double p) const{
switch(key){
case IF97_T: return T;
case IF97_P: return p;
case IF97_DMASS: return rhomass(T, p);
case IF97_HMASS: return hmass(T, p);
case IF97_SMASS: return smass(T, p);
case IF97_UMASS: return umass(T, p);
case IF97_CPMASS: return cpmass(T, p);
case IF97_CVMASS: return cvmass(T, p);
case IF97_W: return speed_sound(T, p);
case IF97_MU: return visc(T,rhomass(T,p)); // Viscosity is a function of rho.
case IF97_K: return tcond(T,p,rhomass(T,p)); // Conductivity needs p and rho.
case IF97_DRHODP: return drhodp(T, p); // For verification testing.
}
throw std::out_of_range("Unable to match input parameters");
}
protected:
std::vector<int> Ir, Jr;
std::vector<double> nr;
std::vector<int> J0;
std::vector<double> n0;
double T_star, p_star;
const double R;
/// For Viscosity Calculations
std::vector<int> muJ0;
std::vector<double> mun0;
std::vector<int> muIr, muJr;
std::vector<double> munr;
/// For Thermal Conductivity Calculations
std::vector<int> lamJ0;
std::vector<double> lamn0;
std::vector<int> lamIr, lamJr;
std::vector<double> lamnr;
double gammar(double T, double p) const{
const double _PI = PIrterm(p), _TAU = TAUrterm(T);
double summer = 0;
for (std::size_t i = 0; i < Jr.size(); ++i){
summer += nr[i]*powi(_PI, Ir[i])*powi(_TAU, Jr[i]);
}
return summer;
}
double dgammar_dPI(double T, double p) const{
const double _PI = PIrterm(p), _TAU = TAUrterm(T);
double summer = 0;
for (std::size_t i = 0; i < Jr.size(); ++i){
summer += nr[i]*Ir[i]*powi(_PI, Ir[i]-1)*powi(_TAU, Jr[i]);
}
return summer;
}
double d2gammar_dPI2(double T, double p) const{
const double _PI = PIrterm(p), _TAU = TAUrterm(T);
double summer = 0;
for (std::size_t i = 0; i < Jr.size(); ++i){
summer += nr[i]*Ir[i]*(Ir[i]-1)*powi(_PI, Ir[i]-2)*powi(_TAU, Jr[i]);
}
return summer;
}
double dgammar_dTAU(double T, double p) const{
const double _PI = PIrterm(p), _TAU = TAUrterm(T);
double summer = 0;
for (std::size_t i = 0; i < Jr.size(); ++i){
summer += nr[i]*Jr[i]*powi(_PI, Ir[i])*powi(_TAU, Jr[i]-1);
}
return summer;
}
double d2gammar_dPIdTAU(double T, double p) const{
const double _PI = PIrterm(p), _TAU = TAUrterm(T);
double summer = 0;
for (std::size_t i = 0; i < Jr.size(); ++i){
summer += nr[i]*Jr[i]*Ir[i]*powi(_PI, Ir[i]-1)*powi(_TAU, Jr[i]-1);
}
return summer;
}
double d2gammar_dTAU2(double T, double p) const {
const double _PI = PIrterm(p), _TAU = TAUrterm(T);
double summer = 0;
for (std::size_t i = 0; i < Jr.size(); ++i){
summer += nr[i]*Jr[i]*(Jr[i]-1)*powi(_PI, Ir[i])*powi(_TAU, Jr[i]-2);
}
return summer;
}
double gamma0(double T, double p) const{
if (J0.size() == 0){ return 0; } // Region 1 has no term
const double PI = p/p_star, _TAU = TAU0term(T);
double summer = log(PI);
for (std::size_t i = 0; i < n0.size(); ++i){
summer += n0[i]*powi(_TAU, J0[i]);
}
return summer;
}
double dgamma0_dPI(double /*T*/, double p) const{
if (J0.size() == 0){ return 0; } // Region 1 has no term
const double PI = p/p_star;
return 1.0/PI;
}
double d2gamma0_dPI2(double /*T*/, double p) const{
if (J0.size() == 0){ return 0; } // Region 1 has no term
const double PI = p/p_star;
return -1.0/(PI*PI);
}
double dgamma0_dTAU(double T, double /*p*/) const{
const double _TAU = TAU0term(T);
double summer = 0;
for (std::size_t i = 0; i < J0.size(); ++i){
summer += n0[i]*J0[i]*powi(_TAU, J0[i]-1);
}
return summer;
}
double d2gamma0_dTAU2(double T, double /*p*/) const{
const double _TAU = TAU0term(T);
double summer = 0;
for (std::size_t i = 0; i < J0.size(); ++i){
summer += n0[i]*J0[i]*(J0[i]-1)*powi(_TAU, J0[i]-2);
}
return summer;
}
double mu0(double T) const{
const double T_bar = T/Tcrit;
double summer = 0.0;
for (std::size_t i = 0; i < muJ0.size(); ++i){
summer += mun0[i]/powi(T_bar, muJ0[i]);
}
return 100.0*sqrt(T_bar)/summer;
}
double mu1(double T, double rho) const{
const double rho_bar = rho/Rhocrit;
double summer = 0.0;
for (std::size_t i = 0; i < muJr.size(); ++i){
summer += rho_bar * powi(Trterm(T),muIr[i]) * munr[i]*powi(Rhorterm(rho),muJr[i]);
}
return exp(summer);
}
double lambda0(double T) const{
const double T_bar = T/Tcrit;
double summer = 0.0;
for (std::size_t i = 0; i < lamJ0.size(); ++i){
summer += lamn0[i]/powi(T_bar, lamJ0[i]);
}
return sqrt(T_bar)/summer;
}
double lambda1(double T, double rho) const{
const double rho_bar = rho/Rhocrit;
double summer = 0.0;
for (std::size_t i = 0; i < lamJr.size(); ++i){
summer += rho_bar * powi(Trterm(T),lamIr[i]) * lamnr[i]*powi(Rhorterm(rho),lamJr[i]);
}
return exp(summer);
}
double lambda2(double T, double p, double rho) const{
double y, Cpbar, mubar, k, Z, delChi;
const double rhobar = rho/Rhocrit;
const double LAMBDA = 177.8514;
const double qD = 1.0/0.40;
const double Tr = 1.5*Tcrit;
const double xi0 = 0.13;
const double nu = 0.630;
const double gam = 1.239;
const double GAMMA0 = 0.06;
const double PI = 3.141592654;
const double Cpstar = 0.46151805*R_fact; /// Note: Slightly lower than IF97 Rgas
Cpbar = cpmass(T,p)/Cpstar;
if ((Cpbar < 0) || (Cpbar > 1.0E13)) Cpbar = 1.0E13; /// Unit-less
k = cpmass(T,p)/cvmass(T,p);
mubar = visc(T,rho)/1.0E-6;
delChi = rhobar*(Pcrit/Rhocrit*drhodp(T,p) - delTr(rho)*Tr/T);
if (delChi > 0) /// At low (T,p), delChi can go negative, causing
y = qD*xi0*std::pow(delChi/GAMMA0,nu/gam); /// y to be imaginary from this nth-root equation.
else ///
y = 0.0; /// Limit delChi to > 0, values.
if (y < 1.2E-7) /// Z is not calculated if y < 1.2E-7 since the
Z = 0.0; /// critical enhancement becomes insignificant.
else
Z = 2.0/PI/y*(((1.0-1.0/k)*atan(y)+y/k) - (1.0 - exp(-1.0/(1.0/y + y*y/(3.0*rhobar*rhobar)))));
return LAMBDA*rhobar*Cpbar*T/(Tcrit*mubar)*Z;
}
double Trterm(double T) const{
return Tcrit/T - 1.0;
}
double Rhorterm(double rho) const{
return rho/Rhocrit - 1.0;
}
};
/********************************************************************************/
/************************** Region #1 *******************************/
/********************************************************************************/
static RegionResidualElement Region1residdata[] = {
// Note: the coefficients of n_i have been multiplied by -1**I_i such that all Gibbs terms are of the form (PI-7.1)**(I_i) rather than (7.1-PI)**(I_i)
{0, -2, 0.14632971213167},
{0, -1, -0.84548187169114},
{0, 0, -3.756360367204},
{0, 1, 3.3855169168385},
{0, 2, -0.95791963387872},
{0, 3, 0.15772038513228},
{0, 4, -0.016616417199501},
{0, 5, 0.00081214629983568},
{1, -9, -0.00028319080123804},
{1, -7, 0.00060706301565874},
{1, -1, 0.018990068218419},
{1, 0, 0.032529748770505},
{1, 1, 0.021841717175414},
{1, 3, 0.00005283835796993},
{2, -3, -0.00047184321073267},
{2, 0, -0.00030001780793026},
{2, 1, 0.000047661393906987},
{2, 3, -4.4141845330846E-06},
{2, 17, -7.2694996297594E-16},
{3, -4, 0.000031679644845054},
{3, 0, 2.8270797985312E-06},
{3, 6, 8.5205128120103E-10},
{4, -5, -0.0000022425281908},
{4, -2, -6.5171222895601E-07},
{4, 10, -1.4341729937924E-13},
{5, -8, 4.0516996860117E-07},
{8, -11, -1.2734301741641E-09},
{8, -6, -1.7424871230634E-10},
{21, -29, 6.8762131295531E-19},
{23, -31, -1.4478307828521E-20},
{29, -38, -2.6335781662795E-23},
{30, -39, -1.1947622640071E-23},
{31, -40, -1.8228094581404E-24},
{32, -41, -9.3537087292458E-26}
};
static std::vector<RegionResidualElement> reg1rdata(Region1residdata, Region1residdata + sizeof(Region1residdata)/sizeof(RegionResidualElement));
static std::vector<RegionIdealElement> reg10data;
class Region1 : public BaseRegion
{
public:
Region1() : BaseRegion(reg1rdata, reg10data) {
T_star = 1386; p_star = 16.53*p_fact;
};
double speed_sound(double T, double p) const{
// Evidently this formulation is special for some reason, and cannot be implemented using the base class formulation
// see Table 3
const double tau = T_star/T;
const double RHS = powi(dgammar_dPI(T,p), 2)/(powi(dgammar_dPI(T,p)-tau*d2gammar_dPIdTAU(T,p), 2)/(tau*tau*d2gammar_dTAU2(T,p)) - d2gammar_dPI2(T, p));
return sqrt(R*(1000/R_fact)*T*RHS);
}
double cvmass(double T, double p) const{
// Evidently this formulation is special for some reason, and cannot be implemented using the base class formulation
// see Table 3
const double tau = T_star / T;
return R*(-tau*tau*d2gammar_dTAU2(T,p) + powi(dgammar_dPI(T, p) - tau*d2gammar_dPIdTAU(T, p), 2) / d2gammar_dPI2(T, p));
}
double drhodp(double T, double p) const{
//double PI = p/p_star;
/// This one is different as well...
/// Derived from IAPWS Revised Advisory Note No. 3 (See Table 2, Section 4.1 & 4.2)
return -d2gammar_dPI2(T,p)/(powi(dgammar_dPI(T,p),2)*R*T)*(1000*R_fact/p_fact);
}
double TAUrterm(double T) const{
return T_star/T - 1.222;
}
double PIrterm(double p) const{
return p/p_star - 7.1;
}
double TAU0term(double /*T*/) const{
return 0.0;
}
};
/********************************************************************************/
/************************** Region #2 *******************************/
/********************************************************************************/
static RegionResidualElement Region2residdata[] = {
{1,0,-0.0017731742473213},
{1,1,-0.017834862292358},
{1,2,-0.045996013696365},
{1,3,-0.057581259083432},
{1,6,-0.05032527872793},
{2,1,-0.000033032641670203},
{2,2,-0.00018948987516315},
{2,4,-0.0039392777243355},
{2,7,-0.043797295650573},
{2,36,-0.000026674547914087},
{3,0,2.0481737692309E-08},
{3,1,4.3870667284435E-07},
{3,3,-0.00003227767723857},
{3,6,-0.0015033924542148},
{3,35,-0.040668253562649},
{4,1,-7.8847309559367E-10},
{4,2,1.2790717852285E-08},
{4,3,4.8225372718507E-07},
{5,7,2.2922076337661E-06},
{6,3,-1.6714766451061E-11},
{6,16,-0.0021171472321355},
{6,35,-23.895741934104},
{7,0,-5.905956432427E-18},
{7,11,-1.2621808899101E-06},
{7,25,-0.038946842435739},
{8,8,1.1256211360459E-11},
{8,36,-8.2311340897998},
{9,13,1.9809712802088E-08},
{10,4,1.0406965210174E-19},
{10,10,-1.0234747095929E-13},
{10,14,-1.0018179379511E-09},
{16,29,-8.0882908646985E-11},
{16,50,0.10693031879409},
{18,57,-0.33662250574171},
{20,20,8.9185845355421E-25},
{20,35,3.0629316876232E-13},
{20,48,-4.2002467698208E-06},
{21,21,-5.9056029685639E-26},
{22,53,3.7826947613457E-06},
{23,39,-1.2768608934681E-15},
{24,26,7.3087610595061E-29},
{24,40,5.5414715350778E-17},
{24,58,-9.436970724121E-07}
};
static RegionIdealElement Region2idealdata[] = {
{0, -0.96927686500217e1},
{1, 0.10086655968018e2},
{-5, -0.56087911283020e-2 },
{-4, 0.71452738081455e-1},
{-3, -0.40710498223928},
{-2, 0.14240819171444e1},
{-1, -0.43839511319450e1},
{2, -0.28408632460772},
{3, 0.21268463753307e-1},
};
static std::vector<RegionResidualElement> reg2rdata(Region2residdata, Region2residdata + sizeof(Region2residdata)/sizeof(RegionResidualElement));
static std::vector<RegionIdealElement> reg20data(Region2idealdata, Region2idealdata + sizeof(Region2idealdata)/sizeof(RegionIdealElement));
class Region2 : public BaseRegion
{
public:
Region2() : BaseRegion(reg2rdata, reg20data) {
T_star = 540; p_star = 1*p_fact;
};
double TAUrterm(double T) const{
return T_star/T - 0.5;
}
double PIrterm(double p) const{
return p/p_star;
}
double TAU0term(double T) const{
return T_star/T;
}
};
static double Region23data[] = {
0.34805185628969e3,
-0.11671859879975e1,
0.10192970039326e-2,
0.57254459862746e3,
0.13918839778870e2
};
static const std::vector<double> region23_n(Region23data, Region23data + sizeof(Region23data)/sizeof(double));
inline double Region23_T(double T){
const double p_star = 1*p_fact, T_star = 1, theta = T/T_star;
const double PI = region23_n[0] + region23_n[1]*theta + region23_n[2]*theta*theta;
return PI*p_star;
}
inline double Region23_p(double p){
const double p_star = 1*p_fact, T_star = 1, PI = p/p_star;
const double THETA = region23_n[3] + sqrt((PI - region23_n[4])/region23_n[2]);
return THETA*T_star;
}
/********************************************************************************/
/********************* Region #3 (Backwards) *************************/
/********************* Implementation for v(T,p) only. *************************/
/********************************************************************************/
namespace Region3Backwards{
static RegionResidualElement Region3Adata[] = {
{-12, 5, 0.110879558823853e-2},
{-12, 10, 0.572616740810616e3},
{-12, 12, -0.767051948380852e5},
{-10, 5, -0.253321069529674e-1},
{-10, 10, 0.628008049345689e4},
{-10, 12, 0.234105654131876e6},
{-8, 5, 0.216867826045856},
{-8, 8, -0.156237904341963e3},
{-8, 10, -0.269893956176613e5},
{-6, 1, -0.180407100085505e-3},
{-5, 1, 0.116732227668261e-2},
{-5, 5, 0.266987040856040e2},
{-5, 10, 0.282776617243286e5},
{-4, 8, -0.242431520029523e4},
{-3, 0, 0.435217323022733e-3},
{-3, 1, -0.122494831387441e-1},
{-3, 3, 0.179357604019989e1},
{-3, 6, 0.442729521058314e2},
{-2, 0, -0.593223489018342e-2},
{-2, 2, 0.453186261685774},
{-2, 3, 0.135825703129140e1},
{-1, 0, 0.408748415856745e-1},
{-1, 1, 0.474686397863312},
{-1, 2, 0.118646814997915e1},
{0, 0, 0.546987265727549},
{0, 1, 0.195266770452643},
{1, 0, -0.502268790869663e-1},
{1, 2, -0.369645308193377},
{2, 0, 0.633828037528420e-2},
{2, 2, 0.797441793901017e-1},
};
static RegionResidualElement Region3Bdata[] = {
{-12, 10, -0.827670470003621e-1},
{-12, 12, 0.416887126010565e2},
{-10, 8, 0.483651982197059e-1},
{-10, 14, -0.291032084950276e5},
{-8, 8, -0.111422582236948e3},
{-6, 5, -0.202300083904014e-1},
{-6, 6, 0.294002509338515e3},
{-6, 8, 0.140244997609658e3},
{-5, 5, -0.344384158811459e3},
{-5, 8, 0.361182452612149e3},
{-5, 10, -0.140699677420738e4},
{-4, 2, -0.202023902676481e-2},
{-4, 4, 0.171346792457471e3},
{-4, 5, -0.425597804058632e1},
{-3, 0, 0.691346085000334e-5},
{-3, 1, 0.151140509678925e-2},
{-3, 2, -0.416375290166236e-1},
{-3, 3, -0.413754957011042e2},
{-3, 5, -0.506673295721637e2},
{-2, 0, -0.572212965569023e-3},
{-2, 2, 0.608817368401785e1},
{-2, 5, 0.239600660256161e2},
{-1, 0, 0.122261479925384e-1},
{-1, 2, 0.216356057692938e1},
{0, 0, 0.398198903368642},
{0, 1, -0.116892827834085},
{1, 0, -0.102845919373532},
{1, 2, -0.492676637589284},
{2, 0, 0.655540456406790e-1},
{3, 2, -0.240462535078530},
{4, 0, -0.269798180310075e-1},
{4, 1, 0.128369435967012},
};
static RegionResidualElement Region3Cdata[] = {
{-12, 6, 3.11967788763030},
{-12, 8, 2.76713458847564e+04},
{-12, 10, 3.22583103403269e+07},
{-10, 6, -3.42416065095363e+02},
{-10, 8, -8.99732529907377e+05},
{-10, 10, -7.93892049821251e+07},
{-8, 5, 9.53193003217388e+01},
{-8, 6, 2.29784742345072e+03},
{-8, 7, 1.75336675322499e+05},
{-6, 8, 7.91214365222792e+06},
{-5, 1, 3.19933345844209e-05},
{-5, 4, -6.59508863555767e+01},
{-5, 7, -8.33426563212851e+05},
{-4, 2, 6.45734680583292e-02},
{-4, 8, -3.82031020570813e+06},
{-3, 0, 4.06398848470079e-05},
{-3, 3, 3.10327498492008e+01},
{-2, 0, -8.92996718483724e-04},
{-2, 4, 2.34604891591616e+02},
{-2, 5, 3.77515668966951e+03},
{-1, 0, 1.58646812591361e-02},
{-1, 1, 7.07906336241843e-01},
{-1, 2, 1.26016225146570e+01},
{0, 0, 7.36143655772152e-01},
{0, 1, 6.76544268999101e-01},
{0, 2, -1.78100588189137e+01},
{1, 0, -1.56531975531713e-01},
{1, 2, 1.17707430048158e+01},
{2, 0, 8.40143653860447e-02},
{2, 1, -1.86442467471949e-01},
{2, 3, -4.40170203949645e+01},
{2, 7, 1.23290423502494e+06},
{3, 0, -2.40650039730845e-02},
{3, 7, -1.07077716660869e+06},
{8, 1, 4.38319858566475e-02},
};
static RegionResidualElement Region3Ddata[] = {
{-12, 4, -4.52484847171645e-10},
{-12, 6, 3.15210389538801e-05},
{-12, 7, -2.14991352047545e-03},
{-12, 10, 5.08058874808345e+02},
{-12, 12, -1.27123036845932e+07},
{-12, 16, 1.15371133120497e+12},
{-10, 0, -1.97805728776273e-16},
{-10, 2, 2.41554806033972e-11},
{-10, 4, -1.56481703640525e-06},
{-10, 6, 2.77211346836625e-03},
{-10, 8, -2.03578994462286e+01},
{-10, 10, 1.44369489909053e+06},
{-10, 14, -4.11254217946539e+10},
{-8, 3, 6.23449786243773e-06},
{-8, 7, -2.21774281146038e+01},
{-8, 8, -6.89315087933158e+04},
{-8, 10, -1.95419525060713e+07},
{-6, 6, 3.16373510564015e+03},
{-6, 8, 2.24040754426988e+06},
{-5, 1, -4.36701347922356e-06},
{-5, 2, -4.04213852833996e-04},
{-5, 5, -3.48153203414663e+02},
{-5, 7, -3.85294213555289e+05},
{-4, 0, 1.35203700099403e-07},
{-4, 1, 1.34648383271089e-04},
{-4, 7, 1.25031835351736e+05},
{-3, 2, 9.68123678455841e-02},
{-3, 4, 2.25660517512438e+02},
{-2, 0, -1.90102435341872e-04},
{-2, 1, -2.99628410819229e-02},
{-1, 0, 5.00833915372121e-03},
{-1, 1, 3.87842482998411e-01},
{-1, 5, -1.38535367777182e+03},
{0, 0, 8.70745245971773e-01},
{0, 2, 1.71946252068742},
{1, 0, -3.26650121426383e-02},
{1, 6, 4.98044171727877e+03},
{3, 0, 5.51478022765087e-03},
};
static RegionResidualElement Region3Edata[] = {
{-12, 14, 7.15815808404721e+08},
{-12, 16, -1.14328360753449e+11},
{-10, 3, 3.76531002015720e-12},
{-10, 6, -9.03983668691157e-05},
{-10, 10, 6.65695908836252e+05},
{-10, 14, 5.35364174960127e+09},
{-10, 16, 7.94977402335603e+10},
{-8, 7, 9.22230563421437e+01},
{-8, 8, -1.42586073991215e+05},
{-8, 10, -1.11796381424162e+06},
{-6, 6, 8.96121629640760e+03},
{-5, 6, -6.69989239070491e+03},
{-4, 2, 4.51242538486834e-03},
{-4, 4, -3.39731325977713e+01},
{-3, 2, -1.20523111552278},
{-3, 6, 4.75992667717124e+04},
{-3, 7, -2.66627750390341e+05},
{-2, 0, -1.53314954386524e-04},
{-2, 1, 3.05638404828265e-01},
{-2, 3, 1.23654999499486e+02},
{-2, 4, -1.04390794213011e+03},
{-1, 0, -1.57496516174308e-02},
{0, 0, 6.85331118940253e-01},
{0, 1, 1.78373462873903},
{1, 0, -5.44674124878910e-01},
{1, 4, 2.04529931318843e+03},
{1, 6, -2.28342359328752e+04},
{2, 0, 4.13197481515899e-01},
{2, 2, -3.41931835910405e+01},
};
static RegionResidualElement Region3Fdata[] = {
{0, -3, -2.51756547792325e-08},
{0, -2, 6.01307193668763e-06},
{0, -1, -1.00615977450049e-03},
{0, 0, 9.99969140252192e-01},
{0, 1, 2.14107759236486},
{0, 2, -1.65175571959086e+01},
{1, -1, -1.41987303638727e-03},
{1, 1, 2.69251915156554},
{1, 2, 3.49741815858722e+01},
{1, 3, -3.00208695771783e+01},
{2, 0, -1.31546288252539},
{2, 1, -8.39091277286169},
{3, -5, 1.81545608337015e-10},
{3, -2, -5.91099206478909e-04},
{3, 0, 1.52115067087106},
{4, -3, 2.52956470663225e-05},
{5, -8, 1.00726265203786e-15},
{5, 1, -1.49774533860650},
{6, -6, -7.93940970562969e-10},
{7, -4, -1.50290891264717e-04},
{7, 1, 1.51205531275133},
{10, -6, 4.70942606221652e-06},
{12, -10, 1.95049710391712e-13},
{12, -8, -9.11627886266077e-09},
{12, -4, 6.04374640201265e-04},
{14, -12, -2.25132933900136e-16},
{14, -10, 6.10916973582981e-12},
{14, -8, -3.03063908043404e-07},
{14, -6, -1.37796070798409e-05},
{14, -4, -9.19296736666106e-04},
{16, -10, 6.39288223132545e-10},
{16, -8, 7.53259479898699e-07},
{18, -12, -4.00321478682929e-13},
{18, -10, 7.56140294351614e-09},
{20, -12, -9.12082054034891e-12},
{20, -10, -2.37612381140539e-08},
{20, -6, 2.69586010591874e-05},
{22, -12, -7.32828135157839e-11},
{24, -12, 2.41995578306660e-10},
{24, -4, -4.05735532730322e-04},
{28, -12, 1.89424143498011e-10},
{32, -12, -4.86632965074563e-10},
};
static RegionResidualElement Region3Gdata[] = {
{-12, 7, 4.12209020652996e-05},
{-12, 12, -1.14987238280587e+06},
{-12, 14, 9.48180885032080e+09},
{-12, 18, -1.95788865718971e+17},
{-12, 22, 4.96250704871300e+24},
{-12, 24, -1.05549884548496e+28},
{-10, 14, -7.58642165988278e+11},
{-10, 20, -9.22172769596101e+22},
{-10, 24, 7.25379072059348e+29},
{-8, 7, -6.17718249205859e+01},
{-8, 8, 1.07555033344858e+04},
{-8, 10, -3.79545802336487e+07},
{-8, 12, 2.28646846221831e+11},
{-6, 8, -4.99741093010619e+06},
{-6, 22, -2.80214310054101e+30},
{-5, 7, 1.04915406769586e+06},
{-5, 20, 6.13754229168619e+27},
{-4, 22, 8.02056715528378e+31},
{-3, 7, -2.98617819828065e+07},
{-2, 3, -9.10782540134681e+01},
{-2, 5, 1.35033227281565e+05},
{-2, 14, -7.12949383408211e+18},
{-2, 24, -1.04578785289542e+36},
{-1, 2, 3.04331584444093e+01},
{-1, 8, 5.93250797959445e+09},
{-1, 18, -3.64174062110798e+27},
{0, 0, 9.21791403532461e-01},
{0, 1, -3.37693609657471e-01},
{0, 2, -7.24644143758508e+01},
{1, 0, -1.10480239272601e-01},
{1, 1, 5.36516031875059},
{1, 3, -2.91441872156205e+03},
{3, 24, 6.16338176535305e+39},
{5, 22, -1.20889175861180e+38},
{6, 12, 8.18396024524612e+22},
{8, 3, 9.40781944835829e+08},
{10, 0, -3.67279669545448e+04},
{10, 6, -8.37513931798655e+15},
};
static RegionResidualElement Region3Hdata[] = {
{-12, 8, 5.61379678887577e-02},
{-12, 12, 7.74135421587083e+09},
{-10, 4, 1.11482975877938e-09},
{-10, 6, -1.43987128208183e-03},
{-10, 8, 1.93696558764920e+03},
{-10, 10, -6.05971823585005e+08},
{-10, 14, 1.71951568124337e+13},
{-10, 16, -1.85461154985145e+16},
{-8, 0, 3.87851168078010e-17},
{-8, 1, -3.95464327846105e-14},
{-8, 6, -1.70875935679023e+02},
{-8, 7, -2.12010620701220e+03},
{-8, 8, 1.77683337348191e+07},
{-6, 4, 1.10177443629575e+01},
{-6, 6, -2.34396091693313e+05},
{-6, 8, -6.56174421999594e+06},
{-5, 2, 1.56362212977396e-05},
{-5, 3, -2.12946257021400},
{-5, 4, 1.35249306374858e+01},
{-4, 2, 1.77189164145813e-01},
{-4, 4, 1.39499167345464e+03},
{-3, 1, -7.03670932036388e-03},
{-3, 2, -1.52011044389648e-01},
{-2, 0, 9.81916922991113e-05},
{-1, 0, 1.47199658618076e-03},
{-1, 2, 2.02618487025578e+01},
{0, 0, 8.99345518944240e-01},
{1, 0, -2.11346402240858e-01},
{1, 2, 2.49971752957491e+01},
};
static RegionResidualElement Region3Idata[] = {
{0, 0, 1.06905684359136},
{0, 1, -1.48620857922333},
{0, 10, 2.59862256980408e+14},
{1, -4, -4.46352055678749e-12},
{1, -2, -5.66620757170032e-07},
{1, -1, -2.35302885736849e-03},
{1, 0, -2.69226321968839e-01},
{2, 0, 9.22024992944392},
{3, -5, 3.57633505503772e-12},
{3, 0, -1.73942565562222e+01},
{4, -3, 7.00681785556229e-06},
{4, -2, -2.67050351075768e-04},
{4, -1, -2.31779669675624},
{5, -6, -7.53533046979752e-13},
{5, -1, 4.81337131452891},
{5, 12, -2.23286270422356e+21},
{7, -4, -1.18746004987383e-05},
{7, -3, 6.46412934136496e-03},
{8, -6, -4.10588536330937e-10},
{8, 10, 4.22739537057241e+19},
{10, -8, 3.13698180473812e-13},
{12, -12, 1.64395334345040e-24},
{12, -6, -3.39823323754373e-06},
{12, -4, -1.35268639905021e-02},
{14, -10, -7.23252514211625e-15},
{14, -8, 1.84386437538366e-09},
{14, -4, -4.63959533752385e-02},
{14, 5, -9.92263100376750e+13},
{18, -12, 6.88169154439335e-17},
{18, -10, -2.22620998452197e-11},
{18, -8, -5.40843018624083e-08},