How to calculate radiuses of an airfoil from its coordinates?

8 visualizaciones (últimos 30 días)
Hi,
I am trying to find the radiuses of an airfoil. I extracted the data points from a design software (Catia) to Excel. Now, l have the points of the airfoil curve, but it is defined as splines. I need to redefine the airfoil as circles.
Any help would be great.

Respuesta aceptada

Mathieu NOE
Mathieu NOE el 14 de Feb. de 2025
hello
find below a demo code that computes neutral line and curvature / radiuses of airfoil . there is also a code section that fit a circle by the Taubin method (at least 4 to 5 points are needed, whereas the curvature is computed on 3 points)
required functions are provided in attachment
hope it helps !
method with cercle fit :
Radius scatter plot the R value is color coded
u = readmatrix('upper.txt');
l = readmatrix('lower.txt');
x = [flipud(u(:,2));flipud(l(:,2))];
y = [flipud(u(:,3));flipud(l(:,3))];
n = numel(x);% number of points
%% compute neutral axis
% centroids
polyin = polyshape(x,y);
[xc,yc] = centroid(polyin);
% compute moment of inertia
Ixx = sum(x.^2) / n;
Iyy = sum(y.^2) / n;
Ixy = sum(x.*y) / n;
% % compute (ellipse) semi-axis lengths
common = sqrt( (Ixx - Iyy)^2 + 4 * Ixy^2);
ra = sqrt(2) * sqrt(Ixx + Iyy + common);
rb = sqrt(2) * sqrt(Ixx + Iyy - common);
% axes angle
theta = atan2(2 * Ixy, Ixx - Iyy) / 2;
theta_deg = 180/pi*theta;
% % section below from link :
% % https://leancrew.com/all-this/2018/01/python-module-for-section-properties/
% %'Principal moments of inertia (I1 I2) and orientation.'
% I_avg = (Ixx + Iyy)/2;
% I_diff = (Ixx - Iyy)/2;
% I1 = I_avg + sqrt(I_diff^2 + Ixy^2);
% I2 = I_avg - sqrt(I_diff^2 + Ixy^2);
% theta2 = atan2(-Ixy, I_diff)/2;
% theta_deg2 = 180/pi*theta2;
% draw the neutral line
slope = tan(theta);
xl = [min(x) max(x)];
yl = yc + slope*(xl-xc);
plot(x,y,'r*-',xc,yc,'dk',xl,yl,'b--');
%% circle fit
% let's assume we want to fit a circle to the front portion (leading edge)
ind = x<0.008;
% circle fit here then plot
par = CircleFitByTaubin([x(ind) y(ind)]);
% Output: Par = [a b R] is the fitting circle:
% center (a,b) and radius R
xc = par(1);
yc = par(2);
Re = par(3);
% display results in command window
disp(['----------------------------']);
disp([' Re = ' num2str(Re) ':']);
disp([' xc = ' num2str(xc) ':']);
disp([' yc = ' num2str(yc) ':']);
disp(['----------------------------']);
% reconstruct circle from data
n=100;
th = (0:n)/n*2*pi;
xe = Re*cos(th)+xc;
ye = Re*sin(th)+yc;
hold on
plot(x(ind), y(ind),'db','MarkerSize',10)
plot(xe,ye,'k--')
title(' measured fitted circles')
text(xc-Re*0.5,yc + 0.75*Re,sprintf('center (%g , %g ); R=%g',xc,yc,Re))
hold off
axis equal
%% curvature computation
[L2,R2,K2] = curvature([x y]);
% figure;
% plot(L2,R2)
% title('Curvature radius vs. cumulative curve length')
% xlabel L
% ylabel R
figure;
h = plot(x,y); grid on; axis equal
set(h,'marker','.');
xlabel x
ylabel y
title('2D curve with curvature vectors')
hold on
quiver(x,y,K2(:,1),K2(:,2));
hold off
figure
scatter(x,y,25,R2,'filled');
title('2D curve with radius values ')
caxis([0 3])
colormap(jet)
colorbar
  17 comentarios
piston_pim_offset
piston_pim_offset el 18 de Feb. de 2025
Assume the ellipse as an airfoil. There will be some radiuses if we divide it to some portions. And each portion includes some number of points. What l am trying to find is the values of radiuses of the airfoil when it is divided into some portions.
Mathieu NOE
Mathieu NOE el 19 de Feb. de 2025
ok , so basically its one of my first code suggestion, simply I generated the ellipse x,y data first
now you can easily pick the last plot data and use them for this new task
n = 100;% number of points
theta = (0:n-1)'/n*2*pi;
x = 3*(cos(theta)+1);
y = sin(theta)+1;
%% circle fit
% let's assume we want to fit a circle to the front portion (leading edge)
ind = x<0.1;
% circle fit here then plot
par = CircleFitByTaubin([x(ind) y(ind)]);
% Output: Par = [a b R] is the fitting circle:
% center (a,b) and radius R
xc = par(1);
yc = par(2);
Re = par(3);
% display results in command window
disp(['----------------------------']);
disp([' Re = ' num2str(Re) ':']);
disp([' xc = ' num2str(xc) ':']);
disp([' yc = ' num2str(yc) ':']);
disp(['----------------------------']);
% reconstruct circle from data
n=100;
th = (0:n)'/n*2*pi;
xe = Re*cos(th)+xc;
ye = Re*sin(th)+yc;
plot(x, y,'.-b')
hold on
plot(x(ind), y(ind),'dr','MarkerSize',10)
plot(xe,ye,'k--')
title(' measured fitted circles')
hold off
axis equal
%% curvature computation
[L2,R2,K2] = curvature([x y]);
figure;
h = plot(x,y); grid on; axis equal
set(h,'marker','.');
xlabel x
ylabel y
title('2D curve with curvature vectors')
hold on
quiver(x,y,K2(:,1),K2(:,2));
hold off
axis equal
figure
scatter(x,y,25,R2,'filled');
title('2D curve with radius values ')
caxis([0 3])
colormap(jet)
colorbar
axis equal

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Airfoil tools en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by