1 | #Test Name: EISMINTRoundIceSheetStaticSIA
|
---|
2 | import numpy
|
---|
3 | from model import *
|
---|
4 | from roundmesh import *
|
---|
5 | from setmask import *
|
---|
6 | from parameterize import *
|
---|
7 | from setflowequation import *
|
---|
8 | from solve import *
|
---|
9 | from MatlabFuncs import *
|
---|
10 |
|
---|
11 | """
|
---|
12 | The aim of this program is to compare a model with an analytical solution given in SSA EISMINT : Lessons in Ice-Sheet Modeling.
|
---|
13 | """
|
---|
14 |
|
---|
15 | printingflag=False
|
---|
16 |
|
---|
17 | numlayers=10
|
---|
18 | resolution=30000.
|
---|
19 |
|
---|
20 | #To begin with the numerical model
|
---|
21 | md=model()
|
---|
22 | md=roundmesh(md,750000.,resolution)
|
---|
23 | md=setmask(md,'','') #We can not test iceshelves nor ice rises with this analytical solution
|
---|
24 | md=parameterize(md,'../Par/RoundSheetStaticEISMINT.py')
|
---|
25 |
|
---|
26 | #Calculation of the analytical 2d velocity field
|
---|
27 | constant=0.3
|
---|
28 | vx_obs=constant/2.*md.mesh.x*(md.geometry.thickness)**-1
|
---|
29 | vy_obs=constant/2.*md.mesh.y*(md.geometry.thickness)**-1
|
---|
30 | vel_obs=numpy.sqrt((md.inversion.vx_obs)**2+(md.inversion.vy_obs)**2)
|
---|
31 |
|
---|
32 | #We extrude the model to have a 3d model
|
---|
33 | md.extrude(numlayers,1.);
|
---|
34 | md=setflowequation(md,'SIA','all')
|
---|
35 |
|
---|
36 | #Spc the nodes on the bed
|
---|
37 | pos=numpy.nonzero(md.mesh.vertexonbase)
|
---|
38 | md.stressbalance.spcvx[pos]=0.
|
---|
39 | md.stressbalance.spcvy[pos]=0.
|
---|
40 | md.stressbalance.spcvz[pos]=0.
|
---|
41 |
|
---|
42 | #Now we can solve the problem
|
---|
43 | md.cluster=generic('name',oshostname(),'np',8)
|
---|
44 | md=solve(md,'Stressbalance')
|
---|
45 |
|
---|
46 | #Calculate the depth averaged velocity field (2d):
|
---|
47 | vx=md.results.StressbalanceSolution.Vx
|
---|
48 | vy=md.results.StressbalanceSolution.Vy
|
---|
49 | vel=numpy.zeros((md.mesh.numberofvertices2d,1))
|
---|
50 |
|
---|
51 | for i in xrange(0,md.mesh.numberofvertices2d):
|
---|
52 | node_vel=0.
|
---|
53 | for j in xrange(0,md.mesh.numberoflayers-1):
|
---|
54 | node_vel=node_vel+1./(2.*(md.mesh.numberoflayers-1))*\
|
---|
55 | (numpy.sqrt(vx[i+(j+1)*md.mesh.numberofvertices2d,0]**2+vy[i+(j+1)*md.mesh.numberofvertices2d,0]**2)+\
|
---|
56 | numpy.sqrt(vx[i+j*md.mesh.numberofvertices2d,0]**2+vy[i+j*md.mesh.numberofvertices2d,0]**2))
|
---|
57 | vel[i,0]=node_vel
|
---|
58 |
|
---|
59 | #Plot of the velocity from the exact and calculated solutions
|
---|
60 | #figure(1)
|
---|
61 | #set(gcf,'Position',[1 1 1580 1150])
|
---|
62 | #subplot(2,2,1)
|
---|
63 | #p=patch('Faces',md.mesh.elements2d,'Vertices',[md.mesh.x2d md.mesh.y2d],'FaceVertexCData',...
|
---|
64 | #vel,'FaceColor','interp','EdgeColor','none');
|
---|
65 | #title('Modelled velocity','FontSize',14,'FontWeight','bold')
|
---|
66 | #colorbar;
|
---|
67 | #caxis([0 200]);
|
---|
68 |
|
---|
69 | #subplot(2,2,2)
|
---|
70 | #p=patch('Faces',md.mesh.elements2d,'Vertices',[md.mesh.x2d md.mesh.y2d],'FaceVertexCData',...
|
---|
71 | #vel_obs,'FaceColor','interp','EdgeColor','none');
|
---|
72 | #title('Analytical velocity','FontSize',14,'FontWeight','bold')
|
---|
73 | #colorbar;
|
---|
74 | #caxis([0 200]);
|
---|
75 |
|
---|
76 | #subplot(2,2,3)
|
---|
77 | #hold on;
|
---|
78 | #plot(sqrt((md.mesh.x(1:md.mesh.numberofvertices2d)).^2+(md.mesh.y(1:md.mesh.numberofvertices2d)).^2),vel,'r.');
|
---|
79 | #plot(sqrt((md.mesh.x2d).^2+(md.mesh.y2d).^2),vel_obs,'b.');
|
---|
80 | #title('Analytical vs calculated velocity','FontSize',14,'FontWeight','bold');
|
---|
81 | #xlabel('distance to the center of the icesheet [m]','FontSize',14,'FontWeight','bold');
|
---|
82 | #ylabel('velocity [m/yr]','FontSize',14,'FontWeight','bold');
|
---|
83 | #legend('calculated velocity','exact velocity');
|
---|
84 | #axis([0 750000 0 200]);
|
---|
85 | #hold off;
|
---|
86 |
|
---|
87 | #subplot(2,2,4)
|
---|
88 | #p=patch('Faces',md.mesh.elements2d,'Vertices',[md.mesh.x2d md.mesh.y2d],'FaceVertexCData',...
|
---|
89 | #abs(vel-vel_obs)./vel_obs*100,'FaceColor','interp','EdgeColor','none');
|
---|
90 | #title('Relative misfit [%]','FontSize',14,'FontWeight','bold')
|
---|
91 | #colorbar;
|
---|
92 | #caxis([0 100]);
|
---|
93 |
|
---|
94 | if printingflag:
|
---|
95 | pass
|
---|
96 | # set(gcf,'Color','w')
|
---|
97 | # printmodel('SIAstatic','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off');
|
---|
98 | # system(['mv SIAstatic.png ' ISSM_DIR '/website/doc_pdf/validation/Images/EISMINT/IceSheet']);
|
---|
99 |
|
---|
100 | #Fields and tolerances to track changes
|
---|
101 | field_names =[ \
|
---|
102 | 'Vx','Vy','Vel', \
|
---|
103 | ]
|
---|
104 | field_tolerances=[ \
|
---|
105 | 1e-13,1e-13,1e-13, \
|
---|
106 | ]
|
---|
107 | field_values=[ \
|
---|
108 | vx,vy,vel, \
|
---|
109 | ]
|
---|