source: issm/oecreview/Archive/12678-13393/ISSM-13027-13028.diff@ 14312

Last change on this file since 14312 was 13394, checked in by Mathieu Morlighem, 13 years ago

Added 12678-13393

File size: 5.7 KB
  • u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/parameterization/setflowequation.py

     
    11import numpy
    22from model import *
    33from pairoptions import *
    4 from recover_areas import *
    54from MatlabFuncs import *
    65from FlagElements import *
    76
    8 def recover_areas(md,*args): # {{{
    9         """
    10         RECOVER_AREAS - flag the element depending on the physical model that is assigned to them
    117
    12                 This routine is called by setelementstype, do not use
     8        #recover elements distribution
    139
    14                 Usage:
    15                         [hutterflag macayealflag pattynflag stokesflag filltype]=recover_areas(md,varargin);
    16         """
    1710
    18         #go through varargin, extract options and plug them into subtype options, by order of appearance
    19         options=pairoptions(*args)
    20 #       options=deleteduplicates(options,1);
    21 
    22         #recover elements distribution
    23         hutterflag  =FlagElements(md,options.getfieldvalue('hutter',''))
    24         macayealflag=FlagElements(md,options.getfieldvalue('macayeal',''))
    25         pattynflag  =FlagElements(md,options.getfieldvalue('pattyn',''))
    26         stokesflag  =FlagElements(md,options.getfieldvalue('stokes',''))
    27         filltype    =options.getfieldvalue('fill','none')
    28 
    2911        return hutterflag,macayealflag,pattynflag,stokesflag,filltype
    3012#}}}
    3113def setflowequation(md,*args):
     
    3315        SETELEMENTSTYPE - associate a solution type to each element
    3416
    3517           This routine works like plotmodel: it works with an even number of inputs
    36            'hutter','macayeal','pattyn','stokes' and 'fill' are the possible options
     18           'hutter','macayeal','pattyn','l1l2','stokes' and 'fill' are the possible options
    3719           that must be followed by the corresponding exp file or flags list
    3820           It can either be a domain file (argus type, .exp extension), or an array of element flags.
    3921           If user wants every element outside the domain to be
     
    5436        if not isinstance(md,model) or not len(args):
    5537                raise TypeError("setflowequation error message")
    5638
     39        #process options
     40        options=pairoptions(*args)
     41#       options=deleteduplicates(options,1);
     42
    5743        #Find_out what kind of coupling to use
    58         options=pairoptions(*args)
    5944        coupling_method=options.getfieldvalue('coupling','tiling')
    6045        if not strcmpi(coupling_method,'tiling') and not strcmpi(coupling_method,'penalties'):
    6146                raise TypeError("coupling type can only be: tiling or penalties")
    6247
    63         hutterflag,macayealflag,pattynflag,stokesflag,filltype=recover_areas(md,*args)
     48        #recover elements distribution
     49        hutterflag   = FlagElements(md,options.getfieldvalue('hutter',''))
     50        macayealflag = FlagElements(md,options.getfieldvalue('macayeal',''))
     51        pattynflag   = FlagElements(md,options.getfieldvalue('pattyn',''))
     52        l1l2flag     = FlagElements(md,options.getfieldvalue('l1l2',''))
     53        stokesflag   = FlagElements(md,options.getfieldvalue('stokes',''))
     54        filltype     = options.getfieldvalue('fill','none')
    6455
    6556        #Flag the elements that have not been flagged as filltype
    6657        if   strcmpi(filltype,'hutter'):
  • u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/parameterization/setflowequation.m

     
    2323        error('setflowequation error message');
    2424end
    2525
     26%Process options
     27options=pairoptions(varargin{:});
     28options=deleteduplicates(options,1);
     29
    2630%Find_out what kind of coupling to use
    27 options=pairoptions(varargin{:});
    2831coupling_method=getfieldvalue(options,'coupling','tiling');
    2932if (~strcmpi(coupling_method,'tiling') & ~strcmpi(coupling_method,'penalties')),
    3033        error('coupling type can only be: tiling or penalties');
    3134end
    3235
    33 [hutterflag macayealflag pattynflag stokesflag filltype]=recover_areas(md,varargin{:});
     36%recover elements distribution
     37hutterflag   = FlagElements(md,getfieldvalue(options,'hutter',''));
     38macayealflag = FlagElements(md,getfieldvalue(options,'macayeal',''));
     39pattynflag   = FlagElements(md,getfieldvalue(options,'pattyn',''));
     40l1l2flag     = FlagElements(md,getfieldvalue(options,'l1l2',''));
     41stokesflag   = FlagElements(md,getfieldvalue(options,'stokes',''));
     42filltype     = getfieldvalue(options,'fill','none');
    3443
    3544%Flag the elements that have not been flagged as filltype
    3645if strcmpi(filltype,'hutter'),
     
    279288if any(md.flowequation.borderstokes) & any(md.flowequation.borderpattyn) & any(md.flowequation.borderpattyn + md.flowequation.borderstokes~=1),
    280289        error('error coupling domain too irregular');
    281290end
    282 end
    283 
    284 function [hutterflag macayealflag pattynflag stokesflag filltype]=recover_areas(md,varargin); % {{{
    285 %RECOVER_AREAS - flag the element depending on the physical model that is assigned to them
    286 %
    287 %   This routine is called by setelementstype, do not use
    288 %
    289 %   Usage:
    290 %      [hutterflag macayealflag pattynflag stokesflag filltype]=recover_areas(md,varargin);
    291 
    292         %go through varargin, extract options and plug them into subtype options, by order of appearance
    293         options=pairoptions(varargin{:});
    294         options=deleteduplicates(options,1);
    295 
    296         %recover elements distribution
    297         hutterflag  =FlagElements(md,getfieldvalue(options,'hutter',''));
    298         macayealflag=FlagElements(md,getfieldvalue(options,'macayeal',''));
    299         pattynflag  =FlagElements(md,getfieldvalue(options,'pattyn',''));
    300         stokesflag  =FlagElements(md,getfieldvalue(options,'stokes',''));
    301         filltype    =getfieldvalue(options,'fill','none');
    302 
    303 end %end function }}}
Note: See TracBrowser for help on using the repository browser.