Changeset 13470
- Timestamp:
- 09/27/12 14:46:49 (12 years ago)
- Location:
- issm/trunk-jpl/src/m
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py
r13467 r13470 26 26 raise IOError("SetIceShelfBC error message: ice front file '%s' not found." % icefrontfile) 27 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 ).astype(float)28 nodeonicefront=numpy.logical_and(md.mesh.vertexonboundary,nodeinsideicefront.reshape(-1)).astype(float) 29 29 else: 30 nodeonicefront=numpy.zeros((md.mesh.numberofvertices ,1))30 nodeonicefront=numpy.zeros((md.mesh.numberofvertices)) 31 31 32 32 # pos=find(md.mesh.vertexonboundary & ~nodeonicefront); 33 pos= [i for i,(vob,noif) in enumerate(zip(md.mesh.vertexonboundary,nodeonicefront)) if vob and not noif]34 md.diagnostic.spcvx=float(' NaN')*numpy.ones((md.mesh.numberofvertices,1))35 md.diagnostic.spcvy=float(' NaN')*numpy.ones((md.mesh.numberofvertices,1))36 md.diagnostic.spcvz=float(' NaN')*numpy.ones((md.mesh.numberofvertices,1))33 pos=numpy.nonzero(numpy.logical_and(md.mesh.vertexonboundary,numpy.logical_not(nodeonicefront)))[0] 34 md.diagnostic.spcvx=float('nan')*numpy.ones((md.mesh.numberofvertices,1)) 35 md.diagnostic.spcvy=float('nan')*numpy.ones((md.mesh.numberofvertices,1)) 36 md.diagnostic.spcvz=float('nan')*numpy.ones((md.mesh.numberofvertices,1)) 37 37 md.diagnostic.spcvx[pos]=0 38 38 md.diagnostic.spcvy[pos]=0 39 39 md.diagnostic.spcvz[pos]=0 40 md.diagnostic.referential=float(' NaN')*numpy.ones((md.mesh.numberofvertices,6))40 md.diagnostic.referential=float('nan')*numpy.ones((md.mesh.numberofvertices,6)) 41 41 42 42 #Dirichlet Values 43 43 if isinstance(md.inversion.vx_obs,numpy.ndarray) and numpy.size(md.inversion.vx_obs,axis=0)==md.mesh.numberofvertices and isinstance(md.inversion.vy_obs,numpy.ndarray) and numpy.size(md.inversion.vy_obs,axis=0)==md.mesh.numberofvertices: 44 print ' boundary conditions for diagnostic model: spc set as observed velocities'44 print " boundary conditions for diagnostic model: spc set as observed velocities" 45 45 md.diagnostic.spcvx[pos]=md.inversion.vx_obs[pos] 46 46 md.diagnostic.spcvy[pos]=md.inversion.vy_obs[pos] 47 47 else: 48 print ' boundary conditions for diagnostic model: spc set as zero'48 print " boundary conditions for diagnostic model: spc set as zero" 49 49 50 50 #segment on Ice Front 51 51 #segment on Neumann (Ice Front) 52 52 # pos=find(nodeonicefront(md.mesh.segments(:,1)) | nodeonicefront(md.mesh.segments(:,2))); 53 pos= [i for i,(noif1,noif2) in enumerate(zip(nodeonicefront[md.mesh.segments[:,0].astype('int')-1],nodeonicefront[md.mesh.segments[:,1].astype('int')-1])) if noif1 or noif2]53 pos=numpy.nonzero(numpy.logical_or(nodeonicefront[md.mesh.segments[:,0].astype(int)-1],nodeonicefront[md.mesh.segments[:,1].astype(int)-1]))[0] 54 54 if md.mesh.dimension==2: 55 55 pressureload=md.mesh.segments[pos,:] … … 60 60 for i in xrange(1,md.mesh.numberoflayers): 61 61 # pressureload=[pressureload ;pressureload_layer1(:,1:4)+(i-1)*md.mesh.numberofvertices2d pressureload_layer1(:,5)+(i-1)*md.mesh.numberofelements2d ]; 62 pressureload=numpy.vstack((pressureload,numpy.hstack((pressureload_layer1[:,0: 3]+(i-1)*md.mesh.numberofvertices2d,pressureload_layer1[:,4]+(i-1)*md.mesh.numberofelements2d))))62 pressureload=numpy.vstack((pressureload,numpy.hstack((pressureload_layer1[:,0:4]+(i-1)*md.mesh.numberofvertices2d,pressureload_layer1[:,4]+(i-1)*md.mesh.numberofelements2d)))) 63 63 64 64 #Add water or air enum depending on the element 65 65 # pressureload=[pressureload 1*md.mask.elementonfloatingice(pressureload(:,end))]; 66 pressureload=numpy.hstack((pressureload,1 *md.mask.elementonfloatingice[pressureload[:,-1].astype('int')-1].reshape((-1,1))))66 pressureload=numpy.hstack((pressureload,1.*md.mask.elementonfloatingice[pressureload[:,-1].astype('int')-1].reshape(-1,1))) 67 67 68 68 #plug onto model … … 72 72 if numpy.all(numpy.isnan(md.surfaceforcings.precipitation)) and (md.surfaceforcings.ispdd==1): 73 73 md.surfaceforcings.precipitation=numpy.zeros((md.mesh.numberofvertices,1)) 74 print ' no surfaceforcings.precipitation specified: values set as zero'74 print " no surfaceforcings.precipitation specified: values set as zero" 75 75 if numpy.all(numpy.isnan(md.surfaceforcings.mass_balance)) and (md.surfaceforcings.ispdd==0): 76 76 md.surfaceforcings.mass_balance=numpy.zeros((md.mesh.numberofvertices,1)) 77 print ' no surfaceforcings.mass_balance specified: values set as zero'77 print " no surfaceforcings.mass_balance specified: values set as zero" 78 78 if numpy.all(numpy.isnan(md.basalforcings.melting_rate)): 79 79 md.basalforcings.melting_rate=numpy.zeros((md.mesh.numberofvertices,1)) 80 print ' no basalforcings.melting_rate specified: values set as zero'80 print " no basalforcings.melting_rate specified: values set as zero" 81 81 if numpy.all(numpy.isnan(md.balancethickness.thickening_rate)): 82 82 md.balancethickness.thickening_rate=numpy.zeros((md.mesh.numberofvertices,1)) 83 print ' no balancethickness.thickening_rate specified: values set as zero'83 print " no balancethickness.thickening_rate specified: values set as zero" 84 84 85 md.prognostic.spcthickness=float(' NaN')*numpy.ones((md.mesh.numberofvertices,1))86 md.balancethickness.spcthickness=float(' NaN')*numpy.ones((md.mesh.numberofvertices,1))85 md.prognostic.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,1)) 86 md.balancethickness.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,1)) 87 87 88 if numpy.size(md.initialization.temperature)==md.mesh.numberofvertices:89 md.thermal.spctemperature=float(' NaN')*numpy.ones((md.mesh.numberofvertices,1))88 if isinstance(md.initialization.temperature,numpy.ndarray) and numpy.size(md.initialization.temperature,axis=0)==md.mesh.numberofvertices: 89 md.thermal.spctemperature=float('nan')*numpy.ones((md.mesh.numberofvertices,1)) 90 90 # pos=find(md.mesh.vertexonsurface); md.thermal.spctemperature(pos)=md.initialization.temperature(pos); %impose observed temperature on surface 91 pos= [i for i,vos in enumerate(md.mesh.vertexonsurface) if vos]92 md.thermal.spctemperature[pos]=md.initialization.temperature[pos] # 93 if not numpy.size(md.basalforcings.geothermalflux)==md.mesh.numberofvertices:91 pos=numpy.nonzero(md.mesh.vertexonsurface)[0] 92 md.thermal.spctemperature[pos]=md.initialization.temperature[pos] #impose observed temperature on surface 93 if not isinstance(md.basalforcings.geothermalflux,numpy.ndarray) or not numpy.size(md.basalforcings.geothermalflux,axis=0)==md.mesh.numberofvertices: 94 94 md.basalforcings.geothermalflux=numpy.zeros((md.mesh.numberofvertices,1)) 95 95 else: 96 print ' no thermal boundary conditions created: no observed temperature found'96 print " no thermal boundary conditions created: no observed temperature found" 97 97 98 98 return md -
issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m
r13076 r13470 53 53 54 54 md.hydrology.spcwatercolumn=zeros(md.mesh.numberofvertices,2); 55 pos=find(md.mesh.vertexonboundary); 55 pos=find(md.mesh.vertexonboundary); 56 56 md.hydrology.spcwatercolumn(pos,1)=1; 57 57 … … 101 101 if (length(md.basalforcings.geothermalflux)~=md.mesh.numberofvertices), 102 102 md.basalforcings.geothermalflux=zeros(md.mesh.numberofvertices,1); 103 md.basalforcings.geothermalflux(find(md.mask.vertexongroundedice))=50 *10^-3; %50mW/m2103 md.basalforcings.geothermalflux(find(md.mask.vertexongroundedice))=50.*10.^-3; %50mW/m2 104 104 end 105 105 else -
issm/trunk-jpl/src/m/classes/model/model.py
r13462 r13470 167 167 print ("model not consistent: %s" % string) 168 168 self.private.isconsistent=False 169 return self 169 170 # }}} 170 171 -
issm/trunk-jpl/src/m/geometry/FlagElements.py
r13449 r13470 41 41 if len(region)>3 and not strcmp(region[-4:],'.exp'): 42 42 raise IOError("Error: File 'region' not found!" % region) 43 raise RuntimeError("FlagElements -- basinzoom not yet converted.")43 raise RuntimeError("FlagElements.py calling basinzoom.py is not complete.") 44 44 xlim,ylim=basinzoom('basin',region) 45 45 flag_nodes=numpy.logical_and(numpy.logical_and(md.mesh.x<xlim[1],md.mesh.x>xlim[0]),numpy.logical_and(md.mesh.y<ylim[1],md.mesh.y>ylim[0])).astype(float) … … 47 47 else: 48 48 #ok, flag elements 49 [flag, fnone]=ContourToMesh(md.mesh.elements[:,0:3],md.mesh.x.reshape(-1,1),md.mesh.y.reshape(-1,1),region,'element',1)49 [flag,dum]=ContourToMesh(md.mesh.elements[:,0:3],md.mesh.x.reshape(-1,1),md.mesh.y.reshape(-1,1),region,'element',1) 50 50 51 51 if invert: -
issm/trunk-jpl/src/m/mesh/bamg.py
r13436 r13470 121 121 122 122 elif numpy.any(numpy.logical_not(flags)): 123 raise RuntimeError("bamg. mfor rifts is not complete.")123 raise RuntimeError("bamg.py for rifts is not complete.") 124 124 #We LOTS of work to do 125 125 print("Rift tip outside of or on the domain has been detected and is being processed...") … … 347 347 def processgeometry(geom,tol,outline): # {{{ 348 348 349 raise RuntimeError("bamg. m/processgeometry is not complete.")349 raise RuntimeError("bamg.py/processgeometry is not complete.") 350 350 #Deal with edges 351 351 print("Checking Edge crossing...")
Note:
See TracChangeset
for help on using the changeset viewer.