source: issm/trunk-jpl/test/NightlyRun/test1207.m@ 21049

Last change on this file since 21049 was 21049, checked in by agscott1, 9 years ago

CHG: Replaced Enums with Strings in matlab and python. Updated corresponding cpp code.

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