Changeset 13032
- Timestamp:
- 08/14/12 14:55:08 (13 years ago)
- Location:
- issm/trunk-jpl/src/m
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py
r13030 r13032 69 69 70 70 #Create zeros basalforcings and surfaceforcings 71 if all(numpy.isnan(md.surfaceforcings.precipitation)):71 if numpy.all(numpy.isnan(md.surfaceforcings.precipitation)): 72 72 md.surfaceforcings.precipitation=numpy.zeros(md.mesh.numberofvertices) 73 73 print ' no surfaceforcings.precipitation specified: values set as zero' 74 if all(numpy.isnan(md.surfaceforcings.mass_balance)):74 if numpy.all(numpy.isnan(md.surfaceforcings.mass_balance)): 75 75 md.surfaceforcings.mass_balance=numpy.zeros(md.mesh.numberofvertices) 76 76 print ' no surfaceforcings.mass_balance specified: values set as zero' 77 if all(numpy.isnan(md.basalforcings.melting_rate)):77 if numpy.all(numpy.isnan(md.basalforcings.melting_rate)): 78 78 md.basalforcings.melting_rate=numpy.zeros(md.mesh.numberofvertices) 79 79 print ' no basalforcings.melting_rate specified: values set as zero' 80 if all(numpy.isnan(md.balancethickness.thickening_rate)):80 if numpy.all(numpy.isnan(md.balancethickness.thickening_rate)): 81 81 md.balancethickness.thickening_rate=numpy.zeros(md.mesh.numberofvertices) 82 82 print ' no balancethickness.thickening_rate specified: values set as zero' -
issm/trunk-jpl/src/m/classes/diagnostic.py
r13030 r13032 139 139 140 140 #singular solution 141 if not any(numpy.logical_and(numpy.logical_not(numpy.isnan(md.diagnostic.spcvx)),numpy.logical_not(numpy.isnan(md.diagnostic.spcvy)))):141 if not numpy.any(numpy.logical_and(numpy.logical_not(numpy.isnan(md.diagnostic.spcvx)),numpy.logical_not(numpy.isnan(md.diagnostic.spcvy)))): 142 142 md.checkmessage("model is not well posed (singular). You need at least one node with fixed velocity!") 143 143 #CHECK THAT EACH LINES CONTAINS ONLY NAN VALUES OR NO NAN VALUES … … 148 148 pos=[i for i,item in enumerate(numpy.sum(numpy.isnan(md.diagnostic.referential),axis=1)) if item==0] 149 149 # numpy.inner (and numpy.dot) calculate all the dot product permutations, resulting in a full matrix multiply 150 # if any(numpy.abs(numpy.inner(md.diagnostic.referential[pos,0:2],md.diagnostic.referential[pos,3:5]).diagonal())>sys.float_info.epsilon):150 # if numpy.any(numpy.abs(numpy.inner(md.diagnostic.referential[pos,0:2],md.diagnostic.referential[pos,3:5]).diagonal())>sys.float_info.epsilon): 151 151 # md.checkmessage("Vectors in diagnostic.referential (columns 1 to 3 and 4 to 6) must be orthogonal") 152 152 for item in md.diagnostic.referential[pos,:]: … … 156 156 if md.mesh.dimension==3 and md.flowequation.isstokes: 157 157 pos=numpy.nonzero(numpy.logical_and(md.mask.vertexongroundedice,md.mesh.vertexonbed)) 158 if any(not numpy.isnan(md.diagnostic.referential[pos,:])):158 if numpy.any(numpy.logical_not(numpy.isnan(md.diagnostic.referential[pos,:]))): 159 159 md.checkmessage("no referential should be specified for basal vertices of grounded ice") 160 160 -
issm/trunk-jpl/src/m/classes/flaim.py
r13023 r13032 68 68 69 69 md = checkfield(md,'flaim.tracks','file',1) 70 if any(numpy.isnan(md.flaim.criterion)) or not md.flaim.criterion:70 if numpy.any(numpy.isnan(md.flaim.criterion)) or not md.flaim.criterion: 71 71 md = checkfield(md,'flaim.targets','file',1) 72 72 else: -
issm/trunk-jpl/src/m/classes/flowequation.py
r13020 r13032 71 71 if DiagnosticHutterAnalysisEnum() in analyses: 72 72 if any(md.flowequation.element_equation==1): 73 if any(numpy.logical_and(md.flowequation.element_equation,md.mask.elementonfloatingice)):73 if numpy.any(numpy.logical_and(md.flowequation.element_equation,md.mask.elementonfloatingice)): 74 74 print "\n !!! Warning: Hutter's model is not consistent on ice shelves !!!\n" 75 75 -
issm/trunk-jpl/src/m/classes/groundingline.py
r13020 r13032 50 50 51 51 if not strcmp(self.migration,'None'): 52 if any(numpy.isnan(md.geometry.bathymetry)):52 if numpy.any(numpy.isnan(md.geometry.bathymetry)): 53 53 md.checkmessage("requesting grounding line migration, but bathymetry is absent!") 54 54 pos=numpy.nonzero(md.mask.vertexongroundedice) -
issm/trunk-jpl/src/m/classes/initialization.py
r13020 r13032 54 54 def checkconsistency(self,md,solution,analyses): # {{{ 55 55 if DiagnosticHorizAnalysisEnum() in analyses: 56 if not any(numpy.isnan(md.initialization.vx) or numpy.isnan(md.initialization.vy)):56 if not numpy.any(numpy.logical_or(numpy.isnan(md.initialization.vx),numpy.isnan(md.initialization.vy))): 57 57 md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices]) 58 58 md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices]) … … 66 66 md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices]) 67 67 #Triangle with zero velocity 68 if any(numpy.logical_and(numpy.sum(numpy.abs(md.initialization.vx[md.mesh.elements.astype(int)-1]),axis=1)==0,\69 numpy.sum(numpy.abs(md.initialization.vy[md.mesh.elements.astype(int)-1]),axis=1)==0)):68 if numpy.any(numpy.logical_and(numpy.sum(numpy.abs(md.initialization.vx[md.mesh.elements.astype(int)-1]),axis=1)==0,\ 69 numpy.sum(numpy.abs(md.initialization.vy[md.mesh.elements.astype(int)-1]),axis=1)==0)): 70 70 md.checkmessage("at least one triangle has all its vertices with a zero velocity") 71 71 if ThermalAnalysisEnum() in analyses: -
issm/trunk-jpl/src/m/classes/mesh.py
r13020 r13032 137 137 else: 138 138 md = checkfield(md,'mesh.elements','size',[md.mesh.numberofelements,6]) 139 if any(numpy.logical_not(ismember(range(1,md.mesh.numberofvertices+1),md.mesh.elements))):139 if numpy.any(numpy.logical_not(ismember(range(1,md.mesh.numberofvertices+1),md.mesh.elements))): 140 140 md.checkmessage("orphan nodes have been found. Check the mesh outline") 141 141 md = checkfield(md,'mesh.dimension','values',[2,3]) -
issm/trunk-jpl/src/m/parameterization/setflowequation.py
r13031 r13032 69 69 #Check that no pattyn or stokes for 2d mesh 70 70 if md.mesh.dimension==2: 71 if any(numpy.logical_or(stokesflag,pattynflag)):71 if numpy.any(numpy.logical_or(stokesflag,pattynflag)): 72 72 raise TypeError("setflowequation error message: stokes and pattyn elements not allowed in 2d mesh, extrude it first") 73 73 … … 124 124 125 125 #initialize and fill in penalties structure 126 if all(numpy.logical_not(numpy.isnan(bordernodes2d))):126 if numpy.all(numpy.logical_not(numpy.isnan(bordernodes2d))): 127 127 penalties=numpy.zeros((0,2)) 128 128 for i in xrange(1,numlayers): … … 146 146 pos=numpy.nonzero(macayealpattynflag) 147 147 elist=numpy.zeros(len(pos)) 148 elist = elist + any(numpy.sum(nodeonmacayeal[md.mesh.elements[pos,:].astype(int)-1],axis=1),axis=1)149 elist = elist - any(numpy.sum(nodeonpattyn[md.mesh.elements[pos,:].astype(int)-1] ,axis=1),axis=1)148 elist = elist + numpy.any(numpy.sum(nodeonmacayeal[md.mesh.elements[pos,:].astype(int)-1],axis=1),axis=1) 149 elist = elist - numpy.any(numpy.sum(nodeonpattyn[md.mesh.elements[pos,:].astype(int)-1] ,axis=1),axis=1) 150 150 pos1=[i for i,item in enumerate(elist) if item==1] 151 151 macayealflag[pos[pos1]]=1 … … 178 178 pos=numpy.nonzero(pattynstokesflag) 179 179 elist=numpy.zeros(len(pos)) 180 elist = elist + any(numpy.sum(nodeonstokes[md.mesh.elements[pos,:].astype(int)-1],axis=1),axis=1)181 elist = elist - any(numpy.sum(nodeonpattyn[md.mesh.elements[pos,:].astype(int)-1],axis=1),axis=1)180 elist = elist + numpy.any(numpy.sum(nodeonstokes[md.mesh.elements[pos,:].astype(int)-1],axis=1),axis=1) 181 elist = elist - numpy.any(numpy.sum(nodeonpattyn[md.mesh.elements[pos,:].astype(int)-1],axis=1),axis=1) 182 182 pos1=[i for i,item in enumerate(elist) if item==1] 183 183 stokesflag[pos[pos1]]=1 … … 210 210 pos=numpy.nonzero(macayealstokesflag) 211 211 elist=numpy.zeros(len(pos)) 212 elist = elist + any(numpy.sum(nodeonmacayeal[md.mesh.elements[pos,:].astype(int)-1],axis=1),axis=1)213 elist = elist - any(numpy.sum(nodeonstokes[md.mesh.elements[pos,:].astype(int)-1] ,axis=1),axis=1)212 elist = elist + numpy.any(numpy.sum(nodeonmacayeal[md.mesh.elements[pos,:].astype(int)-1],axis=1),axis=1) 213 elist = elist - numpy.any(numpy.sum(nodeonstokes[md.mesh.elements[pos,:].astype(int)-1] ,axis=1),axis=1) 214 214 pos1=[i for i,item in enumerate(elist) if item==1] 215 215 macayealflag[pos[pos1]]=1 … … 271 271 #figure out solution types 272 272 md.flowequation.ishutter=float(any(md.flowequation.element_equation==1)) 273 md.flowequation.ismacayealpattyn=float( any(numpy.logical_or(md.flowequation.element_equation==2,md.flowequation.element_equation==3)))273 md.flowequation.ismacayealpattyn=float(numpy.any(numpy.logical_or(md.flowequation.element_equation==2,md.flowequation.element_equation==3))) 274 274 md.flowequation.isstokes=float(any(md.flowequation.element_equation==4)) 275 275
Note:
See TracChangeset
for help on using the changeset viewer.