% This matlabe script is numerically solving the linear beta-plane % equatorial shallow water problem for the third problem of GFD final of fall 2008 clear,clc % the basic parameters T = 50; Ly = 5*pi; Lx = 12*pi; Lz = pi; e = 0.1; Nt = 500; Ny = 60; Nx = 128; Nz = 20; % choose if double the resolution header = {['Parameters: ' ... ' T = ' num2str(T) ... '; Lx = ' num2str(Lx) ... '; Ly = ' num2str(Ly) ]; ... ['Current resolution: ' ... ' Nt = ' num2str(Nt) ... '; Nx = ' num2str(Nx) ... '; Ny = ' num2str(Ny)] }; s{1} = 'Keep the resolution unchanged'; s{2} = 'Double time resolution'; s{3} = 'Double zonal resolution'; s{4} = 'Double meridional resolution'; icase = menu(header,s); switch icase case 2 Nt = 2*Nt; case 3 Nx = 2*Nx; case 4 Ny = 2*Ny; end; dt = T/Nt; dy = Ly/(Ny+1); y = dy*( -Ny/2:Ny/2 )'; dx = Lx/Nx; x = dx*(-Nx/2:Nx/2-1)'; dz = Lz/(Nz-1); z = dz*(0:Nz-1)'; dv = 0.2; mv = 10; cline = [-mv:dv:-dv dv:dv:mv];%choose which contour lines to be shown % the initial values v0 = zeros(Nx,Ny); u0 = zeros(Nx,Ny+1); eta0 = zeros(Nx,Ny+1); Q = zeros(Nx,Ny+1); % choose a case to run header = 'Choose a case'; ss{1} = 'Gill: symmetric heating'; ss{2} = 'Gill: asymmetric heating'; ss{3} = 'Kelvin wave'; ss{4} = 'Gaussian shape initial perturbation'; ss{5} = 'Matsuno: forced stationary motion'; ss{6} = 'Gill: symmetric heating with Gaussian shape in zonal direction'; ss{7} = 'Gill: symmetric heating + asymmetric heating'; ss{8} = 'Gill: delta heating at y = 1'; icase = menu(header,ss); switch icase case 1 x = x + 2*pi; L = 2; Fx = zeros(Nx,1); Fx(abs(x)