/[MITgcm]/MITgcm_contrib/timour_matlab/mscripts/asym.m
ViewVC logotype

Annotation of /MITgcm_contrib/timour_matlab/mscripts/asym.m

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


Revision 1.1 - (hide annotations) (download)
Wed Sep 3 21:22:22 2003 UTC (21 years, 10 months ago) by edhill
Branch: MAIN
CVS Tags: HEAD
initial checkin of Timour's MatLAB scripts

1 edhill 1.1 clear path
2    
3     global Nx Ny Nz
4     global lat long dz dm mdep
5     global delt_su su_its t_su delt
6     global descriptor this_path
7     global f deltaf Q beta r_expt r_heat H
8     global time rots it
9     global g Cp rho_bar alpha
10     global u v t w
11     global iterations
12    
13    
14     param_file_name = ...
15     input(' Please enter the name of the m-file with the parameters for this run : ','s') ;
16     feval(param_file_name) ;
17    
18     % compute the E-W asymmetry of the thermocline and its depth
19    
20     iterations
21    
22     itstart = input(' Please enter start iteration : ','s')
23     itend = input(' Please enter end iteration : ','s')
24    
25    
26     sizeit=size(iterations);
27     for i=1:sizeit(1)
28     iter(i)=eval(iterations(i,1:10));
29     end
30     nitstart=find(iter==eval(itstart))
31     nitend=find(iter==eval(itend))
32    
33     path = this_path
34     cmdstr=['cd ' path ];
35     eval(cmdstr);
36     path=pwd
37    
38     sumtheta=zeros(Nx,Ny,Nz);
39     counter=0;
40    
41     for i=nitstart:nitend
42     tfilename=(['T.' iterations((i),1:10) ]) ;
43     t=rdmds(tfilename,'b');
44     sumtheta=sumtheta+t;
45     counter=counter+1;
46     end
47     meantheta=sumtheta/counter;
48     meantheta(:,:,1)=20;
49     meantheta(:,:,2)=20;
50     meantheta(:,:,3)=20;
51    
52    
53     %cmin=20;
54     %cmax=24,
55     %V=[cmin cmax];
56     %figure
57     %caxis('manual')
58     %
59     %subplot(1,2,1)
60     % title='average temperature at z=2';
61     % imagesc(lat,long,squeeze(meantheta(:,:,2))');shading flat;axis image;caxis(V);colorbar('horizontal');
62     % text(0,-30,descriptor);text(50,-30,num2str(nitend-nitstart+1));text(80,-30,'files');
63     % text(0,140,title);
64     % text(0,-20,'from timestep');text(50,-20,num2str(itstart));
65     % text(0,-10,'to'); text(50,-10,num2str(itend));
66     %
67     %subplot(1,2,2)
68     % contour(flipud(squeeze(meantheta(:,Ny/2,:))'),50);caxis(V);colorbar;grid
69     % text(0,-2,'average temperature at mid-tank')
70     %
71    
72    
73     %
74     NNN=Ny/2
75     %
76    
77     tx=zeros(Nx,1);
78    
79     for i=1:Nx,
80    
81     for k=1:Nz,
82     for j=NNN-10:NNN+10,
83     tx(i)=tx(i)+meantheta(i,j,k);
84     end
85     end
86     tx(i)=tx(i)/Nz;
87     tx(i)=tx(i)/21;
88     end
89    
90     i=find(tx<20);
91     tx(i)=20;
92    
93     tmax=max(tx);
94    
95     lmax=find(tx==tmax);
96    
97    
98     tmin=min(tx);
99    
100     te=tmin+(tmax-tmin)/2.71;
101    
102     tsign=zeros(Nx-1,1);
103    
104     for i=1:Nx-1
105     tsign(i)=(tx(i)-te)*(tx(i+1)-te);
106     end
107    
108     ii=find(tsign<0);
109    
110     xw=ii(1)+0.5;
111     xe=ii(2)+0.5;
112    
113     x0=(lmax-xw)/(xe-xw)
114    
115     txe=zeros(Nx,1);
116     txe(:)=te;
117    
118     plot(tx)
119     hold on
120     plot(txe,'--')
121     hold off
122    
123     % Depth
124     %
125     %tz=zeros(Nz,1);
126     %for k=1:Nz,
127     %for i=1:Nx,
128     %tz(k)=tz(k)+meantheta(i,NNN,k);
129     %end
130     %tz(k)=tz(k)/Nx;
131     %end
132     %
133     %tzmax=max(tz);
134     %tzmin=min(tz);
135     %
136     %kk=zeros(Nz-5,1);
137     %tza=zeros(Nz-5,1);
138     %for k=1:Nz-5
139     %kk(k)=k;
140     %tza(k)=tz(k)-tzmin;
141     %end
142     %
143     %logp1=polyfit(kk,log(tza),1);
144     %logpred1=2.71.^polyval(logp1,kk);
145     %figure
146     %semilogy(kk,logpred1,'-',kk,tza,'+');
147     %grid on
148     %
149     %h0=-1/logp1(1)
150    

  ViewVC Help
Powered by ViewVC 1.1.22