source: issm/trunk/src/m/classes/frictionschoof.py@ 25836

Last change on this file since 25836 was 25836, checked in by Mathieu Morlighem, 4 years ago

merged trunk-jpl and trunk for revision 25834

File size: 3.5 KB
RevLine 
[25806]1import numpy as np
2
3from checkfield import checkfield
4from fielddisplay import fielddisplay
5from project3d import project3d
6from structtoobj import structtoobj
7from WriteData import WriteData
8
9
10class frictionschoof(object):
11 """FRICTIONSCHOOF class definition
12
13 Usage:
14 friction = frictionschoof()
15 """
16
17 def __init__(self, *args): # {{{
18 self.C = np.nan
19 self.Cmax = np.nan
20 self.m = np.nan
21 self.effective_pressure_limit = 0
22
23 nargs = len(args)
24 if nargs == 0:
25 self.setdefaultparameters()
26 elif nargs == 1:
27 self = structtoobj(self, args[0])
28 else:
29 raise Exception('constructor not supported')
30 #}}}
31
32 def __repr__(self): # {{{
33 # See Brondex et al. 2019 https://www.the-cryosphere.net/13/177/2019/
34 s = 'Schoof sliding law parameters:\n'
35 s += ' Schoof\'s sliding law reads:\n'
36 s += ' C^2 |u_b|^(m-1) \n'
37 s += ' tau_b = - _____________________________ u_b \n'
38 s += ' (1+(C^2/(Cmax N))^1/m |u_b| )^m \n'
39 s += '\n'
40 s += "{}\n".format(fielddisplay(self, 'C', 'friction coefficient [SI]'))
41 s += "{}\n".format(fielddisplay(self, 'Cmax', 'Iken\'s bound (typically between 0.17 and 0.84) [SI]'))
42 s += "{}\n".format(fielddisplay(self, 'm', 'm exponent (generally taken as m = 1/n = 1/3)'))
43 s += "{}\n".format(fielddisplay(self, 'effective_pressure_limit', 'fNeff do not allow to fall below a certain limit: effective_pressure_limit*rho_ice*g*thickness (default 0)'))
44 return s
45 #}}}
46
47 def setdefaultparameters(self): # {{{
48 self.effective_pressure_limit = 0
49 return self
50 #}}}
51
52 def extrude(self, md): # {{{
53 self.C = project3d(md, 'vector', self.C, 'type', 'node')
54 self.Cmax = project3d(md, 'vector', self.Cmax, 'type', 'node')
55 self.m = project3d(md, 'vector', self.m, 'type', 'element')
56 return self
57 #}}}
58
59 def checkconsistency(self, md, solution, analyses): # {{{
60 # Early return
61 if 'StressbalanceAnalysis' not in analyses and 'ThermalAnalysis' not in analyses:
62 return md
63 md = checkfield(md, 'fieldname', 'friction.C', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '>',0.)
64 md = checkfield(md, 'fieldname', 'friction.Cmax', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '>', 0.)
65 md = checkfield(md, 'fieldname', 'friction.m', 'NaN', 1, 'Inf', 1, '>', 0., 'size', [md.mesh.numberofelements, 1])
66 md = checkfield(md, 'fieldname', 'friction.effective_pressure_limit', 'numel', [1], '>=', 0)
67 return md
68 # }}}
69
70 def marshall(self, prefix, md, fid): # {{{
71 yts = md.constants.yts
72
73 WriteData(fid, prefix, 'name', 'md.friction.law', 'data', 11, 'format', 'Integer')
74 WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'C', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
75 WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'Cmax', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
76 WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'm', 'format', 'DoubleMat', 'mattype', 2)
77 WriteData(fid, prefix, 'object', self, 'class', 'friction', 'fieldname', 'effective_pressure_limit', 'format', 'Double')
78 # }}}
79
Note: See TracBrowser for help on using the repository browser.