Anda di halaman 1dari 7

Yussef Rikli

HW#2: Hurrican Sandy Matlab Simulation

ME G200

Assumptions/simplifications:
The main unit of calculation is degrees of latitude or longitude, which are assumed equal= 60 miles (although theres an average difference of 20 miles between them in the general area covered by hurricane) The hurricane is invisid like normal air, to get circulation is constant for all points in the velocity field (map) at a one-time instant. Radius of the core=5 degrees (whether latitude or longitude). An alteration is offered to change it to km, but currently the velocity gradient across the radius is clearer. In the calculation of the position of the pathline particles, the new position is calculated by multiplying the velocity of the point the particle is currently in with the time step(6h), and rounding that new destination to fit on the grid of longitudes and latitudes so that the new location would correspond to a point we have the velocity for (exists on the velocity field, to use it to find distance crossed in the next time step).

General steps of building the code


First two velocity functions are created, one for the particles inside the hurricane core and one outside; The velocity at the core edge is maximum, inside the core it is linearly decreasing and outside it is inversely proportional to its distance from the core (r). The velocity for each point in the map(velocity field) is divided into x and y components (u,v) using trigonometric functions based on the angle between the point and the hurricane center. Next we find the velocity of the hurricane center by dividing the distance it moved in a time step over the length of the time step. Then we add this velocity of the hurricane center to all the other points in the velocity field, this can be done in two ways; 1- Either adding algebraically to all points indiscriminately, so its their velocity plus velocity of the core. 2- Adding the effect of the velocity of the center gradually, such that it is maximum at the center (equal to the center velocity), and dwindles as it gets further away till it becomes zero at the farthest point from the center of the hurricane. Both methods are coded and ready for implementation, but the first one is used for now. With the final U and V velocity fields at the different times prepared, all the outputs are ready for computation. Inputs used from internet sources were; arrays of the maximum wind speed and longitude and latitude of the hurricane center, these two were used in the velocity functions for the velocity field, coupling them to the time instances of these geographic coordinates the velocity of the core center can be computed.

Yussef Rikli

HW#2: Hurrican Sandy Matlab Simulation

ME G200

Dynamic Portions of the code:


Line(s) 19-58 What/how Adding rows of data or changing current ones. effect Will integrate into the simulation and affect the results. restriction Must maintain the column format. Points have to be in north and western hemispheres.

68

Erase %.

71

Erase %

74-77

xl=largest latitude xs=smallest latitude yl=largest longitude ys=smallest longitude margin

Change the rotation direction of the hurricane and produce VERY different results. Change the radius of the core from 5 degrees=5*1.6*60 km, To 5km Affects pathlines and streamlines. The location and size of the computed velocity field on the map.

xl=2-180 xs=1-179 yl= 2-180 ys=1-179

84

87

Add a cell to CITY in the form : {latitude, absolute


value of longitude, '<Name of city'}

The margin added to the edges of the velocity field when displaying the map. In other words, zooming in or out. See how the stream and pathlines at these cities.

Points have to be in north and western hemispheres. Points shouldnt be close to the edge of the velocity field, for pathline calculation.

113 & 111 121 & 122 178

Erase ;% Add ;% before +vcx(t); and +vcy(t); Change the 10 to increase or decrease the font size of the cities Replace off with on Change the number of pause(in seconds) between the consecutive time iterations Add % at beginning of line

The velocity of points will be affected by the velocity of center based on their distance from it, and not indiscriminately

185 190 &218

View streamlines of the cities simultaneously Plot faster or slower

183 & 213

View plot on global map.

Yussef Rikli

HW#2: Hurrican Sandy Matlab Simulation

ME G200

Possible improvements:
Calculate error between velocities at cities with actual measured velocities available. Fixing the streaklines code. using matlabs plotm, which is much easier for geospatial applications.

The matlab code:


clc clear all %--------------HURRICANE SANDY--------------% %DATA FROM; %Table 1. Best track for Hurricane Sandy, 22 29 October 2012. %IN PAGE 24 and 25 OF %"Tropical Cyclone Report %Hurricane Sandy %(AL182012) %22 29 October 2012 %Eric S. Blake, Todd B. Kimberlain, Robert J. Berg, John P. Cangialosi and John L. Beven II %National Hurricane Center %12 February 2013" % |days speed(kt) L =1.0e+003 *[0.0210 0.0220 0.0220 0.0220 0.0220 0.0230 0.0230 0.0230 0.0230 0.0240 0.0240 0.0240 0.0240 0.0240 0.0250 0.0250 0.0250 0.0250 0.0250 0.0250 0.0260 |hours 1.8000 0 0.6000 1.2000 1.8000 0 0.6000 1.2000 1.8000 0 0.6000 1.2000 1.8000 1.9000 0 0.5250 0.6000 0.9000 1.2000 1.8000 0 |lat(deg) |long(deg)|pressure |max 0.0143 0.0139 0.0135 0.0131 0.0127 0.0126 0.0129 0.0134 0.0140 0.0147 0.0156 0.0166 0.0177 0.0179 0.0189 0.0200 0.0201 0.0209 0.0217 0.0233 0.0248 0.0774 0.0778 0.0782 0.0786 0.0787 0.0784 0.0781 0.0779 0.0776 0.0773 0.0771 0.0769 0.0767 0.0766 0.0764 0.0760 0.0760 0.0757 0.0755 0.0753 0.0759 1.0060 1.0050 1.0030 1.0020 1.0000 0.9980 0.9980 0.9950 0.9930 0.9900 0.9870 0.9810 0.9720 0.9710 0.9640 0.9540 0.9540 0.9600 0.9660 0.9630 0.9650 0.0250 0.0250 0.0250 0.0300 0.0350 0.0400 0.0400 0.0400 0.0450 0.0550 0.0600 0.0650 0.0750 0.0750 0.0850 0.1000 0.1000 0.0950 0.0950 0.0900 0.0750

Yussef Rikli
0.0260 0.0260 0.0260 0.0270 0.0270 0.0270 0.0270 0.0280 0.0280 0.0280 0.0280 0.0290 0.0290 0.0290 0.0290 0.0290 0.0290 0.0300 ^days

HW#2: Hurrican Sandy Matlab Simulation


0.6000 1.2000 1.8000 0 0.6000 1.2000 1.8000 0 0.6000 1.2000 1.8000 0 0.6000 1.2000 1.8000 2.1000 2.3300 0 ^hours 0.0257 0.0264 0.0270 0.0275 0.0281 0.0288 0.0297 0.0305 0.0313 0.0320 0.0328 0.0339 0.0353 0.0369 0.0383 0.0388 0.0394 0.0395 ^lat(deg) 0.0764 0.9680 0.0700 0.0769 0.9700 0.0650 0.0772 0.9710 0.0650 0.0771 0.9690 0.0600 0.0769 0.9680 0.0600 0.0765 0.9560 0.0700 0.0756 0.9600 0.0700 0.0747 0.9600 0.0650 0.0739 0.9590 0.0650 0.0730 0.9540 0.0650 0.0720 0.9520 0.0650 0.0710 0.9500 0.0700 0.0705 0.9470 0.0800 0.0710 0.9450 0.0850 0.0732 0.9400 0.0800 0.0740 0.9430 0.0750 0.0744 0.9450 0.0700 0.0745 0.9460 0.0700] ^long(deg) ^pressure ^max

ME G200

% speed(kt)

T(1,:)=(L(:,1).*24)+(L(:,2)/100); %linearizing the time line at which the velocities are give in units of hours. xc(1,:)=L(:,3); yc(1,:)=L(:,4); %are the coordinates of the hurricane center. umax(1,:)=L(:,6)%.*-1 %add the multiplication by -1 for clockwise hurricane rotation.(currently counter clockwise) rmax=5 %/(1.6*60) %the assumed radius of the hurricane core(unit is degrees) xl=50 xs=1 %can't=0 or be negative yl=120 ys=50 %can't=0 or be negative %these are the largest and smallest lat/long lines, or edges of the %computed velocity field (grid 1 degree apart). the (0,0) origin for this field is %lat=long=0. this field should be large enough to calculate the velocities %in the vicinity of the desired cities. and the lines should never=0 or %become -ive. margin=10 %map plot margin in length of degrees CITY={{40,74,'<NYC'},{32,65,'<Bermuda'},{30,80,'<Florida'},{37,76,'<Virginia' },{40,86,'<Indiana'}} %NOTE: cities near the equator may cause errors, as their particles may get %carried below the equator, which would cause an error. also the negative

Yussef Rikli

HW#2: Hurrican Sandy Matlab Simulation

ME G200

%longitude values should be put positive.

%VELOCITY OF CENTER AT ALL TIMES for t=2:size(T,2) vc(t)=sqrt((xc(t)-xc(t-1))^2+(yc(t)-yc(t-1))^2)/(T(t)-T(t-1)); vcx(t)=(xc(t)-xc(t-1))/(T(t)-T(t-1)); vcy(t)=(yc(t)-yc(t-1))/(T(t)-T(t-1)); end

%VELOCITY COMPONENTS FIELD FOR ALL PARTICLES AT ALL TIMES for t=1:size(T,2) for x=xs:xl for y=ys:yl G(t)=umax(t)*2*pi*rmax; r(x,y,t)=sqrt((x-xc(t))^2+(y-yc(t))^2); if r(x,y,t)>rmax u(x,y,t)=(G(t)/(2*pi*r(x,y,t)));% +(vc(t) (vc(t)/(max(r(:,:,t)))*r(x,y,t))); else u(x,y,t)=((umax(t)/rmax)*r(x,y,t));% +(vc(t) (vc(t)/(max(r(:,:,t)))*r(x,y,t))); %for an effect of center velocity that dwindles with distance, and is not constant for all points in the field. end theta(x,y,t)=atan2((x-xc(t)),(y-yc(t))); ux(x,y,t)=u(x,y,t)*sin(theta(x,y,t)+90);%this should be wrong because i'm using 90 with sin here and not sind, but it works uy(x,y,t)=u(x,y,t)*cos(theta(x,y,t)+90); U(x,y,t)=ux(x,y,t)+vcx(t); V(x,y,t)=uy(x,y,t)+vcy(t); end end end

%PARTICLES FOR STREAKLINES AND PATHLINES %PROBLEM FOR STREAKLINES: P=3 DDDOOEESSN'TT EXXIISSSTTT; xp(3,:) is zero or %doesn't exist.(although it should!!) for p=1:t for t=2:size(T,2) for city=1:size(CITY,2) dx(p,1)=0; dy(p,1)=0; xp(p,1,city)=CITY{city}{1};

Yussef Rikli

HW#2: Hurrican Sandy Matlab Simulation


yp(p,1,city)=CITY{city}{2}; xp(p,t,city)=xp(p,t-1,city)+dx(p,t-1); yp(p,t,city)=yp(p,t-1,city)+dy(p,t-1);

ME G200

up(p,t,city)=U(round(xp(p,t,city)),round(yp(p,t,city)),t-1); vp(p,t,city)=V(round(xp(p,t,city)),round(yp(p,t,city)),t-1);

dx(p,t,city)=up(p,t,city)*(T(t)-T(t-1))*(1.15/60); %in degrees longitude dy(p,t,city)=vp(p,t,city)*(T(t)-T(t-1))*(1.15/60); %in degrees latitude

end end end

%PLOT OF VELOCITY FIELD OVER TIME WITH STREAMLINES for t=1:size(T,2) map = imread('equidistancecropped.jpg'); imshow(map) image([180,-180],[80,-80],map) set(gca,'YDir','normal') hold on for b=1:size(CITY,2) quiver(V(:,:,t),U(:,:,t)) plot(yc(1,1:t),xc(1,1:t),'-y.','markersize',12) streamline(V(:,:,t),U(:,:,t),CITY{b}{2},CITY{b}{1}) %plot(yp(1,1:t,b),xp(1,1:t,b),'-r ^','markersize',5) text(CITY{b}{2},CITY{b}{1},CITY{b}(3), 'fontsize', 10,'HorizontalAlignment','left') xlabel('Degrees longitude W(-ive)') ylabel('Degrees latitude N') axis equal %tight axis([ys-margin,yl+margin,xs-margin,xl+margin]) set(gca,'XDir','reverse') hold on end hold off %grid on

Yussef Rikli
pause(.3) end

HW#2: Hurrican Sandy Matlab Simulation

ME G200

%PLOT OF STREAMLINES AND PATHLINES FOR INDIVIDUAL CITIES for b=1:size(CITY,2) map = imread('equidistancecropped.jpg'); imshow(map) image([180,-180],[80,-80],map) set(gca,'YDir','normal') hold on for t=1:size(T,2) plot(yp(1,1:t,b),xp(1,1:t,b),'- g*') streamline(V(:,:,t),U(:,:,t),CITY{b}{2},CITY{b}{1}) text(CITY{b}{2},CITY{b}{1},CITY{b}(3), 'fontsize', 10,'HorizontalAlignment','left') xlabel('Degrees longitude W') ylabel('Degrees latitude N') axis equal %tight axis([ys-margin,yl+margin,xs-margin,xl+margin]) set(gca,'XDir','reverse') pause(.3) end hold off end

Anda mungkin juga menyukai