Changeset 22758 for issm/trunk/src/m/classes/friction.py
- Timestamp:
- 05/10/18 10:24:27 (7 years ago)
- Location:
- issm/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk
- Property svn:mergeinfo changed
-
issm/trunk/src
- Property svn:mergeinfo changed
-
issm/trunk/src/m/classes/friction.py
r21341 r22758 1 import numpy as np 1 2 from fielddisplay import fielddisplay 2 3 from project3d import project3d … … 16 17 self.p = float('NaN') 17 18 self.q = float('NaN') 18 19 self.coupling = 0 20 self.effective_pressure = float('NaN') 19 21 #set defaults 20 22 self.setdefaultparameters() … … 22 24 #}}} 23 25 def __repr__(self): # {{{ 24 string="Basal shear stress parameters: Sigma_b = coefficient^2 * Neff ^r * |u_b|^(s-1) * u_b,\n(effective stress Neff=rho_ice*g*thickness+rho_water*g*b ed, r=q/p and s=1/p)"26 string="Basal shear stress parameters: Sigma_b = coefficient^2 * Neff ^r * |u_b|^(s-1) * u_b,\n(effective stress Neff=rho_ice*g*thickness+rho_water*g*base, r=q/p and s=1/p)" 25 27 26 28 string="%s\n%s"%(string,fielddisplay(self,"coefficient","friction coefficient [SI]")) 27 29 string="%s\n%s"%(string,fielddisplay(self,"p","p exponent")) 28 30 string="%s\n%s"%(string,fielddisplay(self,"q","q exponent")) 31 string="%s\n%s"%(string,fielddisplay(self,'coupling','Coupling flag: 0 for default, 1 for forcing(provide md.friction.effective_pressure) and 2 for coupled(not implemented yet)')) 32 string="%s\n%s"%(string,fielddisplay(self,'effective_pressure','Effective Pressure for the forcing if not coupled [Pa]')) 29 33 return string 30 34 #}}} … … 33 37 self.p=project3d(md,'vector',self.p,'type','element') 34 38 self.q=project3d(md,'vector',self.q,'type','element') 39 #if self.coupling==0: #doesnt work with empty loop, so just skip it? 40 if self.coupling==1: 41 self.effective_pressure=project3d(md,'vector',self.effective_pressure,'type','node','layer',1) 42 elif self.coupling==2: 43 raise ValueError('coupling not supported yet') 44 elif self.coupling > 2: 45 raise ValueError('md.friction.coupling larger than 2, not supported yet') 35 46 return self 36 47 #}}} … … 47 58 md = checkfield(md,'fieldname','friction.q','NaN',1,'Inf',1,'size',[md.mesh.numberofelements]) 48 59 md = checkfield(md,'fieldname','friction.p','NaN',1,'Inf',1,'size',[md.mesh.numberofelements]) 49 60 md = checkfield(md,'fieldname','friction.coupling','numel',[1],'values',[0,1,2]) 61 if self.coupling==1: 62 md = checkfield(md,'fieldname','friction.effective_pressure','NaN',1,'Inf',1,'timeseries',1) 63 elif self.coupling==2: 64 raise ValueError('coupling not supported yet') 65 elif self.coupling > 2: 66 raise ValueError('md.friction.coupling larger than 2, not supported yet') 50 67 return md 51 68 # }}} … … 55 72 WriteData(fid,prefix,'object',self,'fieldname','p','format','DoubleMat','mattype',2) 56 73 WriteData(fid,prefix,'object',self,'fieldname','q','format','DoubleMat','mattype',2) 74 WriteData(fid,prefix,'class','friction','object',self,'fieldname','coupling','format','Integer') 75 if self.coupling==1: 76 WriteData(fid,prefix,'class','friction','object',self,'fieldname','effective_pressure','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts) 77 elif self.coupling==2: 78 raise ValueError('coupling not supported yet') 79 elif self.coupling > 2: 80 raise ValueError('md.friction.coupling larger than 2, not supported yet') 57 81 # }}}
Note:
See TracChangeset
for help on using the changeset viewer.