1 |
t0=input('Enter temperature : ') |
2 |
% t0=27; |
3 |
|
4 |
% Interpolate Dw on T=T0 surface |
5 |
|
6 |
h=zeros(Nx,Ny); |
7 |
hh=zeros(Nx,Ny); |
8 |
hhh=zeros(Nx,Ny); |
9 |
Dh=zeros(Nx,Ny); |
10 |
|
11 |
meantheta(:,:,Nz)=0.; |
12 |
for i=1:Nx |
13 |
for j=1:Ny |
14 |
kk=find(meantheta(i,j,:)<t0); |
15 |
|
16 |
if kk(1)>1 |
17 |
h(i,j)=(kk(1)-1)*dz+dz*(meantheta(i,j,kk(1)-1)-t0)/(meantheta(i,j,kk(1)-1)-meantheta(i,j,kk(1))); |
18 |
|
19 |
Dh(i,j)=Dw(i,j,kk(1)-1) ... |
20 |
+(Dw(i,j,kk(1))-Dw(i,j,kk(1)-1)) ... |
21 |
*(meantheta(i,j,kk(1)-1)-t0)/(meantheta(i,j,kk(1)-1)-meantheta(i,j,kk(1))); |
22 |
else |
23 |
h(i,j)=0; |
24 |
Dh(i,j)=0; |
25 |
end |
26 |
|
27 |
end |
28 |
end |
29 |
|
30 |
Nz1=5; |
31 |
he=dz*(Nz1-1); |
32 |
hmax=max(max(h)) |
33 |
|
34 |
|
35 |
figure |
36 |
|
37 |
%pcolor(Dh.');shading flat; colorbar; axis square |
38 |
% title('mean Wstar'); |
39 |
% title(['mean Wstar from ' num2str(eval(itstart)) ' to 'num2str(eval(itend)) ' level of t=' num2str(t0) ]); |
40 |
|
41 |
%figure |
42 |
|
43 |
%pcolor(hhh.');shading flat; colorbar; axis square |
44 |
%pcolor(flipud(h.'));shading flat; colorbar; axis square |
45 |
%title(['mean H from ' num2str(eval(itstart)) ' to 'num2str(eval(itend)) ' level of t=' num2str(t0) ]); |
46 |
%figure |
47 |
|
48 |
|
49 |
we=0; |
50 |
ws=0; |
51 |
WE=zeros(Nx,Ny); |
52 |
WS=zeros(Nx,Ny); |
53 |
hh=zeros(Nx,Ny); |
54 |
WE1=zeros(Nx,Ny,3); |
55 |
WS1=zeros(Nx,Ny,3); |
56 |
hh1=zeros(Nx,Ny,3); |
57 |
for i=1:Nx |
58 |
for j=1:Ny |
59 |
|
60 |
r=sqrt((i-3*Nx/4)*(i-3*Nx/4)+(j-Ny/2)*(j-Ny/2))*dx; |
61 |
WE(i,j)=meanw(i,j,Nz1); |
62 |
WS(i,j)=Dh(i,j); |
63 |
|
64 |
% if r<0.44 |
65 |
if h(i,j)>he |
66 |
we=meanw(i,j,Nz1)*dx*dx+we; |
67 |
ws=Dh(i,j)*dx*dx+ws; |
68 |
end |
69 |
end |
70 |
end |
71 |
% end |
72 |
we |
73 |
ws |
74 |
|
75 |
hh=h; |
76 |
|
77 |
for k=1:3 |
78 |
WE1(:,:,k)=WE(:,:); |
79 |
WS1(:,:,k)=WS(:,:); |
80 |
hh1(:,:,k)=hh(:,:); |
81 |
end |
82 |
|
83 |
|
84 |
for k=1:8 |
85 |
WE1=smooth3(WE1); |
86 |
WS1=smooth3(WS1); |
87 |
hh1=smooth3(hh1); |
88 |
end |
89 |
|
90 |
hhh(2:Nx-1,2:Ny-1)=10000*(hh1(1:Nx-2,2:Ny-1,1)+hh1(3:Nx,2:Ny-1,1)+... |
91 |
hh1(2:Nx-1,1:Ny-2,1)+hh1(2:Nx-1,3:Ny,1)-4*hh1(2:Nx-1,2:Ny-1,1)); |
92 |
|
93 |
%hhh(2:Nx-1,2:Ny-1)=10000*(hh1(1:Nx-2,2:Ny-1,1)-hh1(3:Nx,2:Ny-1,1)).*... |
94 |
%(hh1(1:Nx-2,2:Ny-1,1)-hh1(3:Nx,2:Ny-1,1))+... |
95 |
%10000*(hh1(2:Nx-1,1:Ny-2,1)-hh1(2:Nx-1,3:Ny,1)).*... |
96 |
%(hh1(2:Nx-1,1:Ny-2,1)-hh1(2:Nx-1,3:Ny,1)); |
97 |
|
98 |
i=find(h<he); |
99 |
h(i)=0; |
100 |
% i=find(abs(hhh)>0.001); |
101 |
% hhh(i)=0; |
102 |
|
103 |
for i=1:Nx |
104 |
for j=1:Ny |
105 |
r=sqrt((i-3*Nx/4)*(i-3*Nx/4)+(j-Ny/2)*(j-Ny/2))*dx; |
106 |
|
107 |
% if r>0.44 |
108 |
%hhh(i,j)=NaN; |
109 |
%hh(i,j)=NaN; |
110 |
%WS1(i,j,1)=NaN; |
111 |
% end |
112 |
|
113 |
if h(i,j)<he |
114 |
WE1(i,j,1)=0; |
115 |
WS1(i,j,1)=NaN; |
116 |
hh(i,j)=NaN; |
117 |
hhh(i,j)=NaN; |
118 |
end |
119 |
|
120 |
end |
121 |
end |
122 |
|
123 |
|
124 |
%pcolor(hh(1:Nx,:).');shading flat; colorbar; axis square |
125 |
% set(gca,'DataAspectRatio',[2,2,2]) |
126 |
%title('h','FontSize',16); |
127 |
%figure |
128 |
|
129 |
%x=2:2:Nx; |
130 |
%y=2:2:Ny; |
131 |
%hh(:,:)=max(he,hh(:,:)); |
132 |
%surf(x,y,200*(-hh(2:2:Nx,2:2:Ny)'+he)); |
133 |
%axis([Nx/2 Nx 0 Ny -20.0 0]) |
134 |
%set(gca,'DataAspectRatio',[20,20,5]) |
135 |
%title('h','FontSize',16); |
136 |
%figure |
137 |
|
138 |
hhh(1:Nx,:)=-10*hhh(1:Nx,:); |
139 |
% hhh(Nx/2:Nx,:)=100*hhh(Nx/2:Nx,:); |
140 |
a=max(max(hhh(1:Nx,:))); |
141 |
|
142 |
subplot(2,1,1) |
143 |
pcolor(hhh(:,:).');caxis([0 a]);shading flat; axis square |
144 |
%pcolor(hhh(Nx/2:Nx,:).');caxis([0 a]);shading flat; axis square |
145 |
set(gca,'DataAspectRatio',[2,2,2],'XtickLabel','|','YtickLabel','|') |
146 |
title('-\nabla^2 h','FontSize',15); |
147 |
xlabel('X','FontSize',15); |
148 |
ylabel('Y','Rotation',[0],'FontSize',13); |
149 |
|
150 |
subplot(2,1,2) |
151 |
WS1(1:Nx,:,1)=-WS1(1:Nx,:,1)*16667; |
152 |
a=max(max(WS1(1:Nx,:,1))); |
153 |
pcolor(squeeze(WS1(:,:,1)).');caxis([0 a]);shading flat; axis square; |
154 |
% pcolor(squeeze(WS1(Nx/2:Nx,:,1)).');caxis([0 a]);shading flat; axis square; |
155 |
set(gca,'DataAspectRatio',[2,2,2],'XtickLabel','|','YtickLabel','|') |
156 |
title('w^*','FontSize',15); |
157 |
xlabel('X','FontSize',15); |
158 |
ylabel('Y','Rotation',[0],'FontSize',13); |
159 |
|
160 |
|
161 |
WS2=squeeze(WS1(:,:,1)); |
162 |
i=find(~isnan(hhh)); |
163 |
WS2=WS2(i); |
164 |
WS=-WS*16667; |
165 |
hhh=hhh(i); |
166 |
sqrt(mean(WS2.*WS2)/ mean(hhh.*hhh)) |
167 |
%mean(WS2)/mean(hhh) |
168 |
%max(WS2)/max(hhh) |
169 |
|