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