• Tidak ada hasil yang ditemukan

Plot contour using matlab and octave

N/A
N/A
Protected

Academic year: 2023

Membagikan "Plot contour using matlab and octave"

Copied!
11
0
0

Teks penuh

(1)

Plot contour using matlab and octave

(example: geostrophic vorticity and vorticity advection)

(2)

% Constants

Lx = 6000.e3; % wave length in X (6000 km) Ly = 4000.e3; % wave length in Y (4000 km) k = 2*pi/Lx; % zonal wavenumber [1/m]

l = 2*pi/Ly; % meridional wavenumber [1/m]

...

Define constants

% Define domain size

x1 = (-3000:100:3000)*1.e3; % set domain in x [m]

y1 = (-1000:100:1000)*1.e3; % in y [m]

[x,y] = meshgrid(x1,y1); % make 2D matrix

Set domain

Same as previous lecture

(3)

% compute variables (monochromatic wave) phi = 55000 - U*f0*(y);

phi = 55000 - U*f0*(y);

phi = phi + amp*sin(k*x).*cos(l*y);

Ug = U + amp*l*sin(k*x).*sin(l*y)/f0;

Vg = amp*k*cos(k*x).*cos(l*y)/f0;

vor = -amp*(k^2+l^2)* sin(k*x).*cos(l*y)/f0;

vor_x = -amp*(k^2+l^2)*k*cos(k*x).*cos(l*y)/f0;

vor_y = amp*(k^2+l^2)*l*sin(k*x).*sin(l*y)/f0;

vor_adv = -Ug.*vor_x -Vg.*(vor_y+b0);

Compute values

(4)

Source: http://folk.ntnu.no/leifh/teaching/tkt4140

Laplacian (

2

Φ = Φ

xx

+ Φ

yy

)

(5)

Source: http://folk.ntnu.no/leifh/teaching/tkt4140

Laplacian (

2

Φ = Φ

xx

+ Φ

yy

)

(6)

Source: http://folk.ntnu.no/leifh/teaching/tkt4140

Laplacian (

2

Φ = Φ

xx

+ Φ

yy

)

(7)

Source: http://folk.ntnu.no/leifh/teaching/tkt4140

Laplacian (

2

Φ = Φ

xx

+ Φ

yy

)

(8)

% compute variables (monochromatic wave) phi = 55000 - U*f0*(y);

phi = 55000 - U*f0*(y);

phi = phi + amp*sin(k*x).*cos(l*y);

Ug = U + amp*l*sin(k*x).*sin(l*y)/f0;

Vg = amp*k*cos(k*x).*cos(l*y)/f0;

% If you like numerical methods --- dx = 100.e3; dy = 100.e3;

Vor = 4*del2(phi, dx, dy)/f0;

[vor_x, vor_y] = gradient(vor, dx, dy) vor_adv = -Ug.*vor_x -Vg.*(vor_y+b0);

Compute values

(9)

% Figure2: plot Geopotential and vorticity figure(2)

subplot(2,1,1) % geopotential

[cs,h]=contour(x/1000,y/1000,phi,'linewidth',4);

clabel(cs,h,'LabelSpacing’,400) axis([-3000,3000,-1000,1000]))

xlabel('x (km)’); ylabel('y (km)') title('Geopotential (m^2/s^2)')

Plot contour

(10)

% Figure2: plot Geopotential and vorticity figure(2)

subplot(2,1,1) % geopotential ...

subplot(2,1,2) % vorticity and its advection [cs,h]=contourf(x/1000,y/1000,vor_adv,9);

caxis([-1.2e-9, 1.2e-9]), hold on

[cs,h]=contour(x/1000,y/1000,vor,'linewidth',2);

clabel(cs,h,'LabelSpacing',400) axis([-3000,3000,-1000,1000])

title('Vorticity and vorticity advection') xlabel('x (km)'), ylabel('y (km)')

Plot contour

(11)

Handel colormap & save figure

% Figure2: plot Geopotential and vorticity figure(2)

subplot(2,1,1) % geopotential ...

subplot(2,1,2) % vorticity advection ...

colorbar('southoutside') colormap('jet')

colorbar

% save graphical current figure (gcf) as PDF saveas(gcf,'geo_vorticity.pdf')

Referensi

Dokumen terkait

Whereas by The Real Property Act of 1861, and The Real Property Act of 1877, and the several Acts relating to the Registration of Deeds, that is to say,-An Act of the Governor and