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

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

merged trunk-jpl and trunk for revision 26742

File size: 4.8 KB
Line 
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.coupling = 0
22 self.effective_pressure = np.nan
23 self.effective_pressure_limit = 0
24
25 nargs = len(args)
26 if nargs == 0:
27 self.setdefaultparameters()
28 elif nargs == 1:
29 self = structtoobj(self, args[0])
30 else:
31 raise Exception('constructor not supported')
32 #}}}
33 def __repr__(self): # {{{
34 # See Brondex et al. 2019 https://www.the-cryosphere.net/13/177/2019/
35 s = 'Schoof sliding law parameters:\n'
36 s += ' Schoof\'s sliding law reads:\n'
37 s += ' C^2 |u_b|^(m-1) \n'
38 s += ' tau_b = - _____________________________ u_b \n'
39 s += ' (1+(C^2/(Cmax N))^1/m |u_b| )^m \n'
40 s += '\n'
41 s += "{}\n".format(fielddisplay(self, 'C', 'friction coefficient [SI]'))
42 s += "{}\n".format(fielddisplay(self, 'Cmax', 'Iken\'s bound (typically between 0.17 and 0.84) [SI]'))
43 s += "{}\n".format(fielddisplay(self, 'm', 'm exponent (generally taken as m = 1/n = 1/3)'))
44 s += '{}\n'.format(fielddisplay(self, 'coupling', 'Coupling flag 0: uniform sheet (negative pressure ok, default), 1: ice pressure only, 2: water pressure assuming uniform sheet (no negative pressure), 3: use provided effective_pressure, 4: used coupled model (not implemented yet)'))
45 s += '{}\n'.format(fielddisplay(self, 'effective_pressure', 'Effective Pressure for the forcing if not coupled [Pa]'))
46 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)'))
47 return s
48 #}}}
49 def setdefaultparameters(self): # {{{
50 self.effective_pressure_limit = 0
51 return self
52 #}}}
53 def extrude(self, md): # {{{
54 self.C = project3d(md, 'vector', self.C, 'type', 'node')
55 self.Cmax = project3d(md, 'vector', self.Cmax, 'type', 'node')
56 self.m = project3d(md, 'vector', self.m, 'type', 'element')
57 if self.coupling in[3, 4]:
58 self.effective_pressure = project3d(md, 'vector', self.effective_pressure, 'type', 'node', 'layer', 1)
59 return self
60 #}}}
61 def checkconsistency(self, md, solution, analyses): # {{{
62 # Early return
63 if 'StressbalanceAnalysis' not in analyses and 'ThermalAnalysis' not in analyses:
64 return md
65 md = checkfield(md, 'fieldname', 'friction.C', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '>',0.)
66 md = checkfield(md, 'fieldname', 'friction.Cmax', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '>', 0.)
67 md = checkfield(md, 'fieldname', 'friction.m', 'NaN', 1, 'Inf', 1, '>', 0., 'size', [md.mesh.numberofelements, 1])
68 md = checkfield(md, 'fieldname', 'friction.effective_pressure_limit', 'numel', [1], '>=', 0)
69 md = checkfield(md, 'fieldname', 'friction.coupling', 'numel', [1], 'values', [0, 1, 2, 3, 4])
70 if self.coupling == 3:
71 md = checkfield(md, 'fieldname', 'friction.effective_pressure', 'NaN', 1, 'Inf', 1, 'timeseries', 1)
72 return md
73 # }}}
74 def marshall(self, prefix, md, fid): # {{{
75 yts = md.constants.yts
76
77 WriteData(fid, prefix, 'name', 'md.friction.law', 'data', 11, 'format', 'Integer')
78 WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'C', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
79 WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'Cmax', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
80 WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'm', 'format', 'DoubleMat', 'mattype', 2)
81 WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'coupling', 'format', 'Integer')
82 WriteData(fid, prefix, 'object', self, 'class', 'friction', 'fieldname', 'effective_pressure_limit', 'format', 'Double')
83 if self.coupling == 3 or self.coupling == 4:
84 WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'effective_pressure', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
85 # }}}
Note: See TracBrowser for help on using the repository browser.