Skip to content

Commit a8c0f70

Browse files
committed
Review Upload
1 parent b763d30 commit a8c0f70

25 files changed

+2474
-0
lines changed

@DryAir/DryAir.m

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
%% Property functions of dry air at ambient pressure
2+
%GNU General Public License v3.0
3+
%By Stefan Thanheiser: https://orcid.org/0000-0003-2765-1156
4+
%
5+
%Modified from:
6+
%Stefan Thanheiser, "sthanhe/HeatTransfer: Round 3 Release”. Zenodo, Jan.
7+
%22, 2022. doi: 10.5281/zenodo.5911319.
8+
%
9+
%
10+
%Part of the paper:
11+
%
12+
%Thanheiser, S.; Haider, M.
13+
%Particle Mass Diffusion Model for Level Control of Bubbling Fluidized Beds
14+
%with Horizontal Particle Flow
15+
%Powder Technology 2023
16+
%
17+
%All required files for this class can be found in the software
18+
%repository:
19+
%https://doi.org/10.5281/zenodo.xxxxxxx
20+
%
21+
%
22+
%
23+
%This class describes the thermo-physical properties of dry air as an ideal
24+
%gas according to:
25+
%
26+
%Span, R. Properties of Dry Air. In VDI Heat Atlas, 2nd ed.; Stephan, P.,
27+
%Kabelac, S., et al., Eds.; Springer: Berlin Heidelberg, Germany, 2010;
28+
%pp. 172–191. https://doi.org/10.1007/978-3-540-77877-6_11
29+
%
30+
%
31+
%Requires all files packaged in the class folder and on the MATLAB path
32+
%
33+
%Required products:
34+
% - MATLAB, version 9.14
35+
%Data files:
36+
% - dryAir.xls
37+
% - dryAirTable.mat
38+
39+
40+
classdef DryAir
41+
%All parameters and results in SI base units
42+
43+
%% Constants
44+
properties(Constant)
45+
M=28.9583e-3; %molar mass
46+
R=287.12; %specific gas constant
47+
end
48+
49+
50+
%% prop(T) functions
51+
methods(Static)
52+
function rho=rho(p,T)
53+
%Density
54+
rho=p./(DryAir.R.*T);
55+
end
56+
57+
58+
function h=h(T)
59+
%Specific enthalpy
60+
persistent tab
61+
if isempty(tab)
62+
tabStruct=coder.load('@DryAir\dryAirTable.mat','tab');
63+
tab=tabStruct.tab;
64+
end
65+
66+
h=interp1(tab.T,tab.h,T);
67+
end
68+
69+
70+
function s=s(T)
71+
%Specific entropy. Does not account for pressure variations!
72+
persistent tab
73+
if isempty(tab)
74+
tabStruct=coder.load('@DryAir\dryAirTable.mat','tab');
75+
tab=tabStruct.tab;
76+
end
77+
78+
s=interp1(tab.T,tab.s,T);
79+
end
80+
81+
82+
function c_p=c_p(T)
83+
%Specific isobaric heat capacity
84+
persistent tab
85+
if isempty(tab)
86+
tabStruct=coder.load('@DryAir\dryAirTable.mat','tab');
87+
tab=tabStruct.tab;
88+
end
89+
90+
c_p=interp1(tab.T,tab.c_p,T);
91+
end
92+
93+
94+
function c_v=c_v(T)
95+
%Specific isochoric heat capacity
96+
persistent tab
97+
if isempty(tab)
98+
tabStruct=coder.load('@DryAir\dryAirTable.mat','tab');
99+
tab=tabStruct.tab;
100+
end
101+
102+
c_v=interp1(tab.T,tab.c_v,T);
103+
end
104+
105+
106+
function kappa=kappa(T)
107+
%Isentropic exponent
108+
kappa=DryAir.c_p(T)./DryAir.c_v(T);
109+
end
110+
111+
112+
function beta=beta(T)
113+
%Coefficient of thermal expansion
114+
persistent tab
115+
if isempty(tab)
116+
tabStruct=coder.load('@DryAir\dryAirTable.mat','tab');
117+
tab=tabStruct.tab;
118+
end
119+
120+
beta=interp1(tab.T,tab.beta,T);
121+
end
122+
123+
124+
function w_s=w_s(T)
125+
%Speed of sound
126+
persistent tab
127+
if isempty(tab)
128+
tabStruct=coder.load('@DryAir\dryAirTable.mat','tab');
129+
tab=tabStruct.tab;
130+
end
131+
132+
w_s=interp1(tab.T,tab.w_s,T);
133+
end
134+
135+
136+
function lambda=lambda(T)
137+
%Heat conductivity
138+
persistent tab
139+
if isempty(tab)
140+
tabStruct=coder.load('@DryAir\dryAirTable.mat','tab');
141+
tab=tabStruct.tab;
142+
end
143+
144+
lambda=interp1(tab.T,tab.lambda,T);
145+
end
146+
147+
148+
function eta=eta(T) %#codegen
149+
%Dynamic viscosity
150+
persistent tab
151+
if isempty(tab)
152+
tabStruct=coder.load('@DryAir\dryAirTable.mat','tab');
153+
tab=tabStruct.tab;
154+
end
155+
156+
eta=interp1(tab.T,tab.eta,T);
157+
end
158+
159+
160+
function ny=ny(p,T)
161+
%Kinematic viscosity
162+
persistent tab
163+
if isempty(tab)
164+
tabStruct=coder.load('@DryAir\dryAirTable.mat','tab');
165+
tab=tabStruct.tab;
166+
end
167+
168+
ny=DryAir.eta(T)./DryAir.rho(p,T);
169+
end
170+
171+
172+
function a=a(p,T)
173+
%Thermal diffusivity
174+
a=DryAir.ny(p,T)./DryAir.Pr(T);
175+
end
176+
177+
178+
function Pr=Pr(T)
179+
%Prandtl number
180+
persistent tab
181+
if isempty(tab)
182+
tabStruct=coder.load('@DryAir\dryAirTable.mat','tab');
183+
tab=tabStruct.tab;
184+
end
185+
186+
Pr=interp1(tab.T,tab.Pr,T);
187+
end
188+
end
189+
190+
191+
%% Other property functions
192+
methods(Static)
193+
function T=T_h(h)
194+
%Backwards-equation for temperature as function of specific
195+
%enthalpy
196+
persistent tab
197+
if isempty(tab)
198+
tabStruct=coder.load('@DryAir\dryAirTable.mat','tab');
199+
tab=tabStruct.tab;
200+
end
201+
202+
T=interp1(tab.h,tab.T,h);
203+
end
204+
end
205+
206+
207+
%% Auxilliary Functions
208+
methods(Static)
209+
function createConstants()
210+
%Creates the lookup-constants from the Excel-file
211+
clear('DryAir');
212+
213+
tab=readtable('@DryAir\dryAir.xls','Range','A1:M53');
214+
215+
tab{:,'T'}=tab{:,'T'}+273.15;
216+
tab{:,'h'}=tab{:,'h'}*1000;
217+
tab{:,'s'}=tab{:,'s'}*1000;
218+
tab{:,'c_p'}=tab{:,'c_p'}*1000;
219+
tab{:,'c_v'}=tab{:,'c_v'}*1000;
220+
tab{:,'beta'}=tab{:,'beta'}/1000;
221+
tab{:,'lambda'}=tab{:,'lambda'}/1000;
222+
tab{:,'eta'}=tab{:,'eta'}*10^-6;
223+
tab{:,'ny'}=tab{:,'ny'}*10^-7;
224+
tab{:,'a'}=tab{:,'a'}*10^-7;
225+
226+
save('dryAirTable.mat','tab');
227+
end
228+
end
229+
end
230+
231+
232+
233+

@DryAir/dryAir.xls

18 KB
Binary file not shown.

@DryAir/dryAirTable.mat

4.68 KB
Binary file not shown.

0 commit comments

Comments
 (0)