Changeset 13030
- Timestamp:
- 08/14/12 12:09:35 (13 years ago)
- Location:
- issm/trunk-jpl/src/m
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py
r12944 r13030 69 69 70 70 #Create zeros basalforcings and surfaceforcings 71 if numpy.isnan(md.surfaceforcings.precipitation).all():71 if 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 numpy.isnan(md.surfaceforcings.mass_balance).all():74 if 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 numpy.isnan(md.basalforcings.melting_rate).all():77 if 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 numpy.isnan(md.balancethickness.thickening_rate).all():80 if 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
r13023 r13030 139 139 140 140 #singular solution 141 #if ~any((~isnan(md.diagnostic.spcvx)+~isnan(md.diagnostic.spcvy))==2), 142 if not any((numpy.logical_not(numpy.isnan(md.diagnostic.spcvx))+numpy.logical_not(numpy.isnan(md.diagnostic.spcvy)))==2): 141 if not any(numpy.logical_and(numpy.logical_not(numpy.isnan(md.diagnostic.spcvx)),numpy.logical_not(numpy.isnan(md.diagnostic.spcvy)))): 143 142 md.checkmessage("model is not well posed (singular). You need at least one node with fixed velocity!") 144 143 #CHECK THAT EACH LINES CONTAINS ONLY NAN VALUES OR NO NAN VALUES -
issm/trunk-jpl/src/m/classes/inversion.py
r13029 r13030 111 111 return self 112 112 #}}} 113 113 114 def checkconsistency(self,md,solution,analyses): # {{{ 114 115 … … 142 143 return md 143 144 # }}} 145 144 146 def marshall(self,fid): # {{{ 145 147 … … 184 186 WriteData(fid,'data',num_cost_functions,'enum',InversionNumCostFunctionsEnum(),'format','Integer') 185 187 # }}} 188 -
issm/trunk-jpl/src/m/classes/miscellaneous.m
r12663 r13030 1 %MISCEL ANEOUS class definition1 %MISCELLANEOUS class definition 2 2 % 3 3 % Usage: -
issm/trunk-jpl/src/m/classes/miscellaneous.py
r12958 r13030 1 1 #module imports 2 2 from fielddisplay import fielddisplay 3 from EnumDefinitions import * 4 from checkfield import * 5 from WriteData import * 3 6 4 7 class miscellaneous(object): 8 """ 9 MISCELLANEOUS class definition 10 11 Usage: 12 miscellaneous=miscellaneous(); 13 """ 14 5 15 #properties 6 16 def __init__(self): … … 14 24 15 25 #}}} 16 def __repr__( obj):26 def __repr__(self): 17 27 # {{{ Display 18 28 string=' miscellaneous parameters:' 19 29 20 string="%s\n\n%s"%(string,fielddisplay( obj,'notes','notes in a cell of strings'))21 string="%s\n%s"%(string,fielddisplay( obj,'name','model name'))22 string="%s\n%s"%(string,fielddisplay( obj,'dummy','empty field to store some data'))30 string="%s\n\n%s"%(string,fielddisplay(self,'notes','notes in a cell of strings')) 31 string="%s\n%s"%(string,fielddisplay(self,'name','model name')) 32 string="%s\n%s"%(string,fielddisplay(self,'dummy','empty field to store some data')) 23 33 return string 24 34 #}}} 25 35 26 def setdefaultparameters( obj):36 def setdefaultparameters(self): 27 37 # {{{setdefaultparameters 28 return obj38 return self 29 39 #}}} 30 40 41 def checkconsistency(self,md,solution,analyses): # {{{ 42 md = checkfield(md,'miscellaneous.name','empty',1) 43 return md 44 # }}} 45 46 def marshall(self,fid): # {{{ 47 WriteData(fid,'object',self,'fieldname','name','format','String') 48 # }}} 49 -
issm/trunk-jpl/src/m/classes/model/model.py
r12938 r13030 116 116 string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("inversion","[%s,%s]" % ("1x1",obj.inversion.__class__.__name__),"parameters for inverse methods")) 117 117 string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("qmu","[%s,%s]" % ("1x1",obj.qmu.__class__.__name__),"dakota properties")) 118 string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("results","[%s,%s]" % ("1x1",obj.results.__class__.__name__),"model results '"))118 string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("results","[%s,%s]" % ("1x1",obj.results.__class__.__name__),"model results")) 119 119 string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("radaroverlay","[%s,%s]" % ("1x1",obj.radaroverlay.__class__.__name__),"radar image for plot overlay")) 120 120 string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("miscellaneous","[%s,%s]" % ("1x1",obj.miscellaneous.__class__.__name__),"miscellaneous fields")) -
issm/trunk-jpl/src/m/classes/private.py
r12958 r13030 1 1 #module imports 2 2 from fielddisplay import fielddisplay 3 from EnumDefinitions import * 4 from checkfield import * 3 5 4 6 class private(object): 7 """ 8 PRIVATE class definition 9 10 Usage: 11 private=private(); 12 """ 13 5 14 #properties 6 15 def __init__(self): … … 15 24 16 25 #}}} 17 def __repr__( obj):26 def __repr__(self): 18 27 # {{{ Display 19 28 string=' private parameters: do not change' 20 29 21 string="%s\n%s"%(string,fielddisplay( obj,'isconsistent','is model self consistent'))22 string="%s\n%s"%(string,fielddisplay( obj,'runtimename','name of the run launched'))23 string="%s\n%s"%(string,fielddisplay( obj,'bamg','structure with mesh properties constructed if bamg is used to mesh the domain'))24 string="%s\n%s"%(string,fielddisplay( obj,'solution','type of solution launched'))30 string="%s\n%s"%(string,fielddisplay(self,'isconsistent','is model self consistent')) 31 string="%s\n%s"%(string,fielddisplay(self,'runtimename','name of the run launched')) 32 string="%s\n%s"%(string,fielddisplay(self,'bamg','structure with mesh properties constructed if bamg is used to mesh the domain')) 33 string="%s\n%s"%(string,fielddisplay(self,'solution','type of solution launched')) 25 34 return string 26 35 #}}} 27 36 28 def setdefaultparameters( obj):37 def setdefaultparameters(self): 29 38 # {{{setdefaultparameters 30 return obj39 return self 31 40 #}}} 32 41 42 def checkconsistency(self,md,solution,analyses): # {{{ 43 return md 44 # }}} 45 -
issm/trunk-jpl/src/m/classes/qmu.m
r12663 r13030 47 47 md = checkmessage(md,['user supplied partition for qmu analysis should have size md.mesh.numberofvertices x 1 ']); 48 48 end 49 if find(md.qmu.partition)>=md.mesh.numberofvertices,50 md = checkmessage(md,['user supplied partition should be indexed from 0 (c-convention)']);51 end52 49 if min(md.qmu.partition)~=0, 53 50 md = checkmessage(md,['partition vector not indexed from 0 on']); 54 end55 if max(md.qmu.partition)>=md.mesh.numberofvertices,56 md = checkmessage(md,['partition vector cannot have maximum index larger than number of nodes']);57 end58 if ~isempty(find(md.qmu.partition<0)),59 md = checkmessage(md,['partition vector cannot have values less than 0']);60 end61 if ~isempty(find(md.qmu.partition>=md.qmu.numberofpartitions)),62 md = checkmessage(md,['partition vector cannot have values more than md.qmu.numberofpartitions-1']);63 51 end 64 52 if max(md.qmu.partition)>=md.qmu.numberofpartitions, … … 140 128 end 141 129 end 142 fielddisplay(obj,'partition','user provided mesh partitioni tion, defaults to metis if not specified')143 fielddisplay(obj,'numberofpartitions','number of partitions for semi-d escrete qmu')130 fielddisplay(obj,'partition','user provided mesh partitioning, defaults to metis if not specified') 131 fielddisplay(obj,'numberofpartitions','number of partitions for semi-discrete qmu') 144 132 fielddisplay(obj,'variabledescriptors',''); 145 133 fielddisplay(obj,'responsedescriptors',''); -
issm/trunk-jpl/src/m/classes/qmu.py
r12958 r13030 1 1 #module imports 2 import numpy 2 3 from fielddisplay import fielddisplay 4 from EnumDefinitions import * 5 from checkfield import * 6 from WriteData import * 7 from MatlabFuncs import * 3 8 4 9 class qmu(object): 10 """ 11 QMU class definition 12 13 Usage: 14 qmu=qmu(); 15 """ 16 5 17 #properties 6 18 def __init__(self): … … 27 39 28 40 #}}} 29 def __repr__(obj): 30 # {{{ Display 31 string=" qmu parameters: not implemented yet!" 32 return string 33 #}}} 34 35 def setdefaultparameters(obj): 41 42 def setdefaultparameters(self): 36 43 # {{{setdefaultparameters 37 return obj44 return self 38 45 #}}} 39 46 47 def checkconsistency(self,md,solution,analyses): # {{{ 48 49 #Early return 50 if not md.qmu.isdakota: 51 return 52 53 if not md.qmu.params.evaluation_concurrency==1: 54 md.checkmessage("concurrency should be set to 1 when running dakota in library mode") 55 if md.qmu.partition: 56 if not numpy.size(md.qmu.partition)==md.mesh.numberofvertices: 57 md.checkmessage("user supplied partition for qmu analysis should have size md.mesh.numberofvertices x 1") 58 if not min(md.qmu.partition)==0: 59 md.checkmessage("partition vector not indexed from 0 on") 60 if max(md.qmu.partition)>=md.qmu.numberofpartitions: 61 md.checkmessage("for qmu analysis, partitioning vector cannot go over npart, number of partition areas") 62 63 if not strcmpi(md.cluster.name,'none'): 64 if not md.settings.waitonlock: 65 md.checkmessage("waitonlock should be activated when running qmu in parallel mode!") 66 67 return md 68 # }}} 69 70 def __repr__(self): # {{{ 71 s =' qmu parameters:\n' 72 73 s+="%s\n" % fielddisplay(self,'isdakota','is qmu analysis activated?') 74 for i,variable in enumerate(self.variables): 75 s+=" variables%s: (arrays of each variable class)\n" % \ 76 string_dim(self.variables,i) 77 fnames=vars(variable) 78 maxlen=0 79 for fname in fnames: 80 maxlen=max(maxlen,len(fname)) 81 82 for fname in fnames: 83 s+="' %-*s: [%ix%i] '%s'\n" % \ 84 (maxlen+1,fname,size(getattr(variable,fname)),type(getattr(variable,fname))) 85 86 for i,response in enumerate(self.responses): 87 s+=" responses%s: (arrays of each response class)\n" % \ 88 string_dim(self.responses,i) 89 fnames=vars(response) 90 maxlen=0 91 for fname in fnames: 92 maxlen=max(maxlen,len(fname)) 93 94 for fname in fnames: 95 s+=" %-*s: [%ix%i] '%s'\n" % \ 96 (maxlen+1,fname,size(getattr(response,fname)),type(getattr(response,fname))) 97 98 s+="%s\n" % fielddisplay(self,'numberofresponses','number of responses') 99 100 for i,method in enumerate(self.method): 101 if isinstance(method,'dakota_method'): 102 s+=" method%s : '%s'\n" % \ 103 (string_dim(method,i),method.method) 104 105 for i,param in enumerate(self.params): 106 s+=" params%s: (array of method-independent parameters)\n" % \ 107 string_dim(self.params,i) 108 fnames=vars(param) 109 maxlen=0 110 for fname in fnames: 111 maxlen=max(maxlen,len(fname)) 112 113 for fname in fnames: 114 s+=" %-*s: %s\n" % \ 115 (maxlen+1,fname,any2str(getattr(param,fname))) 116 117 for i,result in enumerate(self.results): 118 s+=" results%s: (information from dakota files)\n" % \ 119 string_dim(self.results,i) 120 fnames=vars(result) 121 maxlen=0 122 for fname in fnames: 123 maxlen=max(maxlen,len(fname)) 124 125 for fname in fnames: 126 s+=" %-*s: [%ix%i] '%s'\n" % \ 127 (maxlen+1,fname,size(getattr(result,fname)),type(getattr(result,fname))) 128 129 s+="%s\n" % fielddisplay(self,'partition','user provided mesh partitioning, defaults to metis if not specified') 130 s+="%s\n" % fielddisplay(self,'numberofpartitions','number of partitions for semi-discrete qmu') 131 s+="%s\n" % fielddisplay(self,'variabledescriptors','') 132 s+="%s\n" % fielddisplay(self,'responsedescriptors','') 133 s+="%s\n" % fielddisplay(self,'method','array of dakota_method class') 134 s+="%s\n" % fielddisplay(self,'mass_flux_profile_directory','directory for mass flux profiles') 135 s+="%s\n" % fielddisplay(self,'mass_flux_profiles','list of mass_flux profiles') 136 s+="%s\n" % fielddisplay(self,'mass_flux_segments','') 137 s+="%s\n" % fielddisplay(self,'adjacency','') 138 s+="%s\n" % fielddisplay(self,'vertex_weight','weight applied to each mesh vertex') 139 140 return s 141 # }}} 142 143 def marshall(self,fid): # {{{ 144 WriteData(fid,'object',self,'fieldname','isdakota','format','Boolean') 145 if not self.isdakota: 146 return 147 WriteData(fid,'object',self,'fieldname','partition','format','DoubleMat','mattype',2) 148 WriteData(fid,'object',self,'fieldname','numberofpartitions','format','Integer') 149 WriteData(fid,'object',self,'fieldname','numberofresponses','format','Integer') 150 WriteData(fid,'object',self,'fieldname','variabledescriptors','format','StringArray') 151 WriteData(fid,'object',self,'fieldname','responsedescriptors','format','StringArray') 152 WriteData(fid,'object',self,'fieldname','mass_flux_segments','format','MatArray') 153 # }}} 154 -
issm/trunk-jpl/src/m/classes/radaroverlay.py
r12958 r13030 3 3 4 4 class radaroverlay(object): 5 """ 6 RADAROVERLAY class definition 7 8 Usage: 9 radaroverlay=radaroverlay(); 10 """ 11 5 12 #properties 6 13 def __init__(self): … … 14 21 15 22 #}}} 16 def __repr__( obj):23 def __repr__(self): 17 24 # {{{ Display 18 25 string=' radaroverlay parameters:' 19 string="%s\n\n%s"%(string,fielddisplay( obj,'pwr','radar power image (matrix)'))20 string="%s\n%s"%(string,fielddisplay( obj,'x','corresponding x coordinates'))21 string="%s\n%s"%(string,fielddisplay( obj,'y','corresponding y coordinates'))26 string="%s\n\n%s"%(string,fielddisplay(self,'pwr','radar power image (matrix)')) 27 string="%s\n%s"%(string,fielddisplay(self,'x','corresponding x coordinates')) 28 string="%s\n%s"%(string,fielddisplay(self,'y','corresponding y coordinates')) 22 29 return string 23 30 #}}} 24 31 25 def setdefaultparameters( obj):32 def setdefaultparameters(self): 26 33 # {{{setdefaultparameters 27 return obj34 return self 28 35 #}}} 29 36 -
issm/trunk-jpl/src/m/consistency/checkfield.py
r13023 r13030 112 112 if options.exist('>='): 113 113 lowerbound=options.getfieldvalue('>=') 114 if numpy.any(field<lowerbound):114 if any(field<lowerbound): 115 115 md = md.checkmessage(options.getfieldvalue('message',\ 116 116 "field '%s' should have values above %d" % (fieldname,lowerbound))) 117 117 if options.exist('>'): 118 118 lowerbound=options.getfieldvalue('>') 119 if numpy.any(field<=lowerbound):119 if any(field<=lowerbound): 120 120 md = md.checkmessage(options.getfieldvalue('message',\ 121 121 "field '%s' should have values above %d" % (fieldname,lowerbound))) … … 124 124 if options.exist('<='): 125 125 upperbound=options.getfieldvalue('<=') 126 if numpy.any(field>upperbound):126 if any(field>upperbound): 127 127 md = md.checkmessage(options.getfieldvalue('message',\ 128 128 "field '%s' should have values below %d" % (fieldname,upperbound))) 129 129 if options.exist('<'): 130 130 upperbound=options.getfieldvalue('<') 131 if numpy.any(field>=upperbound):131 if any(field>=upperbound): 132 132 md = md.checkmessage(options.getfieldvalue('message',\ 133 133 "field '%s' should have values below %d" % (fieldname,upperbound))) … … 145 145 "field '%s' should have only one column as there are md.mesh.numberofvertices lines" % fieldname)) 146 146 elif numpy.size(field,0)==md.mesh.numberofvertices+1: 147 if not numpy.all(field[-1,:]==numpy.sort(field[-1,:])):147 if not all(field[-1,:]==numpy.sort(field[-1,:])): 148 148 md = md.checkmessage(options.getfieldvalue('message',\ 149 149 "field '%s' columns should be sorted chronologically" % fieldname)) 150 if nump.any(field[-1,0:-1]==field[-1,1:]):150 if any(field[-1,0:-1]==field[-1,1:]): 151 151 md = md.checkmessage(options.getfieldvalue('message',\ 152 152 "field '%s' columns must not contain duplicate timesteps" % fieldname)) -
issm/trunk-jpl/src/m/consistency/ismodelselfconsistent.py
r13010 r13030 1 from AnalysisConfiguration import *2 1 from EnumDefinitions import * 3 2 -
issm/trunk-jpl/src/m/parameterization/parameterize.py
r12944 r13030 1 1 import os 2 2 import datetime 3 from addnote import *4 3 5 4 def parameterize(md,parametername): … … 29 28 md.miscellaneous.name=os.path.basename(parametername).split('.')[0] 30 29 31 md =addnote(md,"Model created by using parameter file: '%s' on: %s." % (parametername,datetime.datetime.strftime(datetime.datetime.now(),'%c')))30 md.miscellaneous.notes="Model created by using parameter file: '%s' on: %s." % (parametername,datetime.datetime.strftime(datetime.datetime.now(),'%c')) 32 31 33 32 return md -
issm/trunk-jpl/src/m/parameterization/setflowequation.py
r13028 r13030 63 63 64 64 #check that each element has at least one flag 65 if not numpy.any(hutterflag+macayealflag+pattynflag+stokesflag):65 if not any(hutterflag+macayealflag+pattynflag+stokesflag): 66 66 raise TypeError("setflowequation error message: elements type not assigned, must be specified") 67 67 68 68 #check that each element has only one flag 69 if numpy.any(hutterflag+macayealflag+pattynflag+stokesflag>1):69 if any(hutterflag+macayealflag+pattynflag+stokesflag>1): 70 70 print "setflowequation warning message: some elements have several types, higher order type is used for them" 71 71 hutterflag[numpy.nonzero(numpy.logical_and(hutterflag,macayealflag))]=0 … … 75 75 #Check that no pattyn or stokes for 2d mesh 76 76 if md.mesh.dimension==2: 77 if numpy.any(numpy.logical_or(stokesflag,pattynflag)):77 if any(numpy.logical_or(stokesflag,pattynflag)): 78 78 raise TypeError("setflowequation error message: stokes and pattyn elements not allowed in 2d mesh, extrude it first") 79 79 80 80 #Stokes can only be used alone for now: 81 if numpy.any(stokesflag) and numpy.any(hutterflag):81 if any(stokesflag) and any(hutterflag): 82 82 raise TypeError("setflowequation error message: stokes cannot be used with any other model for now, put stokes everywhere") 83 83 … … 130 130 131 131 #initialize and fill in penalties structure 132 if numpy.all(numpy.logical_not(numpy.isnan(bordernodes2d))):132 if all(numpy.logical_not(numpy.isnan(bordernodes2d))): 133 133 penalties=numpy.zeros((0,2)) 134 134 for i in xrange(1,numlayers): … … 137 137 138 138 elif strcmpi(coupling_method,'tiling'): 139 if numpy.any(macayealflag) and numpy.any(pattynflag): #coupling macayeal pattyn139 if any(macayealflag) and any(pattynflag): #coupling macayeal pattyn 140 140 #Find node at the border 141 141 nodeonmacayealpattyn[numpy.nonzero(numpy.logical_and(nodeonmacayeal,nodeonpattyn))]=1 … … 152 152 pos=numpy.nonzero(macayealpattynflag) 153 153 elist=numpy.zeros(len(pos)) 154 elist = elist + numpy.any(numpy.sum(nodeonmacayeal[md.mesh.elements[pos,:].astype(int)-1],axis=1),axis=1)155 elist = elist - numpy.any(numpy.sum(nodeonpattyn[md.mesh.elements[pos,:].astype(int)-1] ,axis=1),axis=1)154 elist = elist + any(numpy.sum(nodeonmacayeal[md.mesh.elements[pos,:].astype(int)-1],axis=1),axis=1) 155 elist = elist - any(numpy.sum(nodeonpattyn[md.mesh.elements[pos,:].astype(int)-1] ,axis=1),axis=1) 156 156 pos1=[i for i,item in enumerate(elist) if item==1] 157 157 macayealflag[pos[pos1]]=1 … … 169 169 nodeonmacayealpattyn[md.mesh.elements[numpy.nonzero(macayealpattynflag),:].astype(int)-1]=1 170 170 171 elif numpy.any(pattynflag) and numpy.any(stokesflag): #coupling pattyn stokes171 elif any(pattynflag) and any(stokesflag): #coupling pattyn stokes 172 172 #Find node at the border 173 173 nodeonpattynstokes[numpy.nonzero(numpy.logical_and(nodeonpattyn,nodeonstokes))]=1 … … 184 184 pos=numpy.nonzero(pattynstokesflag) 185 185 elist=numpy.zeros(len(pos)) 186 elist = elist + numpy.any(numpy.sum(nodeonstokes[md.mesh.elements[pos,:].astype(int)-1],axis=1),axis=1)187 elist = elist - numpy.any(numpy.sum(nodeonpattyn[md.mesh.elements[pos,:].astype(int)-1],axis=1),axis=1)186 elist = elist + any(numpy.sum(nodeonstokes[md.mesh.elements[pos,:].astype(int)-1],axis=1),axis=1) 187 elist = elist - any(numpy.sum(nodeonpattyn[md.mesh.elements[pos,:].astype(int)-1],axis=1),axis=1) 188 188 pos1=[i for i,item in enumerate(elist) if item==1] 189 189 stokesflag[pos[pos1]]=1 … … 201 201 nodeonpattynstokes[md.mesh.elements[numpy.nonzero(pattynstokesflag),:].astype(int)-1]=1 202 202 203 elif numpy.any(stokesflag) and numpy.any(macayealflag):203 elif any(stokesflag) and any(macayealflag): 204 204 #Find node at the border 205 205 nodeonmacayealstokes[numpy.nonzero(numpy.logical_and(nodeonmacayeal,nodeonstokes))]=1 … … 216 216 pos=numpy.nonzero(macayealstokesflag) 217 217 elist=numpy.zeros(len(pos)) 218 elist = elist + numpy.any(numpy.sum(nodeonmacayeal[md.mesh.elements[pos,:].astype(int)-1],axis=1),axis=1)219 elist = elist - numpy.any(numpy.sum(nodeonstokes[md.mesh.elements[pos,:].astype(int)-1] ,axis=1),axis=1)218 elist = elist + any(numpy.sum(nodeonmacayeal[md.mesh.elements[pos,:].astype(int)-1],axis=1),axis=1) 219 elist = elist - any(numpy.sum(nodeonstokes[md.mesh.elements[pos,:].astype(int)-1] ,axis=1),axis=1) 220 220 pos1=[i for i,item in enumerate(elist) if item==1] 221 221 macayealflag[pos[pos1]]=1 … … 233 233 nodeonmacayealstokes[md.mesh.elements[numpy.nonzero(macayealstokesflag),:].astype(int)-1]=1 234 234 235 elif numpy.any(stokesflag) and numpy.any(hutterflag):235 elif any(stokesflag) and any(hutterflag): 236 236 raise TypeError("type of coupling not supported yet") 237 237 … … 266 266 pos=numpy.nonzero(nodeonstokes) 267 267 md.flowequation.vertex_equation[pos]=4 268 if numpy.any(stokesflag):268 if any(stokesflag): 269 269 pos=numpy.nonzero(numpy.logical_not(nodeonstokes)) 270 if not ( numpy.any(pattynflag) or numpy.any(macayealflag)):270 if not (any(pattynflag) or any(macayealflag)): 271 271 md.flowequation.vertex_equation[pos]=0 272 272 pos=numpy.nonzero(nodeonpattynstokes) … … 276 276 277 277 #figure out solution types 278 md.flowequation.ishutter=float( numpy.any(md.flowequation.element_equation==1))279 md.flowequation.ismacayealpattyn=float( numpy.any(numpy.logical_or(md.flowequation.element_equation==2,md.flowequation.element_equation==3)))280 md.flowequation.isstokes=float( numpy.any(md.flowequation.element_equation==4))278 md.flowequation.ishutter=float(any(md.flowequation.element_equation==1)) 279 md.flowequation.ismacayealpattyn=float(any(numpy.logical_or(md.flowequation.element_equation==2,md.flowequation.element_equation==3))) 280 md.flowequation.isstokes=float(any(md.flowequation.element_equation==4)) 281 281 282 282 return md 283 283 284 284 #Check that tiling can work: 285 if numpy.any(md.flowequation.bordermacayeal) and numpy.any(md.flowequation.borderpattyn) and numpy.any(md.flowequation.borderpattyn + md.flowequation.bordermacayeal !=1):285 if any(md.flowequation.bordermacayeal) and any(md.flowequation.borderpattyn) and any(md.flowequation.borderpattyn + md.flowequation.bordermacayeal !=1): 286 286 raise TypeError("error coupling domain too irregular") 287 if numpy.any(md.flowequation.bordermacayeal) and numpy.any(md.flowequation.borderstokes) and numpy.any(md.flowequation.borderstokes + md.flowequation.bordermacayeal !=1):287 if any(md.flowequation.bordermacayeal) and any(md.flowequation.borderstokes) and any(md.flowequation.borderstokes + md.flowequation.bordermacayeal !=1): 288 288 raise TypeError("error coupling domain too irregular") 289 if numpy.any(md.flowequation.borderstokes) and numpy.any(md.flowequation.borderpattyn) and numpy.any(md.flowequation.borderpattyn + md.flowequation.borderstokes !=1):289 if any(md.flowequation.borderstokes) and any(md.flowequation.borderpattyn) and any(md.flowequation.borderpattyn + md.flowequation.borderstokes !=1): 290 290 raise TypeError("error coupling domain too irregular") 291 291
Note:
See TracChangeset
for help on using the changeset viewer.