8. Anexo – Funciones de Matlab usadas

Anuncio
8. Anexo – Funciones de Matlab usadas
Programa para el cálculo de las presiones y fuerzas según la teoría potencial
function
[cp_out,x_out,Re,Fz,Fz_Allen,Fz_pot]=teoria_potencial(alpha,theta,n)
%% Función que devuelve la distribución de presiones (cp_out) a lo
largo
%% del cuerpo (x_out), a un número de Reynolds (Re), en función del
ángulo
%% de ataque (alpha) y del ángulo theta. Además, da la fuerza sobre la
%% sección situada en la toma n.
%% Constantes generales
R_gas
gamma
= 287;
= 1.4;
%% Parámetros
U_inf
p_inf
T_inf
M_inf
beta
ro_inf
=
=
=
=
=
=
10;
1e5;
288.15;
U_inf/sqrt(gamma*R_gas*T_inf);
sqrt(1-M_inf^2);
p_inf/(R_gas*T_inf);
nu
= 1.5e-5;
alpha
theta
= alpha*pi/180;
= theta*pi/180;
%% ZONA DE LA OJIVA -- Cálculo potencial
% Geometría
L_oj
R
dR_dx
L_fus
L
D_fus
Re
=
=
=
=
=
=
=
0.270;
@(x) sqrt(0.8325^2-(x-L_oj)^2)-0.7875;
@(x) (L_oj-x)/sqrt(0.8325^2-(x-L_oj)^2);
0.630;
L_oj+L_fus;
0.090;
U_inf*D_fus/nu; % Reynolds por unidad de longitud
% Campo lejano y cercano
f
= @(x)
-U_inf*R(x)*dR_dx(x)/2;
D
= @(x)
quad(@(x0)aux1(x0,f(x),x,U_inf),x,0,1e-9)
+ f(x)*log((4*(L_oj-x)*x)/beta^2);
fi_l
= @(x,r)
U_inf*R(x)*dR_dx(x)*log(r) + D(x);
fi_c
= @(x,r,theta) U_inf*alpha*R(x)^2*sin(theta)/r;
%% Cálculo de presiones sobre la ojiva -- Teoría potencial
x
dfil_dx
dfic_dx
cp
=
=
=
=
0.001:0.001:L_oj-0.002;
zeros(length(x),1);
zeros(length(x),1);
zeros(length(x),1);
for i= 1: length(x)
x_aux
r
h
dfil_dx
dfic_dx
cp
= x(i);
= R(x_aux);
= 0.01;
(i) = (fi_l(x_aux+h,r)-fi_l(x_aux-h,r))/(2*h);
(i) = (fi_c(x_aux+h,r,theta)-fi_c(x_aux-h,r,theta))/(2*h);
(i) = -2*(dfil_dx(i)+dfic_dx(i))/U_inf;
end
%% Cálculo de presiones sobre el fuselaje -- Teoría potencial
x_fus
cp_fus(1:length(x_fus))
= L_oj:0.01:L;
= zeros(length(x_fus),1);
% figure(1), hold on
% plot([L_oj-0.002 x_fus],[cp(length(x)) cp_fus])
cp_out
x_out
= [cp' cp_fus];
= [x x_fus];
%% Fuerzas sobre la ojiva -- Teoría potencial
dFz_dx = @(x) 2*ro_inf*U_inf^2*alpha*pi*R(x)*dR_dx(x);
Fz
= @(x) ro_inf*U_inf^2*alpha*pi*R(x)^2;
Sust_ojiva
dF
= Fz(L_oj);
= zeros(length(x),1);
for i= 1: length(x)
x_aux
dF(i)
= x(i);
= dFz_dx(x_aux);
end
% figure(2)
% plot(x,dF)
%
% disp(['Sustentación según la teoría potencial:
num2str(Sust_ojiva), ' N'])
% xlabel('Distancia desde la punta (m)')
',
% ylabel('Fuerza por unidad de longitud (N/m)')
% title('Distribución de fuerza')
%% Fuerza sobre la ojiva -- Teoría de Allen
% Para que la integración numérica se realice bien, hay que poner R
% en milímetros
R
= @(x) sqrt(832.5^2-(x-270)^2)-787.5;
A_oj
= quad(@(x) R , 0 , L_oj*1000)*1e-6;
A_fus
= L_fus*D_fus;
D_cil
L_Dcil
= (A_oj+A_fus)/L;
= L/D_cil;
L_D
CD
= [1 2 3 5 10 20 40 1e5];
= [0.64 0.68 0.72 0.74 0.82 0.91 0.98 1.20];
CD_cil
Fz_Allen
= spline(L_D,CD,L_Dcil);
= 0.5*ro_inf*(U_inf*alpha)^2*L*D_cil*CD_cil;
%% Fuerza en una sección
x_tomas = [9.83 9.39 8.95 8.50 8.06 7.61 7.17 6.72 6.28 5.84 5.39 4.95
4.50 4.06 3.62 2.95 2.50 2.06 1.61 1.22 0.89 0.56 0.22]*D_fus;
x_toma = x_tomas(length(x_tomas)-n+1);
if x_toma>L_oj
Fz_pot
= 0;
else
Fz_pot
= dFz_dx(x_toma);
end
Fz
= Fz_Allen/L + Fz_pot;
Líneas de código para la obtención de las fuerzas
clear all, close all
clc
D_fus
=
x_tomas =
4.50 4.06
x_toma =
Fz
0.09;
[9.83 9.39 8.95 8.50 8.06 7.61 7.17 6.72 6.28 5.84 5.39 4.95
3.62 2.95 2.50 2.06 1.61 1.22 0.89 0.56 0.22]*D_fus;
@(n) x_tomas(length(x_tomas)-n+1);
= [0 4.1145 0.99214 0.2332 0.73282 1.7911];
tomas
= [0 x_toma(4) x_toma(8) x_toma(13) x_toma(19)
x_toma(21)];
aux
= 0:0.01:0.9;
Fz_interp
= spline(tomas,Fz,aux);
figure(1),hold on
plot(aux,Fz_interp)
plot(tomas,Fz,'*')
for i = 1:length(x_tomas)
[cp_out,x_out,Re,Fz2,Fz_Allen,Fz_pot]=teoria_potencial(8,0,i);
F(i)
= Fz2;
end
Fz_interp2
= spline(sort(x_tomas),F,aux);
figure(1)
hold on
plot(aux,Fz_interp2,'k')
plot(sort(x_tomas),F,'k*')
title('Distribución aproximada de fuerza a lo largo del cuerpo')
xlabel('Longitud desde la punta (m)')
ylabel('Fuerza normal (N/m)')
legend('Experimental (spline)','Experimental (datos)','Teoría Allen
(spline)','Teoría Allen (datos)')
Descargar