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

Annotation 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.5 - (hide annotations) (download)
Mon Aug 29 16:49:04 2011 UTC (13 years, 11 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65x, checkpoint65r, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u
Changes since 1.4: +7 -13 lines
>> clean up and speed up transport computations.

- added routines
gcmfaces_edge_mask		infer edge masks associated with an interior subdomain mask
gcmfaces_subset			extract subset of unmasked points from field (e.g. for transports)

- modified routines
gcmfaces_lines_zonal	use gcmfaces_edge_mask and make field names in
						LATS_MASKS more explicit (mskCint, mskCedge, etc.)
gcmfaces_lines_transp	same thing for section masks; also remove the
						longer arc masks (we only use the shorter arcs)
calc_zonmean_T			use new names (see gcmfaces_lines_zonal)
calc_zonmedian_T		use new names (see gcmfaces_lines_zonal)
calc_overturn			use new names (see gcmfaces_lines_zonal) and gcmfaces_subset
calc_MeridionalTransport use new names (see gcmfaces_lines_zonal) and gcmfaces_subset
calc_transports			use new names (see gcmfaces_lines_transp) and gcmfaces_subset
disp_transport			fix case of a single record

1 gforget 1.3 function [FLD]=calc_MeridionalTransport(fldU,fldV,varargin);
2 gforget 1.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 gforget 1.4 % dyg.*drf and accordingly for fldV.
6 gforget 1.2 % 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 gforget 1.3 %
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 gforget 1.1
13     global mygrid;
14    
15 gforget 1.3 if nargin==3; doScaleWithArea=varargin{1}; else; doScaleWithArea=0; end;
16 gforget 1.1
17     %initialize output:
18     n3=max(size(fldU.f1,3),1); n4=max(size(fldV.f1,4),1);
19 gforget 1.3 FLD=NaN*squeeze(zeros(length(mygrid.LATS_MASKS),n4));
20 gforget 1.1
21     %prepare fldU/fldV:
22     fldU(isnan(fldU))=0; fldV(isnan(fldV))=0;
23    
24     if doScaleWithArea;
25     dxg=mk3D(mygrid.DXG,fldU); dyg=mk3D(mygrid.DYG,fldU); drf=mk3D(mygrid.DRF,fldU);
26     for k4=1:n4;
27 gforget 1.4 fldU(:,:,:,k4)=fldU(:,:,:,k4).*dyg.*drf;
28     fldV(:,:,:,k4)=fldV(:,:,:,k4).*dxg.*drf;
29 gforget 1.1 end;
30     end;
31    
32     %use array format to speed up computation below:
33     fldU=convert2array(fldU); fldV=convert2array(fldV);
34    
35 gforget 1.3 for iy=1:length(mygrid.LATS_MASKS);
36 gforget 1.1
37     %get list ofpoints that form a zonal band:
38 gforget 1.5 mskW=mygrid.LATS_MASKS(iy).mskWedge;
39     vecW=gcmfaces_subset(mskW,fldU);
40     mskS=mygrid.LATS_MASKS(iy).mskSedge;
41     vecS=gcmfaces_subset(mskS,fldV);
42    
43     %store vertically integrated transport:
44     FLD(iy,:)=nansum(nansum(vecW,1)+nansum(vecS,1),2);
45 gforget 1.1
46     end;
47    
48    

  ViewVC Help
Powered by ViewVC 1.1.22