% Required functions: ADVOFF_rhs.m and ADVOFF_bc.m utl_contourfill.m clear %% load grid and velocity data load ADVOFF_data.mat grd uvel vvel %% Initialize Passive tracer Po=zeros(grd.I, grd.J); % Initial condition %Po(20:24, 15:18)=5; Po(40, 35)=5; %% Run model tic; [time, P]=ADVOFF_Model (Po, uvel, vvel, grd); toc; x=reshape(Po, [grd.I*grd.J 1]); y=reshape(P(:,:,end), [grd.I*grd.J 1]); Pend=reshape(y, [grd.I grd.J]); % Make movie for ntime=1:length(time) clf; utl_contourfill(grd.lon, grd.lat, P(:,:,ntime),30); tmp=P(:,:,ntime); maxp=max(tmp(:)); caxis([-maxp maxp]); gradsmap4; colorbar 'h' title (datestr(time(ntime))); pause(0.1) end % Plot initial and final states clf subplot(2,1,1); utl_contourfill(grd.lon, grd.lat, Po, 30); tmp=Po; maxp=max(tmp(:)); caxis([-maxp maxp]); gradsmap4; colorbar 'h' subplot(2,1,2); utl_contourfill(grd.lon, grd.lat, P(:,:,end), 30); tmp=P(:,:,end); maxp=max(tmp(:)); caxis([-maxp maxp]); gradsmap4; colorbar 'h'