/[MITgcm]/MITgcm_contrib/gael/matlab_class/gcmfaces_calc/calc_MeridionalTransport.m
ViewVC logotype

Contents of /MITgcm_contrib/gael/matlab_class/gcmfaces_calc/calc_MeridionalTransport.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.6 - (show annotations) (download)
Sat Nov 19 15:22:40 2016 UTC (8 years, 8 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, HEAD
Changes since 1.5: +8 -1 lines
- grid_load.m: remove call to gcmfaces_lines_zonal and gcmfaces_lines_transp
- calc_MeridionalTransport.m, calc_mermean_T.m, calc_overturn.m, calc_zonmean_T.m,
  calc_zonmedian_T.m, gcmfaces_section.m, diags_display.m, diags_grid_parms.m, figureL.m,
  example_transports_disp.m: call gcmfaces_lines_zonal and / or gcmfaces_lines_transp to
  initialize LATS_MASKS, LONS_MASKS, or LINES_MASKS if needed.

1 function [FLD]=calc_MeridionalTransport(fldU,fldV,varargin);
2 %object: compute net meridional transports of e.g. heat or fresh water
3 %inputs: fldU and fldV are the fields of grid point transport
4 %optional: doScaleWithArea, if 1 then multiply fldU by
5 % dyg.*drf and accordingly for fldV.
6 % If 0 (default) then it is assumed that those factors
7 % have already been included (e.g. by pkg/diagnostics).
8 %output: FLD is the integrated transport vector (one point per latitude).
9 %
10 %notes: mygrid.LATS_MASKS is the set of quasi longitudinal lines along which
11 % transports will integrated, as computed in gcmfaces_lines_zonal
12
13 gcmfaces_global;
14
15 if nargin==3; doScaleWithArea=varargin{1}; else; doScaleWithArea=0; end;
16
17 %check that LATS_MASKS has already been defined:
18 if ~isfield(mygrid,'LATS_MASKS');
19 fprintf('one-time initialization of gcmfaces_lines_zonal: begin\n');
20 gcmfaces_lines_zonal;
21 fprintf('one-time initialization of gcmfaces_lines_zonal: end\n');
22 end;
23
24 %initialize output:
25 n3=max(size(fldU.f1,3),1); n4=max(size(fldV.f1,4),1);
26 FLD=NaN*squeeze(zeros(length(mygrid.LATS_MASKS),n4));
27
28 %prepare fldU/fldV:
29 fldU(isnan(fldU))=0; fldV(isnan(fldV))=0;
30
31 if doScaleWithArea;
32 dxg=mk3D(mygrid.DXG,fldU); dyg=mk3D(mygrid.DYG,fldU); drf=mk3D(mygrid.DRF,fldU);
33 for k4=1:n4;
34 fldU(:,:,:,k4)=fldU(:,:,:,k4).*dyg.*drf;
35 fldV(:,:,:,k4)=fldV(:,:,:,k4).*dxg.*drf;
36 end;
37 end;
38
39 %use array format to speed up computation below:
40 fldU=convert2array(fldU); fldV=convert2array(fldV);
41
42 for iy=1:length(mygrid.LATS_MASKS);
43
44 %get list ofpoints that form a zonal band:
45 mskW=mygrid.LATS_MASKS(iy).mskWedge;
46 vecW=gcmfaces_subset(mskW,fldU);
47 mskS=mygrid.LATS_MASKS(iy).mskSedge;
48 vecS=gcmfaces_subset(mskS,fldV);
49
50 %store vertically integrated transport:
51 FLD(iy,:)=nansum(nansum(vecW,1)+nansum(vecS,1),2);
52
53 end;
54
55

  ViewVC Help
Powered by ViewVC 1.1.22