Changeset 25499 for issm/trunk-jpl/src/m/classes/frictionwaterlayer.py
- Timestamp:
- 08/31/20 14:54:17 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/frictionwaterlayer.py
r24213 r25499 1 import numpy as np 2 3 from checkfield import checkfield 4 from fielddisplay import fielddisplay 1 5 from project3d import project3d 2 from fielddisplay import fielddisplay3 from checkfield import checkfield4 6 from WriteData import WriteData 5 7 6 8 7 9 class frictionwaterlayer(object): 8 """ 9 frictionwaterlayer class definition 10 """FRICTIONWATERLAYER class definition 10 11 11 12 Usage: 12 13 friction = frictionwaterlayer(md) 13 14 """ 15 14 16 def __init__(self, md): # {{{ 15 self.coefficient = md.friction.coefficient 16 self.f = float('NaN') 17 self.p = md.friction.p 18 self.q = md.friction.q 19 self.water_layer = float('NaN') 17 self.coefficient = np.nan 18 self.f = np.nan 19 self.p = np.nan 20 self.q = np.nan 21 self.water_layer = np.nan 22 #}}} 23 24 def __repr__(self): # {{{ 25 s = 'Basal shear stress parameters: tau_b = coefficient^2 * Neff ^r * |u_b|^(s - 1) * u_b * 1 / f(T)\n(effective stress Neff = rho_ice * g * thickness + rho_water * g * (bed + water_layer), r = q / p and s = 1 / p)\n' 26 s = "{}\n".format(fielddisplay(self, 'coefficient', 'frictiontemp coefficient [SI]')) 27 s = "{}\n".format(fielddisplay(self, 'f', 'f variable for effective pressure')) 28 s = "{}\n".format(fielddisplay(self, 'p', 'p exponent')) 29 s = "{}\n".format(fielddisplay(self, 'q', 'q exponent')) 30 s = "{}\n".format(fielddisplay(self, 'water_layer', 'water thickness at the base of the ice (m)')) 31 32 return s 33 #}}} 34 35 def setdefaultparameters(self): # {{{ 36 return self 20 37 #}}} 21 38 … … 37 54 self.q = project3d(md, 'vector', self.q, 'type', 'element') 38 55 self.water_layer = project3d(md, 'vector', self.water_layer, 'type', 'node', 'layer', 1) 56 39 57 return self 40 58 # }}} 41 59 42 def __repr__(self): # {{{43 string = 'Basal shear stress parameters: tau_b = coefficient^2 * Neff ^r * |u_b|^(s - 1) * u_b * 1 / f(T)\n(effective stress Neff = rho_ice * g * thickness + rho_water * g * (bed + water_layer), r = q / p and s = 1 / p)'44 string = "%s\n%s" % (string, fielddisplay(self, 'coefficient', 'frictiontemp coefficient [SI]'))45 string = "%s\n%s" % (string, fielddisplay(self, 'f', 'f variable for effective pressure'))46 string = "%s\n%s" % (string, fielddisplay(self, 'p', 'p exponent'))47 string = "%s\n%s" % (string, fielddisplay(self, 'q', 'q exponent'))48 string = "%s\n%s" % (string, fielddisplay(self, 'water_layer', 'water thickness at the base of the ice (m)'))49 50 return string51 #}}}52 53 60 def marshall(self, prefix, md, fid): #{{{ 54 yts = md.constants.yts55 61 WriteData(fid, prefix, 'name', 'md.friction.law', 'data', 5, 'format', 'Integer') 56 WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'coefficient', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)62 WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'coefficient', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts) 57 63 WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'f', 'format', 'Double') 58 64 WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'p', 'format', 'DoubleMat', 'mattype', 2) 59 65 WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'q', 'format', 'DoubleMat', 'mattype', 2) 60 WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'water_layer', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)66 WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'water_layer', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts) 61 67 #}}}
Note:
See TracChangeset
for help on using the changeset viewer.