1 | from fielddisplay import fielddisplay
|
---|
2 | from project3d import project3d
|
---|
3 | from checkfield import checkfield
|
---|
4 | from WriteData import WriteData
|
---|
5 |
|
---|
6 | class frictionshakti(object):
|
---|
7 | """
|
---|
8 | FRICTIONSHAKTI class definition
|
---|
9 |
|
---|
10 | Usage:
|
---|
11 | friction=frictionshakti()
|
---|
12 | """
|
---|
13 |
|
---|
14 | def __init__(self,md): # {{{
|
---|
15 | self.coefficient = md.friction.coefficient
|
---|
16 | #set defaults
|
---|
17 | self.setdefaultparameters()
|
---|
18 | #}}}
|
---|
19 |
|
---|
20 | def __repr__(self): # {{{
|
---|
21 | string="Basal shear stress parameters: Sigma_b = coefficient^2 * Neff * u_b\n(effective stress Neff=rho_ice*g*thickness+rho_water*g*(head-b))"
|
---|
22 | string="%s\n%s"%(string,fielddisplay(self,"coefficient","friction coefficient [SI]"))
|
---|
23 | return string
|
---|
24 | #}}}
|
---|
25 |
|
---|
26 | def extrude(self,md): # {{{
|
---|
27 | self.coefficient=project3d(md,'vector',self.coefficient,'type','node','layer',1)
|
---|
28 | return self
|
---|
29 | #}}}
|
---|
30 |
|
---|
31 | def setdefaultparameters(self): # {{{
|
---|
32 | return self
|
---|
33 | #}}}
|
---|
34 |
|
---|
35 | def checkconsistency(self,md,solution,analyses): # {{{
|
---|
36 | #Early return
|
---|
37 | if 'StressbalanceAnalysis' not in analyses and 'ThermalAnalysis' not in analyses:
|
---|
38 | return md
|
---|
39 |
|
---|
40 | md = checkfield(md,'fieldname','friction.coefficient','timeseries',1,'NaN',1,'Inf',1)
|
---|
41 | return md
|
---|
42 | # }}}
|
---|
43 |
|
---|
44 | def marshall(self,prefix,md,fid): # {{{
|
---|
45 | yts=md.constants.yts
|
---|
46 | WriteData(fid,prefix,'name','md.friction.law','data',8,'format','Integer')
|
---|
47 | WriteData(fid,prefix,'object',self,'fieldname','coefficient','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts)
|
---|
48 | # }}}
|
---|