/[MITgcm]/MITgcm/verification/advect_xz/input.nlfs/grph_StD_AB.m
ViewVC logotype

Contents of /MITgcm/verification/advect_xz/input.nlfs/grph_StD_AB.m

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


Revision 1.1 - (show annotations) (download)
Tue Dec 6 18:56:16 2011 UTC (12 years, 3 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64o, checkpoint64a, checkpoint63r, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint64n, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint64b, checkpoint63h, checkpoint63m, checkpoint64e, checkpoint63i, checkpoint63q, checkpoint64d, checkpoint64c, checkpoint64g, checkpoint64f, checkpoint63j, checkpoint63l, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint63n, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint63k, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint64i, checkpoint63o, checkpoint63p, checkpoint64h, checkpoint63s, checkpoint64k, checkpoint64, checkpoint65, checkpoint64j, checkpoint64m, checkpoint63g, checkpoint64l, HEAD
add note (check_conserve_TS.txt) and matlab script to check global
conservation of T & S with NonLin-FreeSurf and Adams-Bashforth.

1 prefix='dynStD';
2 %namA={'n30','n32','n33'};
3 namA={'std'};
4 Nexp=size(namA,2);
5 %-
6 %namA(2)={'r16a'};
7
8 alphAB=0.6; %- Adams-bashforth parameter (= 0.5+abEps )
9 alphAB=0.;
10
11 % $Header: /u/gcmpack/MITgcm_contrib/jmc_script/grph_StD.m,v 1.3 2008/11/08 18:26:09 jmc Exp $
12 % $Name: $
13
14 nItMx=1e10*ones(1,Nexp); %nItMx(3)=11;
15 nItMx=2400*ones(1,Nexp);
16 namLg=namA ; namLg=strrep(namLg,'_','\_');
17 %-----------
18 %- test if the variable krd is define :
19 if size(who('krd'),1) > 0,
20 fprintf('krd is defined and = %i \n',krd);
21 else
22 fprintf('krd undefined ; set to 1 \n'); krd=1 ;
23 end
24 if krd > 0,
25 %- define list of fields to read in:
26 clear listV ;
27 %listV={'Eta','U','V','W','T','S','DETADT2','RELHUM','Phi'};
28 %listV={'Eta','W','T','S','CONVADJ','DETADT2'};
29 %listV={'Eta','UE_VEL_C','VN_VEL_C','W','T','DETADT2','Phi'};
30 %listV={'Eta','U','W','T','S','ADVx_TH','ADVr_TH','AB_gT','AB_gS'};
31 %listV={'Eta','U','W','T','S','ADVx_TH','ADVr_TH','gSinAB'};
32 %- or take all them:
33 clear listV ; listV='all_flds';
34 %-----------
35
36 %- start to read the longest record:
37 n=1; rf=-1; if strcmp(char(listV),'all_flds'), rf=0; end
38 [ntA(n),rList,tim,vv1,listV] = ...
39 read_StD(prefix,namA(n),listV);
40 nIt=ntA(n); nk=size(vv1,1); nRg=size(vv1,3);
41 %- set global dims: & load vvA --> vvB
42 nbV=size(listV,2);
43 nrec=nIt; n3d=nk; nReg=nRg;
44 vvA=zeros(n3d,nrec,nReg,5,nbV,Nexp); tiA=zeros(nrec,2,Nexp);
45 vvA(1:nk,1:nIt,1:nRg,:,:,n)=vv1; tiA(1:nIt,:,n)=tim;
46 %----
47 for n=2:Nexp,
48 [ntA(n),rList,tim,vv1,listV] = ...
49 read_StD(prefix,namA(n),listV);
50 nIt=ntA(n); nk=size(vv1,1); nRg=size(vv1,3);
51 if (nrec < nIt),
52 fprintf('\n');
53 error([' Nb of records=',int2str(nIt),' exceeds nrec=',int2str(nrec)]);
54 end
55 if (n3d < nk),
56 fprintf('\n');
57 error([' Nb of Levels=',int2str(nk),' exceeds n3d=',int2str(n3d)]);
58 end
59 vvA(1:nk,1:nIt,1:nRg,:,:,n)=vv1; tiA(1:nIt,:,n)=tim;
60 end;
61 if krd == 2,
62 fprintf('save to "sav_StD.mat" file ...');
63 save('sav_StD.mat','vvA','tiA','ntA','rList','listV');
64 fprintf(' done\n')
65 end
66 elseif krd < 0,
67 fprintf('load from "sav_StD.mat" file ...');
68 load sav_StD
69 fprintf(' done\n'); nbV=size(listV,2);
70 end
71 if krd ~= 0,
72 ttA=squeeze(tiA(:,2,:));
73 ttA=ttA/86400; titT='days'; %ttA=ttA/30 ; titT='month'; ttA=ttA/12 ; titT='year';
74 end
75 %=========================================================
76
77 ttax1=0 ; ttax2=0 ; ttay=zeros(nbV,2);
78 %-- fixed time axis bound :
79 % ttax1=15.; ttax2=20.;
80 %-- fixed Y axis bound :
81 % ttay(4,:)=[0 0.6];
82 %-----------
83 fprintf('Total length: ntA=');fprintf(' %i ,',ntA); fprintf(' \n');
84 for n=1:Nexp,
85 fprintf(' exp %i : time(d):%10.2f ->%10.2f \n', n,ttA(1,n),ttA(ntA(n),n) );
86 end;
87 %--
88
89 list_on=zeros(1,nbV);
90 nbG=8;
91 nbG=min(nbG,nbV); list_on(1:nbG)=1 ;
92 %list_on(1:6)=[1 1 1 1 1 1];
93
94 isA=ones(1,Nexp); ieA=ntA;
95 %- limit the length : for search of isA <->1500y: find(ttA(:,2) == 1500)
96 %isA=isA*31 ; % drop the 1rst mnth (1 Monitor/d)
97 %isA=isA*2 ; % drop the 1rst mnth (1 Monitor/30d)
98 %isA(1)=31 ; isA(2)=4 ; % drop the 1rst mnth
99 %ieA(:)=240; %isA(:)=1;
100
101 linA(1,:)='k-'; % ieA(1)=60 ; % ieA(1)=1152 ;
102 linA(2,:)='b-';
103 linA(3,:)='r-';
104 linA(4,:)='g-';
105 linA(5,:)='m-';
106 linA(6,:)='c-';
107
108 ieA=min(ieA,nItMx);
109 %titall='AIM , Cubic-G (32x32) , cpl-FM Forcing' ;
110 %titall='Global Ocean, Cubic-G (32x32) , CORE Forc (2)' ;
111 titall='Advect\_xz (nlfs) test experiment' ;
112
113 %=========================================================
114
115 for ng=1:nbV,
116 %-------------------
117 flag=list_on(ng); kl=0;
118 vv1=vvA(:,:,:,:,ng,:); namV=char(listV(ng));
119 titv=strrep(namV,'_','\_');
120 %if strcmp(namV,'Eta'), vv1=vv1/100; titv='Eta [mb]'; end
121 %if strcmp(namV,'T'), kl=1; end % <-- to get surf.Temp
122 %if ng == 1, flag=2*list_on(1) ; end
123 if kl > 0, titv=[titv,'\_',int2str(kl)];
124 fprintf([' var= ',namV,' at level k= %i \n'],kl);
125 end
126
127 if flag == 1
128 %--
129 figure(ng); set(ng,'position',[100+100*ng 60+40*ng 500 700]);clf;
130 var=squeeze(vv1(1+kl,:,1,:,:)); dd=zeros(5,Nexp); av=zeros(5,Nexp);
131 %------------
132 gAB=0;
133 if strcmp(namV,'T'),
134 if length(strmatch('gTinAB',listV)) == 1, gAB=strmatch('gTinAB',listV); end
135 end
136 if strcmp(namV,'S'),
137 if length(strmatch('gSinAB',listV)) == 1, gAB=strmatch('gSinAB',listV); end
138 end
139 if gAB > 0,
140 tmpvar=squeeze(vvA(1+kl,:,1,1,gAB,:));
141 if Nexp == 1, tmpvar=tmpvar'; end
142 delT=(tiA(2,2,:)-tiA(1,2,:)); delN=(tiA(2,1,:)-tiA(1,1,:));
143 delT=delT./delN; delT=ones(nIt,1)*reshape(delT,[1 Nexp]);
144 tmpvar=tmpvar.*delT;
145 tmpvar=alphAB*tmpvar;
146 tmpvar=reshape(tmpvar,[nIt 1 Nexp]);
147 var(:,1,:)=var(:,1,:)-tmpvar;
148 end
149 %------------
150 for n=1:Nexp,
151 dd(:,n)=max(var(isA(n):ieA(n),:,n))-min(var(isA(n):ieA(n),:,n));
152 av(:,n)=mean(var(isA(n):ieA(n),:,n));
153 end
154 for nv=1:4,
155 subplot(410+nv); ttmn=' Mx-mn:'; ttav=' Av:';
156 for n=1:Nexp,
157 plot(ttA(isA(n):ieA(n),n),var(isA(n):ieA(n),nv,n),linA(n,:));
158 if n == 1, hold on ; end ;
159 ttmn=sprintf([ttmn,' %2.1e ;'],dd(nv,n));
160 ttav=sprintf([ttav,' %3.2e ;'],av(nv,n));
161 end ; hold off ;
162 AA=axis ; dAA=AA(4)-AA(3);
163 if AA(3)*AA(4) <= 0, AA(3)=min(AA(3),-dAA/10); AA(4)=max(AA(4),dAA/10); end
164 if ttax1 < ttax2, AA(1)=ttax1; AA(2)=ttax2; end;
165 axis(AA); grid ;
166 if nv == 1, title(['Avr ',titv,' ',ttmn]); end
167 if nv == 2, title(['Std-Dev ',titv,' ',ttav]); end
168 if nv == 3, title(['min ',titv,' ',ttav]); legend(namLg,0); end
169 if nv == 4, title(['Max ',titv,' ',ttav]); end
170 end ; xlabel(titT);
171 %--
172 axes('position',[.01,.01,.99,.99],'Visible','off');
173 T=text(0.5,0.97,titall);
174 set(T,'HorizontalAlignment','center','FontSize',12);
175 Td=text(0.99,0.01,date);
176 set(Td,'HorizontalAlignment','right','FontSize',6);
177 %---
178 end
179
180 %-------------------
181 end
182
183 %=========================================================

  ViewVC Help
Powered by ViewVC 1.1.22