Fourier Series for thin airfoil theory
40 views (last 30 days)
Show older comments
I'm trying to use a Fourier Series Approximation, specifically that specified in thin airfoil theory, to write a function that will do this more universally than hard coding it. So far what I have is the following code. It runs, and my value for is correct, however none of my other values are even remotely close to correct. I believe the problem is coming from the way that I find dydx, but I don't understand why the same method works for and no the other A values.
clear all;close all;clc
alph = 0;
[ ~, ~, ~, xcam, ~ ]= NACA4Digit('2412',100,100,100);
[ ~, ~, ~, ~, ycam ]= NACA4Digit('2412',100,100,100);
ncoeff = 15;
% %% Error Messages
% if size(xcam) ~= size(ycam)
% error('Camber line vector sizes do not match.');
% return;
% else
% end
%% Variable Initialization
iter = length(xcam);
Uinf = 1; % Freestream Velocity, value is a placeholder as the final
% results are non-dimensionalized.
c = iter; % Chord Length, value is a placeholder as the final results are non-
% dimensionalized.
alpha = deg2rad(alph); % Converts the angle of attack to rad
%% Constant Functions
DF = gradient([xcam;ycam]); % Takes the gradient at the given points
[~,fore] = max(ycam); % Finds the point within the array where the camber is greatest, important for differentiating
zeroToFore = linspace(0,fore,iter); % Defines Integration Bounds
zeroToFore = acos(1 - ((2*zeroToFore)/c)); % Converts to theta from x
foreToAft = linspace(fore,pi,iter); % Defines Integration Bounds
foreToAft = acos(1 - ((2*foreToAft)/c)); % Converts to theta from x
A = zeros(1,ncoeff-1); % Intializes A
A0 = alpha - (1/pi)*(trapz(zeroToFore,DF(1,:)) + trapz(foreToAft,DF(2,:))); % Defines A_0
U_theta = zeros(1,iter); % Intitalizes U_theta
%% Solve
for i = 1:iter
theta = acos(1-((2*xcam(i))/c)); % Defines Theta
for n = 1:1:ncoeff
trapzDataFore = DF(1,:)*cos(n*theta) % Trapz Data from the given function for thin airfoil theory using Fourier Series Approx, fore
trapzDataAft = DF(1,:)*cos(n*theta) % Trapz Data from the given function for thin airfoil theory using Fouerier Series Approx, aft
An(n) = (2/pi) * (trapz(zeroToFore,trapzDataFore) + trapz(foreToAft,trapzDataAft)) % A_n value for the Fourier Series, there are ncoeff A values
end
Eqn1 = 0 % Intitializes Equation 1
for n = 1:ncoeff
Eqn1 = Eqn1 + An(n)*sin(n*theta) % Sums all of the A_n Values
end
gamma = 2*Uinf*(A0*((1 + cos(theta))/(sin(theta))) + Eqn1) % Eqn for gamma at a given theta
U_theta(i) = gamma/2; % U at theta
end
Cp(1) = 0;
Cp(iter) = 0;
C_p = 1 - ((Uinf+U_theta)/Uinf).^2;
Cl = pi*(2*A0 + A(1));
Cm = (pi/4)*(A(2)-A(1));
2 Comments
KSSV
on 16 Nov 2021
Read about gradient function. You are taking only one ouput from graidient. There might be another output which is along y-axes.
Accepted Answer
Paul
on 16 Nov 2021
Edited: Paul
on 16 Nov 2021
From the equation it looks to me that y is scalar function and the independent variable x is also a scalar.
Are xcam and ycam both 1-dimensional?
In which case I think this line needs to change:
%DF = gradient([xcam;ycam]); % Takes the gradient at the given points
DF = gradient(ycam,xcam);
I've used that form of the gradient command for a long time, but it doesn't seem to be documented anymore.
6 Comments
More Answers (0)
See Also
Categories
Find more on Airfoil tools in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!