Documentation of residual_term


Global Index (short | long) | Local contents | Local Index (short | long)


Help text

The vertical diffusivity between the first and second
>layer
>is set to be no less than 20 cm^2/s, so effectively giveing a mixed layer
of
>at least 50 m depth.
>
>**Typical value of the thermocline diffusivity in the tropics is the
default
>minimum of 0.3 cm^2/s

Cross-Reference Information

This script calls

Listing of script residual_term



clear

loadpcs;

lims = [180 270 -3 3];
tim = 101:1000;
lags = -12:12;

temp = getnc('temp', lims, 1:10, tim);
[lat, lon, depth] = getll('temp', lims);

temp = shiftdim(squeeze(mean2(shiftdim(temp, 2))), 1);
treg = regress_eof(temp, lpcs(:,1), lags);

figure(1); fo(1); clf

lind = find(lags == 6);

subplot(2,2,1);
pncont(lon, -depth, squeeze(treg(lind,:,:)), [-0.5:.01:0.5], 0, 'k');
axis([180 270 -550 0]);
set(gca, 'YTick', sort(-depth));

%  Set up centered 2nd order difference:  look at residual term for
%  3rd and 4th level

depth2 = [0; depth];
lagind = -1; lind = find(lags == lagind);
tem = squeeze(treg(lind,:,:));
tem = [tem(1,:); tem];

lagind = lags;
clear dz2;

for lind = lagind;
tem = squeeze(treg(lind+max(abs(lagind))+1,:,:));
tem = [tem(1,:); tem];
for lev = 2:9;
  temlev = depth2(lev)+0.5*diff(depth2(lev:(lev+1)));
  ddepth = [depth2((lev-1):(lev+2))-temlev]';
%  ddepth = [    -diff(depth2((lev-1):lev)) ...
%	  -0.5*diff(depth2(lev:(lev+1))) ...
%	  0.5*diff(depth2(lev:(lev+1))) ...
%	      diff(depth2((lev+1):(lev+2)))];
  dz = diff(depth2(lev:(lev+1)));
  ddepth = ddepth ./ dz;
  mat = [ddepth.^0; ddepth.^1; ddepth.^2; ddepth.^3];
  abc = inv(mat)*[0; 0; 2/dz.^2; 0];
  dz2(lind+max(abs(lagind))+1,lev-1,:) = abc'*squeeze(tem((lev-1):(lev+2), :));
end
end

depth3 = depth(1:8)+0.5*diff(depth(1:9));
subplot(2,2,2);
pncont(lon, -depth3, 1e4*squeeze(dz2(find(lagind==-1),:,:)), [-2:.1:2], 0, 'k');
axis([180 270 -550 0]);
set(gca, 'YTick', sort(-depth));

%  Multiply by typical diffusivity

fz = 1e-4*[20 1 0.3*ones(1, 6)]' * ones(1, size(dz2, 3));
clear dres
for i = lagind;
  dres(i+max(abs(lagind))+1,:,:) = fz.*squeeze(dz2(i+max(abs(lagind))+1,:,:));
end
dres = 1e3 * 4.218e3 * dres;

subplot(2,2,3);
pncont(lon, -depth3, squeeze(dres(find(lagind==5),:,:)), [-2:.01:2], 0, 'k');
axis([180 270 -550 0]);
set(gca, 'YTick', sort(-depth));

%  Now integrate over depth:

dz = diff(depth3(1:4));
dz(3) = 0.5*dz(3);

for i = lagind;
  lind = i+max(abs(lagind))+1;
  tem = dz'*squeeze(dres(lind,1:3,:));
  magdres(lind) = mean2(mean2(tem));
end

subplot(2,2,4);
plot(lagind, magdres);
axis([-10 10 -1.5 2.5])
grid on

dz = diff(depth(3:8));
dz(1) = 0.5*dz(1); dz(5) = 0.5*dz(5);

for i = lagind;
  lind = i+max(abs(lagind))+1;
  tem = dz'*squeeze(dres(lind,3:7,:));
  magdres(lind) = mean2(mean2(tem));
end

subplot(2,2,4);
plot(lagind, magdres);
axis([-10 10 -1.5 2.5])
grid on