@neutrium/thermo.eos.iapws97 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -10
- package/dist/HS.js +112 -84
- package/dist/HS.js.map +1 -0
- package/dist/IAPWS97.js +33 -33
- package/dist/IAPWS97.js.map +1 -0
- package/dist/PH.js +85 -50
- package/dist/PH.js.map +1 -0
- package/dist/PS.js +78 -41
- package/dist/PS.js.map +1 -0
- package/dist/PT.d.ts +1 -1
- package/dist/PT.js +205 -161
- package/dist/PT.js.map +1 -0
- package/dist/base.d.ts +29 -29
- package/dist/base.js +46 -43
- package/dist/base.js.map +1 -0
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -0
- package/package.json +2 -3
- package/spec/aux.spec.js +1 -1
- package/spec/hs.spec.js +1 -1
- package/spec/ph.spec.js +1 -1
- package/spec/ps.spec.js +1 -1
- package/spec/pt.spec.js +1 -1
- package/src/HS.ts +351 -363
- package/src/IAPWS97.ts +38 -31
- package/src/PH.ts +280 -282
- package/src/PS.ts +252 -250
- package/src/PT.ts +1076 -1066
- package/src/base.ts +217 -217
- package/src/index.ts +1 -1
- package/tsconfig.json +14 -12
- package/.npmignore +0 -9
- package/.vscode/tasks.json +0 -18
- /package/{license.txt → LICENSE} +0 -0
package/src/HS.ts
CHANGED
|
@@ -1,86 +1,84 @@
|
|
|
1
|
-
import {State} from '@neutrium/thermo';
|
|
1
|
+
import { State } from '@neutrium/thermo';
|
|
2
2
|
import * as NS from './base';
|
|
3
3
|
import * as PT from './PT';
|
|
4
4
|
import * as PH from './PH';
|
|
5
5
|
|
|
6
|
-
let R = NS.constants['R'];
|
|
7
|
-
|
|
8
6
|
//
|
|
9
|
-
// Comments : Determines which IAPWS-IF97 region a
|
|
7
|
+
// Comments : Determines which IAPWS-IF97 region a enthalpy and entropy combination lie in.
|
|
10
8
|
//
|
|
11
|
-
// @param h is the
|
|
9
|
+
// @param h is the enthalpy in kJ/kg
|
|
12
10
|
// @param s is the entropy in kJ . K^-1 . kg^1
|
|
13
11
|
//
|
|
14
12
|
export function solve(h : number, s : number) : State
|
|
15
13
|
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
let region = findRegion_HS(h, s),
|
|
15
|
+
result : State | null = null;
|
|
16
|
+
|
|
17
|
+
switch (region)
|
|
18
|
+
{
|
|
19
|
+
case 1 : result = r1(h, s); break;
|
|
20
|
+
case 2 : result = r2(h, s); break;
|
|
21
|
+
case 3 : result = r3(h, s); break;
|
|
22
|
+
case 4 : result = r4(h, s); break;
|
|
23
|
+
default : throw new Error('(h,s) : Inputs insufficient or out of range');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return result;
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
function findRegion_HS(h : number, s : number) : number
|
|
32
30
|
{
|
|
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
|
-
|
|
31
|
+
// Interpolate across the saturation curve to test if below P = 0.000611 MPa line
|
|
32
|
+
// Refer to Figure 3 in IAPWS HS document for graphical depiction
|
|
33
|
+
// dG = dH - T*dS where dG = 0 for equilibrium reactions like phase change
|
|
34
|
+
let B23_S = 5.260578707,
|
|
35
|
+
B3_S = 4.41202148223476,
|
|
36
|
+
B13_S = 3.778281340,
|
|
37
|
+
B23_H = 2812.942061,
|
|
38
|
+
hcheck = 273.15*(s - NS.CONST('MIN_S')) + NS.CONST('MIN_H');
|
|
39
|
+
|
|
40
|
+
if ((s <= 9.155759395 && h < hcheck) || s < NS.CONST('MIN_S') || h < NS.CONST('MIN_H') )
|
|
41
|
+
{
|
|
42
|
+
return -1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Region 1
|
|
46
|
+
if (-0.0001545495919 <= s && s <= B13_S && b14_S_H(s) <= h && h <= b13_S_H(s))
|
|
47
|
+
{
|
|
48
|
+
return 1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Region 2 or 3 interface
|
|
52
|
+
if (5.048096828 <= s && s <= B23_S && 2563.592004 <= h && h <= B23_H)
|
|
53
|
+
{
|
|
54
|
+
// Do check using the PB23
|
|
55
|
+
let T = b23_HS_T(h, s),
|
|
56
|
+
P = r2C_HS_P(h, s),
|
|
57
|
+
Pcheck = PT.b23_T_P(T);
|
|
58
|
+
|
|
59
|
+
if(Pcheck > P)
|
|
60
|
+
{
|
|
61
|
+
return 2;
|
|
62
|
+
}
|
|
63
|
+
else
|
|
64
|
+
{
|
|
65
|
+
return 3;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Region 2
|
|
70
|
+
if ((h >= B23_H || s > B23_S) && ((s >= 5.85 && h >= b2ab_S_Hsat(s)) || (s < 5.85 && h >= b2c3b_S_H(s))))
|
|
71
|
+
{
|
|
72
|
+
return 2;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Region 3
|
|
76
|
+
if ((s >= B3_S && h >= b2c3b_S_H(s)) || (B13_S < s && s < B3_S && h >= b3A_S_H(s)) || (s <= B13_S && h > b13_S_H(s)))
|
|
77
|
+
{
|
|
78
|
+
return 3;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return 4;
|
|
84
82
|
}
|
|
85
83
|
|
|
86
84
|
//
|
|
@@ -88,150 +86,150 @@ function findRegion_HS(h : number, s : number) : number
|
|
|
88
86
|
//
|
|
89
87
|
|
|
90
88
|
// h'_1 Equation 3 in HS Region 3 & 4 Supplementary release
|
|
91
|
-
// Exported for testing
|
|
89
|
+
// @internal - Exported for unit testing only
|
|
92
90
|
export function b14_S_H(s : number) : number
|
|
93
91
|
{
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
92
|
+
let R4_HS_I = [0,0,1,1,2,2,3,3,4,4,4,5,5,7,8,12,12,14,14,16,20,20,22,24,28,32,32],
|
|
93
|
+
R4_HS_J = [14,36,3,16,0,5,4,36,4,16,24,18,24,1,4,2,4,1,22,10,12,28,8,3,0,6,8],
|
|
94
|
+
R4_HS_N = [3.32171191705237E-1,6.112177063234960E-4,-8.82092478906822,-4.5562819254325E-1,-2.63483840850452E-5,-2.23949661148062E1,-4.28398660164013,-6.16679338856916E-1,-1.468230311044E1,2.84523138727299E2,-1.13398503195444E2,1.15671380760859E3,3.95551267359325E2,-1.54891257229285,1.94486637751291E1,-3.57915139457043,-3.35369414148819,-6.6442679633246E-1,3.23321885383934E4,3.31766744667084E3,-2.23501257931087E4,5.73953875852936E6,1.73226193407919E2,-3.63968822121321E-2,8.34596332878346E-7,5.03611916682674,6.55444787064505E1],
|
|
95
|
+
sig = s/3.8,
|
|
96
|
+
h = 0;
|
|
97
|
+
|
|
98
|
+
for (let i = 0; i < 27; i++)
|
|
99
|
+
{
|
|
100
|
+
let N = R4_HS_N[i],
|
|
101
|
+
I = R4_HS_I[i],
|
|
102
|
+
J = R4_HS_J[i];
|
|
103
|
+
|
|
104
|
+
h += N*Math.pow(sig - 1.09, I)*Math.pow(sig + 0.0000366, J);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return 1700*h;
|
|
110
108
|
}
|
|
111
109
|
|
|
112
|
-
// Exported for testing
|
|
110
|
+
// @internal - Exported for unit testing only
|
|
113
111
|
export function b13_S_H(s : number) : number
|
|
114
112
|
{
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
113
|
+
let B13_HS_I = [0,1,1,3,5,6],
|
|
114
|
+
B13_HS_J = [0,-2,2,-12,-4,-3],
|
|
115
|
+
B13_HS_N = [0.913965547600543, -0.0000430944856041991, 60.3235694765419, 1.17518273082168E-18, 0.220000904781292, -69.0815545851641],
|
|
116
|
+
sig = s/3.8,
|
|
117
|
+
h = 0;
|
|
118
|
+
|
|
119
|
+
for (let i = 0; i < 6; i++)
|
|
120
|
+
{
|
|
121
|
+
let N = B13_HS_N[i],
|
|
122
|
+
I = B13_HS_I[i],
|
|
123
|
+
J = B13_HS_J[i];
|
|
124
|
+
|
|
125
|
+
h += N*Math.pow(sig - 0.884, I)*Math.pow(sig - 0.864, J);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return 1700*h;
|
|
131
129
|
}
|
|
132
130
|
|
|
133
131
|
// Calculates the temperature on the region 2-3 boundary S-curve
|
|
134
132
|
// T_B23(h,s) Equation 8 in HS Region 3 & 4 in suplementry
|
|
135
|
-
// Exported for testing
|
|
133
|
+
// @internal - Exported for unit testing only
|
|
136
134
|
export function b23_HS_T(h : number, s : number) : number
|
|
137
135
|
{
|
|
138
136
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
137
|
+
let B23_HS_I = [-12,-10,-8,-4,-3,-2,-2,-2,-2,0,1,1,1,3,3,5,6,6,8,8,8,12,12,14,14],
|
|
138
|
+
B23_HS_J = [10,8,3,4,3,-6,2,3,4,0,-3,-2,10,-2,-1,-5,-6,-3,-8,-2,-1,-12,-1,-12,1],
|
|
139
|
+
B23_HS_N = [6.2909626082981E-4,-8.23453502583165E-4,5.15446951519474E-8,-1.17565945784945,3.48519684726192,-5.07837382408313E-12,-2.84637670005479,-2.36092263939673,6.01492324973779,1.48039650824546,3.60075182221907E-4,-1.26700045009952E-2,-1.22184332521413E6,1.49276502463272E-1,6.98733471798484E-1,-2.52207040114321E-2,1.47151930985213E-2,-1.08618917681849,-9.36875039816322E-4,8.19877897570217E1,-1.82041861521835E2,2.61907376402688E-6,-2.91626417025961E4,1.40660774926165E-5,7.83237062349385E6],
|
|
140
|
+
m = h/3000,
|
|
141
|
+
sig = s/5.3,
|
|
142
|
+
T = 0;
|
|
145
143
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
144
|
+
for (let i = 0; i < 25; i++)
|
|
145
|
+
{
|
|
146
|
+
let N = B23_HS_N[i],
|
|
147
|
+
I = B23_HS_I[i],
|
|
148
|
+
J = B23_HS_J[i];
|
|
151
149
|
|
|
152
|
-
|
|
153
|
-
|
|
150
|
+
T += N*Math.pow(m - 0.727, I)*Math.pow(sig - 0.864, J);
|
|
151
|
+
}
|
|
154
152
|
|
|
155
|
-
|
|
153
|
+
return 900*T;
|
|
156
154
|
}
|
|
157
155
|
|
|
158
156
|
// The boundary equation for HS regions 2A and 2b (Equation 2 in supplementary release for HS)
|
|
159
|
-
// Exported for testing
|
|
157
|
+
// @internal - Exported for unit testing only
|
|
160
158
|
export function b2ab_S_H(s : number) : number
|
|
161
159
|
{
|
|
162
|
-
|
|
160
|
+
return (-3498.98083432139 + 2575.60716905876*s + -421.073558227969*s*s + 27.6349063799944*s*s*s);
|
|
163
161
|
}
|
|
164
162
|
|
|
165
163
|
// Equation 5 in the region 3 & 4 HS suplementary release
|
|
166
|
-
// Exported for testing
|
|
164
|
+
// @internal - Exported for unit testing only
|
|
167
165
|
export function b2ab_S_Hsat(s : number) : number
|
|
168
166
|
{
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
167
|
+
let B2ab_I = [1,1,2,2,4,4,7,8,8,10,12,12,18,20,24,28,28,28,28,28,32,32,32,32,32,36,36,36,36,36],
|
|
168
|
+
B2ab_J = [8,24,4,32,1,2,7,5,12,1,0,7,10,12,32,8,12,20,22,24,2,7,12,14,24,10,12,20,22,28],
|
|
169
|
+
B2ab_N = [-0.524581170928788E3, -0.926947218142218E7, -0.237385107491666E3, 0.210770155812776E11, -0.239494562010986E2, 0.221802480294197E3, -0.510472533393438E7, 0.124981396109147E7, 0.200008436996201E10, -0.815158509791035E3, -0.157612685637523E3, -0.114200422332791E11, 0.662364680776872E16, -0.227622818296144E19, -0.171048081348406E32,6.60788766938091E15,1.66320055886021E22,-2.18003784381501E29,-7.87276140295618E29,1.51062329700346E31,7.95732170300541E6,1.31957647355347E15,-3.2509706829914E23,-4.18600611419248E25,2.97478906557467E34,-9.53588761745473E19,1.66957699620939E24,-1.75407764869978E32,3.47581490626396E34,-7.10971318427851E38],
|
|
170
|
+
sig1 = s/5.21,
|
|
171
|
+
sig2 = s/9.2,
|
|
172
|
+
Hsat = 0;
|
|
173
|
+
|
|
174
|
+
for (let i = 0; i < 30; i++)
|
|
175
|
+
{
|
|
176
|
+
let I = B2ab_I[i],
|
|
177
|
+
J = B2ab_J[i],
|
|
178
|
+
N = B2ab_N[i];
|
|
179
|
+
|
|
180
|
+
Hsat += N*Math.pow(1/sig1 - 0.513, I)*Math.pow(sig2 - 0.524, J);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return 2800*Math.exp(Hsat);
|
|
186
184
|
}
|
|
187
185
|
|
|
188
186
|
|
|
189
|
-
// h"_2c3b(s) Equation 6 in HS region 3 and 4
|
|
190
|
-
// Exported for testing
|
|
187
|
+
// h"_2c3b(s) Equation 6 in HS region 3 and 4 supplementary release
|
|
188
|
+
// @internal - Exported for unit testing only
|
|
191
189
|
export function b2c3b_S_H(s : number) : number
|
|
192
190
|
{
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
191
|
+
// Table 17 in in IAPWS-97 HS region 3 and 4
|
|
192
|
+
let B2c3b_HS_I = [0,0,0,1,1,5,6,7,8,8,12,16,22,22,24,36],
|
|
193
|
+
B2c3b_HS_J = [0,3,4,0,12,36,12,16,2,20,32,36,2,32,7,20],
|
|
194
|
+
B2c3b_HS_N = [1.04351280732769,-2.27807912708513,1.80535256723202,0.420440834792042,-1.0572124483466E5,4.36911607493884E24,-3.28032702839753E11,-6.7868676080427E15,7.43957464645363E3,-3.56896445355761E19,1.67590585186801E31,-3.55028625419105E37,3.96611982166538E11,-4.14716268484468E40,3.59080103867382E18,-1.16994334851995E40],
|
|
195
|
+
h = 0,
|
|
196
|
+
sigma = s/5.9;
|
|
197
|
+
|
|
198
|
+
for (let i = 0; i < 16; i++)
|
|
199
|
+
{
|
|
200
|
+
let I = B2c3b_HS_I[i],
|
|
201
|
+
J = B2c3b_HS_J[i],
|
|
202
|
+
N = B2c3b_HS_N[i];
|
|
203
|
+
|
|
204
|
+
h += N*Math.pow(sigma-1.02,I)*Math.pow(sigma-0.726,J);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return 2800*Math.pow(h,4);
|
|
210
208
|
}
|
|
211
209
|
|
|
212
210
|
// h'_3a Equation 4 in HS Region 3 and 4
|
|
213
211
|
// Used as a boundary check between 3a and 3b when P < Pc
|
|
214
212
|
// Function to work out the backwards (h,s) boundry for region 3A
|
|
215
|
-
// Exported for testing
|
|
213
|
+
// @internal - Exported for unit testing only
|
|
216
214
|
export function b3A_S_H(s : number) : number
|
|
217
215
|
{
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
216
|
+
// Table 10 in IAPWS-97 HS region 3 and 4
|
|
217
|
+
let B3A_HS_I = [0, 0, 0, 0, 2, 3, 4, 4, 5, 5, 6, 7, 7, 7, 10, 10, 10, 32, 32],
|
|
218
|
+
B3A_HS_J = [1, 4, 10, 16, 1, 36, 3, 16, 20, 36, 4, 2, 28, 32, 14, 32, 36, 0, 6],
|
|
219
|
+
B3A_HS_N = [0.822673364673336, 0.181977213534479, -0.0112000260313624, -0.000746778287048033, -0.179046263257381, 0.0424220110836657, -0.341355823438768, -2.09881740853565, -8.22477343323596, -4.99684082076008, 0.191413958471069, 0.0581062241093136, -1655.05498701029, 1588.70443421201, -85.0623535172818, -31771.4386511207, -94589.0406632871, -1.3927384708869E-6, 0.63105253224098],
|
|
220
|
+
sig = s/3.8,
|
|
221
|
+
hdash = 0;
|
|
222
|
+
|
|
223
|
+
for (let i = 0; i < 19; i++)
|
|
224
|
+
{
|
|
225
|
+
let N = B3A_HS_N[i],
|
|
226
|
+
I = B3A_HS_I[i],
|
|
227
|
+
J = B3A_HS_J[i];
|
|
228
|
+
|
|
229
|
+
hdash += N*Math.pow(sig-1.09,I)*Math.pow(sig+0.0000366,J);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return 1700*hdash;
|
|
235
233
|
}
|
|
236
234
|
|
|
237
235
|
//
|
|
@@ -240,38 +238,36 @@ export function b3A_S_H(s : number) : number
|
|
|
240
238
|
//
|
|
241
239
|
function r1(h : number, s : number) : State
|
|
242
240
|
{
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
throwOutOfRange();
|
|
253
|
-
}
|
|
241
|
+
let P = r1_HS_P(h,s),
|
|
242
|
+
T = PH.r1_PH_T(P,h);
|
|
243
|
+
|
|
244
|
+
if(P >= NS.CONST('MIN_P') && P <= NS.CONST('MAX_P'))
|
|
245
|
+
{
|
|
246
|
+
return PT.r1(P, T);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
throwOutOfRange("Region 1 (h,s) : ");
|
|
254
250
|
}
|
|
255
251
|
|
|
256
252
|
function r1_HS_P(h : number, s : number) : number
|
|
257
253
|
{
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
254
|
+
let R1_HS_I = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 4, 4, 5],
|
|
255
|
+
R1_HS_J = [0, 1, 2, 4, 5, 6, 8, 14, 0, 1, 4, 6, 0, 1, 10, 4, 1, 4, 0],
|
|
256
|
+
R1_HS_N = [-0.691997014660582, -18.361254878756, -9.28332409297335, 65.9639569909906, -16.2060388912024, 450.620017338667, 854.68067822417, 6075.23214001161, 32.6487682621856, -26.9408844582931, -319.9478483343, -928.35430704332, 30.3634537455249, -65.0540422444146, -4309.9131651613, -747.512324096068, 730.000345529245, 1142.84032569021, -436.407041874559],
|
|
257
|
+
m = h/3400,
|
|
258
|
+
sig = s/7.6,
|
|
259
|
+
P = 0;
|
|
260
|
+
|
|
261
|
+
for (let i = 0; i < 19; i++)
|
|
262
|
+
{
|
|
263
|
+
let N = R1_HS_N[i],
|
|
264
|
+
I = R1_HS_I[i],
|
|
265
|
+
J = R1_HS_J[i];
|
|
266
|
+
|
|
267
|
+
P += N*Math.pow(m+0.05, I)*Math.pow(sig+0.05, J);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return 100*P;
|
|
275
271
|
}
|
|
276
272
|
|
|
277
273
|
//
|
|
@@ -280,102 +276,100 @@ function r1_HS_P(h : number, s : number) : number
|
|
|
280
276
|
//
|
|
281
277
|
function r2(h : number, s : number) : State
|
|
282
278
|
{
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
throwOutOfRange()
|
|
292
|
-
}
|
|
279
|
+
let P = r2_HS_P(h,s);
|
|
280
|
+
|
|
281
|
+
if(P >= NS.CONST('MIN_P') && P <= NS.CONST('MAX_P'))
|
|
282
|
+
{
|
|
283
|
+
return PH.r2(P, h);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
throwOutOfRange("Region 2 (h,s) : ");
|
|
293
287
|
}
|
|
294
288
|
|
|
295
289
|
function r2_HS_P(h : number, s : number) : number
|
|
296
290
|
{
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
291
|
+
let P;
|
|
292
|
+
|
|
293
|
+
if(h <= b2ab_S_H(s))
|
|
294
|
+
{
|
|
295
|
+
P = r2A_HS_P(h,s);
|
|
296
|
+
}
|
|
297
|
+
else
|
|
298
|
+
{
|
|
299
|
+
if(s >= 5.85)
|
|
300
|
+
{
|
|
301
|
+
P = r2B_HS_P(h,s);
|
|
302
|
+
}
|
|
303
|
+
else
|
|
304
|
+
{
|
|
305
|
+
P = r2C_HS_P(h,s);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return P;
|
|
316
310
|
}
|
|
317
311
|
|
|
318
312
|
function r2A_HS_P(h : number, s : number) : number
|
|
319
313
|
{
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
314
|
+
let R2A_HS_I = [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 5, 5, 6, 7],
|
|
315
|
+
R2A_HS_J = [1, 3, 6, 16, 20, 22, 0, 1, 2, 3, 5, 6, 10, 16, 20, 22, 3, 16, 20, 0, 2, 3, 6, 16, 16, 3, 16, 3, 1],
|
|
316
|
+
R2A_HS_N = [-0.0182575361923032, -0.125229548799536, 0.592290437320145, 6.04769706185122, 238.624965444474, -298.639090222922, 0.051225081304075, -0.437266515606486, 0.413336902999504, -5.16468254574773, -5.57014838445711, 12.8555037824478, 11.414410895329, -119.504225652714, -2847.7798596156, 4317.57846408006, 1.1289404080265, 1974.09186206319, 1516.12444706087, 0.0141324451421235, 0.585501282219601, -2.97258075863012, 5.94567314847319, -6236.56565798905, 9659.86235133332, 6.81500934948134, -6332.07286824489, -5.5891922446576, 0.0400645798472063],
|
|
317
|
+
m = h/4200,
|
|
318
|
+
sig = s/12,
|
|
319
|
+
P = 0;
|
|
320
|
+
|
|
321
|
+
for (let i = 0; i < 29; i++)
|
|
322
|
+
{
|
|
323
|
+
let N = R2A_HS_N[i],
|
|
324
|
+
I = R2A_HS_I[i],
|
|
325
|
+
J = R2A_HS_J[i];
|
|
326
|
+
|
|
327
|
+
P += N*Math.pow(m-0.5,I)*Math.pow(sig-1.2,J);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return 4*Math.pow(P,4); // Corresponding pressure for h, s
|
|
337
331
|
}
|
|
338
332
|
|
|
339
333
|
function r2B_HS_P(h : number, s : number) : number
|
|
340
334
|
{
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
335
|
+
let R2B_HS_I = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 8, 12, 14],
|
|
336
|
+
R2B_HS_J = [0, 1, 2, 4, 8, 0, 1, 2, 3, 5, 12, 1, 6, 18, 0, 1, 7, 12, 1, 16, 1, 12, 1, 8, 18, 1, 16, 1, 3, 14, 18, 10, 16],
|
|
337
|
+
R2B_HS_N = [0.0801496989929495, -0.543862807146111, 0.337455597421283, 8.9055545115745, 313.840736431485, 0.797367065977789, -1.2161697355624, 8.72803386937477, -16.9769781757602, -186.552827328416, 95115.9274344237, -18.9168510120494, -4334.0703719484, 543212633.012715, 0.144793408386013, 128.024559637516, -67230.9534071268, 33697238.0095287, -586.63419676272, -22140322476.9889, 1716.06668708389, -570817595.806302, -3121.09693178482, -2078413.8463301, 3056059461577.86, 3221.57004314333, 326810259797.295, -1441.04158934487, 410.694867802691, 109077066873.024, -24796465425889.3, 1888019068.65134, -123651009018773],
|
|
338
|
+
m = h/4100,
|
|
339
|
+
sig = s/7.9,
|
|
340
|
+
P = 0;
|
|
341
|
+
|
|
342
|
+
for (let i = 0; i < 33; i++)
|
|
343
|
+
{
|
|
344
|
+
let N = R2B_HS_N[i],
|
|
345
|
+
I = R2B_HS_I[i],
|
|
346
|
+
J = R2B_HS_J[i];
|
|
347
|
+
|
|
348
|
+
P += N*Math.pow(m-0.6, I)*Math.pow(sig-1.01, J);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
return 100*Math.pow(P, 4);
|
|
358
352
|
}
|
|
359
353
|
|
|
360
354
|
function r2C_HS_P(h : number, s : number) : number
|
|
361
355
|
{
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
356
|
+
let R2C_HS_I = [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 5, 5, 5, 5, 6, 6, 10, 12, 16],
|
|
357
|
+
R2C_HS_J = [0, 1, 2, 3, 4, 8, 0, 2, 5, 8, 14, 2, 3, 7, 10, 18, 0, 5, 8, 16, 18, 18, 1, 4, 6, 14, 8, 18, 7, 7, 10],
|
|
358
|
+
R2C_HS_N = [0.112225607199012, -3.39005953606712, -32.0503911730094, -197.5973051049, -407.693861553446, 13294.3775222331, 1.70846839774007, 37.3694198142245, 3581.44365815434, 423014.446424664, -751071025.760063, 52.3446127607898, -228.351290812417, -960652.417056937, -80705929.2526074, 1626980172256.69, 0.772465073604171, 46392.9973837746, -13731788.5134128, 1704703926305.12, -25110462818730.8, 31774883083552.0, 53.8685623675312, -55308.9094625169, -1028615.22421405, 2042494187562.34, 273918446.626977, -2639631463126850.0, -1078908541.08088, -29649262098.0124, -1117549073234240.0],
|
|
359
|
+
m = h/3500,
|
|
360
|
+
sig = s/5.9,
|
|
361
|
+
P = 0;
|
|
362
|
+
|
|
363
|
+
for (let i = 0; i < 31; i++)
|
|
364
|
+
{
|
|
365
|
+
let N = R2C_HS_N[i],
|
|
366
|
+
I = R2C_HS_I[i],
|
|
367
|
+
J = R2C_HS_J[i];
|
|
368
|
+
|
|
369
|
+
P += N*Math.pow(m-0.7,I)*Math.pow(sig-1.1,J);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
return 100*Math.pow(P,4);
|
|
379
373
|
}
|
|
380
374
|
|
|
381
375
|
//
|
|
@@ -383,71 +377,69 @@ function r2C_HS_P(h : number, s : number) : number
|
|
|
383
377
|
//
|
|
384
378
|
function r3(h : number, s : number) : State
|
|
385
379
|
{
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
throwOutOfRange();
|
|
395
|
-
}
|
|
380
|
+
let P = r3_HS_P(h, s);
|
|
381
|
+
|
|
382
|
+
if(P >= NS.CONST('MIN_P') && P <= NS.CONST('MAX_P'))
|
|
383
|
+
{
|
|
384
|
+
return PH.r2(P, h);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
throwOutOfRange("Region 3 (h,s) : ");
|
|
396
388
|
}
|
|
397
389
|
|
|
398
390
|
function r3_HS_P(h : number, s : number) : number
|
|
399
391
|
{
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
392
|
+
if(s <= NS.CONST('R3_CRT_S'))
|
|
393
|
+
{
|
|
394
|
+
return r3A_HS_P(h, s);
|
|
395
|
+
}
|
|
396
|
+
else
|
|
397
|
+
{
|
|
398
|
+
return r3B_HS_P(h, s);
|
|
399
|
+
}
|
|
408
400
|
}
|
|
409
401
|
|
|
410
402
|
function r3A_HS_P(h : number, s : number) : number
|
|
411
403
|
{
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
404
|
+
let R3A_HS_I = [0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 6, 7, 8, 10, 10, 14, 18, 20, 22, 22, 24, 28, 28, 32, 32],
|
|
405
|
+
R3A_HS_J = [0, 1, 5, 0, 3, 4, 8, 14, 6, 16, 0, 2, 3, 0, 1, 4, 5, 28, 28, 24, 1, 32, 36, 22, 28, 36, 16, 28, 36, 16, 36, 10, 28, ],
|
|
406
|
+
R3A_HS_N = [7.70889828326934, -26.0835009128688, 267.416218930389, 17.2221089496844, -293.54233214597, 614.135601882478, -61056.2757725674, -65127225.1118219, 73591.9313521937, -11664650591.4191, 35.5267086434461, -596.144543825955, -475.842430145708, 69.6781965359503, 335.674250377312, 25052.6809130882, 146997.380630766, 53806931509153400000.0, 1.43619827291346E+21, 36498586616599400000.0, -2547.41561156775, 2.40120197096563E+27, -3.93847464679496E+29, 1.47073407024852E+24, -4.26391250432059E+31, 1.94509340621077E+38, 6.66212132114896E+23, 7.06777016552858E+33, 1.75563621975576E+41, 1.08408607429124E+28, 7.30872705175151E+43, 1.5914584739887E+24, 3.77121605943324E+40],
|
|
407
|
+
m = h/2300,
|
|
408
|
+
sig = s/4.4,
|
|
409
|
+
P = 0;
|
|
410
|
+
|
|
411
|
+
for (let i = 0; i < 33; i++)
|
|
412
|
+
{
|
|
413
|
+
let N = R3A_HS_N[i],
|
|
414
|
+
I = R3A_HS_I[i],
|
|
415
|
+
J = R3A_HS_J[i];
|
|
416
|
+
|
|
417
|
+
P += N*Math.pow(m-1.01,I)*Math.pow(sig-0.75,J);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
return 99*P;
|
|
429
421
|
}
|
|
430
422
|
|
|
431
423
|
function r3B_HS_P(h : number, s : number) : number
|
|
432
424
|
{
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
425
|
+
// Table X data from IAPWS-97
|
|
426
|
+
let R3B_HS_I = [-12, -12, -12, -12, -12, -10, -10, -10, -10, -8, -8, -6, -6, -6, -6, -5, -4, -4, -4, -3, -3, -3, -3, -2, -2, -1, 0, 2, 2, 5, 6, 8, 10, 14, 14],
|
|
427
|
+
R3B_HS_J = [2, 10, 12, 14, 20, 2, 10, 14, 18, 2, 8, 2, 6, 7, 8, 10, 4, 5, 8, 1, 3, 5, 6, 0, 1, 0, 3, 0, 1, 0, 1, 1, 1, 3, 7],
|
|
428
|
+
R3B_HS_N = [1.25244360717979E-13, -0.0126599322553713, 5.06878030140626, 31.7847171154202, -391041.161399932, -9.75733406392044E-11, -18.6312419488279, 510.973543414101, 373847.005822362, 2.99804024666572E-8, 20.0544393820342, -4.98030487662829E-6, -10.230180636003, 55.2819126990325, -206.211367510878, -7940.12232324823, 7.82248472028153, -58.6544326902468, 3550.73647696481, -0.000115303107290162, -1.75092403171802, 257.98168774816, -727.048374179467, 0.000121644822609198, 0.0393137871762692, 0.00704181005909296, -82.910820069811, -0.26517881813125, 13.7531682453991, -52.2394090753046, 2405.56298941048, -22736.1631268929, 89074.6343932567, -23923456.5822486, 5687958081.29714],
|
|
429
|
+
m = h/2800,
|
|
430
|
+
sig = s/5.3,
|
|
431
|
+
P = 0;
|
|
432
|
+
|
|
433
|
+
for (let i = 0; i < 35; i++)
|
|
434
|
+
{
|
|
435
|
+
let N = R3B_HS_N[i],
|
|
436
|
+
I = R3B_HS_I[i],
|
|
437
|
+
J = R3B_HS_J[i];
|
|
438
|
+
|
|
439
|
+
P += N*Math.pow(m-0.681,I)*Math.pow(sig-0.792,J);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
return 16.6/P;
|
|
451
443
|
}
|
|
452
444
|
|
|
453
445
|
//
|
|
@@ -455,42 +447,38 @@ function r3B_HS_P(h : number, s : number) : number
|
|
|
455
447
|
//
|
|
456
448
|
function r4(h : number, s : number) : State
|
|
457
449
|
{
|
|
458
|
-
|
|
459
|
-
|
|
450
|
+
let T = r4_HS_Tsat(h, s),
|
|
451
|
+
P = PT.r4_T_Psat(T);
|
|
460
452
|
|
|
461
|
-
|
|
453
|
+
return PT.solve(P, T);
|
|
462
454
|
}
|
|
463
455
|
|
|
464
456
|
|
|
465
457
|
// Tsat(h,s) Equation 9 in the HS Region 3 & 4 Supplementary release
|
|
466
|
-
// Exported for
|
|
458
|
+
// @internal - Exported for unit testing only
|
|
467
459
|
export function r4_HS_Tsat(h : number, s : number) : number
|
|
468
460
|
{
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
461
|
+
let R4_I = [0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 8, 10, 10, 12, 14, 14, 16, 16, 18, 18, 18, 20, 28],
|
|
462
|
+
R4_J = [0, 3, 12, 0, 1, 2, 5, 0, 5, 8, 0, 2, 3, 4, 0, 1, 1, 2, 4, 16, 6, 8, 22, 1, 20, 36, 24, 1, 28, 12, 32, 14, 22, 36, 24, 36],
|
|
463
|
+
R4_N = [0.179882673606601, -0.267507455199603, 0.11627672261266E1, 0.147545428713616, -0.512871635973248, 0.421333567697984, 0.56374952218987, 0.429274443819153, -0.33570455214214E1, 0.108890916499278E2, -0.248483390456012, 0.30415322190639, -0.494819763939905, 0.107551674933261E1, 0.733888415457688E-1, 0.140170545411085E-1, -0.106110975998808, 0.168324361811875E-1, 0.125028363714877E1, 0.101316840309509E4, -0.151791558000712E1, 0.524277865990866E2, 0.230495545563912E5, 0.249459806365456E-1, 0.210796467412137E7, 0.366836848613065E9, -0.144814105365163E9, -0.17927637300359E-2, 0.489955602100459E10, 0.471262212070518E3, -0.829294390198652E11, -0.171545662263191E4, 0.355777682973575E7, 0.586062760258436E12, -0.129887635078195E8, 0.317247449371057057E11],
|
|
464
|
+
mu = h/2800,
|
|
465
|
+
sig = s/9.2,
|
|
466
|
+
T = 0;
|
|
467
|
+
|
|
468
|
+
for (let i = 0; i < 36; i++)
|
|
469
|
+
{
|
|
470
|
+
let I = R4_I[i],
|
|
471
|
+
J = R4_J[i],
|
|
472
|
+
N = R4_N[i];
|
|
473
|
+
|
|
474
|
+
T += N*Math.pow(mu - 0.119, I)*Math.pow(sig - 1.07, J);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
return 550*T;
|
|
486
478
|
}
|
|
487
479
|
|
|
488
480
|
|
|
489
|
-
function throwOutOfRange()
|
|
481
|
+
function throwOutOfRange(prefix_msg: string = "") : never
|
|
490
482
|
{
|
|
491
|
-
|
|
483
|
+
throw new Error(`${prefix_msg}Input values out of range`);
|
|
492
484
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|