-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathveldis.m
32 lines (26 loc) · 1.05 KB
/
veldis.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
function vt = veldis(qg,x,y,xbar,ybar,st,ct,al,npanel)
% flow tangency boundary condition - source distribution
for i=1:npanel
vt(i) = ct(i)*cos(al) +st(i)*sin(al);
for j=1:npanel
rp = sqrt((xbar(i) -x(j+1))^2 +(ybar(i) -y(j+1))^2);
rm = sqrt((xbar(i) -x(j) )^2 +(ybar(i) -y(j) )^2);
betaij = atan2 ((ybar(i) -y(j+1))*(xbar(i) -x(j)) ...
-(xbar(i) -x(j+1))*(ybar(i) -y(j)), ...
(xbar(i) -x(j+1))*(xbar(i) -x(j)) ...
+(ybar(i) -y(j+1))*(ybar(i) -y(j)));
%calculation of tangent influence coefficients
if i==j
log_term = 0.0;
beta_term = pi;
else
log_term = log(rp/rm);
beta_term = betaij;
end
ctimtj = ct(i)*ct(j) +st(i)*st(j);
stimtj = st(i)*ct(j) -st(j)*ct(i);
vt(i) = vt(i) + (qg(j)/(2*pi))*(stimtj*beta_term -ctimtj*log_term) ...
+ (qg(npanel+1)/(2*pi))*(stimtj*log_term +ctimtj*beta_term);
end
end
return