Fourier Series for thin airfoil theory

40 views (last 30 days)
Tyler Reohr
Tyler Reohr on 16 Nov 2021
Edited: Paul on 16 Nov 2021
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
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.
Tyler Reohr
Tyler Reohr on 16 Nov 2021
KSSV,
When I utilize the other output from gradient, I then have 3 DF outputs:
2x100 DFX, which is equal to what I had with just the DF output, and
2x100 DFY, which is 2 equal 1x100 rows
I'm assuming that you're right and I do need to incorporate this data, but I'm not exactly sure how do to so with the way I have the code set up, how would I define the dydx for different iterations in the first nested for loop? Under trapzDataFore and trapzDataAft?
For reference, if you're not familiar with thin airfoil theory, the equation I am going from is derived from:
and can be simplified to:
and trapzDataFore and trapzDataAft are the respective equations within the integral.
Thanks!
Tyler

Sign in to comment.

Accepted Answer

Paul
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
Tyler Reohr
Tyler Reohr on 16 Nov 2021
Edited: Tyler Reohr on 16 Nov 2021
Paul,
I did as you suggested and can see that you're definitely right about the gradient. I got the following. I'm not exactly sure why if I'm being honest, but for some reason the way that I currently have the gradient setup yields the third graph, which appears to be a scaled version of the xcam and ycam points.
% subplot(3,1,1)
% plot(xcam,ycam)
% subplot(3,1,2)
% plot(xcam,gradient(ycam,xcam))
% subplot(3,1,2)
% plot(xcam,ycam,DF(1,:),DF(2,:))
Tyler Reohr
Tyler Reohr on 16 Nov 2021
EDIT:
I misinterpreted the graph, it is in fact, much weirder than a scaled version of the xcam and ycam values:

Sign in to comment.

More Answers (0)

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!