source: issm/trunk-jpl/test/NightlyRun/test1205.py@ 21060

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

CHG: no more enums in python

  • Property svn:executable set to *
File size: 3.6 KB
Line 
1#Test Name: EISMINTRoundIceSheetStaticSIA
2import numpy
3from model import *
4from roundmesh import *
5from setmask import *
6from parameterize import *
7from setflowequation import *
8from solve import *
9from MatlabFuncs import *
10
11"""
12The aim of this program is to compare a model with an analytical solution given in SSA EISMINT : Lessons in Ice-Sheet Modeling.
13"""
14
15printingflag=False
16
17numlayers=10
18resolution=30000.
19
20#To begin with the numerical model
21md=model()
22md=roundmesh(md,750000.,resolution)
23md=setmask(md,'','') #We can not test iceshelves nor ice rises with this analytical solution
24md=parameterize(md,'../Par/RoundSheetStaticEISMINT.py')
25
26#Calculation of the analytical 2d velocity field
27constant=0.3
28vx_obs=constant/2.*md.mesh.x*(md.geometry.thickness)**-1
29vy_obs=constant/2.*md.mesh.y*(md.geometry.thickness)**-1
30vel_obs=numpy.sqrt((md.inversion.vx_obs)**2+(md.inversion.vy_obs)**2)
31
32#We extrude the model to have a 3d model
33md.extrude(numlayers,1.);
34md=setflowequation(md,'SIA','all')
35
36#Spc the nodes on the bed
37pos=numpy.nonzero(md.mesh.vertexonbase)
38md.stressbalance.spcvx[pos]=0.
39md.stressbalance.spcvy[pos]=0.
40md.stressbalance.spcvz[pos]=0.
41
42#Now we can solve the problem
43md.cluster=generic('name',oshostname(),'np',8)
44md=solve(md,'Stressbalance')
45
46#Calculate the depth averaged velocity field (2d):
47vx=md.results.StressbalanceSolution.Vx
48vy=md.results.StressbalanceSolution.Vy
49vel=numpy.zeros((md.mesh.numberofvertices2d,1))
50
51for 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
94if 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
101field_names =[ \
102 'Vx','Vy','Vel', \
103]
104field_tolerances=[ \
105 1e-13,1e-13,1e-13, \
106]
107field_values=[ \
108 vx,vy,vel, \
109]
Note: See TracBrowser for help on using the repository browser.