Changeset 23838


Ignore:
Timestamp:
04/09/19 13:27:11 (6 years ago)
Author:
kruegern
Message:

BUG: fixed bug in Pig.py and tab misalignment in calvingonmises.py

Location:
issm/trunk-jpl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/calvingvonmises.py

    r23824 r23838  
    55
    66class calvingvonmises(object):
    7         """
    8         CALVINGVONMISES class definition
     7    """
     8    CALVINGVONMISES class definition
    99
    10            Usage:
    11               calvingvonmises=calvingvonmises()
    12         """
     10       Usage:
     11          calvingvonmises=calvingvonmises()
     12    """
    1313
    14         def __init__(self): # {{{
     14    def __init__(self): # {{{
    1515
    16                 self.stress_threshold_groundedice = 0.
    17                 self.stress_threshold_floatingice = 0.
    18                 self.meltingrate   = float('NaN')
    19                 self.min_thickness = 0.
     16        self.stress_threshold_groundedice = 0.
     17        self.stress_threshold_floatingice = 0.
     18        self.meltingrate   = float('NaN')
     19        self.min_thickness = 0.
    2020
    21                 #set defaults
    22                 self.setdefaultparameters()
     21        #set defaults
     22        self.setdefaultparameters()
    2323
    24         #}}}
    25         def __repr__(self): # {{{
    26                 string='   Calving VonMises parameters:'
    27                 string="%s\n%s"%(string,fielddisplay(self,'stress_threshold_groundedice','sigma_max applied to grounded ice only [Pa]'))
    28                 string="%s\n%s"%(string,fielddisplay(self,'stress_threshold_floatingice','sigma_max applied to floating ice only [Pa]'))
    29                 string="%s\n%s"%(string,fielddisplay(self,'min_thickness','minimum thickness below which no ice is allowed [m]'))
     24    #}}}
     25    def __repr__(self): # {{{
     26        string='   Calving VonMises parameters:'
     27        string="%s\n%s"%(string,fielddisplay(self,'stress_threshold_groundedice','sigma_max applied to grounded ice only [Pa]'))
     28        string="%s\n%s"%(string,fielddisplay(self,'stress_threshold_floatingice','sigma_max applied to floating ice only [Pa]'))
     29        string="%s\n%s"%(string,fielddisplay(self,'min_thickness','minimum thickness below which no ice is allowed [m]'))
    3030
    31                 return string
    32         #}}}
    33         def extrude(self,md): # {{{
    34                 return self
    35         #}}}
    36         def setdefaultparameters(self): # {{{
    37                 #Default sigma max
    38                 self.stress_threshold_groundedice = 1e6
    39                 self.stress_threshold_floatingice = 150e3
     31        return string
     32    #}}}
     33    def extrude(self,md): # {{{
     34        return self
     35    #}}}
     36    def setdefaultparameters(self): # {{{
     37        #Default sigma max
     38        self.stress_threshold_groundedice = 1e6
     39        self.stress_threshold_floatingice = 150e3
    4040
    41                 #turn off min_thickness by default.
    42                 self.min_thickness=0.
    43                 return self
    44         #}}}
    45         def checkconsistency(self,md,solution,analyses):    # {{{
    46                 #Early return
    47                 if solution == 'TransientSolution' or md.transient.ismovingfront == 0:
    48                         return
     41        #turn off min_thickness by default.
     42        self.min_thickness=0.
     43        return self
     44    #}}}
     45    def checkconsistency(self,md,solution,analyses):    # {{{
     46        #Early return
     47        if solution == 'TransientSolution' or md.transient.ismovingfront == 0:
     48            return
    4949
    50                 md = checkfield(md,'fieldname','calving.stress_threshold_groundedice','>',0,'nan',1,'Inf',1)
    51                 md = checkfield(md,'fieldname','calving.stress_threshold_floatingice','>',0,'nan',1,'Inf',1)
    52                 md = checkfield(md,'fieldname','calving.min_thickness','>=',0,'NaN',1,'Inf',1,'numel',[1]);
     50        md = checkfield(md,'fieldname','calving.stress_threshold_groundedice','>',0,'nan',1,'Inf',1)
     51        md = checkfield(md,'fieldname','calving.stress_threshold_floatingice','>',0,'nan',1,'Inf',1)
     52        md = checkfield(md,'fieldname','calving.min_thickness','>=',0,'NaN',1,'Inf',1,'numel',[1]);
    5353
    54                 return md
    55         # }}}
    56         def marshall(self,prefix,md,fid):    # {{{
    57                 yts=md.constants.yts
     54        return md
     55    # }}}
     56    def marshall(self,prefix,md,fid):    # {{{
     57        yts=md.constants.yts
    5858
    59                 WriteData(fid,prefix,'name','md.calving.law','data',2,'format','Integer')
    60                 WriteData(fid,prefix,'object',self,'fieldname','stress_threshold_groundedice','format','DoubleMat','mattype',1)
    61                 WriteData(fid,prefix,'object',self,'fieldname','stress_threshold_floatingice','format','DoubleMat','mattype',1)
    62                 WriteData(fid,prefix,'object',self,'fieldname','min_thickness','format','Double');
    63         # }}}
     59        WriteData(fid,prefix,'name','md.calving.law','data',2,'format','Integer')
     60        WriteData(fid,prefix,'object',self,'fieldname','stress_threshold_groundedice','format','DoubleMat','mattype',1)
     61        WriteData(fid,prefix,'object',self,'fieldname','stress_threshold_floatingice','format','DoubleMat','mattype',1)
     62        WriteData(fid,prefix,'object',self,'fieldname','min_thickness','format','Double');
     63    # }}}
  • issm/trunk-jpl/test/Par/Pig.py

    r23835 r23838  
    2525md.geometry.thickness=InterpFromMeshToMesh2d(index,x,y,thickness,md.mesh.x,md.mesh.y)[0][:,0]
    2626md.geometry.base=md.geometry.surface-md.geometry.thickness
    27 md.geometry.bed =md.geometry.base
    28 pos = np.where(md.mask.groundedice_levelset<0.)[0]
    29 md.geometry.bed[pos] =InterpFromMeshToMesh2d(index,x,y,bed,md.mesh.x[pos],md.mesh.y[pos])
     27md.geometry.bed =numpy.array(md.geometry.base)
     28pos = np.where(md.mask.groundedice_levelset<0.)
     29md.geometry.bed[pos] =InterpFromMeshToMesh2d(index,x,y,bed,md.mesh.x[pos],md.mesh.y[pos])[0][:,0]
    3030md.initialization.vx=md.inversion.vx_obs
    3131md.initialization.vy=md.inversion.vy_obs
Note: See TracChangeset for help on using the changeset viewer.