- Timestamp:
- 06/07/17 10:50:54 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/branches/trunk-larour-NatGeoScience2016/test/NightlyRun/test1105.py
r21060 r21759 1 1 #Test Name: ISMIPCHO 2 import numpy 2 import numpy as np 3 3 import shutil 4 4 from model import * 5 from socket import gethostname 5 6 from squaremesh import * 6 7 from setmask import * … … 8 9 from setflowequation import * 9 10 from solve import * 10 from MatlabFuncs import *11 from PythonFuncs import *12 11 13 12 """ … … 18 17 printingflag=False 19 18 20 L_list=[ 5000.,10000.,20000.,40000.,80000.,160000.]19 L_list=[80000.] 21 20 results=[] 22 21 minvx=[] … … 35 34 36 35 #Create MPCs to have periodic boundary conditions 37 md.stressbalance.spcvx= float('NaN')*numpy.ones((md.mesh.numberofvertices,1))38 md.stressbalance.spcvy= float('NaN')*numpy.ones((md.mesh.numberofvertices,1))39 md.stressbalance.spcvz= float('NaN')*numpy.ones((md.mesh.numberofvertices,1))36 md.stressbalance.spcvx=np.nan*np.ones((md.mesh.numberofvertices)) 37 md.stressbalance.spcvy=np.nan*np.ones((md.mesh.numberofvertices)) 38 md.stressbalance.spcvz=np.nan*np.ones((md.mesh.numberofvertices)) 40 39 41 posx=n umpy.nonzero(logical_and_n(md.mesh.x==0.,md.mesh.y!=0.,md.mesh.y!=L))[0]42 posx2=n umpy.nonzero(logical_and_n(md.mesh.x==L,md.mesh.y!=0.,md.mesh.y!=L))[0]40 posx=np.where(np.logical_and.reduce((md.mesh.x==0.,md.mesh.y!=0.,md.mesh.y!=L)))[0] 41 posx2=np.where(np.logical_and.reduce((md.mesh.x==L,md.mesh.y!=0.,md.mesh.y!=L)))[0] 43 42 44 posy=n umpy.nonzero(logical_and_n(md.mesh.y==0.,md.mesh.x!=0.,md.mesh.x!=L))[0] #Don't take the same nodes two times45 posy2=n umpy.nonzero(logical_and_n(md.mesh.y==L,md.mesh.x!=0.,md.mesh.x!=L))[0]43 posy=np.where(np.logical_and.reduce((md.mesh.y==0.,md.mesh.x!=0.,md.mesh.x!=L)))[0] #Don't take the same nodes two times 44 posy2=np.where(np.logical_and.reduce((md.mesh.y==L,md.mesh.x!=0.,md.mesh.x!=L)))[0] 46 45 47 md.stressbalance.vertex_pairing=n umpy.vstack((numpy.hstack((posx.reshape(-1,1)+1,posx2.reshape(-1,1)+1)),numpy.hstack((posy.reshape(-1,1)+1,posy2.reshape(-1,1)+1))))46 md.stressbalance.vertex_pairing=np.vstack((np.vstack((posx+1,posx2+1)).T,np.vstack((posy+1,posy2+1)).T)) 48 47 49 48 #Add spc on the corners 50 pos=n umpy.nonzero(logical_and_n(numpy.logical_or(md.mesh.x==0.,md.mesh.x==L),numpy.logical_or(md.mesh.y==0.,md.mesh.y==L),md.mesh.vertexonbase))49 pos=np.where(np.logical_and.reduce((np.logical_or(md.mesh.x==0.,md.mesh.x==L),np.logical_or(md.mesh.y==0.,md.mesh.y==L),md.mesh.vertexonbase))) 51 50 md.stressbalance.spcvx[pos]=0. 52 51 md.stressbalance.spcvy[pos]=0. … … 71 70 72 71 #Spc the bed at zero for vz 73 pos=n umpy.nonzero(md.mesh.vertexonbase)72 pos=np.where(md.mesh.vertexonbase) 74 73 md.stressbalance.spcvz[pos]=0. 75 74 76 75 #Compute the stressbalance 77 md.cluster=generic('name', oshostname(),'np',8)76 md.cluster=generic('name',gethostname(),'np',8) 78 77 md=solve(md,'Stressbalance') 79 78 … … 83 82 vz=md.results.StressbalanceSolution.Vz 84 83 results.append(md.results.StressbalanceSolution) 85 minvx.append(n umpy.min(vx[-md.mesh.numberofvertices2d:]))86 maxvx.append(n umpy.max(vx[-md.mesh.numberofvertices2d:]))84 minvx.append(np.min(vx[-md.mesh.numberofvertices2d:])) 85 maxvx.append(np.max(vx[-md.mesh.numberofvertices2d:])) 87 86 88 87 #Now plot vx, vy, vz and vx on a cross section … … 91 90 pass 92 91 # set(gcf,'Color','w') 93 # printmodel(['ismipcHOvx' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off') ;92 # printmodel(['ismipcHOvx' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off') 94 93 # shutil.move("ismipcHOvx%d.png" % L,ISSM_DIR+'/website/doc_pdf/validation/Images/ISMIP/TestC') 95 94 # plotmodel(md,'data',vy,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',3) … … 97 96 pass 98 97 # set(gcf,'Color','w') 99 # printmodel(['ismipcHOvy' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off') ;98 # printmodel(['ismipcHOvy' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off') 100 99 # shutil.move("ismipcHOvy%d.png" % L,ISSM_DIR+'/website/doc_pdf/validation/Images/ISMIP/TestC') 101 100 # plotmodel(md,'data',vz,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',4) … … 103 102 pass 104 103 # set(gcf,'Color','w') 105 # printmodel(['ismipcHOvz' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off') ;104 # printmodel(['ismipcHOvz' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off') 106 105 # shutil.move("ismipcHOvz%d.png" % L,ISSM_DIR+'/website/doc_pdf/validation/Images/ISMIP/TestC') 107 106 … … 133 132 pass 134 133 # set(gcf,'Color','w') 135 # printmodel(['ismipcHOvxsec' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off') ;134 # printmodel(['ismipcHOvxsec' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off') 136 135 # shutil.move("ismipcHOvxsec%d.png" % L,ISSM_DIR+'/website/doc_pdf/validation/Images/ISMIP/TestC') 137 136 138 137 #Now plot the min and max values of vx for each size of the square 139 #plot([5 10 20 40 80 160],minvx) ;ylim([4 18]);xlim([0 160])138 #plot([5 10 20 40 80 160],minvx)ylim([4 18])xlim([0 160]) 140 139 if printingflag: 141 140 pass 142 141 # set(gcf,'Color','w') 143 # printmodel('ismipcHOminvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off') ;142 # printmodel('ismipcHOminvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off') 144 143 # shutil.move('ismipcHOminvx.png',ISSM_DIR+'/website/doc_pdf/validation/Images/ISMIP/TestC') 145 #plot([5 10 20 40 80 160],maxvx) ;ylim([0 200]);xlim([0 160])144 #plot([5 10 20 40 80 160],maxvx)ylim([0 200]) xlim([0 160]) 146 145 if printingflag: 147 146 pass 148 147 # set(gcf,'Color','w') 149 # printmodel('ismipcHOmaxvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off') ;148 # printmodel('ismipcHOmaxvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off') 150 149 # shutil.move('ismipcHOmaxvx.png',ISSM_DIR+'/website/doc_pdf/validation/Images/ISMIP/TestC') 151 150 152 151 #Fields and tolerances to track changes 153 field_names =[\ 154 'Vx5km','Vy5km','Vz5km',\ 155 'Vx10km','Vy10km','Vz10km',\ 156 'Vx20km','Vy20km','Vz20km',\ 157 'Vx40km','Vy40km','Vz40km',\ 158 'Vx80km','Vy80km','Vz80km',\ 159 'Vx160km','Vy160km','Vz160km' 160 ] 161 field_tolerances=[\ 162 1e-08,1e-07,1e-07,\ 163 1e-09,1e-07,1e-07,\ 164 1e-09,1e-09,1e-07,\ 165 1e-09,1e-09,1e-08,\ 166 1e-09,1e-08,1e-08,\ 167 1e-09,1e-08,1e-08,\ 168 ] 152 field_names =['Vx80km','Vy80km','Vz80km'] 153 field_tolerances=[1e-09,1e-08,1e-08] 169 154 field_values=[] 170 155 for result in results: 171 field_values=field_values+[\ 172 result.Vx,\ 173 result.Vy,\ 174 result.Vz,\ 175 ] 156 field_values=field_values+[result.Vx,result.Vy,result.Vz]
Note:
See TracChangeset
for help on using the changeset viewer.