Changeset 24213 for issm/trunk-jpl/src/m/classes/calvingdev.py
- Timestamp:
- 10/11/19 00:25:20 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/calvingdev.py
r22267 r24213 4 4 from WriteData import WriteData 5 5 6 6 7 class calvingdev(object): 7 8 8 """ 9 CALVINGDEV class definition 9 10 10 11 calvingdev=calvingdev(); 12 11 Usage: 12 calvingdev = calvingdev() 13 """ 13 14 14 def __init__(self):# {{{15 def __init__(self): # {{{ 15 16 16 17 18 self.meltingrate= float('NaN')17 self.stress_threshold_groundedice = 0. 18 self.stress_threshold_floatingice = 0. 19 self.meltingrate = float('NaN') 19 20 20 21 21 #set defaults 22 self.setdefaultparameters() 22 23 23 #}}} 24 def __repr__(self): # {{{ 25 string=' Calving Pi parameters:' 26 string="%s\n%s"%(string,fielddisplay(self,'stress_threshold_groundedice','sigma_max applied to grounded ice only [Pa]')) 27 string="%s\n%s"%(string,fielddisplay(self,'stress_threshold_floatingice','sigma_max applied to floating ice only [Pa]')) 24 #}}} 28 25 29 string="%s\n%s"%(string,fielddisplay(self,'meltingrate','melting rate at given location [m/a]')) 30 return string 31 #}}} 32 def extrude(self,md): # {{{ 33 self.meltingrate=project3d(md,'vector',self.meltingrate,'type','node') 34 return self 35 #}}} 36 def setdefaultparameters(self): # {{{ 37 #Default sigma max 38 self.stress_threshold_groundedice = 1e6 39 self.stress_threshold_floatingice = 150e3 40 return self 41 #}}} 42 def checkconsistency(self,md,solution,analyses): # {{{ 43 #Early return 44 if solution == 'TransientSolution' or md.transient.ismovingfront == 0: 45 return 26 def __repr__(self): # {{{ 27 string = ' Calving Pi parameters:' 28 string = "%s\n%s" % (string, fielddisplay(self, 'stress_threshold_groundedice', 'sigma_max applied to grounded ice only [Pa]')) 29 string = "%s\n%s" % (string, fielddisplay(self, 'stress_threshold_floatingice', 'sigma_max applied to floating ice only [Pa]')) 46 30 47 md = checkfield(md,'fieldname','calving.stress_threshold_groundedice','>',0,'nan',1,'Inf',1)48 md = checkfield(md,'fieldname','calving.stress_threshold_floatingice','>',0,'nan',1,'Inf',1) 49 md = checkfield(md,'fieldname','calving.meltingrate','NaN',1,'Inf',1,'timeseries',1,'>=',0) 31 string = "%s\n%s" % (string, fielddisplay(self, 'meltingrate', 'melting rate at given location [m / a]')) 32 return string 33 #}}} 50 34 51 return md 52 # }}} 53 def marshall(self,prefix,md,fid): # {{{ 54 yts=md.constants.yts 35 def extrude(self, md): # {{{ 36 self.meltingrate = project3d(md, 'vector', self.meltingrate, 'type', 'node') 37 return self 38 #}}} 55 39 56 WriteData(fid,prefix,'name','md.calving.law','data',2,'format','Integer') 57 WriteData(fid,prefix,'object',self,'fieldname','stress_threshold_groundedice','format','DoubleMat','mattype',1) 58 WriteData(fid,prefix,'object',self,'fieldname','stress_threshold_floatingice','format','DoubleMat','mattype',1) 59 WriteData(fid,prefix,'object',self,'fieldname','meltingrate','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts,'scale',1./yts) 60 # }}} 40 def setdefaultparameters(self): # {{{ 41 #Default sigma max 42 self.stress_threshold_groundedice = 1e6 43 self.stress_threshold_floatingice = 150e3 44 return self 45 #}}} 46 47 def checkconsistency(self, md, solution, analyses): # {{{ 48 #Early return 49 if solution == 'TransientSolution' or md.transient.ismovingfront == 0: 50 return 51 52 md = checkfield(md, 'fieldname', 'calving.stress_threshold_groundedice', '>', 0, 'nan', 1, 'Inf', 1) 53 md = checkfield(md, 'fieldname', 'calving.stress_threshold_floatingice', '>', 0, 'nan', 1, 'Inf', 1) 54 md = checkfield(md, 'fieldname', 'calving.meltingrate', 'NaN', 1, 'Inf', 1, 'timeseries', 1, '>=', 0) 55 56 return md 57 # }}} 58 59 def marshall(self, prefix, md, fid): # {{{ 60 yts = md.constants.yts 61 62 WriteData(fid, prefix, 'name', 'md.calving.law', 'data', 2, 'format', 'Integer') 63 WriteData(fid, prefix, 'object', self, 'fieldname', 'stress_threshold_groundedice', 'format', 'DoubleMat', 'mattype', 1) 64 WriteData(fid, prefix, 'object', self, 'fieldname', 'stress_threshold_floatingice', 'format', 'DoubleMat', 'mattype', 1) 65 WriteData(fid, prefix, 'object', self, 'fieldname', 'meltingrate', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts, 'scale', 1. / yts) 66 # }}}
Note:
See TracChangeset
for help on using the changeset viewer.