iapws-if97 2.1.2 → 2.2.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/CHANGELOG.md +12 -0
- package/README.md +134 -94
- package/dist/backward/fixed-temperature-solver.d.ts +6 -6
- package/dist/backward/fixed-temperature-solver.js +34 -8
- package/dist/backward/hs.d.ts +1 -2
- package/dist/backward/hs.js +67 -46
- package/dist/backward/ph.d.ts +8 -5
- package/dist/backward/ph.js +43 -46
- package/dist/backward/ps.d.ts +0 -1
- package/dist/backward/ps.js +30 -18
- package/dist/backward/solution-validation.d.ts +0 -1
- package/dist/backward/solution-validation.js +33 -5
- package/dist/backward/th.d.ts +0 -1
- package/dist/backward/th.js +4 -6
- package/dist/backward/thermodynamic-derivatives.d.ts +17 -0
- package/dist/backward/thermodynamic-derivatives.js +27 -0
- package/dist/backward/tolerances.d.ts +0 -1
- package/dist/backward/tolerances.js +0 -1
- package/dist/backward/ts.d.ts +0 -1
- package/dist/backward/ts.js +4 -6
- package/dist/boundaries.d.ts +0 -1
- package/dist/boundaries.js +0 -1
- package/dist/constants.d.ts +0 -9
- package/dist/constants.js +3 -13
- package/dist/core/input-validation.d.ts +0 -1
- package/dist/core/input-validation.js +0 -1
- package/dist/core/public-normalization.d.ts +0 -1
- package/dist/core/public-normalization.js +0 -1
- package/dist/core/region-detector.d.ts +0 -1
- package/dist/core/region-detector.js +234 -67
- package/dist/core/region3-pt.d.ts +12 -1
- package/dist/core/region3-pt.js +38 -9
- package/dist/core/solve-input-normalization.d.ts +0 -1
- package/dist/core/solve-input-normalization.js +0 -1
- package/dist/core/solver.d.ts +0 -1
- package/dist/core/solver.js +0 -1
- package/dist/detect.d.ts +0 -1
- package/dist/detect.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/regions/boundaries.d.ts +0 -1
- package/dist/regions/boundaries.js +0 -1
- package/dist/regions/region1.d.ts +0 -1
- package/dist/regions/region1.js +0 -1
- package/dist/regions/region2.d.ts +0 -1
- package/dist/regions/region2.js +0 -1
- package/dist/regions/region3-data.d.ts +0 -1
- package/dist/regions/region3-data.js +0 -1
- package/dist/regions/region3-eval.d.ts +0 -1
- package/dist/regions/region3-eval.js +0 -1
- package/dist/regions/region3-subregions.d.ts +0 -1
- package/dist/regions/region3-subregions.js +0 -1
- package/dist/regions/region3.d.ts +0 -1
- package/dist/regions/region3.js +0 -1
- package/dist/regions/region4.d.ts +0 -1
- package/dist/regions/region4.js +0 -1
- package/dist/regions/region5.d.ts +0 -1
- package/dist/regions/region5.js +0 -1
- package/dist/regions.d.ts +0 -1
- package/dist/regions.js +0 -1
- package/dist/saturation/common.d.ts +0 -1
- package/dist/saturation/common.js +6 -13
- package/dist/saturation/region4-boundaries.d.ts +0 -5
- package/dist/saturation/region4-boundaries.js +4 -5
- package/dist/saturation/region4-hs.d.ts +2 -1
- package/dist/saturation/region4-hs.js +277 -108
- package/dist/saturation/two-phase.d.ts +0 -1
- package/dist/saturation/two-phase.js +0 -1
- package/dist/saturation.d.ts +0 -1
- package/dist/saturation.js +0 -1
- package/dist/solvers/bracketed-newton.d.ts +5 -4
- package/dist/solvers/bracketed-newton.js +5 -6
- package/dist/solvers/damped-newton-2d.d.ts +12 -0
- package/dist/solvers/damped-newton-2d.js +68 -0
- package/dist/solvers/newton-raphson.d.ts +0 -1
- package/dist/solvers/newton-raphson.js +0 -1
- package/dist/transport/properties.d.ts +0 -1
- package/dist/transport/properties.js +0 -1
- package/dist/transport.d.ts +0 -1
- package/dist/transport.js +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -1
- package/package.json +19 -10
- package/dist/backward/fixed-temperature-solver.d.ts.map +0 -1
- package/dist/backward/fixed-temperature-solver.js.map +0 -1
- package/dist/backward/hs.d.ts.map +0 -1
- package/dist/backward/hs.js.map +0 -1
- package/dist/backward/objective-normalization.d.ts +0 -7
- package/dist/backward/objective-normalization.d.ts.map +0 -1
- package/dist/backward/objective-normalization.js +0 -8
- package/dist/backward/objective-normalization.js.map +0 -1
- package/dist/backward/ph.d.ts.map +0 -1
- package/dist/backward/ph.js.map +0 -1
- package/dist/backward/ps.d.ts.map +0 -1
- package/dist/backward/ps.js.map +0 -1
- package/dist/backward/solution-validation.d.ts.map +0 -1
- package/dist/backward/solution-validation.js.map +0 -1
- package/dist/backward/th.d.ts.map +0 -1
- package/dist/backward/th.js.map +0 -1
- package/dist/backward/tolerances.d.ts.map +0 -1
- package/dist/backward/tolerances.js.map +0 -1
- package/dist/backward/ts.d.ts.map +0 -1
- package/dist/backward/ts.js.map +0 -1
- package/dist/boundaries.d.ts.map +0 -1
- package/dist/boundaries.js.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/core/input-validation.d.ts.map +0 -1
- package/dist/core/input-validation.js.map +0 -1
- package/dist/core/public-normalization.d.ts.map +0 -1
- package/dist/core/public-normalization.js.map +0 -1
- package/dist/core/region-detector.d.ts.map +0 -1
- package/dist/core/region-detector.js.map +0 -1
- package/dist/core/region3-pt.d.ts.map +0 -1
- package/dist/core/region3-pt.js.map +0 -1
- package/dist/core/solve-input-normalization.d.ts.map +0 -1
- package/dist/core/solve-input-normalization.js.map +0 -1
- package/dist/core/solver.d.ts.map +0 -1
- package/dist/core/solver.js.map +0 -1
- package/dist/detect.d.ts.map +0 -1
- package/dist/detect.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/regions/boundaries.d.ts.map +0 -1
- package/dist/regions/boundaries.js.map +0 -1
- package/dist/regions/region1.d.ts.map +0 -1
- package/dist/regions/region1.js.map +0 -1
- package/dist/regions/region2.d.ts.map +0 -1
- package/dist/regions/region2.js.map +0 -1
- package/dist/regions/region3-data.d.ts.map +0 -1
- package/dist/regions/region3-data.js.map +0 -1
- package/dist/regions/region3-eval.d.ts.map +0 -1
- package/dist/regions/region3-eval.js.map +0 -1
- package/dist/regions/region3-subregions.d.ts.map +0 -1
- package/dist/regions/region3-subregions.js.map +0 -1
- package/dist/regions/region3.d.ts.map +0 -1
- package/dist/regions/region3.js.map +0 -1
- package/dist/regions/region4.d.ts.map +0 -1
- package/dist/regions/region4.js.map +0 -1
- package/dist/regions/region5.d.ts.map +0 -1
- package/dist/regions/region5.js.map +0 -1
- package/dist/regions.d.ts.map +0 -1
- package/dist/regions.js.map +0 -1
- package/dist/saturation/common.d.ts.map +0 -1
- package/dist/saturation/common.js.map +0 -1
- package/dist/saturation/region4-boundaries.d.ts.map +0 -1
- package/dist/saturation/region4-boundaries.js.map +0 -1
- package/dist/saturation/region4-hs.d.ts.map +0 -1
- package/dist/saturation/region4-hs.js.map +0 -1
- package/dist/saturation/two-phase.d.ts.map +0 -1
- package/dist/saturation/two-phase.js.map +0 -1
- package/dist/saturation.d.ts.map +0 -1
- package/dist/saturation.js.map +0 -1
- package/dist/solvers/bracketed-newton.d.ts.map +0 -1
- package/dist/solvers/bracketed-newton.js.map +0 -1
- package/dist/solvers/nelder-mead.d.ts +0 -17
- package/dist/solvers/nelder-mead.d.ts.map +0 -1
- package/dist/solvers/nelder-mead.js +0 -116
- package/dist/solvers/nelder-mead.js.map +0 -1
- package/dist/solvers/newton-raphson.d.ts.map +0 -1
- package/dist/solvers/newton-raphson.js.map +0 -1
- package/dist/transport/properties.d.ts.map +0 -1
- package/dist/transport/properties.js.map +0 -1
- package/dist/transport.d.ts.map +0 -1
- package/dist/transport.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
package/dist/backward/ph.d.ts
CHANGED
|
@@ -7,15 +7,18 @@
|
|
|
7
7
|
* Reference: IAPWS-IF97 Supplementary Release on Backward Equations
|
|
8
8
|
*/
|
|
9
9
|
import type { BasicProperties } from '../types.js';
|
|
10
|
+
export declare function r1BackwardT(p: number, h: number): number;
|
|
11
|
+
/** B2bc boundary: h → p, discriminating subregions 2b and 2c.
|
|
12
|
+
* Ref: IAPWS-IF97, Eq. 20. Check point: h = 3516.004323 → p = 100 MPa. */
|
|
10
13
|
export declare function b2bc_H_P(h: number): number;
|
|
11
|
-
|
|
12
|
-
export declare function
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
export declare function r2BackwardT(p: number, h: number): number;
|
|
15
|
+
export declare function r3BackwardPHInitial(p: number, h: number): {
|
|
16
|
+
rho: number;
|
|
17
|
+
T: number;
|
|
18
|
+
};
|
|
15
19
|
/**
|
|
16
20
|
* Solve for thermodynamic state given P and H.
|
|
17
21
|
* @param p - Pressure [MPa]
|
|
18
22
|
* @param h - Specific enthalpy [kJ/kg]
|
|
19
23
|
*/
|
|
20
24
|
export declare function solvePH(p: number, h: number): BasicProperties;
|
|
21
|
-
//# sourceMappingURL=ph.d.ts.map
|
package/dist/backward/ph.js
CHANGED
|
@@ -16,10 +16,9 @@ import { saturationTemperature } from '../regions/region4.js';
|
|
|
16
16
|
import { assertFiniteNumber } from '../core/input-validation.js';
|
|
17
17
|
import { detectRegionPH } from '../core/region-detector.js';
|
|
18
18
|
import { newtonRaphson } from '../solvers/newton-raphson.js';
|
|
19
|
-
import {
|
|
19
|
+
import { dampedNewton2D } from '../solvers/damped-newton-2d.js';
|
|
20
20
|
import { validateBackwardState } from './solution-validation.js';
|
|
21
|
-
import {
|
|
22
|
-
import { sumNormalizedResiduals } from './objective-normalization.js';
|
|
21
|
+
import { helmholtzPropertyDerivatives } from './thermodynamic-derivatives.js';
|
|
23
22
|
import { mixSaturationState, qualityFromSaturationProperty, saturationEndpointsAtPressure, } from '../saturation/common.js';
|
|
24
23
|
import { assertCriticalRegion4PHInput, assertRegion4StateAllowed, } from '../saturation/region4-boundaries.js';
|
|
25
24
|
// ─── Backward Polynomial Evaluator ─────────────────────────────────────────
|
|
@@ -39,7 +38,7 @@ const R1_PH = [
|
|
|
39
38
|
[3, 10, 6.6456186191635e-8], [3, 32, 8.0670734103027e-11], [4, 32, -9.3477771213947e-13],
|
|
40
39
|
[5, 32, 5.8265442020601e-15], [6, 32, -1.5020185953503e-17],
|
|
41
40
|
];
|
|
42
|
-
function r1BackwardT(p, h) {
|
|
41
|
+
export function r1BackwardT(p, h) {
|
|
43
42
|
return evalPoly(R1_PH, 0, -1, p, h / 2500);
|
|
44
43
|
}
|
|
45
44
|
// ─── Region 2 Backward T(P,H) ─────────────────────────────────────────────
|
|
@@ -47,9 +46,10 @@ function r1BackwardT(p, h) {
|
|
|
47
46
|
// For 4 < p <= 6.546699678 MPa the supplementary release selects subregion 2b
|
|
48
47
|
// directly; above this threshold use the B2bc(h) boundary to discriminate 2b/2c.
|
|
49
48
|
const R2_PH_B2BC_P_MIN = 6.546699678;
|
|
50
|
-
|
|
49
|
+
/** B2bc boundary: h → p, discriminating subregions 2b and 2c.
|
|
50
|
+
* Ref: IAPWS-IF97, Eq. 20. Check point: h = 3516.004323 → p = 100 MPa. */
|
|
51
51
|
export function b2bc_H_P(h) {
|
|
52
|
-
return 0.
|
|
52
|
+
return 0.90584278514723e3 - 0.67955786399241 * h + 0.12809002730136e-3 * h * h;
|
|
53
53
|
}
|
|
54
54
|
// Subregion 2a — Eq. 22
|
|
55
55
|
const R2A_PH = [
|
|
@@ -96,7 +96,7 @@ const R2C_PH = [
|
|
|
96
96
|
function r2cBackwardT(p, h) {
|
|
97
97
|
return evalPoly(R2C_PH, -25, 1.8, p, h / 2000);
|
|
98
98
|
}
|
|
99
|
-
function r2BackwardT(p, h) {
|
|
99
|
+
export function r2BackwardT(p, h) {
|
|
100
100
|
let T;
|
|
101
101
|
if (p <= C.R2_P_CRT) {
|
|
102
102
|
T = r2aBackwardT(p, h);
|
|
@@ -119,7 +119,7 @@ function r2BackwardT(p, h) {
|
|
|
119
119
|
}
|
|
120
120
|
// ─── Region 3 Backward T(P,H) and v(P,H) ──────────────────────────────────
|
|
121
121
|
/** B3ab boundary: P → H */
|
|
122
|
-
|
|
122
|
+
function b3ab_P_to_H(p) {
|
|
123
123
|
return 2014.64004206875 + 3.74696550136983 * p - 0.0219921901054187 * p * p + 0.000087513168600995 * p * p * p;
|
|
124
124
|
}
|
|
125
125
|
const R3A_PH_T = [
|
|
@@ -173,22 +173,36 @@ const R3B_PH_V = [
|
|
|
173
173
|
[-1, 5, -11.8035753702231], [0, 0, 0.169490044091791], [1, 0, -0.0179967222507787],
|
|
174
174
|
[1, 1, 0.0371810116332674], [2, 2, -0.0536288335065096], [2, 6, 1.6069710109252],
|
|
175
175
|
];
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
[20, 16, -3.33775713645296e22], [22, 3, 3.56499469636328e10], [24, 18, -1.48547544720641e26],
|
|
182
|
-
[28, 8, 3.30611514838798e18], [36, 24, 8.13641294467829e37],
|
|
183
|
-
];
|
|
184
|
-
/** R4: enthalpy → saturation pressure for PH boundary detection */
|
|
185
|
-
export function r4EnthalpyToPsat(h) {
|
|
186
|
-
const mu = h / 2600;
|
|
187
|
-
let p = 0;
|
|
188
|
-
for (const [I, J, N] of R4_H_PSAT) {
|
|
189
|
-
p += N * Math.pow(mu - 1.02, I) * Math.pow(mu - 0.608, J);
|
|
176
|
+
export function r3BackwardPHInitial(p, h) {
|
|
177
|
+
if (h < b3ab_P_to_H(p)) {
|
|
178
|
+
const T = 760 * evalPoly(R3A_PH_T, -0.240, 0.615, p / 100, h / 2300);
|
|
179
|
+
const v = 0.0028 * evalPoly(R3A_PH_V, -0.128, 0.727, p / 100, h / 2100);
|
|
180
|
+
return { rho: 1 / v, T };
|
|
190
181
|
}
|
|
191
|
-
|
|
182
|
+
const T = 860 * evalPoly(R3B_PH_T, -0.298, 0.720, p / 100, h / 2800);
|
|
183
|
+
const v = 0.0088 * evalPoly(R3B_PH_V, -0.0661, 0.720, p / 100, h / 2800);
|
|
184
|
+
return { rho: 1 / v, T };
|
|
185
|
+
}
|
|
186
|
+
function solveRegion3PH(p, h, rho0, T0) {
|
|
187
|
+
const pScale = Math.max(1, Math.abs(p));
|
|
188
|
+
const hScale = Math.max(1, Math.abs(h));
|
|
189
|
+
const [rho, T] = dampedNewton2D(([candidateRho, candidateT]) => {
|
|
190
|
+
const state = region3ByRhoT(candidateRho, candidateT);
|
|
191
|
+
const derivatives = helmholtzPropertyDerivatives(state, candidateRho);
|
|
192
|
+
return {
|
|
193
|
+
residual: [
|
|
194
|
+
(state.pressure - p) / pScale,
|
|
195
|
+
(state.enthalpy - h) / hScale,
|
|
196
|
+
],
|
|
197
|
+
jacobian: [
|
|
198
|
+
[derivatives.dpDrho / pScale, derivatives.dpDT / pScale],
|
|
199
|
+
[derivatives.dhDrho / hScale, derivatives.dhDT / hScale],
|
|
200
|
+
],
|
|
201
|
+
};
|
|
202
|
+
}, [rho0, T0], {
|
|
203
|
+
isValid: ([candidateRho, candidateT]) => candidateRho > 0 && candidateT > 0,
|
|
204
|
+
});
|
|
205
|
+
return region3ByRhoT(rho, T);
|
|
192
206
|
}
|
|
193
207
|
// ─── Main PH Solver ────────────────────────────────────────────────────────
|
|
194
208
|
/**
|
|
@@ -210,7 +224,7 @@ export function solvePH(p, h) {
|
|
|
210
224
|
switch (region) {
|
|
211
225
|
case Region.Region1: {
|
|
212
226
|
const T0 = r1BackwardT(p, h);
|
|
213
|
-
const T = newtonRaphson((T_x) => region1(p, T_x).enthalpy - h, T0);
|
|
227
|
+
const T = newtonRaphson((T_x) => region1(p, T_x).enthalpy - h, T0, (T_x) => region1(p, T_x).cp ?? Number.NaN);
|
|
214
228
|
return validateBackwardState(region1(p, T), [
|
|
215
229
|
{ label: 'pressure', expected: p },
|
|
216
230
|
{ label: 'enthalpy', expected: h },
|
|
@@ -218,33 +232,17 @@ export function solvePH(p, h) {
|
|
|
218
232
|
}
|
|
219
233
|
case Region.Region2: {
|
|
220
234
|
const T0 = r2BackwardT(p, h);
|
|
221
|
-
const T = newtonRaphson((T_x) => region2(p, T_x).enthalpy - h, T0);
|
|
235
|
+
const T = newtonRaphson((T_x) => region2(p, T_x).enthalpy - h, T0, (T_x) => region2(p, T_x).cp ?? Number.NaN);
|
|
222
236
|
return validateBackwardState(region2(p, T), [
|
|
223
237
|
{ label: 'pressure', expected: p },
|
|
224
238
|
{ label: 'enthalpy', expected: h },
|
|
225
239
|
], { solverName: 'solvePH', expectedRegion: Region.Region2 });
|
|
226
240
|
}
|
|
227
241
|
case Region.Region3: {
|
|
228
|
-
const hBound = b3ab_P_to_H(p);
|
|
229
242
|
const pressureTolerance = 1e-5 * Math.max(1, Math.abs(p));
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
T0 = 760 * evalPoly(R3A_PH_T, -0.240, 0.615, p / 100, h / 2300);
|
|
234
|
-
v0 = 0.0028 * evalPoly(R3A_PH_V, -0.128, 0.727, p / 100, h / 2100);
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
T0 = 860 * evalPoly(R3B_PH_T, -0.298, 0.720, p / 100, h / 2800);
|
|
238
|
-
v0 = 0.0088 * evalPoly(R3B_PH_V, -0.0661, 0.720, p / 100, h / 2800);
|
|
239
|
-
}
|
|
240
|
-
const sol = nelderMead((pair) => {
|
|
241
|
-
const state = region3ByRhoT(1 / pair[0], pair[1]);
|
|
242
|
-
return sumNormalizedResiduals([
|
|
243
|
-
{ actual: state.enthalpy, expected: h, tolerance: enthalpyTolerance },
|
|
244
|
-
{ actual: state.pressure, expected: p, tolerance: pressureTolerance },
|
|
245
|
-
]);
|
|
246
|
-
}, [v0, T0], { maxIterations: 1000, minErrorDelta: 1e-8, minTolerance: 1e-9 });
|
|
247
|
-
return validateBackwardState(region3ByRhoT(1 / sol.x[0], sol.x[1]), [
|
|
243
|
+
const initial = r3BackwardPHInitial(p, h);
|
|
244
|
+
const state = solveRegion3PH(p, h, initial.rho, initial.T);
|
|
245
|
+
return validateBackwardState(state, [
|
|
248
246
|
{ label: 'pressure', expected: p, tolerance: pressureTolerance },
|
|
249
247
|
{ label: 'enthalpy', expected: h },
|
|
250
248
|
], { solverName: 'solvePH', expectedRegion: Region.Region3 });
|
|
@@ -259,7 +257,7 @@ export function solvePH(p, h) {
|
|
|
259
257
|
], { solverName: 'solvePH', expectedRegion: Region.Region4 });
|
|
260
258
|
}
|
|
261
259
|
case Region.Region5: {
|
|
262
|
-
const T = newtonRaphson((T_x) => region5(p, T_x).enthalpy - h, 1500);
|
|
260
|
+
const T = newtonRaphson((T_x) => region5(p, T_x).enthalpy - h, 1500, (T_x) => region5(p, T_x).cp ?? Number.NaN);
|
|
263
261
|
return validateBackwardState(region5(p, T), [
|
|
264
262
|
{ label: 'pressure', expected: p },
|
|
265
263
|
{ label: 'enthalpy', expected: h },
|
|
@@ -269,4 +267,3 @@ export function solvePH(p, h) {
|
|
|
269
267
|
throw new IF97Error(`Cannot determine region for P=${p} MPa, h=${h} kJ/kg`);
|
|
270
268
|
}
|
|
271
269
|
}
|
|
272
|
-
//# sourceMappingURL=ph.js.map
|
package/dist/backward/ps.d.ts
CHANGED
package/dist/backward/ps.js
CHANGED
|
@@ -12,10 +12,9 @@ import { region5 } from '../regions/region5.js';
|
|
|
12
12
|
import { assertFiniteNumber } from '../core/input-validation.js';
|
|
13
13
|
import { detectRegionPS } from '../core/region-detector.js';
|
|
14
14
|
import { newtonRaphson } from '../solvers/newton-raphson.js';
|
|
15
|
-
import {
|
|
15
|
+
import { dampedNewton2D } from '../solvers/damped-newton-2d.js';
|
|
16
16
|
import { validateBackwardState } from './solution-validation.js';
|
|
17
|
-
import {
|
|
18
|
-
import { sumNormalizedResiduals } from './objective-normalization.js';
|
|
17
|
+
import { helmholtzPropertyDerivatives } from './thermodynamic-derivatives.js';
|
|
19
18
|
import { mixSaturationState, qualityFromSaturationProperty, saturationEndpointsAtPressure, } from '../saturation/common.js';
|
|
20
19
|
import { assertCriticalRegion4PSInput, assertRegion4StateAllowed, } from '../saturation/region4-boundaries.js';
|
|
21
20
|
function evalPoly(table, piShift, sigShift, pi, sig) {
|
|
@@ -90,9 +89,9 @@ function r2BackwardT(p, s) {
|
|
|
90
89
|
return evalPoly(R2A_PS, 0, 2, p, s / 2);
|
|
91
90
|
}
|
|
92
91
|
if (s >= C.R2_S_CRT) {
|
|
93
|
-
return evalPoly(R2B_PS, 0, 10, p, s / 0.7853);
|
|
92
|
+
return evalPoly(R2B_PS, 0, -10, p, -s / 0.7853);
|
|
94
93
|
}
|
|
95
|
-
return evalPoly(R2C_PS, 0, 2, p, s / 2.9251);
|
|
94
|
+
return evalPoly(R2C_PS, 0, -2, p, -s / 2.9251);
|
|
96
95
|
}
|
|
97
96
|
// ─── Region 3 Backward T(P,S) and v(P,S) ──────────────────────────────────
|
|
98
97
|
const R3A_PS_T_TABLE = [
|
|
@@ -145,6 +144,27 @@ const R3B_PS_V_TABLE = [
|
|
|
145
144
|
[0, 2, -19.1449143716586], [1, 0, -0.0150448002905284], [1, 2, 14.6407900162154],
|
|
146
145
|
[2, 2, -3.2747778718823],
|
|
147
146
|
];
|
|
147
|
+
function solveRegion3PS(p, s, rho0, T0) {
|
|
148
|
+
const pScale = Math.max(1, Math.abs(p));
|
|
149
|
+
const sScale = Math.max(1, Math.abs(s));
|
|
150
|
+
const [rho, T] = dampedNewton2D(([candidateRho, candidateT]) => {
|
|
151
|
+
const state = region3ByRhoT(candidateRho, candidateT);
|
|
152
|
+
const derivatives = helmholtzPropertyDerivatives(state, candidateRho);
|
|
153
|
+
return {
|
|
154
|
+
residual: [
|
|
155
|
+
(state.pressure - p) / pScale,
|
|
156
|
+
(state.entropy - s) / sScale,
|
|
157
|
+
],
|
|
158
|
+
jacobian: [
|
|
159
|
+
[derivatives.dpDrho / pScale, derivatives.dpDT / pScale],
|
|
160
|
+
[derivatives.dsDrho / sScale, derivatives.dsDT / sScale],
|
|
161
|
+
],
|
|
162
|
+
};
|
|
163
|
+
}, [rho0, T0], {
|
|
164
|
+
isValid: ([candidateRho, candidateT]) => candidateRho > 0 && candidateT > 0,
|
|
165
|
+
});
|
|
166
|
+
return region3ByRhoT(rho, T);
|
|
167
|
+
}
|
|
148
168
|
// ─── Main PS Solver ────────────────────────────────────────────────────────
|
|
149
169
|
/**
|
|
150
170
|
* Solve for thermodynamic state given P and S.
|
|
@@ -165,7 +185,7 @@ export function solvePS(p, s) {
|
|
|
165
185
|
switch (region) {
|
|
166
186
|
case Region.Region1: {
|
|
167
187
|
const T0 = r1BackwardT(p, s);
|
|
168
|
-
const T = newtonRaphson((T_x) => region1(p, T_x).entropy - s, T0);
|
|
188
|
+
const T = newtonRaphson((T_x) => region1(p, T_x).entropy - s, T0, (T_x) => (region1(p, T_x).cp ?? Number.NaN) / T_x);
|
|
169
189
|
return validateBackwardState(region1(p, T), [
|
|
170
190
|
{ label: 'pressure', expected: p },
|
|
171
191
|
{ label: 'entropy', expected: s },
|
|
@@ -173,7 +193,7 @@ export function solvePS(p, s) {
|
|
|
173
193
|
}
|
|
174
194
|
case Region.Region2: {
|
|
175
195
|
const T0 = r2BackwardT(p, s);
|
|
176
|
-
const T = newtonRaphson((T_x) => region2(p, T_x).entropy - s, T0);
|
|
196
|
+
const T = newtonRaphson((T_x) => region2(p, T_x).entropy - s, T0, (T_x) => (region2(p, T_x).cp ?? Number.NaN) / T_x);
|
|
177
197
|
return validateBackwardState(region2(p, T), [
|
|
178
198
|
{ label: 'pressure', expected: p },
|
|
179
199
|
{ label: 'entropy', expected: s },
|
|
@@ -181,7 +201,6 @@ export function solvePS(p, s) {
|
|
|
181
201
|
}
|
|
182
202
|
case Region.Region3: {
|
|
183
203
|
const pressureTolerance = 1e-5 * Math.max(1, Math.abs(p));
|
|
184
|
-
const entropyTolerance = backwardConstraintTolerance('entropy', s);
|
|
185
204
|
let T0, v0;
|
|
186
205
|
if (s <= C.R3_S_CRT) {
|
|
187
206
|
T0 = 760 * evalPoly(R3A_PS_T_TABLE, -0.240, 0.703, p / 100, s / 4.4);
|
|
@@ -191,14 +210,8 @@ export function solvePS(p, s) {
|
|
|
191
210
|
T0 = 860 * evalPoly(R3B_PS_T_TABLE, -0.760, 0.818, p / 100, s / 5.3);
|
|
192
211
|
v0 = 0.0088 * evalPoly(R3B_PS_V_TABLE, -0.298, 0.816, p / 100, s / 5.3);
|
|
193
212
|
}
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
return sumNormalizedResiduals([
|
|
197
|
-
{ actual: state.entropy, expected: s, tolerance: entropyTolerance },
|
|
198
|
-
{ actual: state.pressure, expected: p, tolerance: pressureTolerance },
|
|
199
|
-
]);
|
|
200
|
-
}, [v0, T0], { maxIterations: 1000, minErrorDelta: 1e-8, minTolerance: 1e-9 });
|
|
201
|
-
return validateBackwardState(region3ByRhoT(1 / sol.x[0], sol.x[1]), [
|
|
213
|
+
const state = solveRegion3PS(p, s, 1 / v0, T0);
|
|
214
|
+
return validateBackwardState(state, [
|
|
202
215
|
{ label: 'pressure', expected: p, tolerance: pressureTolerance },
|
|
203
216
|
{ label: 'entropy', expected: s },
|
|
204
217
|
], { solverName: 'solvePS', expectedRegion: Region.Region3 });
|
|
@@ -213,7 +226,7 @@ export function solvePS(p, s) {
|
|
|
213
226
|
], { solverName: 'solvePS', expectedRegion: Region.Region4 });
|
|
214
227
|
}
|
|
215
228
|
case Region.Region5: {
|
|
216
|
-
const T = newtonRaphson((T_x) => region5(p, T_x).entropy - s, 1500);
|
|
229
|
+
const T = newtonRaphson((T_x) => region5(p, T_x).entropy - s, 1500, (T_x) => (region5(p, T_x).cp ?? Number.NaN) / T_x);
|
|
217
230
|
return validateBackwardState(region5(p, T), [
|
|
218
231
|
{ label: 'pressure', expected: p },
|
|
219
232
|
{ label: 'entropy', expected: s },
|
|
@@ -223,4 +236,3 @@ export function solvePS(p, s) {
|
|
|
223
236
|
throw new IF97Error(`Cannot determine region for P=${p} MPa, s=${s} kJ/(kg·K)`);
|
|
224
237
|
}
|
|
225
238
|
}
|
|
226
|
-
//# sourceMappingURL=ps.js.map
|
|
@@ -10,4 +10,3 @@ export interface BackwardValidationOptions {
|
|
|
10
10
|
expectedRegion?: Region;
|
|
11
11
|
}
|
|
12
12
|
export declare function validateBackwardState(state: BasicProperties, constraints: readonly BackwardConstraint[], options: BackwardValidationOptions): BasicProperties;
|
|
13
|
-
//# sourceMappingURL=solution-validation.d.ts.map
|
|
@@ -17,6 +17,34 @@ function propertyValue(state, label) {
|
|
|
17
17
|
return Number.NaN;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
function boundaryTolerance(value, boundary) {
|
|
21
|
+
return 1e-9 * Math.max(1, Math.abs(value), Math.abs(boundary));
|
|
22
|
+
}
|
|
23
|
+
function snapUpFromBelow(value, boundary) {
|
|
24
|
+
return value < boundary && boundary - value <= boundaryTolerance(value, boundary)
|
|
25
|
+
? boundary
|
|
26
|
+
: value;
|
|
27
|
+
}
|
|
28
|
+
function snapDownFromAbove(value, boundary) {
|
|
29
|
+
return value > boundary && value - boundary <= boundaryTolerance(value, boundary)
|
|
30
|
+
? boundary
|
|
31
|
+
: value;
|
|
32
|
+
}
|
|
33
|
+
function normalizeComputedPT(state) {
|
|
34
|
+
let pressure = snapUpFromBelow(state.pressure, C.P_MIN);
|
|
35
|
+
pressure = snapDownFromAbove(pressure, state.region === Region.Region5 ? C.R5_P_MAX : C.P_MAX);
|
|
36
|
+
let temperature = snapUpFromBelow(state.temperature, C.T_MIN);
|
|
37
|
+
if (state.region === Region.Region1) {
|
|
38
|
+
temperature = snapDownFromAbove(temperature, C.R2_T_MIN);
|
|
39
|
+
}
|
|
40
|
+
else if (state.region === Region.Region2) {
|
|
41
|
+
temperature = snapDownFromAbove(temperature, C.R2_T_MAX);
|
|
42
|
+
}
|
|
43
|
+
temperature = snapDownFromAbove(temperature, C.T_MAX);
|
|
44
|
+
return pressure === state.pressure && temperature === state.temperature
|
|
45
|
+
? state
|
|
46
|
+
: { ...state, pressure, temperature };
|
|
47
|
+
}
|
|
20
48
|
function validateBasicEnvelope(state, solverName) {
|
|
21
49
|
if (!Number.isFinite(state.pressure) || !Number.isFinite(state.temperature) ||
|
|
22
50
|
!Number.isFinite(state.specificVolume) || state.specificVolume <= 0) {
|
|
@@ -77,9 +105,9 @@ function withExactConstraints(state, constraints) {
|
|
|
77
105
|
return normalized;
|
|
78
106
|
}
|
|
79
107
|
export function validateBackwardState(state, constraints, options) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
108
|
+
const normalized = normalizeComputedPT(state);
|
|
109
|
+
validateBasicEnvelope(normalized, options.solverName);
|
|
110
|
+
validateRegionConsistency(normalized, options.solverName, options.expectedRegion);
|
|
111
|
+
validateConstraints(normalized, constraints, options.solverName);
|
|
112
|
+
return withExactConstraints(normalized, constraints);
|
|
84
113
|
}
|
|
85
|
-
//# sourceMappingURL=solution-validation.js.map
|
package/dist/backward/th.d.ts
CHANGED
package/dist/backward/th.js
CHANGED
|
@@ -12,7 +12,6 @@ import { mixSaturationState, qualityFromSaturationProperty, saturationEndpointsA
|
|
|
12
12
|
import { assertRegion4StateAllowed } from '../saturation/region4-boundaries.js';
|
|
13
13
|
import { solveFixedTemperaturePressure } from './fixed-temperature-solver.js';
|
|
14
14
|
import { validateBackwardState } from './solution-validation.js';
|
|
15
|
-
const extractH = (s) => s.enthalpy;
|
|
16
15
|
/**
|
|
17
16
|
* Solve for full basic thermodynamic state from temperature and enthalpy.
|
|
18
17
|
*
|
|
@@ -43,7 +42,7 @@ export function solveTH(T, h) {
|
|
|
43
42
|
const region = detectRegionTH(T, h);
|
|
44
43
|
switch (region) {
|
|
45
44
|
case Region.Region1:
|
|
46
|
-
return validateBackwardState(solveFixedTemperaturePressure(region1, T, h, saturationPressure(T), C.P_MAX,
|
|
45
|
+
return validateBackwardState(solveFixedTemperaturePressure(region1, T, h, saturationPressure(T), C.P_MAX, 'enthalpy', 'solveTH'), [
|
|
47
46
|
{ label: 'temperature', expected: T },
|
|
48
47
|
{ label: 'enthalpy', expected: h },
|
|
49
48
|
], {
|
|
@@ -56,7 +55,7 @@ export function solveTH(T, h) {
|
|
|
56
55
|
: T <= C.B23_T_MAX
|
|
57
56
|
? boundary23_T_to_P(T)
|
|
58
57
|
: C.P_MAX;
|
|
59
|
-
return validateBackwardState(solveFixedTemperaturePressure(region2, T, h, C.P_MIN, upper,
|
|
58
|
+
return validateBackwardState(solveFixedTemperaturePressure(region2, T, h, C.P_MIN, upper, 'enthalpy', 'solveTH'), [
|
|
60
59
|
{ label: 'temperature', expected: T },
|
|
61
60
|
{ label: 'enthalpy', expected: h },
|
|
62
61
|
], {
|
|
@@ -68,7 +67,7 @@ export function solveTH(T, h) {
|
|
|
68
67
|
const lower = T <= C.Tc
|
|
69
68
|
? saturationPressure(T)
|
|
70
69
|
: boundary23_T_to_P(T);
|
|
71
|
-
return validateBackwardState(solveFixedTemperaturePressure(solveRegion3PTBasic, T, h, lower, C.P_MAX,
|
|
70
|
+
return validateBackwardState(solveFixedTemperaturePressure(solveRegion3PTBasic, T, h, lower, C.P_MAX, 'enthalpy', 'solveTH'), [
|
|
72
71
|
{ label: 'temperature', expected: T },
|
|
73
72
|
{ label: 'enthalpy', expected: h },
|
|
74
73
|
], {
|
|
@@ -86,7 +85,7 @@ export function solveTH(T, h) {
|
|
|
86
85
|
], { solverName: 'solveTH', expectedRegion: Region.Region4 });
|
|
87
86
|
}
|
|
88
87
|
case Region.Region5:
|
|
89
|
-
return validateBackwardState(solveFixedTemperaturePressure(region5, T, h, C.P_MIN, C.R5_P_MAX,
|
|
88
|
+
return validateBackwardState(solveFixedTemperaturePressure(region5, T, h, C.P_MIN, C.R5_P_MAX, 'enthalpy', 'solveTH'), [
|
|
90
89
|
{ label: 'temperature', expected: T },
|
|
91
90
|
{ label: 'enthalpy', expected: h },
|
|
92
91
|
], {
|
|
@@ -97,4 +96,3 @@ export function solveTH(T, h) {
|
|
|
97
96
|
throw new IF97Error(`solveTH cannot determine a valid IF97 state for T=${T} K, h=${h} kJ/kg`);
|
|
98
97
|
}
|
|
99
98
|
}
|
|
100
|
-
//# sourceMappingURL=th.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BasicProperties } from '../types.js';
|
|
2
|
+
export interface GibbsPropertyDerivatives {
|
|
3
|
+
dhDp: number;
|
|
4
|
+
dhDT: number;
|
|
5
|
+
dsDp: number;
|
|
6
|
+
dsDT: number;
|
|
7
|
+
}
|
|
8
|
+
export interface HelmholtzPropertyDerivatives {
|
|
9
|
+
dpDrho: number;
|
|
10
|
+
dpDT: number;
|
|
11
|
+
dhDrho: number;
|
|
12
|
+
dhDT: number;
|
|
13
|
+
dsDrho: number;
|
|
14
|
+
dsDT: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function gibbsPropertyDerivatives(state: BasicProperties): GibbsPropertyDerivatives;
|
|
17
|
+
export declare function helmholtzPropertyDerivatives(state: BasicProperties, rho: number): HelmholtzPropertyDerivatives;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export function gibbsPropertyDerivatives(state) {
|
|
2
|
+
const cp = state.cp ?? Number.NaN;
|
|
3
|
+
const alpha = state.isobaricExpansion ?? Number.NaN;
|
|
4
|
+
const v = state.specificVolume;
|
|
5
|
+
const T = state.temperature;
|
|
6
|
+
return {
|
|
7
|
+
dhDp: 1000 * v * (1 - T * alpha),
|
|
8
|
+
dhDT: cp,
|
|
9
|
+
dsDp: -1000 * v * alpha,
|
|
10
|
+
dsDT: cp / T,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function helmholtzPropertyDerivatives(state, rho) {
|
|
14
|
+
const cv = state.cv ?? Number.NaN;
|
|
15
|
+
const alpha = state.isobaricExpansion ?? Number.NaN;
|
|
16
|
+
const kappa = state.isothermalCompressibility ?? Number.NaN;
|
|
17
|
+
const T = state.temperature;
|
|
18
|
+
const rhoSquaredKappa = rho * rho * kappa;
|
|
19
|
+
return {
|
|
20
|
+
dpDrho: 1 / (rho * kappa),
|
|
21
|
+
dpDT: alpha / kappa,
|
|
22
|
+
dhDrho: 1000 * (1 - T * alpha) / rhoSquaredKappa,
|
|
23
|
+
dhDT: cv + 1000 * alpha / (rho * kappa),
|
|
24
|
+
dsDrho: -1000 * alpha / rhoSquaredKappa,
|
|
25
|
+
dsDT: cv / T,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -3,4 +3,3 @@ export declare const BACKWARD_REGION4_QUALITY_TOLERANCE = 0.000001;
|
|
|
3
3
|
export declare function backwardConstraintTolerance(label: BackwardToleranceLabel, expected: number): number;
|
|
4
4
|
export declare function region4SaturationPressureTolerance(pressure: number): number;
|
|
5
5
|
export declare function backwardSpecificVolumeTolerance(expected: number): number;
|
|
6
|
-
//# sourceMappingURL=tolerances.d.ts.map
|
package/dist/backward/ts.d.ts
CHANGED
package/dist/backward/ts.js
CHANGED
|
@@ -12,7 +12,6 @@ import { mixSaturationState, qualityFromSaturationProperty, saturationEndpointsA
|
|
|
12
12
|
import { assertRegion4StateAllowed } from '../saturation/region4-boundaries.js';
|
|
13
13
|
import { solveFixedTemperaturePressure } from './fixed-temperature-solver.js';
|
|
14
14
|
import { validateBackwardState } from './solution-validation.js';
|
|
15
|
-
const extractS = (s) => s.entropy;
|
|
16
15
|
/**
|
|
17
16
|
* Solve for full basic thermodynamic state from temperature and entropy.
|
|
18
17
|
*
|
|
@@ -43,7 +42,7 @@ export function solveTS(T, s) {
|
|
|
43
42
|
const region = detectRegionTS(T, s);
|
|
44
43
|
switch (region) {
|
|
45
44
|
case Region.Region1:
|
|
46
|
-
return validateBackwardState(solveFixedTemperaturePressure(region1, T, s, saturationPressure(T), C.P_MAX,
|
|
45
|
+
return validateBackwardState(solveFixedTemperaturePressure(region1, T, s, saturationPressure(T), C.P_MAX, 'entropy', 'solveTS'), [
|
|
47
46
|
{ label: 'temperature', expected: T },
|
|
48
47
|
{ label: 'entropy', expected: s },
|
|
49
48
|
], {
|
|
@@ -56,7 +55,7 @@ export function solveTS(T, s) {
|
|
|
56
55
|
: T <= C.B23_T_MAX
|
|
57
56
|
? boundary23_T_to_P(T)
|
|
58
57
|
: C.P_MAX;
|
|
59
|
-
return validateBackwardState(solveFixedTemperaturePressure(region2, T, s, C.P_MIN, upper,
|
|
58
|
+
return validateBackwardState(solveFixedTemperaturePressure(region2, T, s, C.P_MIN, upper, 'entropy', 'solveTS'), [
|
|
60
59
|
{ label: 'temperature', expected: T },
|
|
61
60
|
{ label: 'entropy', expected: s },
|
|
62
61
|
], {
|
|
@@ -68,7 +67,7 @@ export function solveTS(T, s) {
|
|
|
68
67
|
const lower = T <= C.Tc
|
|
69
68
|
? saturationPressure(T)
|
|
70
69
|
: boundary23_T_to_P(T);
|
|
71
|
-
return validateBackwardState(solveFixedTemperaturePressure(solveRegion3PTBasic, T, s, lower, C.P_MAX,
|
|
70
|
+
return validateBackwardState(solveFixedTemperaturePressure(solveRegion3PTBasic, T, s, lower, C.P_MAX, 'entropy', 'solveTS'), [
|
|
72
71
|
{ label: 'temperature', expected: T },
|
|
73
72
|
{ label: 'entropy', expected: s },
|
|
74
73
|
], {
|
|
@@ -86,7 +85,7 @@ export function solveTS(T, s) {
|
|
|
86
85
|
], { solverName: 'solveTS', expectedRegion: Region.Region4 });
|
|
87
86
|
}
|
|
88
87
|
case Region.Region5:
|
|
89
|
-
return validateBackwardState(solveFixedTemperaturePressure(region5, T, s, C.P_MIN, C.R5_P_MAX,
|
|
88
|
+
return validateBackwardState(solveFixedTemperaturePressure(region5, T, s, C.P_MIN, C.R5_P_MAX, 'entropy', 'solveTS'), [
|
|
90
89
|
{ label: 'temperature', expected: T },
|
|
91
90
|
{ label: 'entropy', expected: s },
|
|
92
91
|
], {
|
|
@@ -97,4 +96,3 @@ export function solveTS(T, s) {
|
|
|
97
96
|
throw new IF97Error(`solveTS cannot determine a valid IF97 state for T=${T} K, s=${s} kJ/(kg·K)`);
|
|
98
97
|
}
|
|
99
98
|
}
|
|
100
|
-
//# sourceMappingURL=ts.js.map
|
package/dist/boundaries.d.ts
CHANGED
package/dist/boundaries.js
CHANGED
package/dist/constants.d.ts
CHANGED
|
@@ -28,8 +28,6 @@ export declare const REGION4_PRESSURE_TOLERANCE = 1e-9;
|
|
|
28
28
|
export declare const REGION4_CRITICAL_HS_TOLERANCE = 0.000001;
|
|
29
29
|
/** Residual tolerance for Region 4 h-s temperature inversion */
|
|
30
30
|
export declare const REGION4_HS_RESIDUAL_TOLERANCE = 1e-10;
|
|
31
|
-
/** Scan resolution used when bracketing Region 4 h-s temperature roots */
|
|
32
|
-
export declare const REGION4_HS_BRACKET_SEGMENTS = 256;
|
|
33
31
|
/** Critical density [kg/m³] */
|
|
34
32
|
export declare const RHOc = 322;
|
|
35
33
|
/** Triple point pressure [MPa] */
|
|
@@ -70,8 +68,6 @@ export declare const R2_P_CRT = 4;
|
|
|
70
68
|
export declare const B23_P_MIN = 16.5291642526;
|
|
71
69
|
/** B23 maximum temperature [K] */
|
|
72
70
|
export declare const B23_T_MAX = 863.15;
|
|
73
|
-
/** Region 3 minimum temperature [K] */
|
|
74
|
-
export declare const R3_T_MIN = 623.15;
|
|
75
71
|
/** Region 3 critical entropy [kJ/(kg·K)] */
|
|
76
72
|
export declare const R3_S_CRT = 4.41202148223476;
|
|
77
73
|
/** Region 3 critical enthalpy [kJ/kg] */
|
|
@@ -86,8 +82,3 @@ export declare const R5_T_MAX = 2273.15;
|
|
|
86
82
|
export declare const B23_S_CURVE_MIN = 5.048096828;
|
|
87
83
|
/** Maximum entropy along the B23 curve [kJ/(kg·K)], at T ≈ 644 K */
|
|
88
84
|
export declare const B23_S_CURVE_MAX = 5.260578707;
|
|
89
|
-
/** Minimum enthalpy along the B23 curve [kJ/kg], at T = 623.15 K (currently unused) */
|
|
90
|
-
export declare const B23_H_CURVE_MIN = 2563.592004;
|
|
91
|
-
/** Maximum enthalpy along the B23 curve [kJ/kg], at T = 863.15 K (currently unused) */
|
|
92
|
-
export declare const B23_H_CURVE_MAX = 2812.942061;
|
|
93
|
-
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
|
@@ -30,8 +30,6 @@ export const REGION4_PRESSURE_TOLERANCE = 1e-9;
|
|
|
30
30
|
export const REGION4_CRITICAL_HS_TOLERANCE = 1e-6;
|
|
31
31
|
/** Residual tolerance for Region 4 h-s temperature inversion */
|
|
32
32
|
export const REGION4_HS_RESIDUAL_TOLERANCE = 1e-10;
|
|
33
|
-
/** Scan resolution used when bracketing Region 4 h-s temperature roots */
|
|
34
|
-
export const REGION4_HS_BRACKET_SEGMENTS = 256;
|
|
35
33
|
/** Critical density [kg/m³] */
|
|
36
34
|
export const RHOc = 322;
|
|
37
35
|
// ─── Triple Point ───────────────────────────────────────────────────────────
|
|
@@ -77,8 +75,6 @@ export const B23_P_MIN = 16.5291642526;
|
|
|
77
75
|
/** B23 maximum temperature [K] */
|
|
78
76
|
export const B23_T_MAX = 863.15;
|
|
79
77
|
// ─── Region 3 Boundaries ───────────────────────────────────────────────────
|
|
80
|
-
/** Region 3 minimum temperature [K] */
|
|
81
|
-
export const R3_T_MIN = 623.15;
|
|
82
78
|
/** Region 3 critical entropy [kJ/(kg·K)] */
|
|
83
79
|
export const R3_S_CRT = 4.41202148223476;
|
|
84
80
|
/** Region 3 critical enthalpy [kJ/kg] */
|
|
@@ -90,12 +86,11 @@ export const R5_T_MIN = 1073.15;
|
|
|
90
86
|
export const R5_P_MAX = 50;
|
|
91
87
|
/** Region 5 maximum temperature [K] */
|
|
92
88
|
export const R5_T_MAX = 2273.15;
|
|
93
|
-
// ─── B23 Curve Extrema (Entropy
|
|
89
|
+
// ─── B23 Curve Extrema (Entropy) ───────────────────────────────────────────
|
|
94
90
|
//
|
|
95
91
|
// These are the GLOBAL EXTREMA along the B23 boundary curve, NOT values at
|
|
96
|
-
// the curve endpoints
|
|
97
|
-
// T ≈ 644 K.
|
|
98
|
-
// max at the high-T endpoint (863.15 K).
|
|
92
|
+
// the curve endpoints: entropy has a minimum at T ≈ 777 K and a maximum at
|
|
93
|
+
// T ≈ 644 K.
|
|
99
94
|
//
|
|
100
95
|
// Ref: Computed from Region 2 properties evaluated along B23(T) for
|
|
101
96
|
// T ∈ [623.15, 863.15] K.
|
|
@@ -103,8 +98,3 @@ export const R5_T_MAX = 2273.15;
|
|
|
103
98
|
export const B23_S_CURVE_MIN = 5.048096828;
|
|
104
99
|
/** Maximum entropy along the B23 curve [kJ/(kg·K)], at T ≈ 644 K */
|
|
105
100
|
export const B23_S_CURVE_MAX = 5.260578707;
|
|
106
|
-
/** Minimum enthalpy along the B23 curve [kJ/kg], at T = 623.15 K (currently unused) */
|
|
107
|
-
export const B23_H_CURVE_MIN = 2563.592004;
|
|
108
|
-
/** Maximum enthalpy along the B23 curve [kJ/kg], at T = 863.15 K (currently unused) */
|
|
109
|
-
export const B23_H_CURVE_MAX = 2812.942061;
|
|
110
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { BasicProperties, SteamState } from '../types.js';
|
|
2
2
|
export declare function normalizePublicState(state: SteamState): SteamState;
|
|
3
3
|
export declare function normalizePublicState(state: BasicProperties): BasicProperties;
|
|
4
|
-
//# sourceMappingURL=public-normalization.d.ts.map
|