source:
issm/oecreview/Archive/12678-13393/ISSM-13027-13028.diff@
14312
Last change on this file since 14312 was 13394, checked in by , 13 years ago | |
---|---|
File size: 5.7 KB |
-
u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/parameterization/setflowequation.py
1 1 import numpy 2 2 from model import * 3 3 from pairoptions import * 4 from recover_areas import *5 4 from MatlabFuncs import * 6 5 from FlagElements import * 7 6 8 def recover_areas(md,*args): # {{{9 """10 RECOVER_AREAS - flag the element depending on the physical model that is assigned to them11 7 12 This routine is called by setelementstype, do not use8 #recover elements distribution 13 9 14 Usage:15 [hutterflag macayealflag pattynflag stokesflag filltype]=recover_areas(md,varargin);16 """17 10 18 #go through varargin, extract options and plug them into subtype options, by order of appearance19 options=pairoptions(*args)20 # options=deleteduplicates(options,1);21 22 #recover elements distribution23 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 29 11 return hutterflag,macayealflag,pattynflag,stokesflag,filltype 30 12 #}}} 31 13 def setflowequation(md,*args): … … 33 15 SETELEMENTSTYPE - associate a solution type to each element 34 16 35 17 This routine works like plotmodel: it works with an even number of inputs 36 'hutter','macayeal','pattyn',' stokes' and 'fill' are the possible options18 'hutter','macayeal','pattyn','l1l2','stokes' and 'fill' are the possible options 37 19 that must be followed by the corresponding exp file or flags list 38 20 It can either be a domain file (argus type, .exp extension), or an array of element flags. 39 21 If user wants every element outside the domain to be … … 54 36 if not isinstance(md,model) or not len(args): 55 37 raise TypeError("setflowequation error message") 56 38 39 #process options 40 options=pairoptions(*args) 41 # options=deleteduplicates(options,1); 42 57 43 #Find_out what kind of coupling to use 58 options=pairoptions(*args)59 44 coupling_method=options.getfieldvalue('coupling','tiling') 60 45 if not strcmpi(coupling_method,'tiling') and not strcmpi(coupling_method,'penalties'): 61 46 raise TypeError("coupling type can only be: tiling or penalties") 62 47 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') 64 55 65 56 #Flag the elements that have not been flagged as filltype 66 57 if strcmpi(filltype,'hutter'): -
u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/parameterization/setflowequation.m
23 23 error('setflowequation error message'); 24 24 end 25 25 26 %Process options 27 options=pairoptions(varargin{:}); 28 options=deleteduplicates(options,1); 29 26 30 %Find_out what kind of coupling to use 27 options=pairoptions(varargin{:});28 31 coupling_method=getfieldvalue(options,'coupling','tiling'); 29 32 if (~strcmpi(coupling_method,'tiling') & ~strcmpi(coupling_method,'penalties')), 30 33 error('coupling type can only be: tiling or penalties'); 31 34 end 32 35 33 [hutterflag macayealflag pattynflag stokesflag filltype]=recover_areas(md,varargin{:}); 36 %recover elements distribution 37 hutterflag = FlagElements(md,getfieldvalue(options,'hutter','')); 38 macayealflag = FlagElements(md,getfieldvalue(options,'macayeal','')); 39 pattynflag = FlagElements(md,getfieldvalue(options,'pattyn','')); 40 l1l2flag = FlagElements(md,getfieldvalue(options,'l1l2','')); 41 stokesflag = FlagElements(md,getfieldvalue(options,'stokes','')); 42 filltype = getfieldvalue(options,'fill','none'); 34 43 35 44 %Flag the elements that have not been flagged as filltype 36 45 if strcmpi(filltype,'hutter'), … … 279 288 if any(md.flowequation.borderstokes) & any(md.flowequation.borderpattyn) & any(md.flowequation.borderpattyn + md.flowequation.borderstokes~=1), 280 289 error('error coupling domain too irregular'); 281 290 end 282 end283 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 them286 %287 % This routine is called by setelementstype, do not use288 %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 appearance293 options=pairoptions(varargin{:});294 options=deleteduplicates(options,1);295 296 %recover elements distribution297 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.