source: issm/trunk/test/Validation/MacAyealVsPattyn/test1_iceshelf/runme.m@ 16

Last change on this file since 16 was 16, checked in by Mathieu Morlighem, 16 years ago

Added new tests form ice1

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1% This file can be run to compare MacAyeal and Pattyn's model ie a 2d and a 3d model.
2% This test deals with a mesh includind an iceshelf ans an icesheet. The geometry
3% is square. Just run this file in Matlab, with a properly setup Ice code.
4
5md=model;
6md=mesh(md,'DomainOutline.exp',50000);
7md=geography(md,'Shelf.exp','');
8md=parameterize(md,'Square.par');
9md=setelementstype(md,'Macayeal','all');
10
11%Compute solution for a 2d model
12md=solve(md,'diagnostic','ice');
13vel_2d=md.vel;
14
15%Compute solution for a 3d model
16md=extrude(md,5,3);
17md=setelementstype(md,'Pattyn','Pattyn.exp','fill','Macayeal');
18md=solve(md,'diagnostic','ice');
19
20%Calculate the average velocity on each grid
21vel_3d=zeros(md.numberofgrids2d,1);
22grid_vel=0;
23
24for i=1:md.numberofgrids2d
25 for j=1:(md.numlayers-1)
26 grid_vel=grid_vel+1/(2*(md.numlayers-1))*(md.vel(i+j*md.numberofgrids2d,1)+md.vel(i+(j-1)*md.numberofgrids2d,1));
27 end
28 vel_3d(i,1)=grid_vel;
29 grid_vel=0;
30end
31
32vel_diff=(vel_2d-vel_3d)./vel_2d;
33vel_diff(find(vel_2d==vel_3d))=0;
34
35%Plot of the velocity from the macayeal and pattyn model
36figure(1)
37subplot(2,2,1)
38p1=patch('Faces',md.elements2d,'Vertices',[md.x2d md.y2d],'FaceVertexCData',...
39vel_2d,'FaceColor','interp','EdgeColor','none');
40title('MacAyeal model [m/yr]','FontSize',14,'FontWeight','bold')
41colorbar;
42
43subplot(2,2,2)
44p2=patch('Faces',md.elements2d,'Vertices',[md.x2d md.y2d],'FaceVertexCData',...
45vel_3d,'FaceColor','interp','EdgeColor','none');
46title('Pattyn model [m/yr]','FontSize',14,'FontWeight','bold')
47colorbar;
48
49subplot(2,2,3)
50p3=patch('Faces',md.elements2d,'Vertices',[md.x2d md.y2d],'FaceVertexCData',...
51vel_diff*100,'FaceColor','interp','EdgeColor','none');
52title('Relative misfit [%]','FontSize',14,'FontWeight','bold')
53colorbar;
54
55subplot(2,2,4)
56p3=patch('Faces',md.elements2d,'Vertices',[md.x2d md.y2d],'FaceVertexCData',...
57vel_2d-vel_3d,'FaceColor','interp','EdgeColor','none');
58title('Absolute misfit [m/yr]','FontSize',14,'FontWeight','bold')
59colorbar;
60
Note: See TracBrowser for help on using the repository browser.