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

Last change on this file since 4871 was 4871, checked in by seroussi, 15 years ago

Validation tests MacAyeal/Pattyn

  • Property svn:executable set to *
File size: 2.2 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,'analysis_type',DiagnosticSolutionEnum);
13vel_2d=zeros(md.numberofgrids,1);
14vel_2d(md.results.DiagnosticSolution.Vel.index)=md.results.DiagnosticSolution.Vel.value;
15
16%Compute solution for a 3d model
17md=extrude(md,5,3);
18md=setelementstype(md,'Pattyn','Pattyn.exp','fill','Macayeal');
19md=solve(md,'analysis_type',DiagnosticSolutionEnum);
20
21%Calculate the average velocity on each grid
22vel_3d=zeros(md.numberofgrids2d,1);
23vel=vel_3d;
24vel(md.results.DiagnosticSolution.Vel.index)=md.results.DiagnosticSolution.Vel.value;
25grid_vel=0;
26
27for 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;
33end
34
35vel_diff=(vel_2d-vel_3d)./vel_2d;
36vel_diff(find(vel_2d==vel_3d))=0;
37
38%Plot of the velocity from the macayeal and pattyn model
39figure(1)
40subplot(2,2,1)
41p1=patch('Faces',md.elements2d,'Vertices',[md.x2d md.y2d],'FaceVertexCData',...
42vel_2d,'FaceColor','interp','EdgeColor','none');
43title('MacAyeal model [m/yr]','FontSize',14,'FontWeight','bold')
44colorbar;
45
46subplot(2,2,2)
47p2=patch('Faces',md.elements2d,'Vertices',[md.x2d md.y2d],'FaceVertexCData',...
48vel_3d,'FaceColor','interp','EdgeColor','none');
49title('Pattyn model [m/yr]','FontSize',14,'FontWeight','bold')
50colorbar;
51
52subplot(2,2,3)
53p3=patch('Faces',md.elements2d,'Vertices',[md.x2d md.y2d],'FaceVertexCData',...
54vel_diff*100,'FaceColor','interp','EdgeColor','none');
55title('Relative misfit [%]','FontSize',14,'FontWeight','bold')
56colorbar;
57
58subplot(2,2,4)
59p3=patch('Faces',md.elements2d,'Vertices',[md.x2d md.y2d],'FaceVertexCData',...
60vel_2d-vel_3d,'FaceColor','interp','EdgeColor','none');
61title('Absolute misfit [m/yr]','FontSize',14,'FontWeight','bold')
62colorbar;
63
Note: See TracBrowser for help on using the repository browser.