-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetfreestreamconditions.m
33 lines (30 loc) · 1.22 KB
/
setfreestreamconditions.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function [freeStreamConditionMatrix] = setfreestreamconditions(panels, freeStream)
%SETFREESTREAMCONDITIONS Builds the right-hand side of the system
%arising from the freestream contribution.
%
% Arguments
% ----------
% panels: 1D array of Panel objects
% List of the panels used to describe the airfoil.
% freeStream: FreeStream object
% Properties of the free stream.
%
% Returns
% -------
% freeStreamConditionMatrix: 1D array of float
% List of the free stream conditions. The last element of the
% array is the vortex condition.
arguments
panels {mustBeNonempty}
freeStream {mustBeNonempty}
end
freeStreamConditionMatrix = zeros([length(panels)+1, 1]);
% Contribution of free stream on panel "iPanel"
for iPanel = 1:length(panels)
freeStreamConditionMatrix(iPanel, 1) = (-1) * freeStream.Uinf * ...
cos(deg2rad(freeStream.alpha - panels(iPanel).beta));
end
freeStreamConditionMatrix(end, 1) = (-1) * freeStream.Uinf * ...
(sin(deg2rad(freeStream.alpha - panels(1).beta)) + ...
sin(deg2rad(freeStream.alpha - panels(end).beta)));
end