- Timestamp:
- 11/19/12 14:11:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py
r13970 r13984 25 25 if not os.path.exists(icefrontfile): 26 26 raise IOError("SetIceShelfBC error message: ice front file '%s' not found." % icefrontfile) 27 [nodeinsideicefront,dum]=ContourToMesh(md.mesh.elements ,md.mesh.x.reshape(-1,1),md.mesh.y.reshape(-1,1),icefrontfile,'node',2)28 nodeonicefront=numpy.logical_and(md.mesh.vertexonboundary,nodeinsideicefront.reshape(-1)) .astype(float)27 [nodeinsideicefront,dum]=ContourToMesh(md.mesh.elements.astype(float),md.mesh.x.reshape(-1,1),md.mesh.y.reshape(-1,1),icefrontfile,'node',2) 28 nodeonicefront=numpy.logical_and(md.mesh.vertexonboundary,nodeinsideicefront.reshape(-1)) 29 29 else: 30 nodeonicefront=numpy.zeros((md.mesh.numberofvertices) )30 nodeonicefront=numpy.zeros((md.mesh.numberofvertices),bool) 31 31 32 32 # pos=find(md.mesh.vertexonboundary & ~nodeonicefront); … … 56 56 #segment on Neumann (Ice Front) 57 57 # pos=find(nodeonicefront(md.mesh.segments(:,1)) | nodeonicefront(md.mesh.segments(:,2))); 58 pos=numpy.nonzero(numpy.logical_or(nodeonicefront[md.mesh.segments[:,0] .astype(int)-1],nodeonicefront[md.mesh.segments[:,1].astype(int)-1]))[0]58 pos=numpy.nonzero(numpy.logical_or(nodeonicefront[md.mesh.segments[:,0]-1],nodeonicefront[md.mesh.segments[:,1]-1]))[0] 59 59 if md.mesh.dimension==2: 60 60 pressureload=md.mesh.segments[pos,:] … … 62 62 # pressureload_layer1=[md.mesh.segments(pos,1:2) md.mesh.segments(pos,2)+md.mesh.numberofvertices2d md.mesh.segments(pos,1)+md.mesh.numberofvertices2d md.mesh.segments(pos,3)]; 63 63 pressureload_layer1=numpy.hstack((md.mesh.segments[pos,0:2],md.mesh.segments[pos,1]+md.mesh.numberofvertices2d,md.mesh.segments[pos,0]+md.mesh.numberofvertices2d,md.mesh.segments[pos,2])) 64 pressureload=numpy.zeros((0,5) )64 pressureload=numpy.zeros((0,5),int) 65 65 for i in xrange(1,md.mesh.numberoflayers): 66 66 # pressureload=[pressureload ;pressureload_layer1(:,1:4)+(i-1)*md.mesh.numberofvertices2d pressureload_layer1(:,5)+(i-1)*md.mesh.numberofelements2d ]; … … 69 69 #Add water or air enum depending on the element 70 70 # pressureload=[pressureload 1*md.mask.elementonfloatingice(pressureload(:,end))]; 71 pressureload=numpy.hstack((pressureload,1 .*md.mask.elementonfloatingice[pressureload[:,-1].astype('int')-1].reshape(-1,1)))71 pressureload=numpy.hstack((pressureload,1*md.mask.elementonfloatingice[pressureload[:,-1]-1].reshape(-1,1))) 72 72 73 73 #plug onto model
Note:
See TracChangeset
for help on using the changeset viewer.