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 |
|
---|
5 | md=model;
|
---|
6 | md=mesh(md,'DomainOutline.exp',50000);
|
---|
7 | md=geography(md,'Shelf.exp','');
|
---|
8 | md=parameterize(md,'Square.par');
|
---|
9 | md=setelementstype(md,'Macayeal','all');
|
---|
10 |
|
---|
11 | %Compute solution for a 2d model
|
---|
12 | md=solve(md,'analysis_type',DiagnosticSolutionEnum);
|
---|
13 | vel_2d=zeros(md.numberofgrids,1);
|
---|
14 | vel_2d(md.results.DiagnosticSolution.Vel.index)=md.results.DiagnosticSolution.Vel.value;
|
---|
15 |
|
---|
16 | %Compute solution for a 3d model
|
---|
17 | md=extrude(md,5,3);
|
---|
18 | md=setelementstype(md,'Pattyn','Pattyn.exp','fill','Macayeal');
|
---|
19 | md=solve(md,'analysis_type',DiagnosticSolutionEnum);
|
---|
20 |
|
---|
21 | %Calculate the average velocity on each grid
|
---|
22 | vel_3d=zeros(md.numberofgrids2d,1);
|
---|
23 | vel=vel_3d;
|
---|
24 | vel(md.results.DiagnosticSolution.Vel.index)=md.results.DiagnosticSolution.Vel.value;
|
---|
25 | grid_vel=0;
|
---|
26 |
|
---|
27 | for i=1:md.numberofgrids2d
|
---|
28 | for j=1:(md.numlayers-1)
|
---|
29 | grid_vel=grid_vel+1/(2*(md.numlayers-1))*(vel(i+j*md.numberofgrids2d,1)+vel(i+(j-1)*md.numberofgrids2d,1));
|
---|
30 | end
|
---|
31 | vel_3d(i,1)=grid_vel;
|
---|
32 | grid_vel=0;
|
---|
33 | end
|
---|
34 |
|
---|
35 | vel_diff=(vel_2d-vel_3d)./vel_2d;
|
---|
36 | vel_diff(find(vel_2d==vel_3d))=0;
|
---|
37 |
|
---|
38 | %Plot of the velocity from the macayeal and pattyn model
|
---|
39 | figure(1)
|
---|
40 | subplot(2,2,1)
|
---|
41 | p1=patch('Faces',md.elements2d,'Vertices',[md.x2d md.y2d],'FaceVertexCData',...
|
---|
42 | vel_2d,'FaceColor','interp','EdgeColor','none');
|
---|
43 | title('MacAyeal model [m/yr]','FontSize',14,'FontWeight','bold')
|
---|
44 | colorbar;
|
---|
45 |
|
---|
46 | subplot(2,2,2)
|
---|
47 | p2=patch('Faces',md.elements2d,'Vertices',[md.x2d md.y2d],'FaceVertexCData',...
|
---|
48 | vel_3d,'FaceColor','interp','EdgeColor','none');
|
---|
49 | title('Pattyn model [m/yr]','FontSize',14,'FontWeight','bold')
|
---|
50 | colorbar;
|
---|
51 |
|
---|
52 | subplot(2,2,3)
|
---|
53 | p3=patch('Faces',md.elements2d,'Vertices',[md.x2d md.y2d],'FaceVertexCData',...
|
---|
54 | vel_diff*100,'FaceColor','interp','EdgeColor','none');
|
---|
55 | title('Relative misfit [%]','FontSize',14,'FontWeight','bold')
|
---|
56 | colorbar;
|
---|
57 |
|
---|
58 | subplot(2,2,4)
|
---|
59 | p3=patch('Faces',md.elements2d,'Vertices',[md.x2d md.y2d],'FaceVertexCData',...
|
---|
60 | vel_2d-vel_3d,'FaceColor','interp','EdgeColor','none');
|
---|
61 | title('Absolute misfit [m/yr]','FontSize',14,'FontWeight','bold')
|
---|
62 | colorbar;
|
---|
63 |
|
---|