/[ascend]/trunk/models/johnpye/airprops2.a4c
ViewVC logotype

Contents of /trunk/models/johnpye/airprops2.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3412 - (show annotations) (download) (as text)
Fri Sep 14 02:19:20 2018 UTC (4 weeks, 6 days ago) by jpye
File MIME type: text/x-ascend
File size: 4275 byte(s)
corrected a missing 'M' in the entropy calculation. Thanks Maggie!

1 (* Air properties calculator for ASCEND modelling environment
2 Copyright (C) John Pye 2014
3
4 This program is free software; you can redistribute it
5 and/or modify it under the terms of the GNU General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later
8 version.
9
10 This program is distributed in the hope that it will be
11 useful, but WITHOUT ANY WARRANTY; without even the implied
12 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the GNU General Public License for more
14 details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *)
19 REQUIRE "atoms.a4l";
20 REQUIRE "johnpye/moltensalt.a4c";
21
22 (*
23 Ideal-gas air with polynomial specific heat capacity,
24 together with some simplified correlations for viscosity and thermal
25 conductivity. Should be good enough for high-temperature heat transfer
26 problems involving air (>300°C or so).
27 *)
28 MODEL air_fluid REFINES thermophysical_fluid_base;
29 M IS_A real_constant;
30 M :== 28.97{kg/kmol}; (* Cengel *)
31 R IS_A real_constant;
32 R :== 1{GAS_C} / M;
33 T_star IS_A temperature_constant;
34 T_star :== 132.5 {K}; (* Kadoya et al, 10.1063/1.555744 *)
35 rho_star IS_A mass_density_constant;
36 rho_star :== 314.3 {kg/m^3}; (* Kadoya et al, 10.1063/1.555744 *)
37
38 (* coefficients of zero-pressure ideal gas equation: Cengel 7e, Table A-2 (molar heat capacity) *)
39 n IS_A integer_constant;
40 n :== 4;
41 c[0..n-1] IS_A real_constant;
42 c[0] :== 28.11;
43 c[1] :== 0.1967e-2;
44 c[2] :== 0.4802e-5;
45 c[3] :== -1.966e-9;
46 cp_eq: cp * M = 1{kJ/kmol/K} * SUM[c[i] * (T/1{K})^i | i IN [0..n-1]];
47
48 (* ideal gas equation *)
49 rho_eq: p = rho * R * T;
50
51 h_cor IS_A specific_enthalpy;
52 s_cor IS_A specific_entropy;
53
54 (* enthalpy is the integral of cp(T)*dT over a temperature range, with h_cor being the offset for a reference condition *)
55 h_eq: (h - h_cor) * M = 1{kJ/kmol} * SUM[c[i]/(i+1) * (T/1{K})^(i+1) | i IN [0..n-1]];
56
57 (* entropy is the integral of (cp(T)/T)*dT over a temperature range, with s_cor being the offset *)
58 s_eq: (s - s_cor) * M = 1{kJ/kmol/K} * c[0]*ln(T/1{K}) - R*M*ln(p/1{Pa}) + SUM[c[i]/i * (T/1{K})^i | i IN [1..n-1]];
59
60 (* viscosity from Lo et al, 1966, doi:10.1021/je60031a020, with ideal gas EOS for dpdT_v *)
61 mustar IS_A viscosity;
62 z1_eq: mustar = 4.38e-2{cP} * (1.01e-3 * T - 0.093)^(5./9);
63 dpdT_v IS_A solver_var;
64 z2_eq: mu - mustar = 5.76e-3{cP} * (dpdT_v/1{atm})^1.126;
65 dpdT_v = rho * R;
66
67 (* conductivity, from Kadoya et al, doi:10.1063/1.555744, using ideal EOS because of use of rho in calc *)
68 cc[-4..0,1,5] IS_A real_constant;
69 cc[1] :== 0.239503;
70 cc[5] :== 0.00649768;
71 cc[0] :== 1.;
72 cc[-1] :== -1.92615;
73 cc[-2] :== 2.00383;
74 cc[-3] :== -1.07553;
75 cc[-4] :== 0.229414;
76
77 D[1..5] IS_A real_constant;
78 D[1] :== 0.402287;
79 D[2] :==0.356603;
80 D[3] :== -0.163159;
81 D[4] :== 0.138059;
82 D[5] :== 0.0201725;
83
84 lam0, lamr IS_A factor;
85 T_r, rho_r IS_A factor;
86 T_r = T / T_star;
87 rho_r = rho / rho_star;
88 lam0 = cc[1]*T_r + cc[5]*sqrt(T_r) + SUM[cc[i]*T_r^i | i IN [-4..0]];
89 lamr = SUM[D[i]*rho_r^i | i IN [1..5]];
90 GAMMA IS_A real_constant;
91 GAMMA :== 25.9778e-3 {W/m/K};
92 k = GAMMA * (lam0 + lamr);
93 METHODS
94 METHOD bound_self;
95 h_cor.lower_bound := -1e5 {kJ/kg};
96 s_cor.lower_bound := -1e5 {kJ/kg/K};
97 h.lower_bound := -1e5 {kJ/kg};
98 s.lower_bound := -1e5 {kJ/kg/K};
99 u.lower_bound := -1e5 {kJ/kg};
100 T.upper_bound := 2000 {K};
101 T.lower_bound := 20 {K};
102 (* h.upper_bound := 2046.04 {kJ/kg}; *)
103 (* h.lower_bound := 0 {kJ/kg}; -- maybe necessary?? *)
104 END bound_self;
105 METHOD default;
106 RUN bound_self;
107 (* FIXME make same reference conditions for both h and s *)
108 FIX h_cor := 4.68596651709 {kJ/kg}; (* gives h=300.19 kJ/kg at T=300 K *)
109 FIX s_cor := 4.61372432101 {kJ/kg/K}; (* gives s=6.8484 at T=293.15 K, p=1 bar *)
110 h := 200 {kJ/kg};
111 END default;
112 METHOD on_load;
113 RUN ClearAll;
114 RUN default;
115 FIX T := 560 {K};
116 FIX p := 20 {bar};
117
118 END on_load;
119 METHOD self_test;
120 (* these values check against Cengel, table A-17 *)
121 ASSERT abs(h - 565.17 {kJ/kg}) < 2.1 {kJ/kg};
122 ASSERT abs((s - 6.8484 {kJ/kg/K}) - (2.33685 {kJ/kg/K} - 1.68 {kJ/kg/K} - R*ln(20./1.))) < 0.01 {kJ/kg/K};
123 END self_test;
124 END air_fluid;
125

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22