Last active
April 14, 2024 12:54
-
-
Save jkpieterse/9f2f1d30f188ca20e3311e83b5a2a8a5 to your computer and use it in GitHub Desktop.
Excel Lambda functions to calculate thermodynamic properties of water
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cpreg1 = LAMBDA(temp, press, | |
LET( | |
tau, 1386 / temp, | |
pi, 0.1 * press / 16.53, | |
-0.001 * rgas_water * tau ^ 2 * gammatautaureg1(tau, pi) | |
) | |
); | |
cpreg2 = LAMBDA(temp, press, | |
LET( | |
tau, 540 / temp, | |
pi, 0.1 * press, | |
-0.001 * rgas_water * tau ^ 2 * | |
(gamma0tautaureg2(tau, pi) + gammartautaureg2(tau, pi)) | |
) | |
); | |
cpreg3 = LAMBDA(temp, density, | |
LET( | |
tau, tc_water / temp, | |
delta, density / dc_water, | |
0.001 * rgas_water * | |
(-(tau ^ 2) * fitautaureg3(tau, delta) + | |
(delta * fideltareg3(tau, delta) - | |
delta * tau * fideltataureg3(tau, delta)) ^ 2 / | |
(2 * delta * fideltareg3(tau, delta) + | |
delta ^ 2 * fideltadeltareg3(tau, delta))) | |
) | |
); | |
cpSatLiqPW = LAMBDA(press, | |
LET( | |
temp, tSatW(press), | |
IF( | |
AND(press >= PSatW(273.15), press <= PSatW(623.15)), | |
cpreg1(temp, press), | |
IF( | |
AND(press > tSatW(623.15), press <= pc_water), | |
cpreg3(temp, densreg3(temp, press + 0.00001)), | |
-1 | |
) | |
) | |
) | |
); | |
cpSatLiqTW = LAMBDA(temp, | |
LET( | |
press, PSatW(temp), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
cpreg1(temp, press), | |
IF( | |
AND(temp > 623.15, temp <= tc_water), | |
cpreg3(temp, densreg3(temp, press)), | |
-1 | |
) | |
) | |
) | |
); | |
cpSatVapPW = LAMBDA(press, | |
LET( | |
temp, tSatW(press), | |
IF( | |
AND(press >= PSatW(273.15), press <= PSatW(623.15)), | |
cpreg2(temp, press), | |
IF( | |
AND(press > tSatW(623.15), press <= pc_water), | |
cpreg3(temp, densreg3(temp, press - 0.00001)), | |
-1 | |
) | |
) | |
) | |
); | |
cpSatVapTW = LAMBDA(temp, | |
LET( | |
press, PSatW(temp), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
cpreg2(temp, press), | |
IF( | |
AND(temp > 623.15, temp <= tc_water), | |
cpreg3(temp, densreg3(temp, press - 0.00001)), | |
-1 | |
) | |
) | |
) | |
); | |
cpW = LAMBDA(temp, press, | |
LET( | |
reg, getreg(temp, press), | |
IF( | |
reg = -1, | |
"NA", | |
CHOOSE( | |
reg, | |
cpreg1(temp, press), | |
cpreg2(temp, press), | |
cpreg3(temp, densreg3(temp, press)) | |
) | |
) | |
) | |
); | |
cvreg1 = LAMBDA(temp, press, | |
LET( | |
tau, 1386 / temp, | |
pi, 0.1 * press / 16.53, | |
0.001 * rgas_water * | |
(-(tau ^ 2) * gammatautaureg1(tau, pi) + | |
(gammapireg1(tau, pi) - tau * gammapitaureg1(tau, pi)) ^ 2 / | |
gammapipireg1(tau, pi)) | |
) | |
); | |
cvreg2 = LAMBDA(temp, press, | |
LET( | |
tau, 540 / temp, | |
pi, 0.1 * press, | |
0.001 * rgas_water * | |
(-(tau ^ 2) * | |
(gamma0tautaureg2(tau, pi) + gammartautaureg2(tau, pi)) - | |
(1 + pi * gammarpireg2(tau, pi) - | |
tau * pi * gammarpitaureg2(tau, pi)) ^ 2 / | |
(1 - pi ^ 2 * gammarpipireg2(tau, pi))) | |
) | |
); | |
cvreg3 = LAMBDA(temp, density, | |
LET( | |
tau, tc_water / temp, | |
delta, density / dc_water, | |
0.001 * rgas_water * (-(tau ^ 2) * fitautaureg3(tau, delta)) | |
) | |
); | |
cvSatLiqPW = LAMBDA(press, | |
LET( | |
temp, tSatW(press), | |
IF( | |
AND(press >= PSatW(273.15), press <= PSatW(623.15)), | |
cvreg1(temp, press), | |
IF( | |
AND(press > tSatW(623.15), press <= pc_water), | |
cvreg3(temp, densreg3(temp, press + 0.00001)), | |
-1 | |
) | |
) | |
) | |
); | |
cvSatLiqTW = LAMBDA(temp, | |
LET( | |
press, PSatW(temp), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
cvreg1(temp, press), | |
IF( | |
AND(temp > 623.15, temp <= tc_water), | |
cvreg3(temp, densreg3(temp, press)), | |
-1 | |
) | |
) | |
) | |
); | |
cvSatVapPW = LAMBDA(press, | |
LET( | |
temp, tSatW(press), | |
IF( | |
AND(press >= PSatW(273.15), press <= PSatW(623.15)), | |
cvreg2(temp, press), | |
IF( | |
AND(press > tSatW(623.15), press <= pc_water), | |
cvreg3(temp, densreg3(temp, press - 0.00001)), | |
-1 | |
) | |
) | |
) | |
); | |
cvSatVapTW = LAMBDA(temp, | |
LET( | |
press, PSatW(temp), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
cvreg2(temp, press), | |
IF( | |
AND(temp > 623.15, temp <= tc_water), | |
cvreg3(temp, densreg3(temp, press - 0.00001)), | |
-1 | |
) | |
) | |
) | |
); | |
cvW = LAMBDA(temp, press, | |
LET( | |
reg, getreg(temp, press), | |
IF( | |
reg = -1, | |
"NA", | |
CHOOSE( | |
reg, | |
cvreg1(temp, press), | |
cvreg2(temp, press), | |
cvreg3(temp, densreg3(temp, press)) | |
) | |
) | |
) | |
); | |
dc_water = 322; | |
densreg3 = LAMBDA(temp, press, | |
LET( | |
tau, tc_water / temp, | |
SolveDens3( | |
IF(AND(temp < tc_water, press < PSatW(temp)), 100, 600), | |
temp, | |
press | |
) | |
) | |
); | |
densSatLiqPW = LAMBDA(press, | |
LET( | |
temp, tSatW(press), | |
IF( | |
AND(press >= PSatW(273.15), press <= PSatW(623.15)), | |
1 / volreg1(temp, press), | |
IF( | |
AND(press > tSatW(623.15), press <= pc_water), | |
densreg3(temp, press + 0.00001), | |
-1 | |
) | |
) | |
) | |
); | |
densSatLiqTW = LAMBDA(temp, | |
LET( | |
press, PSatW(temp), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
1 / volreg1(temp, press), | |
IF(AND(temp > 623.15, temp <= tc_water), densreg3(temp, press), -1) | |
) | |
) | |
); | |
densSatVapPW = LAMBDA(press, | |
LET( | |
temp, tSatW(press), | |
IF( | |
AND(press >= PSatW(273.15), press <= PSatW(623.15)), | |
1 / volreg2(temp, press), | |
IF( | |
AND(press > tSatW(623.15), press <= pc_water), | |
densreg3(temp, press - 0.00001), | |
-1 | |
) | |
) | |
) | |
); | |
densSatVapTW = LAMBDA(temp, | |
LET( | |
press, PSatW(temp), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
1 / volreg2(temp, press), | |
IF( | |
AND(temp > 623.15, temp <= tc_water), | |
densreg3(temp, press - 0.00001), | |
-1 | |
) | |
) | |
) | |
); | |
densW = LAMBDA(temp, press, | |
LET( | |
reg, getreg(temp, press), | |
IF( | |
reg = -1, | |
"NA", | |
CHOOSE( | |
reg, | |
1 / volreg1(temp, press), | |
1 / volreg2(temp, press), | |
densreg3(temp, press) | |
) | |
) | |
) | |
); | |
energyreg1 = LAMBDA(temp, press, | |
LET( | |
tau, 1386 / temp, | |
pi, 0.1 * press / 16.53, | |
0.001 * rgas_water * temp * | |
(tau * gammataureg1(tau, pi) - pi * gammapireg1(tau, pi)) | |
) | |
); | |
energyreg2 = LAMBDA(temp, press, | |
LET( | |
tau, 540 / temp, | |
pi, 0.1 * press, | |
0.001 * rgas_water * temp * | |
(tau * (gamma0taureg2(tau, pi) + gammartaureg2(tau, pi)) - | |
pi * (gamma0pireg2(tau, pi) + gammarpireg2(tau, pi))) | |
) | |
); | |
energyreg3 = LAMBDA(temp, density, | |
LET( | |
tau, tc_water / temp, | |
delta, density / dc_water, | |
0.001 * rgas_water * temp * tau * fitaureg3(tau, delta) | |
) | |
); | |
energySatLiqPW = LAMBDA(press, | |
LET( | |
temp, tSatW(press), | |
IF( | |
AND(press >= PSatW(273.15), press <= PSatW(623.15)), | |
energyreg1(temp, press), | |
IF( | |
AND(press > tSatW(623.15), press <= pc_water), | |
energyreg3(temp, densreg3(temp, press + 0.00001)), | |
-1 | |
) | |
) | |
) | |
); | |
energySatLiqTW = LAMBDA(temp, | |
LET( | |
press, PSatW(temp), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
energyreg1(temp, press), | |
IF( | |
AND(temp > 623.15, temp <= tc_water), | |
energyreg3(temp, densreg3(temp, press)), | |
-1 | |
) | |
) | |
) | |
); | |
energySatVapPW = LAMBDA(press, | |
LET( | |
temp, tSatW(press), | |
IF( | |
AND(press >= PSatW(273.15), press <= PSatW(623.15)), | |
energyreg2(temp, press), | |
IF( | |
AND(press > tSatW(623.15), press <= pc_water), | |
energyreg3(temp, densreg3(temp, press - 0.00001)), | |
-1 | |
) | |
) | |
) | |
); | |
energySatVapTW = LAMBDA(temp, | |
LET( | |
press, PSatW(temp), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
enthalpyreg2(temp, press), | |
IF( | |
AND(temp > 623.15, temp <= tc_water), | |
enthalpyreg3(temp, densreg3(temp, press - 0.00001)), | |
-1 | |
) | |
) | |
) | |
); | |
energyW = LAMBDA(temp, press, | |
LET( | |
reg, getreg(temp, press), | |
IF( | |
reg = -1, | |
"NA", | |
CHOOSE( | |
reg, | |
energyreg1(temp, press), | |
energyreg2(temp, press), | |
energyreg3(temp, densreg3(temp, press)) | |
) | |
) | |
) | |
); | |
enthalpyreg1 = LAMBDA(temp, press, | |
LET( | |
tau, 1386 / temp, | |
pi, 0.1 * press / 16.53, | |
0.001 * rgas_water * temp * tau * gammataureg1(tau, pi) | |
) | |
); | |
enthalpyreg2 = LAMBDA(temp, press, | |
LET( | |
tau, 540 / temp, | |
pi, 0.1 * press, | |
0.001 * rgas_water * temp * tau * | |
(gamma0taureg2(tau, pi) + gammartaureg2(tau, pi)) | |
) | |
); | |
enthalpyreg3 = LAMBDA(temp, density, | |
LET( | |
tau, tc_water / temp, | |
delta, density / dc_water, | |
0.001 * rgas_water * temp * | |
(tau * fitaureg3(tau, delta) + delta * fideltareg3(tau, delta)) | |
) | |
); | |
enthalpySatLiqPW = LAMBDA(press, | |
LET( | |
temp, tSatW(press), | |
IF( | |
AND(press >= PSatW(273.15), press <= PSatW(623.15)), | |
enthalpyreg1(temp, press), | |
IF( | |
AND(press > tSatW(623.15), press <= pc_water), | |
enthalpyreg3(temp, densreg3(temp, press + 0.00001)), | |
-1 | |
) | |
) | |
) | |
); | |
enthalpySatLiqTW = LAMBDA(temp, | |
LET( | |
press, PSatW(temp), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
enthalpyreg1(temp, press), | |
IF( | |
AND(temp > 623.15, temp <= tc_water), | |
enthalpyreg3(temp, densreg3(temp, press)), | |
-1 | |
) | |
) | |
) | |
); | |
enthalpySatVapPW = LAMBDA(press, | |
LET( | |
temp, tSatW(press), | |
IF( | |
AND(press >= PSatW(273.15), press <= PSatW(623.15)), | |
enthalpyreg2(temp, press), | |
IF( | |
AND(press > tSatW(623.15), press <= pc_water), | |
enthalpyreg3(temp, densreg3(temp, press - 0.00001)), | |
-1 | |
) | |
) | |
) | |
); | |
enthalpySatVapTW = LAMBDA(temp, | |
LET( | |
press, PSatW(temp), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
enthalpyreg2(temp, press), | |
IF( | |
AND(temp > 623.15, temp <= tc_water), | |
enthalpyreg3(temp, densreg3(temp, press - 0.00001)), | |
-1 | |
) | |
) | |
) | |
); | |
enthalpyW = LAMBDA(temp, press, | |
LET( | |
reg, getreg(temp, press), | |
IF( | |
reg = -1, | |
"NA", | |
CHOOSE( | |
reg, | |
enthalpyreg1(temp, press), | |
enthalpyreg2(temp, press), | |
enthalpyreg3(temp, densreg3(temp, press)) | |
) | |
) | |
) | |
); | |
entropyreg1 = LAMBDA(temp, press, | |
LET( | |
tau, 1386 / temp, | |
pi, 0.1 * press / 16.53, | |
0.001 * rgas_water * (tau * gammataureg1(tau, pi) - gammareg1(tau, pi)) | |
) | |
); | |
entropyreg2 = LAMBDA(temp, press, | |
LET( | |
tau, 540 / temp, | |
pi, 0.1 * press, | |
0.001 * rgas_water * | |
(tau * (gamma0taureg2(tau, pi) + gammartaureg2(tau, pi)) - | |
(gamma0reg2(tau, pi) + gammarreg2(tau, pi))) | |
) | |
); | |
entropyreg3 = LAMBDA(temp, density, | |
LET( | |
tau, tc_water / temp, | |
delta, density / dc_water, | |
0.001 * rgas_water * (tau * fitaureg3(tau, delta) - fireg3(tau, delta)) | |
) | |
); | |
entropySatLiqPW = LAMBDA(press, | |
LET( | |
temp, tSatW(press), | |
IF( | |
AND(press >= PSatW(273.15), press <= PSatW(623.15)), | |
entropyreg1(temp, press), | |
IF( | |
AND(press > tSatW(623.15), press <= pc_water), | |
entropyreg3(temp, densreg3(temp, press + 0.00001)), | |
-1 | |
) | |
) | |
) | |
); | |
entropySatLiqTW = LAMBDA(temp, | |
LET( | |
press, PSatW(temp), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
entropyreg1(temp, press), | |
IF( | |
AND(temp > 623.15, temp <= tc_water), | |
entropyreg3(temp, densreg3(temp, press)), | |
-1 | |
) | |
) | |
) | |
); | |
entropySatVapPW = LAMBDA(press, | |
LET( | |
temp, tSatW(press), | |
IF( | |
AND(press >= PSatW(273.15), press <= PSatW(623.15)), | |
entropyreg2(temp, press), | |
IF( | |
AND(press > tSatW(623.15), press <= pc_water), | |
entropyreg3(temp, densreg3(temp, press - 0.00001)), | |
-1 | |
) | |
) | |
) | |
); | |
entropySatVapTW = LAMBDA(temp, | |
LET( | |
press, PSatW(temp), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
entropyreg2(temp, press), | |
IF( | |
AND(temp > 623.15, temp <= tc_water), | |
entropyreg3(temp, densreg3(temp, press - 0.00001)), | |
-1 | |
) | |
) | |
) | |
); | |
entropyW = LAMBDA(temp, press, | |
LET( | |
reg, getreg(temp, press), | |
IF( | |
reg = -1, | |
"NA", | |
CHOOSE( | |
reg, | |
entropyreg1(temp, press), | |
entropyreg2(temp, press), | |
entropyreg3(temp, densreg3(temp, press)) | |
) | |
) | |
) | |
); | |
fideltadeltareg3 = LAMBDA(tau, delta, | |
-nreg3(1) / delta / delta + | |
LET( | |
i, SEQUENCE(39, 1, 2, 1), | |
SUM( | |
nreg3(i) * ireg3(i) * (ireg3(i) - 1) * delta ^ (ireg3(i) - 2) * | |
tau ^ jreg3(i) | |
) | |
) | |
); | |
fideltareg3 = LAMBDA(tau, delta, | |
nreg3(1) / delta + | |
LET( | |
i, SEQUENCE(39, 1, 2, 1), | |
SUM(nreg3(i) * ireg3(i) * delta ^ (ireg3(i) - 1) * tau ^ jreg3(i)) | |
) | |
); | |
fideltataureg3 = LAMBDA(tau, delta, | |
LET( | |
i, SEQUENCE(39, 1, 2, 1), | |
SUM( | |
nreg3(i) * ireg3(i) * delta ^ (ireg3(i) - 1) * jreg3(i) * | |
tau ^ (jreg3(i) - 1) | |
) | |
) | |
); | |
fireg3 = LAMBDA(tau, delta, | |
nreg3(1) * LOG(delta) / LOG(EXP(1)) + | |
LET( | |
i, SEQUENCE(39, 1, 2, 1), | |
SUM(nreg3(i) * delta ^ ireg3(i) * tau ^ jreg3(i)) | |
) | |
); | |
fitaureg3 = LAMBDA(tau, delta, | |
LET( | |
i, SEQUENCE(39, 1, 2, 1), | |
SUM(nreg3(i) * delta ^ ireg3(i) * jreg3(i) * tau ^ (jreg3(i) - 1)) | |
) | |
); | |
fitautaureg3 = LAMBDA(tau, delta, | |
LET( | |
i, SEQUENCE(39, 1, 2, 1), | |
SUM( | |
nreg3(i) * delta ^ ireg3(i) * jreg3(i) * (jreg3(i) - 1) * | |
tau ^ (jreg3(i) - 2) | |
) | |
) | |
); | |
gamma0pipireg2 = LAMBDA(tau, pi, -1 / pi / pi); | |
gamma0pireg2 = LAMBDA(tau, pi, 1 / pi); | |
gamma0pitaureg2 = LAMBDA(tau, pi, 0); | |
gamma0reg2 = LAMBDA(tau, pi, | |
LOG(pi) / LOG(EXP(1)) + | |
LET(i, SEQUENCE(9, 1, 1, 1), SUM(n0reg2(i) * tau ^ j0reg2(i))) | |
); | |
gamma0taureg2 = LAMBDA(tau, pi, | |
LET( | |
i, SEQUENCE(9, 1, 1, 1), | |
SUM(n0reg2(i) * j0reg2(i) * tau ^ (j0reg2(i) - 1)) | |
) | |
); | |
gamma0tautaureg2 = LAMBDA(tau, pi, | |
LET( | |
i, SEQUENCE(9, 1, 1, 1), | |
SUM(n0reg2(i) * j0reg2(i) * (j0reg2(i) - 1) * tau ^ (j0reg2(i) - 2)) | |
) | |
); | |
gammapipireg1 = LAMBDA(tau, pi, | |
LET( | |
i, SEQUENCE(34, 1, 1, 1), | |
SUM( | |
nreg1(i) * ireg1(i) * (ireg1(i) - 1) * (7.1 - pi) ^ (ireg1(i) - 2) * | |
(tau - 1.222) ^ jreg1(i) | |
) | |
) | |
); | |
gammapireg1 = LAMBDA(tau, pi, | |
LET( | |
i, SEQUENCE(34, 1, 1, 1), | |
SUM( | |
-nreg1(i) * ireg1(i) * (7.1 - pi) ^ (ireg1(i) - 1) * | |
(tau - 1.222) ^ jreg1(i) | |
) | |
) | |
); | |
gammapitaureg1 = LAMBDA(tau, pi, | |
LET( | |
i, SEQUENCE(34, 1, 1, 1), | |
SUM( | |
-nreg1(i) * ireg1(i) * (7.1 - pi) ^ (ireg1(i) - 1) * jreg1(i) * | |
(tau - 1.222) ^ (jreg1(i) - 1) | |
) | |
) | |
); | |
gammareg1 = LAMBDA(tau, pi, | |
LET( | |
i, SEQUENCE(34, 1, 1, 1), | |
SUM(nreg1(i) * (7.1 - pi) ^ ireg1(i) * (tau - 1.222) ^ jreg1(i)) | |
) | |
); | |
gammarpipireg2 = LAMBDA(tau, pi, | |
LET( | |
i, SEQUENCE(43, 1, 1, 1), | |
SUM( | |
nreg2(i) * ireg2(i) * (ireg2(i) - 1) * pi ^ (ireg2(i) - 2) * | |
(tau - 0.5) ^ jreg2(i) | |
) | |
) | |
); | |
gammarpireg2 = LAMBDA(tau, pi, | |
LET( | |
i, SEQUENCE(43, 1, 1, 1), | |
SUM(nreg2(i) * ireg2(i) * pi ^ (ireg2(i) - 1) * (tau - 0.5) ^ jreg2(i)) | |
) | |
); | |
gammarpitaureg2 = LAMBDA(tau, pi, | |
LET( | |
i, SEQUENCE(43, 1, 1, 1), | |
SUM( | |
nreg2(i) * ireg2(i) * pi ^ (ireg2(i) - 1) * jreg2(i) * | |
(tau - 0.5) ^ (jreg2(i) - 1) | |
) | |
) | |
); | |
gammarreg2 = LAMBDA(tau, pi, | |
LET( | |
i, SEQUENCE(43, 1, 1, 1), | |
SUM(nreg2(i) * pi ^ ireg2(i) * (tau - 0.5) ^ jreg2(i)) | |
) | |
); | |
gammartaureg2 = LAMBDA(tau, pi, | |
LET( | |
i, SEQUENCE(43, 1, 1, 1), | |
SUM(nreg2(i) * pi ^ ireg2(i) * jreg2(i) * (tau - 0.5) ^ (jreg2(i) - 1)) | |
) | |
); | |
gammartautaureg2 = LAMBDA(tau, pi, | |
LET( | |
i, SEQUENCE(43, 1, 1, 1), | |
SUM( | |
nreg2(i) * pi ^ ireg2(i) * jreg2(i) * (jreg2(i) - 1) * | |
(tau - 0.5) ^ (jreg2(i) - 2) | |
) | |
) | |
); | |
gammataureg1 = LAMBDA(tau, pi, | |
LET( | |
i, SEQUENCE(34, 1, 1, 1), | |
SUM( | |
nreg1(i) * (7.1 - pi) ^ ireg1(i) * jreg1(i) * | |
(tau - 1.222) ^ (jreg1(i) - 1) | |
) | |
) | |
); | |
gammatautaureg1 = LAMBDA(tau, pi, | |
LET( | |
i, SEQUENCE(34, 1, 1, 1), | |
SUM( | |
nreg1(i) * (7.1 - pi) ^ ireg1(i) * jreg1(i) * (jreg1(i) - 1) * | |
(tau - 1.222) ^ (jreg1(i) - 2) | |
) | |
) | |
); | |
getreg = LAMBDA(temp, press, | |
IF( | |
AND(temp >= 273.15, temp <= 623.15, press >= PSatW(temp), press < 1000), | |
1, | |
IF( | |
OR( | |
AND( | |
temp >= 273.15, | |
temp <= 623.15, | |
press > 0, | |
press <= PSatW(temp) | |
), | |
AND( | |
temp >= 623.15, | |
temp <= 863.15, | |
press > 0, | |
press <= pBound(temp) | |
), | |
AND(temp >= 863.15, temp <= 1073.15, press > 0, press <= 1000) | |
), | |
2, | |
IF( | |
AND( | |
temp >= 623.15, | |
temp <= tBound(press), | |
press >= pBound(temp), | |
press <= 1000 | |
), | |
3, | |
-1 | |
) | |
) | |
) | |
); | |
ireg1 = LAMBDA(x, | |
INDEX( | |
{ | |
0, | |
0, | |
0, | |
0, | |
0, | |
0, | |
0, | |
0, | |
1, | |
1, | |
1, | |
1, | |
1, | |
1, | |
2, | |
2, | |
2, | |
2, | |
2, | |
3, | |
3, | |
3, | |
4, | |
4, | |
4, | |
5, | |
8, | |
8, | |
21, | |
23, | |
29, | |
30, | |
31, | |
32 | |
}, | |
x | |
) | |
); | |
ireg2 = LAMBDA(x, | |
INDEX( | |
{ | |
1, | |
1, | |
1, | |
1, | |
1, | |
2, | |
2, | |
2, | |
2, | |
2, | |
3, | |
3, | |
3, | |
3, | |
3, | |
4, | |
4, | |
4, | |
5, | |
6, | |
6, | |
6, | |
7, | |
7, | |
7, | |
8, | |
8, | |
9, | |
10, | |
10, | |
10, | |
16, | |
16, | |
18, | |
20, | |
20, | |
20, | |
21, | |
22, | |
23, | |
24, | |
24, | |
24 | |
}, | |
x | |
) | |
); | |
ireg3 = LAMBDA(x, | |
INDEX( | |
{ | |
0, | |
0, | |
0, | |
0, | |
0, | |
0, | |
0, | |
0, | |
1, | |
1, | |
1, | |
1, | |
2, | |
2, | |
2, | |
2, | |
2, | |
2, | |
3, | |
3, | |
3, | |
3, | |
3, | |
4, | |
4, | |
4, | |
4, | |
5, | |
5, | |
5, | |
6, | |
6, | |
6, | |
7, | |
8, | |
9, | |
9, | |
10, | |
10, | |
11 | |
}, | |
x | |
) | |
); | |
ivisc = LAMBDA(x, | |
INDEX({0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 6}, x) | |
); | |
j0reg2 = LAMBDA(x, INDEX({0, 1, -5, -4, -3, -2, -1, 2, 3}, x)); | |
jreg1 = LAMBDA(x, | |
INDEX( | |
{ | |
-2, | |
-1, | |
0, | |
1, | |
2, | |
3, | |
4, | |
5, | |
-9, | |
-7, | |
-1, | |
0, | |
1, | |
3, | |
-3, | |
0, | |
1, | |
3, | |
17, | |
-4, | |
0, | |
6, | |
-5, | |
-2, | |
10, | |
-8, | |
-11, | |
-6, | |
-29, | |
-31, | |
-38, | |
-39, | |
-40, | |
-41 | |
}, | |
x | |
) | |
); | |
jreg2 = LAMBDA(x, | |
INDEX( | |
{ | |
0, | |
1, | |
2, | |
3, | |
6, | |
1, | |
2, | |
4, | |
7, | |
36, | |
0, | |
1, | |
3, | |
6, | |
35, | |
1, | |
2, | |
3, | |
7, | |
3, | |
16, | |
35, | |
0, | |
11, | |
25, | |
8, | |
36, | |
13, | |
4, | |
10, | |
14, | |
29, | |
50, | |
57, | |
20, | |
35, | |
48, | |
21, | |
53, | |
39, | |
26, | |
40, | |
58 | |
}, | |
x | |
) | |
); | |
jreg3 = LAMBDA(x, | |
INDEX( | |
{ | |
0, | |
0, | |
1, | |
2, | |
7, | |
10, | |
12, | |
23, | |
2, | |
6, | |
15, | |
17, | |
0, | |
2, | |
6, | |
7, | |
22, | |
26, | |
0, | |
2, | |
4, | |
16, | |
26, | |
0, | |
2, | |
4, | |
26, | |
1, | |
3, | |
26, | |
0, | |
2, | |
26, | |
2, | |
26, | |
2, | |
26, | |
0, | |
1, | |
26 | |
}, | |
x | |
) | |
); | |
jvisc = LAMBDA(x, | |
INDEX({0, 1, 4, 5, 0, 1, 2, 3, 0, 1, 2, 0, 1, 2, 3, 0, 3, 1, 3}, x) | |
); | |
lamb2Reg1 = LAMBDA(temp, press, tau, delta, | |
LET( | |
taus, 1386 / temp, | |
pis, press / 165.3, | |
dpidtau, (647.226 * 165.3 * | |
(gammapitaureg1(taus, pis) * 1386 - | |
gammapireg1(taus, pis) * temp)) / | |
(221.15 * temp ^ 2 * gammapipireg1(taus, pis)), | |
ddeltadpi, -(22115000 * gammapipireg1(taus, pis)) / | |
(317.763 * rgas_water * temp * gammapireg1(taus, pis) ^ 2), | |
0.0013848 / psivisc(tau, delta) * (tau * delta) ^ (-2) * dpidtau ^ 2 * | |
(delta * ddeltadpi) ^ 0.4678 * delta ^ 0.5 * | |
EXP(-18.66 * (1 / tau - 1) ^ 2 - (delta - 1) ^ 4) | |
) | |
); | |
lamb2Reg2 = LAMBDA(temp, press, tau, delta, | |
LET( | |
taus, 540 / temp, | |
pis, press / 10, | |
dpidtau, (647.226 * 10 * | |
((gamma0pitaureg2(taus, pis) + gammarpitaureg2(taus, pis)) * 540 - | |
(gamma0pireg2(taus, pis) + gammarpireg2(taus, pis)) * temp)) / | |
(221.15 * temp ^ 2 * | |
(gamma0pipireg2(taus, pis) + gammarpipireg2(taus, pis))), | |
ddeltadpi, -(22115000 * | |
(gamma0pipireg2(taus, pis) + gammarpipireg2(taus, pis))) / | |
(317.763 * rgas_water * temp * | |
(gamma0pireg2(taus, pis) + gammarpireg2(taus, pis)) ^ 2), | |
0.0013848 / psivisc(tau, delta) * (tau * delta) ^ (-2) * dpidtau ^ 2 * | |
(delta * ddeltadpi) ^ 0.4678 * delta ^ 0.5 * | |
EXP(-18.66 * (1 / tau - 1) ^ 2 - (delta - 1) ^ 4) | |
) | |
); | |
lamb2Reg3 = LAMBDA(temp, press, tau, delta, | |
LET( | |
taus, 647.096 / temp, | |
deltas, delta * 317.763 / 322, | |
dpidtau, (647.226 * rgas_water * (delta * 317.763) ^ 2 * | |
(fideltareg3(taus, deltas) - | |
(647.096 / temp) * fideltataureg3(taus, deltas))) / | |
(22115000 * 322), | |
ddeltadpi, (22115000 * 322) / | |
(317.763 * delta * 317.763 * rgas_water * temp * | |
(2 * fideltareg3(taus, deltas) + | |
(delta * 317.763 / 322) * fideltadeltareg3(taus, deltas))), | |
0.0013848 / psivisc(tau, delta) * (tau * delta) ^ (-2) * dpidtau ^ 2 * | |
(delta * ddeltadpi) ^ 0.4678 * delta ^ 0.5 * | |
EXP(-18.66 * (1 / tau - 1) ^ 2 - (delta - 1) ^ 4) | |
) | |
); | |
lambthcon = LAMBDA(temp, press, tau, delta, | |
LET( | |
lamb0, 1 / tau ^ 0.5 / | |
LET(i, SEQUENCE(4, 1, 0, 1), SUM(n0thcon(i) * tau ^ i)), | |
lamb1, EXP( | |
LET( | |
i, SEQUENCE(5, 1, 0, 1), | |
j, SEQUENCE(1, 6, 0, 1), | |
SUM(nthcon(i, j) * (tau - 1) ^ i * (delta - 1) ^ j) | |
) * delta | |
), | |
lamb2, CHOOSE( | |
getreg(temp, press), | |
lamb2Reg1(temp, press, tau, delta), | |
lamb2Reg2(temp, press, tau, delta), | |
lamb2Reg3(temp, press, tau, delta) | |
), | |
lamb0 * lamb1 + lamb2 | |
) | |
); | |
n0reg2 = LAMBDA(x, | |
INDEX( | |
{ | |
-9.6927686500217, | |
10.086655968018, | |
-0.005608791128302, | |
0.071452738081455, | |
-0.40710498223928, | |
1.4240819171444, | |
-4.383951131945, | |
-0.28408632460772, | |
0.021268463753307 | |
}, | |
x | |
) | |
); | |
n0thcon = LAMBDA(x, INDEX({1, 6.978267, 2.599096, -0.998254}, x + 1)); | |
n0visc = LAMBDA(x, INDEX({1, 0.978197, 0.579829, -0.202354}, x + 1)); | |
nbound = LAMBDA(x, | |
INDEX( | |
{ | |
348.05185628969, | |
-1.1671859879975, | |
0.0010192970039326, | |
572.54459862746, | |
13.91883977887 | |
}, | |
x | |
) | |
); | |
nreg1 = LAMBDA(x, | |
INDEX( | |
{ | |
0.14632971213167, | |
-0.84548187169114, | |
-3.756360367204, | |
3.3855169168385, | |
-0.95791963387872, | |
0.15772038513228, | |
-0.016616417199501, | |
0.00081214629983568, | |
0.00028319080123804, | |
-0.00060706301565874, | |
-0.018990068218419, | |
-0.032529748770505, | |
-0.021841717175414, | |
-0.00005283835796993, | |
-0.00047184321073267, | |
-0.00030001780793026, | |
0.000047661393906987, | |
-0.0000044141845330846, | |
-7.2694996297594E-16, | |
-0.000031679644845054, | |
-0.0000028270797985312, | |
-8.5205128120103E-10, | |
-0.0000022425281908, | |
-6.5171222895601E-07, | |
-1.4341729937924E-13, | |
-4.0516996860117E-07, | |
-1.2734301741641E-09, | |
-1.7424871230634E-10, | |
-6.8762131295531E-19, | |
1.4478307828521E-20, | |
2.6335781662795E-23, | |
-1.1947622640071E-23, | |
1.8228094581404E-24, | |
-9.3537087292458E-26 | |
}, | |
x | |
) | |
); | |
nreg2 = LAMBDA(x, | |
INDEX( | |
{ | |
-0.0017731742473213, | |
-0.017834862292358, | |
-0.045996013696365, | |
-0.057581259083432, | |
-0.05032527872793, | |
-0.000033032641670203, | |
-0.00018948987516315, | |
-0.0039392777243355, | |
-0.043797295650573, | |
-0.000026674547914087, | |
2.0481737692309E-08, | |
4.3870667284435E-07, | |
-0.00003227767723857, | |
-0.0015033924542148, | |
-0.040668253562649, | |
-7.8847309559367E-10, | |
1.2790717852285E-08, | |
4.8225372718507E-07, | |
0.0000022922076337661, | |
-1.6714766451061E-11, | |
-0.0021171472321355, | |
-23.895741934104, | |
-5.905956432427E-18, | |
-0.0000012621808899101, | |
-0.038946842435739, | |
1.1256211360459E-11, | |
-8.2311340897998, | |
1.9809712802088E-08, | |
1.0406965210174E-19, | |
-1.0234747095929E-13, | |
-1.0018179379511E-09, | |
-8.0882908646985E-11, | |
0.10693031879409, | |
-0.33662250574171, | |
8.9185845355421E-25, | |
3.0629316876232E-13, | |
-0.0000042002467698208, | |
-5.9056029685639E-26, | |
0.0000037826947613457, | |
-1.2768608934681E-15, | |
7.3087610595061E-29, | |
5.5414715350778E-17, | |
-0.0000009436970724121 | |
}, | |
x | |
) | |
); | |
nreg3 = LAMBDA(x, | |
INDEX( | |
{ | |
1.0658070028513, | |
-15.732845290239, | |
20.944396974307, | |
-7.6867707878716, | |
2.6185947787954, | |
-2.808078114862, | |
1.2053369696517, | |
-0.0084566812812502, | |
-1.2654315477714, | |
-1.1524407806681, | |
0.88521043984318, | |
-0.64207765181607, | |
0.38493460186671, | |
-0.85214708824206, | |
4.8972281541877, | |
-3.0502617256965, | |
0.039420536879154, | |
0.12558408424308, | |
-0.2799932969871, | |
1.389979956946, | |
-2.018991502357, | |
-0.0082147637173963, | |
-0.47596035734923, | |
0.0439840744735, | |
-0.44476435428739, | |
0.90572070719733, | |
0.70522450087967, | |
0.10770512626332, | |
-0.32913623258954, | |
-0.50871062041158, | |
-0.022175400873096, | |
0.094260751665092, | |
0.16436278447961, | |
-0.013503372241348, | |
-0.014834345352472, | |
0.00057922953628084, | |
0.0032308904703711, | |
0.000080964802996215, | |
-0.00016557679795037, | |
-0.000044923899061815 | |
}, | |
x | |
) | |
); | |
nreg4 = LAMBDA(x, | |
INDEX( | |
{ | |
1167.0521452767, | |
-724213.16703206, | |
-17.073846940092, | |
12020.82470247, | |
-3232555.0322333, | |
14.91510861353, | |
-4823.2657361591, | |
405113.40542057, | |
-0.23855557567849, | |
650.17534844798 | |
}, | |
x | |
) | |
); | |
nthcon = LAMBDA(x, y, | |
INDEX( | |
{ | |
1.3293046, -0.40452437, 0.2440949, 0.018660751, -0.12961068, 0.044809953; | |
1.7018363, -2.2156845, 1.6511057, -0.76736002, 0.37283344, -0.1120316; | |
5.2246158, -10.124111, 4.9874687, -0.27297694, -0.43083393, 0.13333849; | |
8.7127675, -9.5000611, 4.3786606, -0.91783782, 0, 0; | |
-1.8525999, 0.9340469, 0, 0, 0, 0 | |
}, | |
x + 1, | |
y + 1 | |
) | |
); | |
nvisc = LAMBDA(x, | |
INDEX( | |
{ | |
0.5132047, | |
0.3205656, | |
-0.7782567, | |
0.1885447, | |
0.2151778, | |
0.7317883, | |
1.241044, | |
1.476783, | |
-0.2818107, | |
-1.070786, | |
-1.263184, | |
0.1778064, | |
0.460504, | |
0.2340379, | |
-0.4924179, | |
-0.0417661, | |
0.1600435, | |
-0.01578386, | |
-0.003629481 | |
}, | |
x | |
) | |
); | |
pBound = LAMBDA(temp, | |
IF( | |
OR(temp < 623.15, temp > 863.15), | |
-1, | |
(nbound(1) + nbound(2) * temp + nbound(3) * temp * temp) * 10 | |
) | |
); | |
pc_water = 220.64; | |
pressreg3 = LAMBDA(temp, density, | |
LET( | |
tau, tc_water / temp, | |
delta, density / dc_water, | |
density * rgas_water * temp * delta * fideltareg3(tau, delta) / 100000 | |
) | |
); | |
PSatW = LAMBDA(temperature, | |
LET( | |
t, temperature, | |
del, t + nreg4(9) / (t - nreg4(10)), | |
aco, del ^ 2 + nreg4(1) * del + nreg4(2), | |
bco, nreg4(3) * del ^ 2 + nreg4(4) * del + nreg4(5), | |
cco, nreg4(6) * del ^ 2 + nreg4(7) * del + nreg4(8), | |
IF( | |
OR(t < 273.15, t > 647.096), | |
-1, | |
(2 * cco / (-bco + (bco ^ 2 - 4 * aco * cco) ^ 0.5)) ^ 4 * 10 | |
) | |
) | |
); | |
psivisc = LAMBDA(tau, delta, | |
1 / (tau ^ 0.5 * LET(i, SEQUENCE(4, 1, 0, 1), SUM(n0visc(i) * tau ^ i))) * | |
EXP( | |
delta * | |
LET( | |
i, SEQUENCE(19, 1, 1, 1), | |
SUM( | |
nvisc(i) * (delta - 1) ^ ivisc(i) * (tau - 1) ^ jvisc(i) | |
) | |
) | |
) | |
); | |
rgas_water = 461.526; | |
SolveDens3 = LAMBDA(densin, temp, press, | |
LET( | |
tau, tc_water / temp, | |
delta, densin / dc_water, | |
fidel3, fideltareg3(tau, delta), | |
ddens, (press * 100000 - | |
rgas_water * temp * densin ^ 2 / dc_water * fidel3) / | |
(rgas_water * temp / dc_water * | |
(2 * densin * fidel3 + | |
densin ^ 2 / dc_water * fideltadeltareg3(tau, delta))), | |
IF( | |
ABS(ddens) > 0.000005, | |
SolveDens3(densin + ddens, temp, press), | |
densin + ddens | |
) | |
) | |
); | |
spsoundreg1 = LAMBDA(temp, press, | |
LET( | |
tau, 540 / temp, | |
pi, 0.1 * press / 16.53, | |
(rgas_water * temp * | |
(gammapireg1(tau, pi) ^ 2 / | |
((gammapireg1(tau, pi) - tau * gammapitaureg1(tau, pi)) ^ 2 / | |
(tau ^ 2 * gammatautaureg1(tau, pi)) - | |
gammapipireg1(tau, pi)))) ^ 0.5 | |
) | |
); | |
spsoundreg2 = LAMBDA(temp, press, | |
LET( | |
tau, 540 / temp, | |
pi, 0.1 * press, | |
(rgas_water * temp * | |
(1 + 2 * pi * gammarpireg2(tau, pi) + | |
pi ^ 2 * gammarpireg2(tau, pi) ^ 2) / | |
((1 - pi ^ 2 * gammarpipireg2(tau, pi)) + | |
(1 + pi * gammarpireg2(tau, pi) - | |
tau * pi * gammarpitaureg2(tau, pi)) ^ 2 / | |
(tau ^ 2 * | |
(gamma0tautaureg2(tau, pi) + | |
gammartautaureg2(tau, pi))))) ^ 0.5 | |
) | |
); | |
spsoundreg3 = LAMBDA(temp, density, | |
LET( | |
tau, tc_water / temp, | |
delta, density / dc_water, | |
(rgas_water * temp * | |
(2 * delta * fideltareg3(tau, delta) + | |
delta ^ 2 * fideltadeltareg3(tau, delta) - | |
(delta * fideltareg3(tau, delta) - | |
delta * tau * fideltataureg3(tau, delta)) ^ 2 / | |
(tau ^ 2 * fitautaureg3(tau, delta)))) ^ 0.5 | |
) | |
); | |
spsoundSatLiqPW = LAMBDA(press, | |
LET( | |
temp, tSatW(press), | |
IF( | |
AND(press >= PSatW(273.15), press <= PSatW(623.15)), | |
spsoundreg1(temp, press), | |
IF( | |
AND(press > tSatW(623.15), press <= pc_water), | |
spsoundreg3(temp, densreg3(temp, press + 0.00001)), | |
-1 | |
) | |
) | |
) | |
); | |
spsoundSatLiqTW = LAMBDA(temp, | |
LET( | |
press, PSatW(temp), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
spsoundreg1(temp, press), | |
IF( | |
AND(temp > 623.15, temp <= tc_water), | |
spsoundreg3(temp, densreg3(temp, press)), | |
-1 | |
) | |
) | |
) | |
); | |
spsoundSatVapPW = LAMBDA(press, | |
LET( | |
temp, tSatW(press), | |
IF( | |
AND(press >= PSatW(273.15), press <= PSatW(623.15)), | |
spsoundreg2(temp, press), | |
IF( | |
AND(press > tSatW(623.15), press <= pc_water), | |
spsoundreg3(temp, densreg3(temp, press - 0.00001)), | |
-1 | |
) | |
) | |
) | |
); | |
spsoundSatVapTW = LAMBDA(temp, | |
LET( | |
press, PSatW(temp), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
spsoundreg2(temp, press), | |
IF( | |
AND(temp > 623.15, temp <= tc_water), | |
spsoundreg3(temp, densreg3(temp, press - 0.00001)), | |
-1 | |
) | |
) | |
) | |
); | |
spsoundW = LAMBDA(temp, press, | |
LET( | |
reg, getreg(temp, press), | |
IF( | |
reg = -1, | |
"NA", | |
CHOOSE( | |
reg, | |
spsoundreg1(temp, press), | |
spsoundreg2(temp, press), | |
spsoundreg3(temp, densreg3(temp, press)) | |
) | |
) | |
) | |
); | |
tBound = LAMBDA(press, | |
IF( | |
OR(press < 165.292, press > 1000), | |
-1, | |
nbound(4) + ((0.1 * press - nbound(5)) / nbound(3)) ^ 0.5 | |
) | |
); | |
tc_water = 647.096; | |
thconSatLiqPW = LAMBDA(press, | |
LET( | |
temp, tSatW(press), | |
IF( | |
AND(press >= PSatW(273.15), press <= PSatW(623.15)), | |
0.4945 * | |
lambthcon( | |
temp, | |
press, | |
647.226 / temp, | |
1 / volreg1(temp, press) / 317.763 | |
), | |
IF( | |
AND(press > tSatW(623.15), press <= pc_water), | |
0.4945 * | |
lambthcon( | |
tSatW(press), | |
press, | |
647.226 / temp, | |
densreg3(tSatW(press), press + 0.00001) / 317.763 | |
), | |
-1 | |
) | |
) | |
) | |
); | |
thconSatLiqTW = LAMBDA(temp, | |
LET( | |
press, PSatW(temp), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
0.4945 * | |
lambthcon( | |
temp, | |
press, | |
647.226 / temp, | |
1 / volreg1(temp, press) / 317.763 | |
), | |
IF( | |
AND(temp > 623.15, temp <= tc_water), | |
0.4945 * | |
lambthcon( | |
temp, | |
press, | |
647.226 / temp, | |
densreg3(temp, press) / 317.763 | |
), | |
-1 | |
) | |
) | |
) | |
); | |
thconSatVapPW = LAMBDA(press, | |
LET( | |
temp, tSatW(press), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
0.4945 * | |
lambthcon( | |
temp, | |
press - 0.0001 * press, | |
647.226 / temp, | |
1 / volreg2(temp, press) / 317.763 | |
), | |
IF( | |
AND(temp > 623.15, temp <= tc_water), | |
0.4945 * | |
lambthcon( | |
temp, | |
press - 0.00001, | |
647.226 / temp, | |
densreg3(temp, press - 0.00001) / 317.763 | |
), | |
-1 | |
) | |
) | |
) | |
); | |
thconSatVapTW = LAMBDA(temp, | |
LET( | |
press, PSatW(temp), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
0.4945 * | |
lambthcon( | |
temp, | |
press - 0.0001 * press, | |
647.226 / temp, | |
1 / volreg2(temp, press) / 317.763 | |
), | |
IF( | |
AND(temp > 623.15, temp <= tc_water), | |
0.4945 * | |
lambthcon( | |
temp, | |
press - 0.00001 * press, | |
647.226 / temp, | |
densreg3(temp, press - 0.00001) / 317.763 | |
), | |
-1 | |
) | |
) | |
) | |
); | |
thconW = LAMBDA(temp, press, | |
IF( | |
AND(temp >= 273.15, temp <= 1073.15, press > 0, press <= 1000), | |
0.4945 * | |
lambthcon( | |
temp, | |
press, | |
647.226 / temp, | |
densW(temp, press) / 317.763 | |
), | |
-1 | |
) | |
); | |
tSatW = LAMBDA(pressure, | |
LET( | |
bet, (0.1 * pressure) ^ 0.25, | |
eco, bet ^ 2 + nreg4(3) * bet + nreg4(6), | |
fco, nreg4(1) * bet ^ 2 + nreg4(4) * bet + nreg4(7), | |
gco, nreg4(2) * bet ^ 2 + nreg4(5) * bet + nreg4(8), | |
dco, 2 * gco / (-fco - (fco ^ 2 - 4 * eco * gco) ^ 0.5), | |
IF( | |
OR(pressure < 0.00611213, pressure > 220.64), | |
-1, | |
0.5 * | |
(nreg4(10) + dco - | |
((nreg4(10) + dco) ^ 2 - 4 * (nreg4(9) + nreg4(10) * dco)) ^ | |
0.5) | |
) | |
) | |
); | |
viscSatLiqPW = LAMBDA(press, | |
LET( | |
temp, tSatW(press), | |
IF( | |
AND(press >= PSatW(273.15), press <= PSatW(623.15)), | |
0.000055071 * | |
psivisc(647.226 / temp, 1 / volreg1(temp, press) / 317.763), | |
IF( | |
AND(press > tSatW(623.15), press <= pc_water), | |
0.000055071 * | |
psivisc( | |
647.226 / temp, | |
densreg3(temp, press + 0.00001) / 317.763 | |
), | |
-1 | |
) | |
) | |
) | |
); | |
viscSatLiqTW = LAMBDA(temp, | |
LET( | |
press, PSatW(temp), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
0.000055071 * | |
psivisc(647.226 / temp, 1 / volreg1(temp, press) / 317.763), | |
IF( | |
AND(temp > 623.15, temp <= tc_water), | |
0.000055071 * | |
psivisc(647.226 / temp, densreg3(temp, press) / 317.763), | |
-1 | |
) | |
) | |
) | |
); | |
viscSatVapPW = LAMBDA(press, | |
LET( | |
temp, tSatW(press), | |
IF( | |
AND(press >= PSatW(273.15), press <= PSatW(623.15)), | |
0.000055071 * | |
psivisc(647.226 / temp, 1 / volreg2(temp, press) / 317.763), | |
IF( | |
AND(press > tSatW(623.15), press <= pc_water), | |
0.000055071 * | |
psivisc( | |
647.226 / temp, | |
densreg3(temp, press - 0.00001) / 317.763 | |
), | |
-1 | |
) | |
) | |
) | |
); | |
viscSatVapTW = LAMBDA(temp, | |
LET( | |
press, PSatW(temp), | |
IF( | |
AND(temp >= 273.15, temp <= 623.15), | |
0.000055071 * | |
psivisc(647.226 / temp, 1 / volreg2(temp, press) / 317.763), | |
IF( | |
AND(temp > 623.15, temp <= tc_water), | |
0.000055071 * | |
psivisc( | |
647.226 / temp, | |
densreg3(temp, press - 0.00001) / 317.763 | |
), | |
-1 | |
) | |
) | |
) | |
); | |
viscW = LAMBDA(temp, press, | |
IF( | |
AND(temp >= 273.15, temp <= 1073.15, press <= 1000), | |
0.000055071 * psivisc(647.226 / temp, densW(temp, press) / 317.763), | |
-1 | |
) | |
); | |
volreg1 = LAMBDA(temp, press, | |
LET( | |
tau, 1386 / temp, | |
pi, 0.1 * press / 16.53, | |
rgas_water * temp * pi * gammapireg1(tau, pi) / (press * 100000) | |
) | |
); | |
volreg2 = LAMBDA(temp, press, | |
LET( | |
tau, 540 / temp, | |
pi, 0.1 * press, | |
rgas_water * temp * pi * | |
(gamma0pireg2(tau, pi) + gammarpireg2(tau, pi)) / (press * 100000) | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wow. Incredible work.