-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunsteady.asv
620 lines (558 loc) · 21 KB
/
funsteady.asv
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
function [output]=funsteady(lattice,geo,ref,Mach);
%% Transforming Tornado geometry to Tornagi
lattice2.colloc(:,1)=lattice.COLLOC(:,1);
lattice2.colloc(:,3)=lattice.COLLOC(:,2); %Russian coordinate system y=z
lattice2.colloc(:,2)=lattice.COLLOC(:,3);
[a b c]=size(lattice.VORTEX);
try
if b>5
lattice.VORTEX(:,2,:)=lattice.VORTEX(:,4,:); % JOp 0902
lattice.VORTEX(:,3,:)=lattice.VORTEX(:,5,:); % JOp 0902
end
end
lattice2.vortex(:,1)=(lattice.VORTEX(:,2,1)+lattice.VORTEX(:,3,1))/2;
lattice2.vortex(:,3)=(lattice.VORTEX(:,2,2)+lattice.VORTEX(:,3,2))/2;
lattice2.vortex(:,2)=(lattice.VORTEX(:,2,3)+lattice.VORTEX(:,3,3))/2;
lattice2.normal(:,1)=-lattice.N(:,1);
lattice2.normal(:,3)=-lattice.N(:,2);
lattice2.normal(:,2)=-lattice.N(:,3);
x(1,:)=lattice.VORTEX(:,2,1);
x(2,:)=lattice.VORTEX(:,3,1);
y(1,:)=lattice.VORTEX(:,2,2);
y(2,:)=lattice.VORTEX(:,3,2);
z(1,:)=lattice.VORTEX(:,2,3);
z(2,:)=lattice.VORTEX(:,3,3);
dx=diff(x);
dy=diff(y);
dz=diff(z);
lattice2.semisp=sqrt(dz.^2+dy.^2)./2;
lattice2.vsweep=dx./lattice2.semisp;
cntr_pos=zeros(size(dx));
Sym=0;
Hground=40;
Ref.Swn=ref.S_ref;
Ref.MAC=ref.C_mac;
Ref.Spn=ref.b_ref;
Ref.Xcg=geo.CG(1);
Ref.Ycg=geo.CG(2);
Ref.Zcg=geo.CG(3);
%% Calling Tornagi functions
%% A=matr(lattice2,Sym,Hground,Mach,Ref);
A = matrJO(lattice2,Sym,Hground,Mach,Ref);%Downwash influence matrix.
Am1=inv(A); %Inverting
task_id='alpha';
b=rhs(task_id,lattice2,Ref,cntr_pos);
g=A\b;
%% Adot=matr_dot(lattice2,Sym,Hground,Mach,Ref);
Adot = matr_dotJO(lattice2,Sym,Hground,Mach,Ref);
gdot=-Am1*Adot*g/Ref.MAC;
[cy,cz,mx,my,mz]=aer_coef(lattice2,gdot,Ref,Sym);
% Russian notations
%output.cyda=cy;
%output.mzda=mz;
% American notations
%output.CZ_a_dot=-2*cy;
%output.Cm_a_dot=2*mz;
output(1)=-2*cy;
output(2)=2*mz;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function A=matr(lattice,Sym,Hground,Mach,Ref)
% Calculation of matrix for steady task
%
% Input:
% lattice - aircraft vortex lattice
% Sym - symmetry sign
% Hground - height above ground
% Mach - flow Mach number
% Ref - structure with aircraft reference data
%
% Output:
% A - resulting matrix
%
Hinf=5;
H=Hground*Ref.MAC;
n=length(lattice.semisp);
A=zeros(n,n);
switch Sym
case 1 % Symmetrical solution
if Hground >= Hinf
% Far from ground
for i=1:n
for j=1:n
% j - number of collocation point
% i - numer of vortex
x=lattice.colloc(j,1)-lattice.vortex(i,1);
dy=lattice.colloc(j,2)-lattice.vortex(i,2);
dz=lattice.colloc(j,3)-lattice.vortex(i,3);
y=dy*lattice.normal(i,2)+dz*lattice.normal(i,3);
z=-dy*lattice.normal(i,3)+dz*lattice.normal(i,2);
[vy0,vz0]=sks_sta(x,y,z,lattice.semisp(i),lattice.vsweep(i),Mach);
vy=vy0*lattice.normal(i,2)-vz0*lattice.normal(i,3);
vz=vy0*lattice.normal(i,3)+vz0*lattice.normal(i,2);
% symmetrical vortex
dy=lattice.colloc(j,2)-lattice.vortex(i,2);
dz=lattice.colloc(j,3)+lattice.vortex(i,3);
y=dy*lattice.normal(i,2)-dz*lattice.normal(i,3);
z=dy*lattice.normal(i,3)+dz*lattice.normal(i,2);
[vy0,vz0]=sks_sta(x,y,z,lattice.semisp(i),-lattice.vsweep(i),Mach);
vy1=vy0*lattice.normal(i,2)+vz0*lattice.normal(i,3);
vz1=-vy0*lattice.normal(i,3)+vz0*lattice.normal(i,2);
A(j,i)=(vy+vy1)*lattice.normal(j,2)+(vz+vz1)*lattice.normal(j,3);
end
end
else
% Account of ground effects
for i=1:n
for j=1:n
% j - number of collocation point
% i - numer of vortex
x=lattice.colloc(j,1)-lattice.vortex(i,1);
dy=lattice.colloc(j,2)-lattice.vortex(i,2);
dz=lattice.colloc(j,3)-lattice.vortex(i,3);
y=dy*lattice.normal(i,2)+dz*lattice.normal(i,3);
z=-dy*lattice.normal(i,3)+dz*lattice.normal(i,2);
[vy0,vz0]=sks_sta(x,y,z,lattice.semisp(i),lattice.vsweep(i),Mach);
% under ground vortex
dy=dy+2*H;
y=dy*lattice.normal(i,2)-dz*lattice.normal(i,3);
z=dy*lattice.normal(i,3)+dz*lattice.normal(i,2);
[vy2,vz2]=sks_sta(x,y,z,lattice.semisp(i),lattice.vsweep(i),Mach);
% total from pair
vy0=vy0-vy2; vz0=vz0-vz2;
vy=vy0*lattice.normal(i,2)-vz0*lattice.normal(i,3);
vz=vy0*lattice.normal(i,3)+vz0*lattice.normal(i,2);
% symmetrical vortex
dy=lattice.colloc(j,2)-lattice.vortex(i,2);
dz=lattice.colloc(j,3)+lattice.vortex(i,3);
y=dy*lattice.normal(i,2)-dz*lattice.normal(i,3);
z=dy*lattice.normal(i,3)+dz*lattice.normal(i,2);
[vy0,vz0]=sks_sta(x,y,z,lattice.semisp(i),-lattice.vsweep(i),Mach);
% under ground symmetrical vortex
dy=dy+2*H;
y=dy*lattice.normal(i,2)+dz*lattice.normal(i,3);
z=-dy*lattice.normal(i,3)+dz*lattice.normal(i,2);
[vy2,vz2]=sks_sta(x,y,z,lattice.semisp(i),-lattice.vsweep(i),Mach);
% total from symmetrical pair
vy0=vy0-vy2; vz0=vz0-vz2;
vy1=vy0*lattice.normal(i,2)+vz0*lattice.normal(i,3);
vz1=-vy0*lattice.normal(i,3)+vz0*lattice.normal(i,2);
% matrix coeeficient
A(j,i)=(vy+vy1)*lattice.normal(j,2)+(vz+vz1)*lattice.normal(j,3);
end
end
end
case 0 % Solution without symmetry
if Hground >= Hinf
% Far from ground
for i=1:n
for j=1:n
% j - number of collocation point
% i - numer of vortex
x=lattice.colloc(j,1)-lattice.vortex(i,1);
dy=lattice.colloc(j,2)-lattice.vortex(i,2);
dz=lattice.colloc(j,3)-lattice.vortex(i,3);
y=dy*lattice.normal(i,2)+dz*lattice.normal(i,3);
z=-dy*lattice.normal(i,3)+dz*lattice.normal(i,2);
[vy0,vz0]=sks_sta(x,y,z,lattice.semisp(i),lattice.vsweep(i),Mach);
vy=vy0*lattice.normal(i,2)-vz0*lattice.normal(i,3);
vz=vy0*lattice.normal(i,3)+vz0*lattice.normal(i,2);
A(j,i)=vy*lattice.normal(j,2)+vz*lattice.normal(j,3);
end
end
else
for i=1:n
for j=1:n
% j - number of collocation point
% i - numer of vortex
x=lattice.colloc(j,1)-lattice.vortex(i,1);
dy=lattice.colloc(j,2)-lattice.vortex(i,2);
dz=lattice.colloc(j,3)-lattice.vortex(i,3);
y=dy*lattice.normal(i,2)+dz*lattice.normal(i,3);
z=-dy*lattice.normal(i,3)+dz*lattice.normal(i,2);
[vy0,vz0]=sks_sta(x,y,z,lattice.semisp(i),lattice.vsweep(i),Mach);
% under ground vortex
dy=dy+2*H;
y=dy*lattice.normal(i,2)-dz*lattice.normal(i,3);
z=dy*lattice.normal(i,3)+dz*lattice.normal(i,2);
[vy2,vz2]=sks_sta(x,y,z,lattice.semisp(i),lattice.vsweep(i),Mach);
% total from pair
vy0=vy0-vy2; vz0=vz0-vz2;
vy=vy0*lattice.normal(i,2)-vz0*lattice.normal(i,3);
vz=vy0*lattice.normal(i,3)+vz0*lattice.normal(i,2);
vy=vy0*lattice.normal(i,2)-vz0*lattice.normal(i,3);
vz=vy0*lattice.normal(i,3)+vz0*lattice.normal(i,2);
A(j,i)=vy*lattice.normal(j,2)+vz*lattice.normal(j,3);
end
end
end
otherwise
disp('Unknown symmetry switch')
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function b=rhs(task_id,lattice,Ref,cntr_pos)
% Calculation of right hand sides for main system of linear equations
%
% Input:
% task_id - identificator of solving task
% lattice - aircraft vortex lattice
% Ref - structure with aircraft reference data
% cntr_pos -
%
% Output:
% b - vector of right hand sides
%
N=length(lattice.semisp);
b=zeros(N,1);
switch task_id
case 'zero'
b(:)=-2*pi*lattice.normal(:,1);
case 'alpha'
b(:)=-2*pi*lattice.normal(:,2);
case 'beta'
b(:)=2*pi*lattice.normal(:,3);
case 'roll'
b(:)=(lattice.colloc(:,2)-Ref.Ycg).*lattice.normal(:,3)-...
(lattice.colloc(:,3)-Ref.Zcg).*lattice.normal(:,2);
b=4*pi*b/Ref.Spn;
case 'yaw'
b(:)=4*pi*(lattice.colloc(:,1)-Ref.Xcg).*lattice.normal(:,3)/Ref.Spn;
case 'pitch'
b(:)=-2*pi*(lattice.colloc(:,1)-Ref.Xcg).*lattice.normal(:,2)/Ref.MAC;
case 'control'
b(:)=-2*pi*cntr_pos(:);
otherwise
disp(strcat('RHS: unknown task:_',task_id))
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function A=matr_dot(lattice,Sym,Hground,Mach,Ref)
% Calculation of matrix for "dot" task
%
% Input:
% lattice - aircraft vortex lattice
% Sym - symmetry sign
% Hground - height above ground
% Mach - flow Mach number
% Ref - structure with aircraft reference data
%
% Output:
% A - resulting matrix
%
Hinf=5;
H=Hground*Ref.MAC;
n=length(lattice.semisp);
A=zeros(n,n);
switch Sym
case 1 % Symmetrical solution
if Hground >= Hinf
% Far from ground
for i=1:n
for j=1:n
% j - number of collocation point
% i - numer of vortex
x=lattice.colloc(j,1)-lattice.vortex(i,1);
dy=lattice.colloc(j,2)-lattice.vortex(i,2);
dz=lattice.colloc(j,3)-lattice.vortex(i,3);
y=dy*lattice.normal(i,2)+dz*lattice.normal(i,3);
z=-dy*lattice.normal(i,3)+dz*lattice.normal(i,2);
[vy0,vz0]=sks_dyn(x,y,z,lattice.semisp(i),lattice.vsweep(i),Mach);
vy=vy0*lattice.normal(i,2)-vz0*lattice.normal(i,3);
vz=vy0*lattice.normal(i,3)+vz0*lattice.normal(i,2);
% symmetrical vortex
dy=lattice.colloc(j,2)-lattice.vortex(i,2);
dz=lattice.colloc(j,3)+lattice.vortex(i,3);
y=dy*lattice.normal(i,2)-dz*lattice.normal(i,3);
z=dy*lattice.normal(i,3)+dz*lattice.normal(i,2);
[vy0,vz0]=sks_dyn(x,y,z,lattice.semisp(i),-lattice.vsweep(i),Mach);
vy1=vy0*lattice.normal(i,2)+vz0*lattice.normal(i,3);
vz1=-vy0*lattice.normal(i,3)+vz0*lattice.normal(i,2);
A(j,i)=(vy+vy1)*lattice.normal(j,2)+(vz+vz1)*lattice.normal(j,3);
end
end
else
% Account of ground effects
for i=1:n
for j=1:n
% j - number of collocation point
% i - numer of vortex
x=lattice.colloc(j,1)-lattice.vortex(i,1);
dy=lattice.colloc(j,2)-lattice.vortex(i,2);
dz=lattice.colloc(j,3)-lattice.vortex(i,3);
y=dy*lattice.normal(i,2)+dz*lattice.normal(i,3);
z=-dy*lattice.normal(i,3)+dz*lattice.normal(i,2);
[vy0,vz0]=sks_dyn(x,y,z,lattice.semisp(i),lattice.vsweep(i),Mach);
% under ground vortex
dy=dy+2*H;
y=dy*lattice.normal(i,2)-dz*lattice.normal(i,3);
z=dy*lattice.normal(i,3)+dz*lattice.normal(i,2);
[vy2,vz2]=sks_dyn(x,y,z,lattice.semisp(i),lattice.vsweep(i),Mach);
% total from pair
vy0=vy0-vy2; vz0=vz0-vz2;
vy=vy0*lattice.normal(i,2)-vz0*lattice.normal(i,3);
vz=vy0*lattice.normal(i,3)+vz0*lattice.normal(i,2);
% symmetrical vortex
dy=lattice.colloc(j,2)-lattice.vortex(i,2);
dz=lattice.colloc(j,3)+lattice.vortex(i,3);
y=dy*lattice.normal(i,2)-dz*lattice.normal(i,3);
z=dy*lattice.normal(i,3)+dz*lattice.normal(i,2);
[vy0,vz0]=sks_dyn(x,y,z,lattice.semisp(i),-lattice.vsweep(i),Mach);
% under ground symmetrical vortex
dy=dy+2*H;
y=dy*lattice.normal(i,2)+dz*lattice.normal(i,3);
z=-dy*lattice.normal(i,3)+dz*lattice.normal(i,2);
[vy2,vz2]=sks_dyn(x,y,z,lattice.semisp(i),-lattice.vsweep(i),Mach);
% total from symmetrical pair
vy0=vy0-vy2; vz0=vz0-vz2;
vy1=vy0*lattice.normal(i,2)+vz0*lattice.normal(i,3);
vz1=-vy0*lattice.normal(i,3)+vz0*lattice.normal(i,2);
% matrix coeeficient
A(j,i)=(vy+vy1)*lattice.normal(j,2)+(vz+vz1)*lattice.normal(j,3);
end
end
end
case -1 % Antisymmetrical solution
disp('Antisymmetrical solution')
case 0 % Solution without symmetry
if Hground >= Hinf
% Far from graund
for i=1:n
for j=1:n
% j - number of collocation point
% i - numer of vortex
x=lattice.colloc(j,1)-lattice.vortex(i,1);
dy=lattice.colloc(j,2)-lattice.vortex(i,2);
dz=lattice.colloc(j,3)-lattice.vortex(i,3);
y=dy*lattice.normal(i,2)+dz*lattice.normal(i,3);
z=-dy*lattice.normal(i,3)+dz*lattice.normal(i,2);
[vy0,vz0]=sks_dyn(x,y,z,lattice.semisp(i),lattice.vsweep(i),Mach);
vy=vy0*lattice.normal(i,2)-vz0*lattice.normal(i,3);
vz=vy0*lattice.normal(i,3)+vz0*lattice.normal(i,2);
A(j,i)=vy*lattice.normal(j,2)+vz*lattice.normal(j,3);
end
end
else
for i=1:n
for j=1:n
% j - number of collocation point
% i - numer of vortex
x=lattice.colloc(j,1)-lattice.vortex(i,1);
dy=lattice.colloc(j,2)-lattice.vortex(i,2);
dz=lattice.colloc(j,3)-lattice.vortex(i,3);
y=dy*lattice.normal(i,2)+dz*lattice.normal(i,3);
z=-dy*lattice.normal(i,3)+dz*lattice.normal(i,2);
[vy0,vz0]=sks_dyn(x,y,z,lattice.semisp(i),lattice.vsweep(i),Mach);
% under ground vortex
dy=dy+2*H;
y=dy*lattice.normal(i,2)-dz*lattice.normal(i,3);
z=dy*lattice.normal(i,3)+dz*lattice.normal(i,2);
[vy2,vz2]=sks_dyn(x,y,z,lattice.semisp(i),lattice.vsweep(i),Mach);
% total from pair
vy0=vy0-vy2; vz0=vz0-vz2;
vy=vy0*lattice.normal(i,2)-vz0*lattice.normal(i,3);
vz=vy0*lattice.normal(i,3)+vz0*lattice.normal(i,2);
vy=vy0*lattice.normal(i,2)-vz0*lattice.normal(i,3);
vz=vy0*lattice.normal(i,3)+vz0*lattice.normal(i,2);
A(j,i)=vy*lattice.normal(j,2)+vz*lattice.normal(j,3);
end
end
end
otherwise
disp('Unknown symmetry switch')
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [cy,cz,mx,my,mz]=aer_coef(lattice,circ,Ref,Sym)
% calculation of aerodynamic loads
%
% Output:
% cy - vertical force coefficient
% cz - side force coefficient
% mx - rolling moment coefficient
% my - yawing moment coefficient
% mz - pitching moment coefficient
%
% Input:
% lattice - vortex lattice structure
% circ - circulations of vortex lattice
% Ref - structure with referensial data
% Sym - symmetry sign
N=length(lattice.vsweep);
switch Sym
case 1
cy=0; cz=0; mx=0; my=0; mz=0;
for i=1:N
dcy=2*circ(i)*lattice.semisp(i)*lattice.normal(i,2);
cy=cy+dcy;
mz=mz-dcy*(lattice.vortex(i,1)-Ref.Xcg);
end
cy=4*cy/Ref.Swn;
mz=4*mz/Ref.Swn/Ref.MAC;
case -1
cy=0; cz=0; mx=0; my=0; mz=0;
case 0
cy=0; cz=0; mx=0; my=0; mz=0;
for i=1:N
dx=lattice.vortex(i,1)-Ref.Xcg;
dy=lattice.vortex(i,2)-Ref.Ycg;
dz=lattice.vortex(i,3)-Ref.Zcg;
dp=2*circ(i)*lattice.semisp(i);
dcy=dp*lattice.normal(i,2);
dcz=dp*lattice.normal(i,3);
cy=cy+dcy;
cz=cz+dcz;
mx=mx+dcz*dy-dcy*dz;
my=my+dcz*dx;
mz=mz-dcy*dx;
end
cy=2*cy/Ref.Swn;
cz=2*cz/Ref.Swn;
mx=2*mx/Ref.Swn/Ref.Spn;
my=2*my/Ref.Swn/Ref.Spn;
mz=2*mz/Ref.Swn/Ref.MAC;
otherwise
disp(strcat('AER_COEF: unknown Sym:_',num2str(Sym)))
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [vy,vz]=sks_sta(x,y,z,l_2,tg,M)
% Calculation of steady downwash from horseshoe vortex
%
% Input:
% x - longitudinal coordinate of the collocation point with respect to the
% center of horseshoe vortex
% y - vertical coordinate of the collocation point with respect to the
% center of horseshoe vortex
% z - side coordinate of the collocation point with respect to the
% center of horseshoe vortex
% l_2 - semispan of horseshoe vortex
% tg - tangent of horseshoe vortex sweep
% M - flow Mach number
%
% Output:
% vy - vertical downwash
% vz - side downwash
%
bet2=1-M*M;
bet2tg2=bet2+tg*tg;
%l_2
%z
z1=-l_2-z;
z2= l_2-z;
x1=x-tg*z;
y2=y*y;
r1=x1*x1+bet2tg2*y2;
r3=y2+z1*z1;
r4=y2+z2*z2;
a1=x1-z1*tg;
a2=x1-z2*tg;
r5=sqrt(a1*a1+bet2*r3);
r6=sqrt(a2*a2+bet2*r4);
if r3==0
disp('asas')
end
vy=-z2/r4*((x1-z2*tg)/r6+1)+z1/r3*((x1-z1*tg)/r5+1);
vy=vy-x1/r1*((bet2tg2*z2-x1*tg)/r6-(bet2tg2*z1-x1*tg)/r5);
vy=.5*vy;
vz=1/r3-1/r4-(x1-z2*tg)/r6/r4+(x1-z1*tg)/r5/r3-tg/r1*((bet2tg2*z2-x1*tg)/r6-(bet2tg2*z1-x1*tg)/r5);
vz=.5*y*vz;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [VY,VZ]=sks_dyn(X,Y,Z,AL2,TG,AM)
% Calculation of dynamic downwash from horseshoe vortex
%
% Input:
% X - longitudinal coordinate of the collocation point with respect to the
% center of horseshoe vortex
% Y - vertical coordinate of the collocation point with respect to the
% center of horseshoe vortex
% Z - side coordinate of the collocation point with respect to the
% center of horseshoe vortex
% AL2 - semispan of horseshoe vortex
% TG - tangent of horseshoe vortex sweep
% AM - flow Mach number
%
% Output:
% VY - vertical downwash
% VZ - side downwash
%
EPS=.1*AL2*AL2;
B=1.-AM*AM;
BETSQ=B+TG*TG;
BET=sqrt(BETSQ);
Z1=-AL2-Z;
Z2=AL2-Z;
X1=X-Z*TG;
if (Y < 0 || Y > 0)
YSQ=Y*Y;
R1=Z1*Z1+YSQ;
R2=Z2*Z2+YSQ;
R3=X1-Z1*TG;
R4=X1-Z2*TG;
R0=X1*X1+YSQ*BETSQ;
R5=sqrt(R3*R3+B*R1);
R6=sqrt(R4*R4+B*R2);
R7=B*Z1-R3*TG;
R8=B*Z2-R4*TG;
if (R4 <= 0)
R10=R6-R4;
else
R10=B*R2/(R6+R4);
end
if (R3 <= 0)
R10=R10/(R5-R3);
else
R10=R10*(R5+R3)/(B*R1);
end
VY=(1.+R4/R6)*(R4*Z2+R2*TG)/R2-(1.+R3/R5)*(R3*Z1+R1*TG)/R1...
+(R0+AM*AM*YSQ)/R0*(R8/R6-R7/R5)-(1.+TG*TG)/BET*log((BET*R6...
+R8)/(BET*R5+R7))+TG*log(R10);
VZ=Y*((R6+R4)/R2-(R5+R3)/R1+AM*AM*X1/R0*(R4/R6-R3/R5))+...
TG*(atan(Z2/Y)-atan(Z1/Y)+atan((R4*Z2-R2*TG)/(Y*R6))-...
atan((R3*Z1-R1*TG)/(Y*R5)));
VY=.5*VY;
VZ=.5*VZ;
else
R1=Z1*Z1*B;
R2=Z2*Z2*B;
R3=X1-Z1*TG;
R4=X1-Z2*TG;
R5=sqrt(R3*R3+R1);
R6=sqrt(R4*R4+R2);
R7=B*Z1-R3*TG;
R8=B*Z2-R4*TG;
if (R4 <= 0)
R10=R6-R4;
else
R10=R2/(R6+R4);
end
if (R3 <= 0)
R10=R10/(R5-R3);
else
R10=R10*(R5+R3)/R1;
end
VY=(X1+R6)/Z2-(X1+R5)/Z1+TG*log(R10);
R0=sqrt(B)*abs(X1);
if (R0 < EPS)
VY=VY-sign(Z2)*(1.+TG*TG)/BET*log(abs(Z2/Z1));
else
VY=VY-(1.+TG*TG)/BET*(sign(R8)*log((BET*R6+abs(R8))/...
R0)-sign(R7)*log((BET*R5+abs(R7))/R0));
end
VY=.5*VY;
VZ=0.;
end
end%function
end%file