source: issm/branches/trunk-jpl-damage/src/m/classes/friction.py@ 13101

Last change on this file since 13101 was 13101, checked in by cborstad, 13 years ago

merged trunk-jpl through revision 13099 into branch

File size: 1.6 KB
RevLine 
[12038]1#module imports
2from fielddisplay import fielddisplay
[13101]3from EnumDefinitions import *
4from checkfield import *
5from WriteData import *
[12038]6
[13101]7class friction(object):
8 """
9 FRICTION class definition
10
11 Usage:
12 friction=friction();
13 """
14
[12038]15 #properties
16 def __init__(self):
17 # {{{ Properties
18 self.coefficient = float('NaN')
19 self.p = float('NaN')
20 self.q = float('NaN')
[12123]21
22 #set defaults
23 self.setdefaultparameters()
24
[12038]25 #}}}
[13101]26 def __repr__(self):
[12038]27 # {{{ Display
28 string="Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p"
[13101]29 string="%s\n\n%s"%(string,fielddisplay(self,"coefficient","friction coefficient [SI]"))
30 string="%s\n%s"%(string,fielddisplay(self,"p","p exponent"))
31 string="%s\n%s"%(string,fielddisplay(self,"q","q exponent"))
[12038]32 return string
33 #}}}
[12123]34
[13101]35 def setdefaultparameters(self):
[12123]36 # {{{setdefaultparameters
[13101]37 return self
[12123]38 #}}}
39
[13101]40 def checkconsistency(self,md,solution,analyses): # {{{
41
42 #Early return
43 if DiagnosticHorizAnalysisEnum() not in analyses and ThermalAnalysisEnum() not in analyses:
44 return md
45
46 md = checkfield(md,'friction.coefficient','NaN',1,'size',[md.mesh.numberofvertices])
47 md = checkfield(md,'friction.q','NaN',1,'size',[md.mesh.numberofelements])
48 md = checkfield(md,'friction.p','NaN',1,'size',[md.mesh.numberofelements])
49
50 return md
51 # }}}
52
53 def marshall(self,fid): # {{{
54 WriteData(fid,'object',self,'fieldname','coefficient','format','DoubleMat','mattype',1)
55 WriteData(fid,'object',self,'fieldname','p','format','DoubleMat','mattype',2)
56 WriteData(fid,'object',self,'fieldname','q','format','DoubleMat','mattype',2)
57 # }}}
58
Note: See TracBrowser for help on using the repository browser.