Commit c242a844 authored by mmroma's avatar mmroma
Browse files

added automatic plot saving

parent f4a43195
% Misc_Aero_Calcs
%% Parameters
p_f = 1.225; % kg / m^3
mu = 1.802e-5; % kg / m s
d = 0.246; % m
v_max = 10; % m / s
R_max = 2e5; %
%% Reynolds Number given speed
% R = p_f * v_max * d / mu;
%% Speed given reynolds number
% v = mu * R_max / p_f / d;
%% Plot everything against velocity
v = 0.5:0.01:12; % 0.01 up to 12.0 m/s
R = p_f .* v .* d ./ mu;
C_D = (24 ./ R) .* (1 + 0.15 .* R .^ 0.681) + 0.407 ./ (1 + 8710./R);
C_D_2 = (8./R) .* (1./ sqrt(phi_par))...
+ (16./R) .* (1./ sqrt(phi))...
+ (3./sqrt(R)) .* (1./ phi.^(3./4))...
+ 0.421.^(0.4 .* (- log(phi) ).^2 )...
.* (1 ./ phi_perp);
F_D = (1/8) .* C_D .* pi .* d.^2 .* p_f .* v.^2;
F_D_2 = (1/8) .* C_D_2 .* pi .* d.^2 .* p_f .* v.^2;
figure(1);
plot(v, R);
xlabel('Relative Wind Speed (m/s)');
ylabel('Reynolds Number');
% title('Reynolds Number');
savefig('')
figure(2);
plot(v, C_D);
xlabel('Relative Wind Speed (m/s)');
ylabel('Coefficient of Drag');
% title('Coefficient of Drag');
figure(3);
plot(v, F_D);
xlabel('Relative Wind Speed (m/s)');
ylabel('Drag Force (N)');
% title('Drag Force');
figure(4);
plot(v, C_D_2);
xlabel('Relative Wind Speed (m/s)');
ylabel('Coefficient of Drag');
% title('Coefficient of Drag');
figure(5);
plot(v, F_D_2);
xlabel('Relative Wind Speed (m/s)');
ylabel('Drag Force (N)');
% Misc_Aero_Calcs
%% Figure vars
fig_num = 1;
fig_prefix = 'aero_';
save_figs_bool = true;
%% Parameters
p_f = 1.225; % kg / m^3
mu = 1.802e-5; % kg / m s
......@@ -14,6 +19,11 @@ R_max = 2e5; %
%% Speed given reynolds number
% v = mu * R_max / p_f / d;
%% phi values for cubes
phi = (pi/6)^(1/3);
phi_perp = (9*pi/16)^(1/3);
phi_par = ((9*pi/16)^(1/3) ) / (3 - (4/pi));
%% Plot everything against velocity
v = 0.5:0.01:12; % 0.01 up to 12.0 m/s
......@@ -34,29 +44,38 @@ plot(v, R);
xlabel('Relative Wind Speed (m/s)');
ylabel('Reynolds Number');
% title('Reynolds Number');
fig_num = save_current_figure(fig_prefix, fig_num, save_figs_bool);
figure(2);
plot(v, C_D);
xlabel('Relative Wind Speed (m/s)');
ylabel('Coefficient of Drag');
% title('Coefficient of Drag');
savefig('Figures/aero_2.fig');
fig_num = save_current_figure(fig_prefix, fig_num, save_figs_bool);
figure(3);
plot(v, F_D);
xlabel('Relative Wind Speed (m/s)');
ylabel('Drag Force (N)');
% title('Drag Force');
savefig('Figures/aero_1.fig');
fig_num = save_current_figure(fig_prefix, fig_num, save_figs_bool);
figure(4);
plot(v, C_D_2);
xlabel('Relative Wind Speed (m/s)');
ylabel('Coefficient of Drag');
% title('Coefficient of Drag');
savefig('Figures/aero_4.fig');
fig_num = save_current_figure(fig_prefix, fig_num, save_figs_bool);
figure(5);
plot(v, F_D_2);
xlabel('Relative Wind Speed (m/s)');
ylabel('Drag Force (N)');
savefig('Figures/aero_5.fig');
fig_num = save_current_figure(fig_prefix, fig_num, save_figs_bool);
% Paper 4 - New simple correlation formula for the drag coefficient of non-spherical particles
% Paper 4 - New simple correlation formula for the drag coefficient of
% non-spherical particles (2007)
%% phi values for cubes
phi = (pi/6)^(1/3);
......
function [fig_num] = save_current_figure(prefix,fig_num,save_figs_bool)
%SAVE_CURRENT_FIGURE
if ~save_figs_bool
return
else
figname = strcat(prefix,string(fig_num));
fig_num = fig_num + 1;
savefig(strcat('Figures/',figname,'.fig'));
saveas(gcf,strcat('Figures/',figname,'.png'));
end
end
......@@ -19,7 +19,7 @@ simData = runSimulation(params);
plotData(simData,params);
%% Animate
animate(simData,params);
% animate(simData,params);
%% Save the Data
% saveData(simData,params);
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment