-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlt_Example.m
More file actions
75 lines (52 loc) · 1.9 KB
/
Copy pathAlt_Example.m
File metadata and controls
75 lines (52 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
% 1976 Altitude Calculator
% Original tool created here: https://www.mathworks.com/matlabcentral/fileexchange/92653-u-s-standard-atmosphere-1976-model
% See above website for more details on it
% Modified by K. Hanquist - 3 Jan 2025
close all
% Make sure you update the characteristic dimensions (L) and Mach number if
% you want accurate Reynolds and Knudsen numbers
% The following commands creates a vector of altitudes. You can modify as
% needed to include as many or as little altitudes as you want
min_alt = 5; % km
max_alt = 80; % km
d_alt = 5; % km
addpath('Toolbox')
Atmo = StandardAtmos([min_alt:d_alt:max_alt],'HeightUnit','km');
altitude = Atmo.(1); % km
T = Atmo.(3); % K
p = Atmo.(5); % Pa
rho = Atmo.(6); % kg/m^3
mu = Atmo.(10);
% The following commands are extra and calculate the Reynolds number and
% unit Reynolds number for certain flight and geometry conditions
Mach = 4.9;
L = 1; % Characteristic length or diameter [m]
% Assume constant R
R = 287; % J/kg*K
% Assume constant gamma
gamma = 1.4;
% Calcualte Reynolds numbers
for i = 1:length(altitude)
a = sqrt(gamma * R * T(i)); % Speed of sound (m/s)
u = Mach * a; % Velocity (m/s)
Re_1alt(i) = rho(i) * u / mu(i); % unit Reynolds number (1/m)
Re_Dalt(i) = rho(i) * u * L / mu(i); % Reynolds number
end
% Calculate Knudsen number
d = 4.0E-10; % Approximate hard sphere diameter of an "air" particle [m]
k = 1.380649E-23; % Boltzmann constant
n = p ./ (k .* T); % Number density of particles at given altitude
lambda = (sqrt(2) .* n .* pi .* d^2 ).^-1; % Mean free path of particles at given altitude
Kn = lambda ./ L;
% Plot the results
yyaxis left
semilogy(min_alt:d_alt:max_alt,Kn)
ylabel('Kn')
xlabel('Altitude [km]')
yyaxis right
semilogy(min_alt:d_alt:max_alt,Re_Dalt)
ylabel('Re')
xlabel('Altitude [km]')
% Save data so we can create with Tecplot
data = [(min_alt:d_alt:max_alt)', Kn, Re_Dalt'];
save AltData.dat data -ascii