0 оценок0% нашли этот документ полезным (0 голосов)
14 просмотров5 страниц
Impulsive start, possibly followed by an impulsive stop, by the discrete-vortex 3 % method with uniform elements 4 clear 5 clc 6 % input parameters 7 n = 200; % input the number of elements 8 ntsteps = 300; % the number of time steps for this run 9 tstop = 205.
Impulsive start, possibly followed by an impulsive stop, by the discrete-vortex 3 % method with uniform elements 4 clear 5 clc 6 % input parameters 7 n = 200; % input the number of elements 8 ntsteps = 300; % the number of time steps for this run 9 tstop = 205.
Impulsive start, possibly followed by an impulsive stop, by the discrete-vortex 3 % method with uniform elements 4 clear 5 clc 6 % input parameters 7 n = 200; % input the number of elements 8 ntsteps = 300; % the number of time steps for this run 9 tstop = 205.
1 % Unsteady Flow over a Flat Plate following an impulsive Start, 2 % possibly followed by an impulsive stop, by the discrete-vortex 3 % method with uniform elements 4 clear 5 clc 6 % input parameters 7 n = 200; % input the number of elements 8 ntsteps = 300; % input the number of time steps for this run 9 tstop = 205; % the time step when the impulsive start is 10 % followed by an impulsive stop 11 % input the angle of attack in degrees 12 alfa = 20; 13 sa = sind(alfa); 14 ca = cosd(alfa); 15 np = n + 1; 16 dx = 1/n; 17 dx34 = 3*dx/4; 18 dx14 = dx/4; 19 % input the cut-off to avoid the singularity 20 % associated with the vortices in the wake 21 cutoff = 0.25*dx; 22 % time step for more-or-less evenly 23 % spaced vortices in the wake 24 dt = dx; 25 % control points 26 xcpt = (0:n-1)*dx + dx34; 27 % vortex points 28 xvor = (0:n)*dx + dx14 29 yvor(1:np) = 0; 30 ycpt(1:n) = 0; 31 % first n rows of the influence matrix, which is 32 % independent of alfa, and the right-hand side 33 for i = 1:n; 34 R(i) = -sa; 35 for j = 1:np; 36 A(i,j) = 1/(xcpt(i) - xvor(j)); 37 end 38 end 39 % last row to sum for the circulation 40 A(np,1:np) = 1; 41 R(np) = 0; 42 % instant just after the start, time = 1 43 G = inv(A)*R'; 44 % velocity jump; note 2*pi, which 45 % was missing in in A(i,j) 46 du = -2*pi*G./dx; -1- C:\Users\Domenico\Documents\MATLAB\start.m marted 11 febbraio 2014 14:57 47 % rotate the plate through alfa 48 % here we take the freestream to be horizontal 49 % and place the plate at an angle of attack 50 yv = -xvor*sa; 51 yc = -xcpt*sa; 52 xv = xvor*ca; 53 xc = xcpt*ca; 54 % XXXXXXXXXXXXXX FIGURE(1) XXXXXXXXXXXXXXXXXX 55 % coordinates for plotting the 56 % plate at an angle of attack 57 xplate(1) = 0; xplate(2) = ca; 58 yplate(1) = 0; yplate(2) = -sa; 59 figure(1) 60 plot( xplate,yplate,':k', xv,yv,'.g', xc,yc,'xb') 61 axis equal 62 axis ([-.2, 1.2, -.5 .2]); 63 xlabel('\bf\itx','fontsize',14); 64 ylabel('\bf\ity ','fontsize',14) 65 set(get(gca,'YLabel'),'Rotation',0.0) 66 title([num2str(n),' panels']) 67 % XXXXXXXXXXXXXX FIGURE(2) XXXXXXXXXXXXXXXXXXX 68 % the exact steady-state solution, the exact 69 % unsteady solution does not exist 70 nplot = 100; 71 x = linspace(.01,1,nplot); 72 due = 2*sa*sqrt((1-x)./x); 73 figure(2) 74 plot( x, due, xvor,du,'.', xvor,du, xvor,yvor,'.g', xcpt,ycpt,'xb' ) 75 xlabel('\bf\itposition on the plate','fontsize',12 ); 76 ylabel('\bf\it\Deltau ','fontsize',14) 77 set(get(gca,'YLabel'),'Rotation',0.0) 78 time = 1; 79 title([num2str(n),' panels, time step = ',num2str(time)]) 80 axis ([-.05, 1.05, -7 7]); 81 grid 82 % check figures 1 and 2 83 pause 84 % the initial value of phi (vel. potential) around the plate 85 phiO(1:np) = 0; 86 % the initial sum of the circulations around the vortices 87 % in the wake, sum(Gw) 88 sgw = 0; 89 %XXXXXXXXXX time-marching begins here XXXXXXXXXXXXXXXX 90 for time = 2:ntsteps 91 % step 1:shed the 'starting' vortex at the trailing 92 % edge at the beginning of the time step -2- C:\Users\Domenico\Documents\MATLAB\start.m marted 11 febbraio 2014 14:57 93 % one vortex is added to the wake at each time step 94 Gw(time-1) = G(np); 95 xw(time-1) = xv(np); 96 yw(time-1) = yv(np); 97 gammaC(time-1) = sum(G(1:n)); 98 % update the sum of the circulations around the vortices in the wake 99 sgw = sgw + Gw(time-1); 100 % step 2: convect the wake to its new position 101 % to convect the wake, first find the velocity 102 % at the location of each vortex in the wake, 103 for j = 1:time-1 104 xp = xw(j); 105 yp = yw(j); 106 % contribution to the velocity from the freestream 107 u(j) = 1; 108 v(j) = 0; 109 if time > tstop 110 u(j) = 0; % used when the impulsive start is 111 v(j) = 0; % followed by an implusive stop 112 end 113 % contribution from the bound vortex sheet (the plate) 114 for i = 1:n; 115 rsq = ( xp - xv(i) )^2 + ( yp - yv(i) )^2; 116 f = G(i)/rsq; 117 u(j) = u(j) - f*( yp - yv(i) ); 118 v(j) = v(j) + f*( xp - xv(i) ); 119 end 120 % contribution from the free vortex sheet (the wake) 121 for i = 1:time-1 122 rsq = ( xp - xw(i) )^2 + ( yp - yw(i) )^2; 123 if rsq > cutoff; 124 f = Gw(i)/rsq; 125 u(j) = u(j) - f*( yp - yw(i) ); 126 v(j) = v(j) + f*( xp - xw(i) ); 127 end 128 end 129 end 130 % step 3: move each vortex in the wake to its 131 % new position using a simple Euler algorithm 132 for i = 1:time-1 133 xw(i) = xw(i) + u(i)*dt; 134 yw(i) = yw(i) + v(i)*dt; 135 end 136 % the wake is now in its new position and so the downwash 137 % (the velocity associated with the vorticity in the wake) 138 % on the wing has changed and must be re-computed -3- C:\Users\Domenico\Documents\MATLAB\start.m marted 11 febbraio 2014 14:57 139 % step4: re-compute the downwash from the wake and the 140 % freestream on the plate the influence matrix does not change 141 for i = 1:n 142 xp = xc(i); 143 yp = yc(i); 144 % contribution to the velocity from the freestream 145 uu = 1; 146 vv = 0; 147 if time > tstop 148 uu = 0; % used when the impulsive start is 149 vv = 0; % followed by an impulsive stop 150 end 151 % contribution from the wake 152 for k = 1:time - 1 153 rsq = ( xp - xw(k) )^2 + ( yp - yw(k) )^2; 154 f = Gw(k)/rsq; 155 uu = uu - f*( yp - yw(k) ); 156 vv = vv + f*( xp - xw(k) ); 157 end 158 % the right-hand side now contains the velocity of the freestream 159 % and that associated with wake's vorticity 160 R(i) = - uu*sa - vv*ca; 161 end 162 % the sum of the circulations in the wake plus the sum of the 163 % circulations on the plate plus the circulation for the new 164 % vortex at the trailing edge must add up to zero: transpose of 165 % the known circulations in the wake 166 R(np) = -sgw; 167 % step 5: compute the new distribution of 168 % circulation on the plate 169 G = inv(A)*R'; 170 % this is the end of the calculations for this time 171 % step -- the wake is in its new position and the 172 % circulations on the plate plus the new vortex at 173 % the trailing edge have been determined so that the 174 % no-penetration and Kutta conditions are satisfied, 175 % consistent with the wake in its new position, and 176 % the circulation around the plate and its wake is 177 % still zero 178 % XXXXXXXXXXXXX figure(1) XXXXXXXXXXXXXXX 179 % plot the wake as it's being calculated 180 figure(1) 181 plot(xv(np), yv(np),'.r', xw,yw,'.r','linewidth',1); 182 hold on 183 plot(xplate, yplate,' k','linewidth',2); 184 axis equal -4- C:\Users\Domenico\Documents\MATLAB\start.m marted 11 febbraio 2014 14:57 185 xlabel('\bf\itx','fontsize',14); 186 ylabel('\bf\ity ','fontsize',14) 187 set(get(gca,'YLabel'),'Rotation',0.0) 188 title([num2str(n),' panels, Time Step = ',num2str(time)]) 189 hold off 190 % XXXXXXXXXXXXX figure(2) XXXXXXXXXXXXXXXXX 191 % plot the pressure jump as it's being calculated 192 for i = 1:np 193 phi(i) = sum( G(1:i) ); 194 end 195 % d(phi)/dt 196 dGdt = -2*pi*( phi(1:np) - phiO(1:np) )/dt; 197 phiO = phi; 198 du2 = -2*pi*G(1:np)./dx; 199 up = ca + du2; 200 ul = ca - du2; 201 cpu = 1 - up.*up; 202 cpl = 1 - ul.*ul; 203 dcp = -2*dGdt' - cpl + cpu; 204 figure(2) 205 plot(xv, dcp) 206 xlabel('\bf\itx','fontsize',14); 207 ylabel('\bf\it\DeltaC_P ','fontsize',14) 208 set(get(gca,'YLabel'),'Rotation',0.0) 209 grid 210 title([num2str(n),' panels, time step = ',num2str(time)]) 211 % XXXXXXXXXXX figure(3) XXXXXXXXXXXXXXXXXXX 212 % plot the velocity jump a cross the plate as it's being calculated 213 du = -2*pi*G/dx; 214 up = ca + 0.5*du; 215 upe = ca + 0.5*due; 216 ul = ca - 0.5*du; 217 ule = ca - 0.5*due; 218 figure(3) 219 plot(xv, up, xv, ul) 220 xlabel('\it\bfx','fontsize',14); 221 ylabel('\bf\itvelocity along the surfaces','fontsize',12) 222 axis([-.1, 1.1, -1, 3]) 223 title([num2str(n),' panels, time step = ',num2str(time)]) 224 grid 225 drawnow 226 % end of the "for"-loop in the time-marching 227 end -5-