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

Last change on this file since 21408 was 21408, checked in by bdef, 8 years ago

CHG: uniformization fix

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