-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetsourcecontribution.m
36 lines (33 loc) · 1.29 KB
/
setsourcecontribution.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
34
35
36
function [sourceContributionMatrix] = setsourcecontribution(panels)
%SETSOURCECONTRIBUTION Builds the source contribution matrix for
% the normal velocity.
%
% Arguments
% ----------
% panels: 1D array of Panel objects
% List of panels.
%
% Returns
% -------
% sourceContributionMatrix: 2D array of floats
% Source contribution matrix.
arguments
panels {mustBeNonempty}
end
% Source contribution on a panel from itself
diagonalElements = 0.5 * ones([1, length(panels)]);
sourceContributionMatrix = diag(diagonalElements);
% Source contribution on a panel from others
for iPanel = 1:length(sourceContributionMatrix)
for jPanel = 1:length(sourceContributionMatrix)
if iPanel ~= jPanel
sourceContributionMatrix(iPanel, jPanel) = ...
(0.5 / pi) * getintegraloverpanel( ...
panels(iPanel).xC, panels(iPanel).yC, ...
panels(jPanel), ...
cos(deg2rad(panels(iPanel).beta)), ...
sin(deg2rad(panels(iPanel).beta)) );
end % if
end % for jPanel
end % for iPanel
end