Ignore:
Timestamp:
09/16/13 09:43:55 (12 years ago)
Author:
Mathieu Morlighem
Message:

merged trunk-jpl and trunk for revision 16135

Location:
issm/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk

  • issm/trunk/src

  • issm/trunk/src/m/parameterization/setflowequation.py

    r14310 r16137  
    1111
    1212           This routine works like plotmodel: it works with an even number of inputs
    13            'hutter','macayeal','pattyn','l1l2','stokes' and 'fill' are the possible options
     13           'SIA','SSA','HO','L1L2','FS' and 'fill' are the possible options
    1414           that must be followed by the corresponding exp file or flags list
    1515           It can either be a domain file (argus type, .exp extension), or an array of element flags.
    1616           If user wants every element outside the domain to be
    17            setflowequationd, add '~' to the name of the domain file (ex: '~Pattyn.exp');
     17           setflowequationd, add '~' to the name of the domain file (ex: '~HO.exp');
    1818           an empty string '' will be considered as an empty domain
    1919           a string 'all' will be considered as the entire domain
     
    2424
    2525           Example:
    26               md=setflowequation(md,'pattyn','Pattyn.exp','macayeal',md.mask.elementonfloatingice,'fill','hutter');
    27               md=setflowequation(md,'pattyn','Pattyn.exp',fill','hutter','coupling','tiling');
     26              md=setflowequation(md,'HO','HO.exp',fill','SIA','coupling','tiling');
    2827        """
    2928
     
    4241
    4342        #recover elements distribution
    44         hutterflag   = FlagElements(md,options.getfieldvalue('hutter',''))
    45         macayealflag = FlagElements(md,options.getfieldvalue('macayeal',''))
    46         pattynflag   = FlagElements(md,options.getfieldvalue('pattyn',''))
    47         l1l2flag     = FlagElements(md,options.getfieldvalue('l1l2',''))
    48         stokesflag   = FlagElements(md,options.getfieldvalue('stokes',''))
     43        SIAflag   = FlagElements(md,options.getfieldvalue('SIA',''))
     44        SSAflag = FlagElements(md,options.getfieldvalue('SSA',''))
     45        HOflag   = FlagElements(md,options.getfieldvalue('HO',''))
     46        L1L2flag     = FlagElements(md,options.getfieldvalue('L1L2',''))
     47        FSflag   = FlagElements(md,options.getfieldvalue('FS',''))
    4948        filltype     = options.getfieldvalue('fill','none')
    5049
    5150        #Flag the elements that have not been flagged as filltype
    52         if   strcmpi(filltype,'hutter'):
    53                 hutterflag[numpy.nonzero(numpy.logical_not(logical_or_n(macayealflag,pattynflag)))]=True
    54         elif strcmpi(filltype,'macayeal'):
    55                 macayealflag[numpy.nonzero(numpy.logical_not(logical_or_n(hutterflag,pattynflag,stokesflag)))]=True
    56         elif strcmpi(filltype,'pattyn'):
    57                 pattynflag[numpy.nonzero(numpy.logical_not(logical_or_n(hutterflag,macayealflag,stokesflag)))]=True
     51        if   strcmpi(filltype,'SIA'):
     52                SIAflag[numpy.nonzero(numpy.logical_not(logical_or_n(SSAflag,HOflag)))]=True
     53        elif strcmpi(filltype,'SSA'):
     54                SSAflag[numpy.nonzero(numpy.logical_not(logical_or_n(SIAflag,HOflag,FSflag)))]=True
     55        elif strcmpi(filltype,'HO'):
     56                HOflag[numpy.nonzero(numpy.logical_not(logical_or_n(SIAflag,SSAflag,FSflag)))]=True
    5857
    5958        #check that each element has at least one flag
    60         if not any(hutterflag+macayealflag+l1l2flag+pattynflag+stokesflag):
    61                 raise TypeError("elements type not assigned, must be specified")
     59        if not any(SIAflag+SSAflag+L1L2flag+HOflag+FSflag):
     60                raise TypeError("elements type not assigned, supported models are 'SIA','SSA','HO' and 'FS'")
    6261
    6362        #check that each element has only one flag
    64         if any(hutterflag+macayealflag+l1l2flag+pattynflag+stokesflag>1):
     63        if any(SIAflag+SSAflag+L1L2flag+HOflag+FSflag>1):
    6564                print "setflowequation warning message: some elements have several types, higher order type is used for them"
    66                 hutterflag[numpy.nonzero(numpy.logical_and(hutterflag,macayealflag))]=False
    67                 hutterflag[numpy.nonzero(numpy.logical_and(hutterflag,pattynflag))]=False
    68                 macayealflag[numpy.nonzero(numpy.logical_and(macayealflag,pattynflag))]=False
    69 
    70         #Check that no pattyn or stokes for 2d mesh
     65                SIAflag[numpy.nonzero(numpy.logical_and(SIAflag,SSAflag))]=False
     66                SIAflag[numpy.nonzero(numpy.logical_and(SIAflag,HOflag))]=False
     67                SSAflag[numpy.nonzero(numpy.logical_and(SSAflag,HOflag))]=False
     68
     69        #Check that no HO or FS for 2d mesh
    7170        if md.mesh.dimension==2:
    72                 if numpy.any(logical_or_n(l1l2flag,stokesflag,pattynflag)):
    73                         raise TypeError("stokes and pattyn elements not allowed in 2d mesh, extrude it first")
    74 
    75         #Stokes can only be used alone for now:
    76         if any(stokesflag) and any(hutterflag):
    77                 raise TypeError("stokes cannot be used with any other model for now, put stokes everywhere")
     71                if numpy.any(logical_or_n(L1L2flag,FSflag,HOflag)):
     72                        raise TypeError("FS and HO elements not allowed in 2d mesh, extrude it first")
     73
     74        #FS can only be used alone for now:
     75        if any(FSflag) and any(SIAflag):
     76                raise TypeError("FS cannot be used with any other model for now, put FS everywhere")
    7877
    7978        #Initialize node fields
    80         nodeonhutter=numpy.zeros(md.mesh.numberofvertices,bool)
    81         nodeonhutter[md.mesh.elements[numpy.nonzero(hutterflag),:]-1]=True
    82         nodeonmacayeal=numpy.zeros(md.mesh.numberofvertices,bool)
    83         nodeonmacayeal[md.mesh.elements[numpy.nonzero(macayealflag),:]-1]=True
    84         nodeonl1l2=numpy.zeros(md.mesh.numberofvertices,bool)
    85         nodeonl1l2[md.mesh.elements[numpy.nonzero(l1l2flag),:]-1]=True
    86         nodeonpattyn=numpy.zeros(md.mesh.numberofvertices,bool)
    87         nodeonpattyn[md.mesh.elements[numpy.nonzero(pattynflag),:]-1]=True
    88         nodeonstokes=numpy.zeros(md.mesh.numberofvertices,bool)
     79        nodeonSIA=numpy.zeros(md.mesh.numberofvertices,bool)
     80        nodeonSIA[md.mesh.elements[numpy.nonzero(SIAflag),:]-1]=True
     81        nodeonSSA=numpy.zeros(md.mesh.numberofvertices,bool)
     82        nodeonSSA[md.mesh.elements[numpy.nonzero(SSAflag),:]-1]=True
     83        nodeonL1L2=numpy.zeros(md.mesh.numberofvertices,bool)
     84        nodeonL1L2[md.mesh.elements[numpy.nonzero(L1L2flag),:]-1]=True
     85        nodeonHO=numpy.zeros(md.mesh.numberofvertices,bool)
     86        nodeonHO[md.mesh.elements[numpy.nonzero(HOflag),:]-1]=True
     87        nodeonFS=numpy.zeros(md.mesh.numberofvertices,bool)
    8988        noneflag=numpy.zeros(md.mesh.numberofelements,bool)
    9089
    91         #First modify stokesflag to get rid of elements contrained everywhere (spc + border with pattyn or macayeal)
    92         if any(stokesflag):
    93 #               fullspcnodes=double((~isnan(md.diagnostic.spcvx)+~isnan(md.diagnostic.spcvy)+~isnan(md.diagnostic.spcvz))==3 | (nodeonpattyn & nodeonstokes));         %find all the nodes on the boundary of the domain without icefront
    94                 fullspcnodes=numpy.logical_or(numpy.logical_not(numpy.isnan(md.diagnostic.spcvx)).astype(int)+ \
    95                                               numpy.logical_not(numpy.isnan(md.diagnostic.spcvy)).astype(int)+ \
    96                                               numpy.logical_not(numpy.isnan(md.diagnostic.spcvz)).astype(int)==3, \
    97                                               numpy.logical_and(nodeonpattyn,nodeonstokes).reshape(-1,1)).astype(int)    #find all the nodes on the boundary of the domain without icefront
     90        #First modify FSflag to get rid of elements contrained everywhere (spc + border with HO or SSA)
     91        if any(FSflag):
     92#               fullspcnodes=double((~isnan(md.stressbalance.spcvx)+~isnan(md.stressbalance.spcvy)+~isnan(md.stressbalance.spcvz))==3 | (nodeonHO & nodeonFS));         %find all the nodes on the boundary of the domain without icefront
     93                fullspcnodes=numpy.logical_or(numpy.logical_not(numpy.isnan(md.stressbalance.spcvx)).astype(int)+ \
     94                                              numpy.logical_not(numpy.isnan(md.stressbalance.spcvy)).astype(int)+ \
     95                                              numpy.logical_not(numpy.isnan(md.stressbalance.spcvz)).astype(int)==3, \
     96                                              numpy.logical_and(nodeonHO,nodeonFS).reshape(-1,1)).astype(int)    #find all the nodes on the boundary of the domain without icefront
    9897#               fullspcelems=double(sum(fullspcnodes(md.mesh.elements),2)==6);         %find all the nodes on the boundary of the domain without icefront
    9998                fullspcelems=(numpy.sum(fullspcnodes[md.mesh.elements-1],axis=1)==6).astype(int)    #find all the nodes on the boundary of the domain without icefront
    100                 stokesflag[numpy.nonzero(fullspcelems.reshape(-1))]=False
    101                 nodeonstokes[md.mesh.elements[numpy.nonzero(stokesflag),:]-1]=True
    102 
    103         #Then complete with NoneApproximation or the other model used if there is no stokes
    104         if any(stokesflag):
    105                 if   any(pattynflag):    #fill with pattyn
    106                         pattynflag[numpy.logical_not(stokesflag)]=True
    107                         nodeonpattyn[md.mesh.elements[numpy.nonzero(pattynflag),:]-1]=True
    108                 elif any(macayealflag):    #fill with macayeal
    109                         macayealflag[numpy.logical_not(stokesflag)]=True
    110                         nodeonmacayeal[md.mesh.elements[numpy.nonzero(macayealflag),:]-1]=True
     99                FSflag[numpy.nonzero(fullspcelems.reshape(-1))]=False
     100                nodeonFS[md.mesh.elements[numpy.nonzero(FSflag),:]-1]=True
     101
     102        #Then complete with NoneApproximation or the other model used if there is no FS
     103        if any(FSflag):
     104                if   any(HOflag):    #fill with HO
     105                        HOflag[numpy.logical_not(FSflag)]=True
     106                        nodeonHO[md.mesh.elements[numpy.nonzero(HOflag),:]-1]=True
     107                elif any(SSAflag):    #fill with SSA
     108                        SSAflag[numpy.logical_not(FSflag)]=True
     109                        nodeonSSA[md.mesh.elements[numpy.nonzero(SSAflag),:]-1]=True
    111110                else:    #fill with none
    112                         noneflag[numpy.nonzero(numpy.logical_not(stokesflag))]=True
    113 
    114         #Now take care of the coupling between MacAyeal and Pattyn
    115         md.diagnostic.vertex_pairing=numpy.array([])
    116         nodeonmacayealpattyn=numpy.zeros(md.mesh.numberofvertices,bool)
    117         nodeonpattynstokes=numpy.zeros(md.mesh.numberofvertices,bool)
    118         nodeonmacayealstokes=numpy.zeros(md.mesh.numberofvertices,bool)
    119         macayealpattynflag=numpy.zeros(md.mesh.numberofelements,bool)
    120         macayealstokesflag=numpy.zeros(md.mesh.numberofelements,bool)
    121         pattynstokesflag=numpy.zeros(md.mesh.numberofelements,bool)
     111                        noneflag[numpy.nonzero(numpy.logical_not(FSflag))]=True
     112
     113        #Now take care of the coupling between SSA and HO
     114        md.stressbalance.vertex_pairing=numpy.array([])
     115        nodeonSSAHO=numpy.zeros(md.mesh.numberofvertices,bool)
     116        nodeonHOFS=numpy.zeros(md.mesh.numberofvertices,bool)
     117        nodeonSSAFS=numpy.zeros(md.mesh.numberofvertices,bool)
     118        SSAHOflag=numpy.zeros(md.mesh.numberofelements,bool)
     119        SSAFSflag=numpy.zeros(md.mesh.numberofelements,bool)
     120        HOFSflag=numpy.zeros(md.mesh.numberofelements,bool)
    122121        if   strcmpi(coupling_method,'penalties'):
    123                 #Create the border nodes between Pattyn and MacAyeal and extrude them
     122                #Create the border nodes between HO and SSA and extrude them
    124123                numnodes2d=md.mesh.numberofvertices2d
    125124                numlayers=md.mesh.numberoflayers
    126                 bordernodes2d=numpy.nonzero(numpy.logical_and(nodeonpattyn[0:numnodes2d],nodeonmacayeal[0:numnodes2d]))[0]+1    #Nodes connected to two different types of elements
     125                bordernodes2d=numpy.nonzero(numpy.logical_and(nodeonHO[0:numnodes2d],nodeonSSA[0:numnodes2d]))[0]+1    #Nodes connected to two different types of elements
    127126
    128127                #initialize and fill in penalties structure
     
    131130                        for     i in xrange(1,numlayers):
    132131                                penalties=numpy.vstack((penalties,numpy.hstack((bordernodes2d.reshape(-1,1),bordernodes2d.reshape(-1,1)+md.mesh.numberofvertices2d*(i)))))
    133                         md.diagnostic.vertex_pairing=penalties
     132                        md.stressbalance.vertex_pairing=penalties
    134133
    135134        elif strcmpi(coupling_method,'tiling'):
    136                 if   any(macayealflag) and any(pattynflag):    #coupling macayeal pattyn
     135                if   any(SSAflag) and any(HOflag):    #coupling SSA HO
    137136                        #Find node at the border
    138                         nodeonmacayealpattyn[numpy.nonzero(numpy.logical_and(nodeonmacayeal,nodeonpattyn))]=True
    139                         #Macayeal elements in contact with this layer become MacAyealPattyn elements
    140                         matrixelements=ismember(md.mesh.elements-1,numpy.nonzero(nodeonmacayealpattyn)[0])
     137                        nodeonSSAHO[numpy.nonzero(numpy.logical_and(nodeonSSA,nodeonHO))]=True
     138                        #SSA elements in contact with this layer become SSAHO elements
     139                        matrixelements=ismember(md.mesh.elements-1,numpy.nonzero(nodeonSSAHO)[0])
    141140                        commonelements=numpy.sum(matrixelements,axis=1)!=0
    142                         commonelements[numpy.nonzero(pattynflag)]=False    #only one layer: the elements previously in macayeal
    143                         macayealflag[numpy.nonzero(commonelements)]=False    #these elements are now macayealpattynelements
    144                         macayealpattynflag[numpy.nonzero(commonelements)]=True
    145                         nodeonmacayeal[:]=False
    146                         nodeonmacayeal[md.mesh.elements[numpy.nonzero(macayealflag),:]-1]=True
     141                        commonelements[numpy.nonzero(HOflag)]=False    #only one layer: the elements previously in SSA
     142                        SSAflag[numpy.nonzero(commonelements)]=False    #these elements are now SSAHOelements
     143                        SSAHOflag[numpy.nonzero(commonelements)]=True
     144                        nodeonSSA[:]=False
     145                        nodeonSSA[md.mesh.elements[numpy.nonzero(SSAflag),:]-1]=True
    147146
    148147                        #rule out elements that don't touch the 2 boundaries
    149                         pos=numpy.nonzero(macayealpattynflag)[0]
     148                        pos=numpy.nonzero(SSAHOflag)[0]
    150149                        elist=numpy.zeros(numpy.size(pos),dtype=int)
    151                         elist = elist + numpy.sum(nodeonmacayeal[md.mesh.elements[pos,:]-1],axis=1).astype(bool)
    152                         elist = elist - numpy.sum(nodeonpattyn[md.mesh.elements[pos,:]-1]  ,axis=1).astype(bool)
     150                        elist = elist + numpy.sum(nodeonSSA[md.mesh.elements[pos,:]-1],axis=1).astype(bool)
     151                        elist = elist - numpy.sum(nodeonHO[md.mesh.elements[pos,:]-1]  ,axis=1).astype(bool)
    153152                        pos1=numpy.nonzero(elist==1)[0]
    154                         macayealflag[pos[pos1]]=True
    155                         macayealpattynflag[pos[pos1]]=False
     153                        SSAflag[pos[pos1]]=True
     154                        SSAHOflag[pos[pos1]]=False
    156155                        pos2=numpy.nonzero(elist==-1)[0]
    157                         pattynflag[pos[pos2]]=True
    158                         macayealpattynflag[pos[pos2]]=False
     156                        HOflag[pos[pos2]]=True
     157                        SSAHOflag[pos[pos2]]=False
    159158
    160159                        #Recompute nodes associated to these elements
    161                         nodeonmacayeal[:]=False
    162                         nodeonmacayeal[md.mesh.elements[numpy.nonzero(macayealflag),:]-1]=True
    163                         nodeonpattyn[:]=False
    164                         nodeonpattyn[md.mesh.elements[numpy.nonzero(pattynflag),:]-1]=True
    165                         nodeonmacayealpattyn[:]=False
    166                         nodeonmacayealpattyn[md.mesh.elements[numpy.nonzero(macayealpattynflag),:]-1]=True
    167 
    168                 elif any(pattynflag) and any(stokesflag):    #coupling pattyn stokes
     160                        nodeonSSA[:]=False
     161                        nodeonSSA[md.mesh.elements[numpy.nonzero(SSAflag),:]-1]=True
     162                        nodeonHO[:]=False
     163                        nodeonHO[md.mesh.elements[numpy.nonzero(HOflag),:]-1]=True
     164                        nodeonSSAHO[:]=False
     165                        nodeonSSAHO[md.mesh.elements[numpy.nonzero(SSAHOflag),:]-1]=True
     166
     167                elif any(HOflag) and any(FSflag):    #coupling HO FS
    169168                        #Find node at the border
    170                         nodeonpattynstokes[numpy.nonzero(numpy.logical_and(nodeonpattyn,nodeonstokes))]=True
    171                         #Stokes elements in contact with this layer become PattynStokes elements
    172                         matrixelements=ismember(md.mesh.elements-1,numpy.nonzero(nodeonpattynstokes)[0])
     169                        nodeonHOFS[numpy.nonzero(numpy.logical_and(nodeonHO,nodeonFS))]=True
     170                        #FS elements in contact with this layer become HOFS elements
     171                        matrixelements=ismember(md.mesh.elements-1,numpy.nonzero(nodeonHOFS)[0])
    173172                        commonelements=numpy.sum(matrixelements,axis=1)!=0
    174                         commonelements[numpy.nonzero(pattynflag)]=False    #only one layer: the elements previously in macayeal
    175                         stokesflag[numpy.nonzero(commonelements)]=False    #these elements are now macayealpattynelements
    176                         pattynstokesflag[numpy.nonzero(commonelements)]=True
    177                         nodeonstokes=numpy.zeros(md.mesh.numberofvertices,bool)
    178                         nodeonstokes[md.mesh.elements[numpy.nonzero(stokesflag),:]-1]=True
     173                        commonelements[numpy.nonzero(HOflag)]=False    #only one layer: the elements previously in SSA
     174                        FSflag[numpy.nonzero(commonelements)]=False    #these elements are now SSAHOelements
     175                        HOFSflag[numpy.nonzero(commonelements)]=True
     176                        nodeonFS=numpy.zeros(md.mesh.numberofvertices,bool)
     177                        nodeonFS[md.mesh.elements[numpy.nonzero(FSflag),:]-1]=True
    179178
    180179                        #rule out elements that don't touch the 2 boundaries
    181                         pos=numpy.nonzero(pattynstokesflag)[0]
     180                        pos=numpy.nonzero(HOFSflag)[0]
    182181                        elist=numpy.zeros(numpy.size(pos),dtype=int)
    183                         elist = elist + numpy.sum(nodeonstokes[md.mesh.elements[pos,:]-1],axis=1).astype(bool)
    184                         elist = elist - numpy.sum(nodeonpattyn[md.mesh.elements[pos,:]-1],axis=1).astype(bool)
     182                        elist = elist + numpy.sum(nodeonFS[md.mesh.elements[pos,:]-1],axis=1).astype(bool)
     183                        elist = elist - numpy.sum(nodeonHO[md.mesh.elements[pos,:]-1],axis=1).astype(bool)
    185184                        pos1=numpy.nonzero(elist==1)[0]
    186                         stokesflag[pos[pos1]]=True
    187                         pattynstokesflag[pos[pos1]]=False
     185                        FSflag[pos[pos1]]=True
     186                        HOFSflag[pos[pos1]]=False
    188187                        pos2=numpy.nonzero(elist==-1)[0]
    189                         pattynflag[pos[pos2]]=True
    190                         pattynstokesflag[pos[pos2]]=False
     188                        HOflag[pos[pos2]]=True
     189                        HOFSflag[pos[pos2]]=False
    191190
    192191                        #Recompute nodes associated to these elements
    193                         nodeonstokes[:]=False
    194                         nodeonstokes[md.mesh.elements[numpy.nonzero(stokesflag),:]-1]=True
    195                         nodeonpattyn[:]=False
    196                         nodeonpattyn[md.mesh.elements[numpy.nonzero(pattynflag),:]-1]=True
    197                         nodeonpattynstokes[:]=False
    198                         nodeonpattynstokes[md.mesh.elements[numpy.nonzero(pattynstokesflag),:]-1]=True
    199 
    200                 elif any(stokesflag) and any(macayealflag):
     192                        nodeonFS[:]=False
     193                        nodeonFS[md.mesh.elements[numpy.nonzero(FSflag),:]-1]=True
     194                        nodeonHO[:]=False
     195                        nodeonHO[md.mesh.elements[numpy.nonzero(HOflag),:]-1]=True
     196                        nodeonHOFS[:]=False
     197                        nodeonHOFS[md.mesh.elements[numpy.nonzero(HOFSflag),:]-1]=True
     198
     199                elif any(FSflag) and any(SSAflag):
    201200                        #Find node at the border
    202                         nodeonmacayealstokes[numpy.nonzero(numpy.logical_and(nodeonmacayeal,nodeonstokes))]=True
    203                         #Stokes elements in contact with this layer become MacAyealStokes elements
    204                         matrixelements=ismember(md.mesh.elements-1,numpy.nonzero(nodeonmacayealstokes)[0])
     201                        nodeonSSAFS[numpy.nonzero(numpy.logical_and(nodeonSSA,nodeonFS))]=True
     202                        #FS elements in contact with this layer become SSAFS elements
     203                        matrixelements=ismember(md.mesh.elements-1,numpy.nonzero(nodeonSSAFS)[0])
    205204                        commonelements=numpy.sum(matrixelements,axis=1)!=0
    206                         commonelements[numpy.nonzero(macayealflag)]=False    #only one layer: the elements previously in macayeal
    207                         stokesflag[numpy.nonzero(commonelements)]=False    #these elements are now macayealmacayealelements
    208                         macayealstokesflag[numpy.nonzero(commonelements)]=True
    209                         nodeonstokes=numpy.zeros(md.mesh.numberofvertices,bool)
    210                         nodeonstokes[md.mesh.elements[numpy.nonzero(stokesflag),:]-1]=True
     205                        commonelements[numpy.nonzero(SSAflag)]=False    #only one layer: the elements previously in SSA
     206                        FSflag[numpy.nonzero(commonelements)]=False    #these elements are now SSASSAelements
     207                        SSAFSflag[numpy.nonzero(commonelements)]=True
     208                        nodeonFS=numpy.zeros(md.mesh.numberofvertices,bool)
     209                        nodeonFS[md.mesh.elements[numpy.nonzero(FSflag),:]-1]=True
    211210
    212211                        #rule out elements that don't touch the 2 boundaries
    213                         pos=numpy.nonzero(macayealstokesflag)[0]
     212                        pos=numpy.nonzero(SSAFSflag)[0]
    214213                        elist=numpy.zeros(numpy.size(pos),dtype=int)
    215                         elist = elist + numpy.sum(nodeonmacayeal[md.mesh.elements[pos,:]-1],axis=1).astype(bool)
    216                         elist = elist - numpy.sum(nodeonstokes[md.mesh.elements[pos,:]-1]  ,axis=1).astype(bool)
     214                        elist = elist + numpy.sum(nodeonSSA[md.mesh.elements[pos,:]-1],axis=1).astype(bool)
     215                        elist = elist - numpy.sum(nodeonFS[md.mesh.elements[pos,:]-1]  ,axis=1).astype(bool)
    217216                        pos1=numpy.nonzero(elist==1)[0]
    218                         macayealflag[pos[pos1]]=True
    219                         macayealstokesflag[pos[pos1]]=False
     217                        SSAflag[pos[pos1]]=True
     218                        SSAFSflag[pos[pos1]]=False
    220219                        pos2=numpy.nonzero(elist==-1)[0]
    221                         stokesflag[pos[pos2]]=True
    222                         macayealstokesflag[pos[pos2]]=False
     220                        FSflag[pos[pos2]]=True
     221                        SSAFSflag[pos[pos2]]=False
    223222
    224223                        #Recompute nodes associated to these elements
    225                         nodeonmacayeal[:]=False
    226                         nodeonmacayeal[md.mesh.elements[numpy.nonzero(macayealflag),:]-1]=True
    227                         nodeonstokes[:]=False
    228                         nodeonstokes[md.mesh.elements[numpy.nonzero(stokesflag),:]-1]=True
    229                         nodeonmacayealstokes[:]=False
    230                         nodeonmacayealstokes[md.mesh.elements[numpy.nonzero(macayealstokesflag),:]-1]=True
    231 
    232                 elif any(stokesflag) and any(hutterflag):
     224                        nodeonSSA[:]=False
     225                        nodeonSSA[md.mesh.elements[numpy.nonzero(SSAflag),:]-1]=True
     226                        nodeonFS[:]=False
     227                        nodeonFS[md.mesh.elements[numpy.nonzero(FSflag),:]-1]=True
     228                        nodeonSSAFS[:]=False
     229                        nodeonSSAFS[md.mesh.elements[numpy.nonzero(SSAFSflag),:]-1]=True
     230
     231                elif any(FSflag) and any(SIAflag):
    233232                        raise TypeError("type of coupling not supported yet")
    234233
    235         #Create MacAyealPattynApproximation where needed
     234        #Create SSAHOApproximation where needed
    236235        md.flowequation.element_equation=numpy.zeros(md.mesh.numberofelements,int)
    237236        md.flowequation.element_equation[numpy.nonzero(noneflag)]=0
    238         md.flowequation.element_equation[numpy.nonzero(hutterflag)]=1
    239         md.flowequation.element_equation[numpy.nonzero(macayealflag)]=2
    240         md.flowequation.element_equation[numpy.nonzero(l1l2flag)]=8
    241         md.flowequation.element_equation[numpy.nonzero(pattynflag)]=3
    242         md.flowequation.element_equation[numpy.nonzero(stokesflag)]=4
    243         md.flowequation.element_equation[numpy.nonzero(macayealpattynflag)]=5
    244         md.flowequation.element_equation[numpy.nonzero(macayealstokesflag)]=6
    245         md.flowequation.element_equation[numpy.nonzero(pattynstokesflag)]=7
     237        md.flowequation.element_equation[numpy.nonzero(SIAflag)]=1
     238        md.flowequation.element_equation[numpy.nonzero(SSAflag)]=2
     239        md.flowequation.element_equation[numpy.nonzero(L1L2flag)]=8
     240        md.flowequation.element_equation[numpy.nonzero(HOflag)]=3
     241        md.flowequation.element_equation[numpy.nonzero(FSflag)]=4
     242        md.flowequation.element_equation[numpy.nonzero(SSAHOflag)]=5
     243        md.flowequation.element_equation[numpy.nonzero(SSAFSflag)]=6
     244        md.flowequation.element_equation[numpy.nonzero(HOFSflag)]=7
    246245
    247246        #border
    248         md.flowequation.borderpattyn=nodeonpattyn
    249         md.flowequation.bordermacayeal=nodeonmacayeal
    250         md.flowequation.borderstokes=nodeonstokes
     247        md.flowequation.borderHO=nodeonHO
     248        md.flowequation.borderSSA=nodeonSSA
     249        md.flowequation.borderFS=nodeonFS
    251250
    252251        #Create vertices_type
    253252        md.flowequation.vertex_equation=numpy.zeros(md.mesh.numberofvertices,int)
    254         pos=numpy.nonzero(nodeonmacayeal)
     253        pos=numpy.nonzero(nodeonSSA)
    255254        md.flowequation.vertex_equation[pos]=2
    256         pos=numpy.nonzero(nodeonl1l2)
     255        pos=numpy.nonzero(nodeonL1L2)
    257256        md.flowequation.vertex_equation[pos]=8
    258         pos=numpy.nonzero(nodeonpattyn)
     257        pos=numpy.nonzero(nodeonHO)
    259258        md.flowequation.vertex_equation[pos]=3
    260         pos=numpy.nonzero(nodeonhutter)
     259        pos=numpy.nonzero(nodeonSIA)
    261260        md.flowequation.vertex_equation[pos]=1
    262         pos=numpy.nonzero(nodeonmacayealpattyn)
     261        pos=numpy.nonzero(nodeonSSAHO)
    263262        md.flowequation.vertex_equation[pos]=5
    264         pos=numpy.nonzero(nodeonstokes)
     263        pos=numpy.nonzero(nodeonFS)
    265264        md.flowequation.vertex_equation[pos]=4
    266         if any(stokesflag):
    267                 pos=numpy.nonzero(numpy.logical_not(nodeonstokes))
    268                 if not (any(pattynflag) or any(macayealflag)):
     265        if any(FSflag):
     266                pos=numpy.nonzero(numpy.logical_not(nodeonFS))
     267                if not (any(HOflag) or any(SSAflag)):
    269268                        md.flowequation.vertex_equation[pos]=0
    270         pos=numpy.nonzero(nodeonpattynstokes)
     269        pos=numpy.nonzero(nodeonHOFS)
    271270        md.flowequation.vertex_equation[pos]=7
    272         pos=numpy.nonzero(nodeonmacayealstokes)
     271        pos=numpy.nonzero(nodeonSSAFS)
    273272        md.flowequation.vertex_equation[pos]=6
    274273
    275274        #figure out solution types
    276         md.flowequation.ishutter=any(md.flowequation.element_equation==1)
    277         md.flowequation.ismacayealpattyn=bool(numpy.any(numpy.logical_or(md.flowequation.element_equation==2,md.flowequation.element_equation==3)))
    278         md.flowequation.isl1l2=any(md.flowequation.element_equation==8)
    279         md.flowequation.isstokes=any(md.flowequation.element_equation==4)
     275        md.flowequation.isSIA=any(md.flowequation.element_equation==1)
     276        md.flowequation.isSSA=any(md.flowequation.element_equation==2)
     277        md.flowequation.isL1L2=any(md.flowequation.element_equation==8)
     278        md.flowequation.isHO=any(md.flowequation.element_equation==3)
     279        md.flowequation.isFS=any(md.flowequation.element_equation==4)
    280280
    281281        return md
    282282
    283283        #Check that tiling can work:
    284         if any(md.flowequation.bordermacayeal) and any(md.flowequation.borderpattyn) and any(md.flowequation.borderpattyn + md.flowequation.bordermacayeal !=1):
     284        if any(md.flowequation.borderSSA) and any(md.flowequation.borderHO) and any(md.flowequation.borderHO + md.flowequation.borderSSA !=1):
    285285                raise TypeError("error coupling domain too irregular")
    286         if any(md.flowequation.bordermacayeal) and any(md.flowequation.borderstokes) and any(md.flowequation.borderstokes + md.flowequation.bordermacayeal !=1):
     286        if any(md.flowequation.borderSSA) and any(md.flowequation.borderFS) and any(md.flowequation.borderFS + md.flowequation.borderSSA !=1):
    287287                raise TypeError("error coupling domain too irregular")
    288         if any(md.flowequation.borderstokes) and any(md.flowequation.borderpattyn) and any(md.flowequation.borderpattyn + md.flowequation.borderstokes !=1):
     288        if any(md.flowequation.borderFS) and any(md.flowequation.borderHO) and any(md.flowequation.borderHO + md.flowequation.borderFS !=1):
    289289                raise TypeError("error coupling domain too irregular")
    290290
Note: See TracChangeset for help on using the changeset viewer.