|
9 | 9 | '''
|
10 | 10 | import math
|
11 | 11 |
|
| 12 | +import numpy as np |
| 13 | + |
12 | 14 | import Constants
|
13 | 15 | import Convert
|
14 | 16 | import Region1
|
@@ -1441,116 +1443,6 @@ def vx_ps(pressure, entropy):
|
1441 | 1443 | else:
|
1442 | 1444 | return Constants._errorValue
|
1443 | 1445 |
|
1444 |
| -#'*********************************************************************************************************** |
1445 |
| -#Rem '*5 Transport properties |
1446 |
| -#Rem '*********************************************************************************************************** |
1447 |
| -#Rem '*5.1 Viscosity (IAPWS formulation 1985, Revised 2003) |
1448 |
| -#Rem '*********************************************************************************************************** |
1449 |
| -#Rem Private Function my_AllRegions_pT(ByVal p As Double, ByVal T As Double) As Double |
1450 |
| -#Rem Dim h0, h1, h2, h3, h4, h5, h6 As Variant, rho, Ts, ps, my0, sum, my1, rhos As Double, i As Integer |
1451 |
| -#Rem h0 = Array(0.5132047, 0.3205656, 0, 0, -0.7782567, 0.1885447) |
1452 |
| -#Rem h1 = Array(0.2151778, 0.7317883, 1.241044, 1.476783, 0, 0) |
1453 |
| -#Rem h2 = Array(-0.2818107, -1.070786, -1.263184, 0, 0, 0) |
1454 |
| -#Rem h3 = Array(0.1778064, 0.460504, 0.2340379, -0.4924179, 0, 0) |
1455 |
| -#Rem h4 = Array(-0.0417661, 0, 0, 0.1600435, 0, 0) |
1456 |
| -#Rem h5 = Array(0, -0.01578386, 0, 0, 0, 0) |
1457 |
| -#Rem h6 = Array(0, 0, 0, -0.003629481, 0, 0) |
1458 |
| -#Rem |
1459 |
| -#Rem 'Calcualte density. |
1460 |
| -#Rem Select Case region_pT(p, T) |
1461 |
| -#Rem Case 1 |
1462 |
| -#Rem rho = 1 / v1_pT(p, T) |
1463 |
| -#Rem Case 2 |
1464 |
| -#Rem rho = 1 / v2_pT(p, T) |
1465 |
| -#Rem Case 3 |
1466 |
| -#Rem rho = 1 / v3_ph(p, h3_pT(p, T)) |
1467 |
| -#Rem Case 4 |
1468 |
| -#Rem rho = CVErr(xlErrValue) |
1469 |
| -#Rem Case 5 |
1470 |
| -#Rem rho = 1 / v5_pT(p, T) |
1471 |
| -#Rem Case Else |
1472 |
| -#Rem my_AllRegions_pT = CVErr(xlErrValue) |
1473 |
| -#Rem Exit Function |
1474 |
| -#Rem End Select |
1475 |
| -#Rem |
1476 |
| -#Rem rhos = rho / 317.763 |
1477 |
| -#Rem Ts = T / 647.226 |
1478 |
| -#Rem ps = p / 22.115 |
1479 |
| -#Rem |
1480 |
| -#Rem 'Check valid area |
1481 |
| -#Rem If T > 900 + 273.15 Or (T > 600 + 273.15 And p > 300) Or (T > 150 + 273.15 And p > 350) Or p > 500 Then |
1482 |
| -#Rem my_AllRegions_pT = CVErr(xlErrValue) |
1483 |
| -#Rem Exit Function |
1484 |
| -#Rem End If |
1485 |
| -#Rem my0 = Ts ^ 0.5 / (1 + 0.978197 / Ts + 0.579829 / (Ts ^ 2) - 0.202354 / (Ts ^ 3)) |
1486 |
| -#Rem sum = 0 |
1487 |
| -#Rem For i = 0 To 5 |
1488 |
| -#Rem sum = sum + h0(i) * (1 / Ts - 1) ^ i + h1(i) * (1 / Ts - 1) ^ i * (rhos - 1) ^ 1 + h2(i) * (1 / Ts - 1) ^ i * (rhos - 1) ^ 2 + h3(i) * (1 / Ts - 1) ^ i * (rhos - 1) ^ 3 + h4(i) * (1 / Ts - 1) ^ i * (rhos - 1) ^ 4 + h5(i) * (1 / Ts - 1) ^ i * (rhos - 1) ^ 5 + h6(i) * (1 / Ts - 1) ^ i * (rhos - 1) ^ 6 |
1489 |
| -#Rem Next i |
1490 |
| -#Rem my1 = Exp(rhos * sum) |
1491 |
| -#Rem my_AllRegions_pT = my0 * my1 * 0.000055071 |
1492 |
| -#Rem End Function |
1493 |
| -#Rem |
1494 |
| -#Rem Private Function my_AllRegions_ph(ByVal p As Double, ByVal h As Double) As Double |
1495 |
| -#Rem Dim h0, h1, h2, h3, h4, h5, h6 As Variant, rho, T, Ts, ps, my0, sum, my1, rhos, v4V, v4L, xs As Double, i As Integer |
1496 |
| -#Rem h0 = Array(0.5132047, 0.3205656, 0, 0, -0.7782567, 0.1885447) |
1497 |
| -#Rem h1 = Array(0.2151778, 0.7317883, 1.241044, 1.476783, 0, 0) |
1498 |
| -#Rem h2 = Array(-0.2818107, -1.070786, -1.263184, 0, 0, 0) |
1499 |
| -#Rem h3 = Array(0.1778064, 0.460504, 0.2340379, -0.4924179, 0, 0) |
1500 |
| -#Rem h4 = Array(-0.0417661, 0, 0, 0.1600435, 0, 0) |
1501 |
| -#Rem h5 = Array(0, -0.01578386, 0, 0, 0, 0) |
1502 |
| -#Rem h6 = Array(0, 0, 0, -0.003629481, 0, 0) |
1503 |
| -#Rem |
1504 |
| -#Rem 'Calcualte density. |
1505 |
| -#Rem Select Case region_ph(p, h) |
1506 |
| -#Rem Case 1 |
1507 |
| -#Rem Ts = T1_ph(p, h) |
1508 |
| -#Rem T = Ts |
1509 |
| -#Rem rho = 1 / v1_pT(p, Ts) |
1510 |
| -#Rem Case 2 |
1511 |
| -#Rem Ts = T2_ph(p, h) |
1512 |
| -#Rem T = Ts |
1513 |
| -#Rem rho = 1 / v2_pT(p, Ts) |
1514 |
| -#Rem Case 3 |
1515 |
| -#Rem rho = 1 / v3_ph(p, h) |
1516 |
| -#Rem T = T3_ph(p, h) |
1517 |
| -#Rem Case 4 |
1518 |
| -#Rem xs = x4_ph(p, h) |
1519 |
| -#Rem If p < 16.529 Then |
1520 |
| -#Rem v4V = v2_pT(p, T4_p(p)) |
1521 |
| -#Rem v4L = v1_pT(p, T4_p(p)) |
1522 |
| -#Rem Else |
1523 |
| -#Rem v4V = v3_ph(p, h4V_p(p)) |
1524 |
| -#Rem v4L = v3_ph(p, h4L_p(p)) |
1525 |
| -#Rem End If |
1526 |
| -#Rem rho = 1 / (xs * v4V + (1 - xs) * v4L) |
1527 |
| -#Rem T = T4_p(p) |
1528 |
| -#Rem Case 5 |
1529 |
| -#Rem Ts = T5_ph(p, h) |
1530 |
| -#Rem T = Ts |
1531 |
| -#Rem rho = 1 / v5_pT(p, Ts) |
1532 |
| -#Rem Case Else |
1533 |
| -#Rem my_AllRegions_ph = CVErr(xlErrValue) |
1534 |
| -#Rem Exit Function |
1535 |
| -#Rem End Select |
1536 |
| -#Rem rhos = rho / 317.763 |
1537 |
| -#Rem Ts = T / 647.226 |
1538 |
| -#Rem ps = p / 22.115 |
1539 |
| -#Rem 'Check valid area |
1540 |
| -#Rem If T > 900 + 273.15 Or (T > 600 + 273.15 And p > 300) Or (T > 150 + 273.15 And p > 350) Or p > 500 Then |
1541 |
| -#Rem my_AllRegions_ph = CVErr(xlErrValue) |
1542 |
| -#Rem Exit Function |
1543 |
| -#Rem End If |
1544 |
| -#Rem my0 = Ts ^ 0.5 / (1 + 0.978197 / Ts + 0.579829 / (Ts ^ 2) - 0.202354 / (Ts ^ 3)) |
1545 |
| -#Rem |
1546 |
| -#Rem sum = 0 |
1547 |
| -#Rem For i = 0 To 5 |
1548 |
| -#Rem sum = sum + h0(i) * (1 / Ts - 1) ^ i + h1(i) * (1 / Ts - 1) ^ i * (rhos - 1) ^ 1 + h2(i) * (1 / Ts - 1) ^ i * (rhos - 1) ^ 2 + h3(i) * (1 / Ts - 1) ^ i * (rhos - 1) ^ 3 + h4(i) * (1 / Ts - 1) ^ i * (rhos - 1) ^ 4 + h5(i) * (1 / Ts - 1) ^ i * (rhos - 1) ^ 5 + h6(i) * (1 / Ts - 1) ^ i * (rhos - 1) ^ 6 |
1549 |
| -#Rem Next i |
1550 |
| -#Rem my1 = Exp(rhos * sum) |
1551 |
| -#Rem my_AllRegions_ph = my0 * my1 * 0.000055071 |
1552 |
| -#Rem End Function |
1553 |
| - |
1554 | 1446 | def tc_pTrho(pressure, temperature, density):
|
1555 | 1447 | '''Revised release on the IAPS Formulation 1985 for the Thermal Conductivity of ordinary water IAPWS September 1998 Page 8'''
|
1556 | 1448 | if temperature < 0.0 or pressure < Constants._pressureMin \
|
|
0 commit comments