source: issm/trunk-jpl/src/py3/classes/calvinglevermann.py@ 23670

Last change on this file since 23670 was 23670, checked in by bdef, 6 years ago

CHG: python scripts after 2to3 and indentation fix

File size: 1.3 KB
Line 
1from fielddisplay import fielddisplay
2from checkfield import checkfield
3from WriteData import WriteData
4
5class calvinglevermann(object):
6 """
7 CALVINGLEVERMANN class definition
8
9 Usage:
10 calvinglevermann=calvinglevermann();
11 """
12
13 def __init__(self): # {{{
14
15 self.coeff = float('NaN')
16 self.meltingrate = float('NaN')
17
18 #set defaults
19 self.setdefaultparameters()
20
21 #}}}
22 def __repr__(self): # {{{
23 string=' Calving Levermann parameters:'
24 string="%s\n%s"%(string,fielddisplay(self,'coeff','proportionality coefficient in Levermann model'))
25
26 return string
27 #}}}
28 def extrude(self,md): # {{{
29 self.coeff=project3d(md,'vector',self.coeff,'type','node')
30 return self
31 #}}}
32 def setdefaultparameters(self): # {{{
33
34 #Proportionality coefficient in Levermann model
35 self.coeff=2e13;
36 #}}}
37 def checkconsistency(self,md,solution,analyses): # {{{
38
39 #Early return
40 if (solution!='TransientSolution') or (not md.transient.ismovingfront):
41 return md
42
43 md = checkfield(md,'fieldname','calving.coeff','size',[md.mesh.numberofvertices],'>',0)
44 return md
45 # }}}
46 def marshall(self,prefix,md,fid): # {{{
47 yts=md.constants.yts
48 WriteData(fid,prefix,'name','md.calving.law','data',3,'format','Integer');
49 WriteData(fid,prefix,'object',self,'fieldname','coeff','format','DoubleMat','mattype',1)
50 # }}}
Note: See TracBrowser for help on using the repository browser.