[19049] | 1 | #Test Name: EISMINTRoundIceSheetStaticSIA
|
---|
[21408] | 2 | import numpy as np
|
---|
[14157] | 3 | from model import *
|
---|
[21408] | 4 | from socket import gethostname
|
---|
[14157] | 5 | from roundmesh import *
|
---|
| 6 | from setmask import *
|
---|
| 7 | from parameterize import *
|
---|
| 8 | from setflowequation import *
|
---|
| 9 | from solve import *
|
---|
| 10 |
|
---|
[21408] | 11 |
|
---|
[14157] | 12 | """
|
---|
[15566] | 13 | The aim of this program is to compare a model with an analytical solution given in SSA EISMINT : Lessons in Ice-Sheet Modeling.
|
---|
[14157] | 14 | """
|
---|
| 15 |
|
---|
| 16 | printingflag=False
|
---|
| 17 |
|
---|
| 18 | numlayers=10
|
---|
| 19 | resolution=30000.
|
---|
| 20 |
|
---|
| 21 | #To begin with the numerical model
|
---|
| 22 | md=model()
|
---|
| 23 | md=roundmesh(md,750000.,resolution)
|
---|
| 24 | md=setmask(md,'','') #We can not test iceshelves nor ice rises with this analytical solution
|
---|
| 25 | md=parameterize(md,'../Par/RoundSheetStaticEISMINT.py')
|
---|
| 26 |
|
---|
| 27 | #Calculation of the analytical 2d velocity field
|
---|
| 28 | constant=0.3
|
---|
| 29 | vx_obs=constant/2.*md.mesh.x*(md.geometry.thickness)**-1
|
---|
| 30 | vy_obs=constant/2.*md.mesh.y*(md.geometry.thickness)**-1
|
---|
[21408] | 31 | vel_obs=np.sqrt((md.inversion.vx_obs)**2+(md.inversion.vy_obs)**2)
|
---|
[14157] | 32 |
|
---|
| 33 | #We extrude the model to have a 3d model
|
---|
[21408] | 34 | md.extrude(numlayers,1.)
|
---|
[15565] | 35 | md=setflowequation(md,'SIA','all')
|
---|
[14157] | 36 |
|
---|
| 37 | #Spc the nodes on the bed
|
---|
[21408] | 38 | pos=np.where(md.mesh.vertexonbase)
|
---|
[15771] | 39 | md.stressbalance.spcvx[pos]=0.
|
---|
| 40 | md.stressbalance.spcvy[pos]=0.
|
---|
| 41 | md.stressbalance.spcvz[pos]=0.
|
---|
[14157] | 42 |
|
---|
| 43 | #Now we can solve the problem
|
---|
[21408] | 44 | md.cluster=generic('name',gethostname(),'np',8)
|
---|
[21056] | 45 | md=solve(md,'Stressbalance')
|
---|
[14157] | 46 |
|
---|
| 47 | #Calculate the depth averaged velocity field (2d):
|
---|
[15771] | 48 | vx=md.results.StressbalanceSolution.Vx
|
---|
| 49 | vy=md.results.StressbalanceSolution.Vy
|
---|
[21408] | 50 | vel=np.zeros((md.mesh.numberofvertices2d))
|
---|
[14157] | 51 |
|
---|
| 52 | for i in xrange(0,md.mesh.numberofvertices2d):
|
---|
| 53 | node_vel=0.
|
---|
| 54 | for j in xrange(0,md.mesh.numberoflayers-1):
|
---|
[21408] | 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
|
---|
[14157] | 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',...
|
---|
[21408] | 63 | #vel,'FaceColor','interp','EdgeColor','none')
|
---|
[14157] | 64 | #title('Modelled velocity','FontSize',14,'FontWeight','bold')
|
---|
[21408] | 65 | #colorbar
|
---|
| 66 | #caxis([0 200])
|
---|
[14157] | 67 |
|
---|
| 68 | #subplot(2,2,2)
|
---|
| 69 | #p=patch('Faces',md.mesh.elements2d,'Vertices',[md.mesh.x2d md.mesh.y2d],'FaceVertexCData',...
|
---|
[21408] | 70 | #vel_obs,'FaceColor','interp','EdgeColor','none')
|
---|
[14157] | 71 | #title('Analytical velocity','FontSize',14,'FontWeight','bold')
|
---|
[21408] | 72 | #colorbar
|
---|
| 73 | #caxis([0 200])
|
---|
[14157] | 74 |
|
---|
| 75 | #subplot(2,2,3)
|
---|
[21408] | 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
|
---|
[14157] | 85 |
|
---|
| 86 | #subplot(2,2,4)
|
---|
| 87 | #p=patch('Faces',md.mesh.elements2d,'Vertices',[md.mesh.x2d md.mesh.y2d],'FaceVertexCData',...
|
---|
[21408] | 88 | #abs(vel-vel_obs)./vel_obs*100,'FaceColor','interp','EdgeColor','none')
|
---|
[14157] | 89 | #title('Relative misfit [%]','FontSize',14,'FontWeight','bold')
|
---|
[21408] | 90 | #colorbar
|
---|
| 91 | #caxis([0 100])
|
---|
[14157] | 92 |
|
---|
| 93 | if printingflag:
|
---|
| 94 | pass
|
---|
| 95 | # set(gcf,'Color','w')
|
---|
[21408] | 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'])
|
---|
[14157] | 98 |
|
---|
| 99 | #Fields and tolerances to track changes
|
---|
[21408] | 100 | field_names =['Vx','Vy','Vel']
|
---|
| 101 | field_tolerances=[1e-13,1e-13,1e-13]
|
---|
| 102 | field_values=[vx,vy,vel]
|
---|