Skip to content

Commit cbadfed

Browse files
committed
r4 (h,s)
1 parent d64ece9 commit cbadfed

10 files changed

Lines changed: 282 additions & 337 deletions

File tree

docs/IF97-Rev (1).pdf

-397 KB
Binary file not shown.

docs/Supp-phs3-2014.pdf

-303 KB
Binary file not shown.

docs/test_iapws_hs.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

examples/simple.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
///
1111
use seuif97::*;
1212
fn main() {
13+
1314
let mut p: f64 = 3.0;
1415
let mut t: f64 = 300.0 - 273.15;
1516
// universal function with o_id parameter

src/common/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ pub mod constant;
44
pub mod property_id;
55
pub mod property_pairs;
66
pub mod region;
7-
pub mod region_hs;
8-
97
pub mod transport_further;
108

119
pub use self::boundaries::*;
1210
pub use self::constant::*;
1311
pub use self::property_id::*;
1412
pub use self::property_pairs::*;
1513
pub use self::region::*;
16-
pub use self::region_hs::*;
1714
pub use self::transport_further::*;

src/common/region.rs

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,199 @@ pub fn ps_sub_region(p: f64, s: f64) -> i32 {
265265
INVALID_VALUE
266266
}
267267

268+
269+
/// region 1,2,3,4 (smin ->smax), region 5
270+
pub fn hs_sub_region(h: f64, s: f64) -> i32 {
271+
let mut T: f64 = 0.0;
272+
let mut p: f64 = 0.0;
273+
let mut v: f64 = 0.0;
274+
let mut hs: f64 = 0.0;
275+
let s13: f64 = 3.3977829547018907;// pT2s_reg1(100.0, 623.15);
276+
let s13s: f64 = 3.7782813395443466;//pT2s_reg1(Ps_623, 623.15);
277+
let sTPmax: f64 = 6.040483671712382;//pT2s_reg2(100.0, 1073.15);
278+
let s2ab: f64 = 7.85234039987851;//pT2s_reg2(4.0, 1073.15); // TODO: p=4 2ab s2ab
279+
280+
// Left point in h-s plot
281+
let mut smin: f64 =-0.00858228709262268;// pT2s_reg1(100.0, 273.15);
282+
let mut hmin: f64 = -0.0415878259881163;//pT2h_reg1(P_MIN, 273.15);
283+
284+
// Right point in h-s plot
285+
let mut hmax: f64 =4160.660928250124;// pT2h_reg2(P_MIN, 1073.15);
286+
let mut smax: f64 = 11.921055068613795;//pT2s_reg2(P_MIN, 1073.15);
287+
288+
// Region 4 left and right point
289+
let h4l: f64 = -0.0415878259881163 ;//pT2h_reg1(P_MIN, 273.15);
290+
let s4l: f64 = -0.00015454959194230702;//pT2s_reg1(P_MIN, 273.15);
291+
292+
let h4v: f64 = 2500.892617817172;//pT2h_reg2(P_MIN, 273.15);
293+
let s4v: f64 = 9.155759395224662;//pT2s_reg2(P_MIN, 273.15);
294+
295+
// !!!! Check region 5 MUST On TOP !!!
296+
// if (s4v <= s && s<= smax) (h,s)may be setup to error region2
297+
if pT2s_reg5(50.0, 1073.15) < s
298+
&& s <= pT2s_reg5(P_MIN, 2273.15)
299+
&& pT2h_reg5(50.0, 1073.15) < h
300+
&& h <= pT2h_reg5(P_MIN, 2273.15)
301+
{
302+
p = hs2p_reg5(h, s);
303+
T = ph2T_reg5(p, h);
304+
if 1073.15 < T && T <= 2273.15 && P_MIN <= p && p <= 50.0 {
305+
return 5;
306+
}
307+
};
308+
309+
if smin <= s && s <= s13 {
310+
hmin = h4l + (s - s4l) / (s4v - s4l) * (h4v - h4l);
311+
hs = hs_region_h1_s(s);
312+
T = ps2T_reg1(100.0, s) - 0.0218;
313+
hmax = pT2h_reg1(100.0, T);
314+
if hmin <= h && h < hs {
315+
return 4;
316+
}
317+
if hs <= h && h <= hmax {
318+
return 1;
319+
}
320+
};
321+
322+
if s13 < s && s <= s13s {
323+
hmin = h4l + (s - s4l) / (s4v - s4l) * (h4v - h4l);
324+
hs = hs_region_h1_s(s);
325+
let h13: f64 = hs_region_h13_s(s);
326+
v = ps2v_reg3(100.0, s) * (1.0 + 9.6e-5);
327+
T = ps2T_reg3(100.0, s) - 0.0248;
328+
hmax = Td2h_reg3(T, 1.0 / v);
329+
if hmin <= h && h < hs {
330+
return 4;
331+
}
332+
if hs <= h && h < h13 {
333+
return 1;
334+
}
335+
if h13 <= h && h <= hmax {
336+
return 3;
337+
}
338+
};
339+
340+
if s13s < s && s <= SC_WATER {
341+
hmin = h4l + (s - s4l) / (s4v - s4l) * (h4v - h4l);
342+
hs = hs_region_h3a_s(s);
343+
v = ps2v_reg3(100.0, s) * (1.0 + 9.6e-5);
344+
T = ps2T_reg3(100.0, s) - 0.0248;
345+
hmax = Td2h_reg3(T, 1.0 / v);
346+
if hmin <= h && h < hs {
347+
return 4;
348+
}
349+
if hs <= h && h <= hmax {
350+
return 3;
351+
}
352+
};
353+
354+
if SC_WATER < s && s < 5.049096828 {
355+
hmin = h4l + (s - s4l) / (s4v - s4l) * (h4v - h4l);
356+
hs = hs_region_h2c3b_s(s);
357+
v = ps2v_reg3(100.0, s) * (1.0 + 9.6e-5);
358+
T = ps2T_reg3(100.0, s) - 0.0248;
359+
hmax = Td2h_reg3(T, 1.0 / v);
360+
if hmin <= h && h < hs {
361+
return 4;
362+
}
363+
if hs <= h && h <= hmax {
364+
return 3;
365+
}
366+
};
367+
368+
if 5.049096828 <= s && s < 5.260578707 {
369+
// Specific zone with 2-3 boundary in s shape
370+
hmin = h4l + (s - s4l) / (s4v - s4l) * (h4v - h4l);
371+
hs = hs_region_h2c3b_s(s);
372+
let h23max: f64 = pT2h_reg2(100.0, 863.15);
373+
let h23min: f64 = pT2h_reg2(Ps_623, 623.15);
374+
T = ps2T_reg2(100.0, s) - 0.019;
375+
hmax = pT2h_reg2(100.0, T);
376+
377+
if hmin <= h && h < hs {
378+
return 4;
379+
}
380+
if hs <= h && h < h23min {
381+
return 3;
382+
}
383+
384+
if h23min <= h && h < h23max {
385+
if hs2p_reg2c(h, s) <= B23_T2p(hs_region_t_hs(h, s))
386+
//hs2p_reg2c r2::region2_p_hs
387+
{
388+
return 2;
389+
} else {
390+
return 3;
391+
}
392+
}
393+
if h23max <= h && h <= hmax {
394+
return 2;
395+
}
396+
};
397+
398+
if 5.260578707 <= s && s < 5.85 {
399+
hmin = h4l + (s - s4l) / (s4v - s4l) * (h4v - h4l);
400+
hs = hs_region_h2c3b_s(s);
401+
T = ps2T_reg2(100.0, s) - 0.019;
402+
hmax = pT2h_reg2(100.0, T);
403+
if hmin <= h && h < hs {
404+
return 4;
405+
}
406+
if hs <= h && h <= hmax {
407+
return 2;
408+
}
409+
}
410+
411+
if 5.85 <= s && s < sTPmax {
412+
hmin = h4l + (s - s4l) / (s4v - s4l) * (h4v - h4l);
413+
hs = hs_region_h2ab_s(s);
414+
T = ps2T_reg2(100.0, s) - 0.019;
415+
hmax = pT2h_reg2(100.0, T);
416+
if hmin <= h && h < hs {
417+
return 4;
418+
}
419+
if hs <= h && h <= hmax {
420+
return 2;
421+
}
422+
};
423+
424+
if sTPmax <= s && s < s2ab {
425+
hmin = h4l + (s - s4l) / (s4v - s4l) * (h4v - h4l);
426+
hs = hs_region_h2ab_s(s);
427+
p = hs2p_reg2(h, s);
428+
hmax = pT2h_reg2(p, 1073.15);
429+
if hmin <= h && h < hs {
430+
return 4;
431+
}
432+
if hs <= h && h <= hmax {
433+
return 2;
434+
}
435+
};
436+
437+
if s2ab <= s && s < s4v {
438+
hmin = h4l + (s - s4l) / (s4v - s4l) * (h4v - h4l);
439+
hs = hs_region_h2ab_s(s);
440+
p = hs2p_reg2(h, s);
441+
hmax = pT2h_reg2(p, 1073.15);
442+
if hmin <= h && h < hs {
443+
return 4;
444+
}
445+
if hs <= h && h <= hmax {
446+
return 2;
447+
}
448+
}
449+
450+
if s4v <= s && s <= smax {
451+
hmin = pT2h_reg2(P_MIN, 273.15);
452+
p = hs2p_reg2a(h, s); //hs2p_reg2a r2::region2_p_hs
453+
hmax = pT2h_reg2(p, 1073.15);
454+
if P_MIN <= p && p <= 100.0 && hmin <= h && h <= hmax {
455+
return 2;
456+
}
457+
}
458+
INVALID_HS
459+
}
460+
268461
/// Region for extended input pairs (p,v),(t,v),(t,s),(t,h)
269462
/// Region (p,v)
270463
pub fn pv_sub_region(p: f64, v: f64) -> i32 {

0 commit comments

Comments
 (0)