Changeset 23793 for issm/trunk-jpl/test/NightlyRun/test1206.py
- Timestamp:
- 03/13/19 03:17:46 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/test/NightlyRun/test1206.py
r23707 r23793 14 14 """ 15 15 16 printingflag =False16 printingflag = False 17 17 18 numlayers =1019 resolution =30000.18 numlayers = 10 19 resolution = 30000. 20 20 21 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 solution25 md =parameterize(md,'../Par/RoundSheetStaticEISMINT.py')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 26 27 27 #Calculation of the analytical 2d velocity field 28 constant =0.329 vx_obs =constant/2.*md.mesh.x*(md.geometry.thickness)**-130 vy_obs =constant/2.*md.mesh.y*(md.geometry.thickness)**-131 vel_obs =np.sqrt((md.inversion.vx_obs)**2+(md.inversion.vy_obs)**2)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 31 vel_obs = np.sqrt((md.inversion.vx_obs)**2 + (md.inversion.vy_obs)**2) 32 32 33 33 #We extrude the model to have a 3d model 34 md.extrude(numlayers, 1.)35 md =setflowequation(md,'HO','all')34 md.extrude(numlayers, 1.) 35 md = setflowequation(md, 'HO', 'all') 36 36 37 37 #Spc the nodes on the bed 38 pos =np.where(md.mesh.vertexonbase)39 md.stressbalance.spcvx[pos] =0.40 md.stressbalance.spcvy[pos] =0.41 md.stressbalance.spcvz[pos] =0.38 pos = np.where(md.mesh.vertexonbase) 39 md.stressbalance.spcvx[pos] = 0. 40 md.stressbalance.spcvy[pos] = 0. 41 md.stressbalance.spcvz[pos] = 0. 42 42 43 #Now we can solve the problem 44 md.cluster =generic('name',gethostname(),'np',8)45 md =solve(md,'Stressbalance')43 #Now we can solve the problem 44 md.cluster = generic('name', gethostname(), 'np', 8) 45 md = solve(md, 'Stressbalance') 46 46 47 47 #Calculate the depth averaged velocity field (2d): 48 vx =md.results.StressbalanceSolution.Vx49 vy =md.results.StressbalanceSolution.Vy50 vel =np.zeros((md.mesh.numberofvertices2d))48 vx = md.results.StressbalanceSolution.Vx 49 vy = md.results.StressbalanceSolution.Vy 50 vel = np.zeros((md.mesh.numberofvertices2d)) 51 51 52 for i in range(0,md.mesh.numberofvertices2d): 53 node_vel=0. 54 for j in range(0,md.mesh.numberoflayers-1): 55 node_vel=node_vel+1./(2.*(md.mesh.numberoflayers-1))*\ 56 (np.sqrt(vx[i+(j+1)*md.mesh.numberofvertices2d,0]**2+vy[i+(j+1)*md.mesh.numberofvertices2d,0]**2)+\ 57 np.sqrt(vx[i+j*md.mesh.numberofvertices2d,0]**2+vy[i+j*md.mesh.numberofvertices2d,0]**2)) 58 vel[i]=node_vel 52 for i in range(0, md.mesh.numberofvertices2d): 53 node_vel = 0. 54 for j in range(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 59 57 60 58 #Plot of the velocity from the exact and calculated solutions 61 59 #figure(1) 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 60 #subplot(2, 2, 1) 61 #p = patch('Faces', md.mesh.elements2d, 'Vertices',[md.mesh.x2d md.mesh.y2d], 'FaceVertexCData',... 62 #vel, 'FaceColor', 'interp', 'EdgeColor', 'none') 63 #title('Modelled velocity', 'FontSize', 14, 'FontWeight', 'bold') 64 #colorbar 74 65 #caxis([0 200]) 75 66 76 #subplot(2,2,3) 67 #subplot(2, 2, 2) 68 #p = patch('Faces', md.mesh.elements2d, 'Vertices',[md.mesh.x2d md.mesh.y2d], 'FaceVertexCData',... 69 #vel_obs, 'FaceColor', 'interp', 'EdgeColor', 'none') 70 #title('Analytical velocity', 'FontSize', 14, 'FontWeight', 'bold') 71 #colorbar 72 #caxis([0 200]) 73 74 #subplot(2, 2, 3) 77 75 #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')76 #plot(sqrt((md.mesh.x(1:md.mesh.numberofvertices2d)).^2+(md.mesh.y(1:md.mesh.numberofvertices2d)).^2), vel, 'r.') 77 #plot(sqrt((md.mesh.x2d).^2+(md.mesh.y2d).^2), vel_obs, 'b.') 78 #title('Analytical vs calculated velocity', 'FontSize', 14, 'FontWeight', 'bold') 79 #xlabel('distance to the center of the icesheet [m]', 'FontSize', 14, 'FontWeight', 'bold') 80 #ylabel('velocity [m/yr]', 'FontSize', 14, 'FontWeight', 'bold') 81 #legend('calculated velocity', 'exact velocity') 84 82 #axis([0 750000 0 200]) 85 83 #hold off 86 84 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')85 #subplot(2, 2, 4) 86 #p = patch('Faces', md.mesh.elements2d, 'Vertices',[md.mesh.x2d md.mesh.y2d], 'FaceVertexCData',... 87 #abs(vel-vel_obs)./vel_obs*100, 'FaceColor', 'interp', 'EdgeColor', 'none') 88 #title('Relative misfit [%]', 'FontSize', 14, 'FontWeight', 'bold') 91 89 #colorbar 92 90 #caxis([0 100]) 93 91 94 92 if printingflag: 95 96 # set(gcf,'Color','w')97 # printmodel('HOstatic','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off')98 # 93 pass 94 # set(gcf, 'Color', 'w') 95 # printmodel('HOstatic', 'png', 'margin', 'on', 'marginsize', 25, 'frame', 'off', 'resolution', 0.7, 'hardcopy', 'off') 96 # system(['mv HOstatic.png ' ISSM_DIR '/website/doc_pdf/validation/Images/EISMINT/IceSheet']) 99 97 100 98 #Fields and tolerances to track changes 101 field_names =['Vx','Vy','Vel']102 field_tolerances =[1e-12,1e-12,1e-12]103 field_values =[vx,vy,vel]99 field_names = ['Vx', 'Vy', 'Vel'] 100 field_tolerances = [1e-12, 1e-12, 1e-12] 101 field_values = [vx, vy, vel]
Note:
See TracChangeset
for help on using the changeset viewer.