[25844] | 1 | from checkfield import checkfield
|
---|
| 2 | from fielddisplay import fielddisplay
|
---|
| 3 | #from project3d import project3d # Uncomment if/when extrude is implemented
|
---|
| 4 | from WriteData import WriteData
|
---|
| 5 |
|
---|
| 6 |
|
---|
| 7 | class calvingcrevassedepth(object):
|
---|
| 8 | """CALVINCREVASSEDEPTH class definition
|
---|
| 9 |
|
---|
| 10 | Usage:
|
---|
| 11 | calvingcrevassedepth = calvingcrevassedepth()
|
---|
| 12 | """
|
---|
| 13 |
|
---|
| 14 | def __init__(self): # {{{
|
---|
| 15 | self.crevasse_opening_stress = 1
|
---|
[26444] | 16 | self.crevasse_threshold = 1.
|
---|
| 17 | self.water_height = 0.
|
---|
[25844] | 18 |
|
---|
| 19 | #self.setdefaultparameters() # Uncomment if/when setdefaultparameters is used
|
---|
[27458] | 20 | # }}}
|
---|
[25844] | 21 | def __repr__(self): # {{{
|
---|
| 22 | s = ' Calving Pi parameters:'
|
---|
| 23 | s += '{}\n'.format(fielddisplay(self, 'crevasse_opening_stress', '0: stress only in the ice-flow direction, 1: max principal'))
|
---|
[26444] | 24 | s += '{}\n'.format(fielddisplay(self, 'crevasse_threshold', 'ratio of full thickness to calve (e.g. 0.75 is for 75% of the total ice thickness)'))
|
---|
[25844] | 25 | s += '{}\n'.format(fielddisplay(self, 'water_height', 'water height in the crevasse [m]'))
|
---|
| 26 | return s
|
---|
[27458] | 27 | # }}}
|
---|
[25844] | 28 | def setdefaultparameters(self): # {{{
|
---|
| 29 | return self
|
---|
[27458] | 30 | # }}}
|
---|
[25844] | 31 | def extrude(self, md): # {{{
|
---|
| 32 | return self
|
---|
[27458] | 33 | # }}}
|
---|
[25844] | 34 | def checkconsistency(self, md, solution, analyses): # {{{
|
---|
| 35 | #Early return
|
---|
| 36 | if solution != 'TransientSolution' or not md.transient.ismovingfront:
|
---|
| 37 | return md
|
---|
| 38 |
|
---|
| 39 | md = checkfield(md, 'fieldname', 'calving.crevasse_opening_stress', 'numel', [1], 'values', [0,1])
|
---|
[26444] | 40 | md = checkfield(md, 'fieldname', 'calving.crevasse_threshold', 'numel', [1], '>', 0., '<=', 1.)
|
---|
[25844] | 41 | md = checkfield(md, 'fieldname', 'calving.water_height', 'NaN', 1, 'Inf', 1, 'timeseries', 1, '>=', 0)
|
---|
| 42 |
|
---|
| 43 | return md
|
---|
| 44 | # }}}
|
---|
| 45 | def marshall(self, prefix, md, fid): # {{{
|
---|
| 46 | yts = md.constants.yts
|
---|
| 47 | WriteData(fid, prefix, 'name', 'md.calving.law', 'data', 6, 'format', 'Integer')
|
---|
| 48 | WriteData(fid, prefix, 'object', self, 'fieldname', 'crevasse_opening_stress', 'format', 'Integer')
|
---|
[26444] | 49 | WriteData(fid, prefix, 'object', self, 'fieldname', 'crevasse_threshold', 'format', 'Double')
|
---|
[25844] | 50 | WriteData(fid, prefix, 'object', self, 'fieldname', 'water_height', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
|
---|
| 51 | # }}}
|
---|