source: issm/trunk/src/m/classes/frictionshakti.py@ 28013

Last change on this file since 28013 was 28013, checked in by Mathieu Morlighem, 16 months ago

merged trunk-jpl and trunk for revision 28011

File size: 1.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 frictionshakti(object):
11 """FRICTIONSHAKTI class definition
12
13 Usage:
14 friction = frictionshakti()
15 """
16
17 def __init__(self, *args): # {{{
18 self.coefficient = np.nan
19
20 nargs = len(args)
21 if nargs == 0:
22 self.setdefaultparameters()
23 elif nargs == 1:
24 self = structtoobj(self, args[0])
25 # }}}
26
27 def __repr__(self): # {{{
28 s = 'Basal shear stress parameters: Sigma_b = coefficient^2 * Neff * u_b\n'
29 s += '(effective stress Neff = rho_ice * g * thickness + rho_water * g * (head - b))\n'
30 s += '{}\n'.format(fielddisplay(self, 'coefficient', 'friction coefficient [SI]'))
31 return s
32 # }}}
33
34 def setdefaultparameters(self): # {{{
35 return self
36 # }}}
37
38 def extrude(self, md): # {{{
39 self.coefficient = project3d(md, 'vector', self.coefficient, 'type', 'node', 'layer', 1)
40 return self
41 # }}}
42
43 def checkconsistency(self, md, solution, analyses): # {{{
44 # Early return
45 if 'StressbalanceAnalysis' not in analyses and 'ThermalAnalysis' not in analyses:
46 return md
47 md = checkfield(md, 'fieldname', 'friction.coefficient', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
48 return md
49 # }}}
50
51 def marshall(self, prefix, md, fid): # {{{
52 WriteData(fid, prefix, 'name', 'md.friction.law', 'data', 8, 'format', 'Integer')
53 WriteData(fid, prefix, 'object', self, 'fieldname', 'coefficient', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
54 # }}}
Note: See TracBrowser for help on using the repository browser.