/[MITgcm]/MITgcm_contrib/gael/matlab_class/gcmfaces_exch/exch_Z_cube.m
ViewVC logotype

Contents of /MITgcm_contrib/gael/matlab_class/gcmfaces_exch/exch_Z_cube.m

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


Revision 1.1 - (show annotations) (download)
Fri Sep 14 03:39:51 2012 UTC (12 years, 10 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65x, checkpoint65r, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, HEAD
- added vorticity point exchanges : @gcmfaces/exch_Z.m, gcmfaces_exch/exch_Z_ll.m,
  gcmfaces_exch/exch_Z_cube.m, gcmfaces_exch/exch_Z_llc.m (largely contributed by M.Buckley).
- gcmfaces_exch/exch_T_N_ll.m : extend assumtion on periodicity to global_ocean.90x40x15

1 function [FLD]=exch_Z_cub(fld);
2 %[FLD]=exch_Z_cub(fld, [flag]);
3 %adds vorticity points (to north and east of center points) for
4 %cubed-sphere grid
5
6 gcmfaces_global;
7
8 %missing corners : assume symmetry of the grid (that may be completly wrong!)
9 global exch_Z_assume_sym;
10 if isempty(exch_Z_assume_sym);
11 exch_Z_assume_sym=0;
12 end;
13
14 %determine vertical and/or time dimensions
15 n3=max(size(fld.f1,3),1); n4=max(size(fld.f1,4),1);
16
17 %initialize FLD
18 FLD=gcmfaces;
19 for iF=1:mygrid.nFaces
20 [n1,n2]=size(mygrid.XC{iF});
21 FLD{iF}=NaN*zeros([n1+1 n2+1 n3 n4]);
22 end;
23
24 for k3=1:n3; for k4=1:n4;
25
26 for iF=1:mygrid.nFaces
27 FLD{iF}(1:end-1,1:end-1,k3,k4)=fld{iF}(:,:,k3,k4);
28 end
29
30 %overlap in i+1
31 FLD.f1(end,1:end-1,k3,k4)=fld.f2(1,:,k3,k4);
32 FLD.f2(end,2:end,k3,k4)=flipud(fld.f4(:,1,k3,k4));
33 FLD.f3(end,1:end-1,k3,k4)=fld.f4(1,:,k3,k4);
34 FLD.f4(end,2:end,k3,k4)=flipud(fld.f6(:,1,k3,k4));
35 FLD.f5(end,1:end-1,k3,k4)=fld.f6(1,:,k3,k4);
36 FLD.f6(end,2:end,k3,k4)=flipud(fld.f2(:,1,k3,k4));
37
38 %overlap in j+1
39 FLD.f1(2:end,end,k3,k4)=fliplr(fld.f3(1,:,k3,k4));
40 FLD.f2(1:end-1,end,k3,k4)=fld.f3(:,1,k3,k4);
41 FLD.f3(2:end,end,k3,k4)=fliplr(fld.f5(1,:,k3,k4));
42 FLD.f4(1:end-1,end,k3,k4)=fld.f5(:,1,k3,k4);
43 FLD.f5(2:end,end,k3,k4)=fliplr(fld.f1(1,:,k3,k4));
44 FLD.f6(1:end-1,end,k3,k4)=fld.f1(:,1,k3,k4);
45
46 %missing corners : use the average value (from the 3 or 2 neighbours)
47 zzC(1)=fld.f1(1,end,k3,k4)+fld.f3(1,end,k3,k4)+fld.f5(1,end,k3,k4);
48 zzC(2)=fld.f2(end,1,k3,k4)+fld.f4(end,1,k3,k4)+fld.f6(end,1,k3,k4);
49 zzC=zzC/3;
50
51 %missing corners : assume symmetry of the grid (that may be completly wrong!)
52 if exch_Z_assume_sym;
53 zzC(1)=fld.f4(1,1,k3,k4);
54 zzC(2)=fld.f1(1,1,k3,k4);
55 end
56
57 %- 1rst = N.W corner of face 1
58 FLD.f1(1,end,k3,k4)=zzC(1);
59 FLD.f3(1,end,k3,k4)=zzC(1);
60 FLD.f5(1,end,k3,k4)=zzC(1);
61 %- 2nd = S.E corner of face 2
62 FLD.f2(end,1,k3,k4)=zzC(2);
63 FLD.f4(end,1,k3,k4)=zzC(2);
64 FLD.f6(end,1,k3,k4)=zzC(2);
65
66 end;
67 end;
68

  ViewVC Help
Powered by ViewVC 1.1.22