Changeset 13052
- Timestamp:
- 08/15/12 17:22:09 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/parameterization/setflowequation.py
r13032 r13052 57 57 58 58 #check that each element has at least one flag 59 if not any(hutterflag+macayealflag+ pattynflag+stokesflag):60 raise TypeError(" setflowequation error message:elements type not assigned, must be specified")59 if not any(hutterflag+macayealflag+l1l2flag+pattynflag+stokesflag): 60 raise TypeError("elements type not assigned, must be specified") 61 61 62 62 #check that each element has only one flag 63 if any(hutterflag+macayealflag+ pattynflag+stokesflag>1):63 if any(hutterflag+macayealflag+l1l2flag+pattynflag+stokesflag>1): 64 64 print "setflowequation warning message: some elements have several types, higher order type is used for them" 65 65 hutterflag[numpy.nonzero(numpy.logical_and(hutterflag,macayealflag))]=0 … … 69 69 #Check that no pattyn or stokes for 2d mesh 70 70 if md.mesh.dimension==2: 71 if numpy.any(numpy.logical_or( stokesflag,pattynflag)):72 raise TypeError("s etflowequation error message: stokes and pattyn elements not allowed in 2d mesh, extrude it first")71 if numpy.any(numpy.logical_or(l1l2flag,stokesflag,pattynflag)): 72 raise TypeError("stokes and pattyn elements not allowed in 2d mesh, extrude it first") 73 73 74 74 #Stokes can only be used alone for now: 75 75 if any(stokesflag) and any(hutterflag): 76 raise TypeError("s etflowequation error message: stokes cannot be used with any other model for now, put stokes everywhere")76 raise TypeError("stokes cannot be used with any other model for now, put stokes everywhere") 77 77 78 78 #Initialize node fields … … 81 81 nodeonmacayeal=numpy.zeros(md.mesh.numberofvertices) 82 82 nodeonmacayeal[md.mesh.elements[numpy.nonzero(macayealflag),:].astype(int)-1]=1 83 nodeonl1l2=numpy.zeros(md.mesh.numberofvertices) 84 nodeonl1l2[md.mesh.elements[numpy.nonzero(l1l2flag),:].astype(int)-1]=1 83 85 nodeonpattyn=numpy.zeros(md.mesh.numberofvertices) 84 86 nodeonpattyn[md.mesh.elements[numpy.nonzero(pattynflag),:].astype(int)-1]=1 … … 235 237 md.flowequation.element_equation[numpy.nonzero(hutterflag)]=1 236 238 md.flowequation.element_equation[numpy.nonzero(macayealflag)]=2 239 md.flowequation.element_equation[numpy.nonzero(l1l2flag)]=8 237 240 md.flowequation.element_equation[numpy.nonzero(pattynflag)]=3 238 241 md.flowequation.element_equation[numpy.nonzero(stokesflag)]=4 … … 252 255 pos=numpy.nonzero(nodeonmacayeal) 253 256 md.flowequation.vertex_equation[pos]=2 257 pos=numpy.nonzero(nodeonl1l2) 258 md.flowequation.vertex_equation[pos]=8 254 259 pos=numpy.nonzero(nodeonpattyn) 255 260 md.flowequation.vertex_equation[pos]=3 256 pos=numpy.nonzero(nodeonhutter)257 md.flowequation.vertex_equation[pos]=1258 261 pos=numpy.nonzero(nodeonmacayealpattyn) 259 262 md.flowequation.vertex_equation[pos]=5 … … 272 275 md.flowequation.ishutter=float(any(md.flowequation.element_equation==1)) 273 276 md.flowequation.ismacayealpattyn=float(numpy.any(numpy.logical_or(md.flowequation.element_equation==2,md.flowequation.element_equation==3))) 277 md.flowequation.isl1l2=float(any(md.flowequation.element_equation==8)) 274 278 md.flowequation.isstokes=float(any(md.flowequation.element_equation==4)) 275 279
Note:
See TracChangeset
for help on using the changeset viewer.