Fourier Series for thin airfoil theory

조회 수: 10(최근 30일)
Tyler Reohr
Tyler Reohr 2021년 11월 16일
편집: Paul 2021년 11월 16일
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
Tyler Reohr
Tyler Reohr 2021년 11월 16일
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

댓글을 달려면 로그인하십시오.

채택된 답변

Paul
Paul 2021년 11월 16일
편집: Paul 2021년 11월 16일
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
Tyler Reohr
Tyler Reohr 2021년 11월 16일
EDIT:
I misinterpreted the graph, it is in fact, much weirder than a scaled version of the xcam and ycam values:

댓글을 달려면 로그인하십시오.

추가 답변(1개)

VBBV
VBBV 2021년 11월 16일
trapzDataFore = DF(1,:)*cos(n*theta*pi/180) % change to radian
trapzDataAft = DF(1,:)*cos(n*theta*pi/180) % change to radian
for n = 1:ncoeff
Eqn1 = Eqn1 + An(n)*sin(n*theta*pi/180) % change to radian
end
gamma = 2*Uinf*(A0*((1 + cos(theta*pi/180))/(sin(theta*pi/180))) + Eqn1) % change to radian
May be you need to multiply with pi/180 in sin and cos functions. Matlab assumes input values in radians.
  댓글 수: 2
Tyler Reohr
Tyler Reohr 2021년 11월 16일
VBBV,
Yes, I converted to radians previously in the code utilizing matlab's built in "deg2rad(alph)", which was the only thing not in radians to begin with.
In terms of c, I can try this and see if it works, however, we were told in class that because we were non-dimensionalizing the units, c was essentially a placeholder in the equations, and would eventually be divided out. As a result, the way the code is written, using the "actual" chord value would make the answer imaginary, which may have some significance, I'm not sure, but it is beyond the scope of what I'm currently trying to do. It is possible that what we were told was incorrect, and in that case your code would get the "actual" cord value, however I would have to rewrite the nearly the entire thing.
Thanks!
Tyler

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by