Changeset 9087
- Timestamp:
- 07/20/11 15:00:12 (14 years ago)
- Location:
- issm/trunk/test/NightlyRun
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/test/NightlyRun/test1501.m
r8999 r9087 1 printingflag = false; 2 1 3 md=mesh(model,'../Exp/Square.exp',350000); 2 4 md=geography(md,'all',''); … … 86 88 PatchToVec(md.results.TransientSolution(2000).SurfaceMassBalance),... 87 89 }; 90 91 if printingflag, 92 93 starttime = 360; 94 endtime = 2000; 95 res = 40; 96 ts = [starttime:res:endtime]; 97 98 index = md.elements; 99 x1=md.x(index(:,1)); x2=md.x(index(:,2)); x3=md.x(index(:,3)); 100 y1=md.y(index(:,1)); y2=md.y(index(:,2)); y3=md.y(index(:,3)); 101 areas=(0.5*((x2-x1).*(y3-y1)-(y2-y1).*(x3-x1))); 102 103 thickness = []; 104 volume = []; 105 massbal = []; 106 velocity = []; 107 for t=starttime:endtime 108 thickness = [thickness PatchToVec(md.results.TransientSolution(t).Thickness)]; 109 volume = [volume mean(md.results.TransientSolution(t).Thickness.value,2).*areas]; 110 massbal = [massbal PatchToVec(md.results.TransientSolution(t).SurfaceMassBalance)]; 111 velocity = [velocity PatchToVec(md.results.TransientSolution(t).Vel)]; 112 end 113 114 figure('Position', [0 0 860 932]) 115 116 options = plotoptions('data','transient_movie','unit','km'); 117 options = options.list{1}; 118 options = checkplotoptions(md,options); 119 120 %loop over the time steps 121 results=md.results.TransientSolution; 122 count = 1; 123 for i=ts 124 125 subplot(5,9,[28:31 37:40]) 126 set(gca,'pos',get(gca,'pos')+[-0.08 -0.08 0.07 0.08]) 127 field = 'Thickness'; 128 129 %process data 130 [x y z elements is2d isplanet]=processmesh(md,results(i).(field),options); 131 [data datatype]=processdata(md,results(i).(field),options); 132 133 titlestring=[field ' at time ' num2str(results(i).time/md.yts) ' year']; 134 plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options) 135 options=changefieldvalue(options,'title',titlestring); 136 options=addfielddefault(options,'colorbar',1); 137 options=changefieldvalue(options,'caxis',[0 max(max(thickness))]); 138 applyoptions(md,[],options); 139 140 subplot(5,9,[33:36 42:45]) 141 set(gca,'pos',get(gca,'pos')+[-0.00 -0.08 0.07 0.08]) 142 field = 'Vel'; 143 144 %process data 145 [x y z elements is2d isplanet]=processmesh(md,results(i).(field),options); 146 [data datatype]=processdata(md,results(i).(field),options); 147 148 titlestring=[field ' at time ' num2str(results(i).time/md.yts) ' year']; 149 plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options) 150 options=changefieldvalue(options,'title',titlestring); 151 options=addfielddefault(options,'colorbar',1); 152 options=changefieldvalue(options,'caxis',[0 max(max(velocity))]); 153 applyoptions(md,[],options); 154 155 subplot(5,4,1:4) 156 cla 157 set(gca,'pos',get(gca,'pos')+[-0.07 0.03 0.12 0.015]) 158 plot(starttime:endtime,mean(massbal),'k','LineWidth', 4) 159 hold on 160 ya = ylim; 161 plot([i i], ya, 'r', 'LineWidth',6) 162 ylim(ya); xlim([starttime endtime]); 163 title('Surface Mass Balance','FontSize',14) 164 ylabel('m/year','FontSize',14) 165 166 subplot(5,4,5:8) 167 cla 168 set(gca,'pos',get(gca,'pos')+[-0.07 0.015 0.12 0.015]) 169 plot(starttime:endtime,sum(volume)/1000/1000/1000,'LineWidth',4) 170 hold on 171 ya = ylim; 172 plot([i i], ya, 'r', 'LineWidth',6) 173 ylim(ya); xlim([starttime endtime]); 174 title('Ice Volume','FontSize',14) 175 ylabel('km^3','FontSize',14) 176 177 subplot(5,4,9:12) 178 cla 179 set(gca,'pos',get(gca,'pos')+[-0.07 0 0.12 0.015]) 180 plot(starttime:endtime,mean(velocity)/1000, 'LineWidth', 4) 181 hold on 182 ya = ylim; 183 plot([i i], ya, 'r', 'LineWidth',6) 184 ylim(ya); xlim([starttime endtime]); 185 title('Mean Velocity','FontSize', 14) 186 ylabel('km/year','FontSize', 14) 187 xlabel('year','FontSize', 14) 188 189 set(gcf,'Renderer','zbuffer','color','white'); %fixes a bug on Mac OS X (not needed in future Matlab version) 190 if i==starttime, 191 %initialize images and frame 192 frame=getframe(gcf); 193 [images,map]=rgb2ind(frame.cdata,256,'nodither'); 194 images(1,1,1,length(ts))=0; 195 else 196 frame=getframe(gcf); 197 images(:,:,1,count) = rgb2ind(frame.cdata,map,'nodither'); 198 end 199 200 count = count+1; 201 202 end 203 204 filename='transawtooth2d.gif'; 205 imwrite(images,map,filename,'DelayTime',1.0,'LoopCount',inf) 206 207 end %printingflag -
issm/trunk/test/NightlyRun/test1502.m
r8999 r9087 1 printingflag = false; 2 1 3 md=mesh(model,'../Exp/Square.exp',700000); 2 4 md=geography(md,'all',''); … … 92 94 PatchToVec(md.results.TransientSolution(2000).SurfaceMassBalance),... 93 95 }; 96 97 if printingflag, 98 99 starttime = 360; 100 endtime = 2000; 101 res = 40; 102 ts = [starttime:res:endtime]; 103 104 index = md.elements; 105 x1=md.x(index(:,1)); x2=md.x(index(:,2)); x3=md.x(index(:,3)); 106 y1=md.y(index(:,1)); y2=md.y(index(:,2)); y3=md.y(index(:,3)); 107 areas=(0.5*((x2-x1).*(y3-y1)-(y2-y1).*(x3-x1))); 108 109 thickness = []; 110 volume = []; 111 massbal = []; 112 velocity = []; 113 for t=starttime:endtime 114 thickness = [thickness PatchToVec(md.results.TransientSolution(t).Thickness)]; 115 volume = [volume mean(md.results.TransientSolution(t).Thickness.value,2).*areas]; 116 massbal = [massbal PatchToVec(md.results.TransientSolution(t).SurfaceMassBalance)]; 117 velocity = [velocity PatchToVec(md.results.TransientSolution(t).Vel)]; 118 end 119 120 figure('Position', [0 0 1060 1060]) 121 122 options = plotoptions('data','transient_movie','unit','km'); 123 options = options.list{1}; 124 options = checkplotoptions(md,options); 125 126 %loop over the time steps 127 results=md.results.TransientSolution; 128 count = 1; 129 for i=ts 130 131 subplot(5,9,[28:31 37:40]) 132 set(gca,'pos',get(gca,'pos')+[-0.08 -0.08 0.07 0.08]) 133 field = 'Thickness'; 134 135 %process data 136 [x y z elements is2d isplanet]=processmesh(md,results(i).(field),options); 137 [data datatype]=processdata(md,results(i).(field),options); 138 139 titlestring=[field ' at time ' num2str(results(i).time/md.yts) ' year']; 140 plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options) 141 options=changefieldvalue(options,'title',titlestring); 142 options=addfielddefault(options,'colorbar',1); 143 options=changefieldvalue(options,'caxis',[0 max(max(thickness))]); 144 applyoptions(md,[],options); 145 146 subplot(5,9,[33:36 42:45]) 147 set(gca,'pos',get(gca,'pos')+[-0.01 -0.08 0.07 0.08]) 148 field = 'Vel'; 149 150 %process data 151 [x y z elements is2d isplanet]=processmesh(md,results(i).(field),options); 152 [data datatype]=processdata(md,results(i).(field),options); 153 154 titlestring=[field ' at time ' num2str(results(i).time/md.yts) ' year']; 155 plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options) 156 options=changefieldvalue(options,'title',titlestring); 157 options=addfielddefault(options,'colorbar',1); 158 options=changefieldvalue(options,'caxis',[0 max(max(velocity))]); 159 applyoptions(md,[],options); 160 161 subplot(5,4,1:4) 162 cla 163 set(gca,'pos',get(gca,'pos')+[-0.07 0.03 0.12 0.015]) 164 plot(starttime:endtime,mean(massbal),'k','LineWidth', 4) 165 hold on 166 ya = ylim; 167 plot([i i], ya, 'r', 'LineWidth',6) 168 ylim(ya); xlim([starttime endtime]); 169 title('Surface Mass Balance','FontSize',14) 170 ylabel('m/year','FontSize',14) 171 172 subplot(5,4,5:8) 173 cla 174 set(gca,'pos',get(gca,'pos')+[-0.07 0.015 0.12 0.015]) 175 plot(starttime:endtime,sum(volume)/1000/1000/1000,'LineWidth',4) 176 hold on 177 ya = ylim; 178 plot([i i], ya, 'r', 'LineWidth',6) 179 ylim(ya); xlim([starttime endtime]); 180 title('Ice Volume','FontSize',14) 181 ylabel('km^3','FontSize',14) 182 183 subplot(5,4,9:12) 184 cla 185 set(gca,'pos',get(gca,'pos')+[-0.07 0 0.12 0.015]) 186 plot(starttime:endtime,mean(velocity)/1000, 'LineWidth', 4) 187 hold on 188 ya = ylim; 189 plot([i i], ya, 'r', 'LineWidth',6) 190 ylim(ya); xlim([starttime endtime]); 191 title('Mean Velocity','FontSize', 14) 192 ylabel('km/year','FontSize', 14) 193 xlabel('year','FontSize', 14) 194 195 set(gcf,'Renderer','zbuffer','color','white'); %fixes a bug on Mac OS X (not needed in future Matlab version) 196 if i==starttime, 197 %initialize images and frame 198 frame=getframe(gcf); 199 [images,map]=rgb2ind(frame.cdata,256,'nodither'); 200 images(1,1,1,length(ts))=0; 201 else 202 frame=getframe(gcf); 203 images(:,:,1,count) = rgb2ind(frame.cdata,map,'nodither'); 204 end 205 206 count = count+1; 207 208 end 209 210 filename='transawtooth3d.gif'; 211 imwrite(images,map,filename,'DelayTime',1.0,'LoopCount',inf) 212 213 end %printingflag
Note:
See TracChangeset
for help on using the changeset viewer.