Changeset 21739
- Timestamp:
- 05/23/17 00:21:35 (8 years ago)
- Location:
- issm/trunk-jpl/src/m/classes
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/friction.m
r21049 r21739 9 9 p = NaN; 10 10 q = NaN; 11 coupling = 0; %Silje 12 effective_pressure = NaN; %Silje 11 13 end 12 14 methods … … 15 17 self.p=project3d(md,'vector',self.p,'type','element'); 16 18 self.q=project3d(md,'vector',self.q,'type','element'); 19 switch self.coupling 20 case 0 21 case 1 22 self.effective_pressure=project3d(md,'vector',self.effective_pressure,'type','node','layer',1); 23 case 2 24 error('not implemented yet'); 25 otherwise 26 error('not supported yet'); 27 end 17 28 end % }}} 18 29 function self = friction(varargin) % {{{ … … 36 47 md = checkfield(md,'fieldname','friction.q','NaN',1,'Inf',1,'size',[md.mesh.numberofelements 1]); 37 48 md = checkfield(md,'fieldname','friction.p','NaN',1,'Inf',1,'size',[md.mesh.numberofelements 1]); 49 md = checkfield(md,'fieldname','friction.coupling','numel',[1],'values',[0 1 2]);%Silje 50 switch self.coupling 51 case 0 52 case 1 53 md = checkfield(md,'fieldname','friction.effective_pressure','NaN',1,'Inf',1,'timeseries',1); 54 case 2 55 error('not implemented yet'); 56 otherwise 57 error('not supported yet'); 58 end 38 59 end % }}} 39 60 function disp(self) % {{{ … … 42 63 fielddisplay(self,'p','p exponent'); 43 64 fielddisplay(self,'q','q exponent'); 65 fielddisplay(self,'effective_pressure','Effective Pressure for the forcing if not coupled [Pa]');%Silje 66 fielddisplay(self,'coupling','Coupling flag: 0 for default, 1 for forcing(provide md.friction.effective_pressure) and 2 for coupled(not implemented yet)');%Silje 44 67 end % }}} 45 68 function marshall(self,prefix,md,fid) % {{{ … … 50 73 WriteData(fid,prefix,'object',self,'fieldname','p','format','DoubleMat','mattype',2); 51 74 WriteData(fid,prefix,'object',self,'fieldname','q','format','DoubleMat','mattype',2); 52 53 75 WriteData(fid,prefix,'class','friction','object',self,'fieldname','coupling','format','Integer'); %Silje 76 switch self.coupling 77 case 0 78 case 1 79 WriteData(fid,prefix,'class','friction','object',self,'fieldname','effective_pressure','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts); 80 case 2 81 error('not implemented yet'); 82 otherwise 83 error('not supported yet'); 84 end 54 85 end % }}} 55 86 function savemodeljs(self,fid,modelname) % {{{ … … 58 89 writejs1Darray(fid,[modelname '.friction.p'],self.p); 59 90 writejs1Darray(fid,[modelname '.friction.q'],self.q); 91 writejs1Darray(fid,[modelname '.friction.coupling'],self.coupling);%Silje 92 writejs1Darray(fid,[modelname '.friction.effective_pressure'],self.effective_pressure);%Silje 60 93 61 94 end % }}} -
issm/trunk-jpl/src/m/classes/friction.py
r21049 r21739 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 # }}} -
issm/trunk-jpl/src/m/classes/frictionhydro.m
r21049 r21739 6 6 classdef frictionhydro 7 7 properties (SetAccess=public) 8 Coupling = 0;8 coupling = 0; 9 9 q = NaN; 10 10 C = NaN; … … 28 28 %Early return 29 29 if ~ismember('StressbalanceAnalysis',analyses) & ~ismember('ThermalAnalysis',analyses), return; end 30 md = checkfield(md,'fieldname','friction. Coupling','numel',[1],'values',[0 1]);30 md = checkfield(md,'fieldname','friction.coupling','numel',[1],'values',[0 1 2]); 31 31 md = checkfield(md,'fieldname','friction.q','NaN',1,'Inf',1,'size',[md.mesh.numberofelements 1]); 32 32 md = checkfield(md,'fieldname','friction.C','NaN',1,'Inf',1,'size',[md.mesh.numberofelements 1]); 33 33 md = checkfield(md,'fieldname','friction.As','NaN',1,'Inf',1,'size',[md.mesh.numberofelements 1]); 34 if self.Coupling==0, 35 md = checkfield(md,'fieldname','friction.effective_pressure','NaN',1,'Inf',1,'timeseries',1); 34 switch self.coupling 35 case 0 36 case 1 37 md = checkfield(md,'fieldname','friction.effective_pressure','NaN',1,'Inf',1,'timeseries',1); 38 case 2 39 error('not implemented yet'); 40 otherwise 41 error('not supported yet'); 42 end 36 43 end 37 44 end % }}} … … 40 47 self.C=project3d(md,'vector',self.C,'type','element'); 41 48 self.As=project3d(md,'vector',self.As,'type','element'); 42 if self.Coupling==0, 43 self.effective_pressure=project3d(md,'vector',self.effective_pressure,'type','node','layer',1); 49 switch self.coupling 50 case 0 51 case 1 52 self.effective_pressure=project3d(md,'vector',self.effective_pressure,'type','node','layer',1); 53 case 2 54 error('not implemented yet'); 55 otherwise 56 error('not supported yet'); 44 57 end 45 58 end % }}} 46 59 function disp(self) % {{{ 47 60 disp(sprintf('Effective Pressure based friction law described in Gagliardini 2007')); 48 fielddisplay(self,' Coupling','Coupling flag, 1 for coupling and 0 for forcing');61 fielddisplay(self,'coupling','Coupling flag: 0 for default, 1 for forcing(provide md.friction.effective_pressure) and 2 for coupled(not implemented yet)'); 49 62 fielddisplay(self,'q','friction law exponent q>=1'); 50 63 fielddisplay(self,'C','friction law max value [SI]'); … … 54 67 function marshall(self,prefix,md,fid) % {{{ 55 68 WriteData(fid,prefix,'name','md.friction.law','data',3,'format','Integer'); 56 WriteData(fid,prefix,'class','friction','object',self,'fieldname',' Coupling','format','Integer');69 WriteData(fid,prefix,'class','friction','object',self,'fieldname','coupling','format','Integer'); 57 70 WriteData(fid,prefix,'class','friction','object',self,'fieldname','q','format','DoubleMat','mattype',2); 58 71 WriteData(fid,prefix,'class','friction','object',self,'fieldname','C','format','DoubleMat','mattype',2); 59 72 WriteData(fid,prefix,'class','friction','object',self,'fieldname','As','format','DoubleMat','mattype',2); 60 if self.Coupling==0, 61 WriteData(fid,prefix,'class','friction','object',self,'fieldname','effective_pressure','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts); 73 switch self.coupling 74 case 0 75 case 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 case 2 78 error('not implemented yet'); 79 otherwise 80 error('not supported yet'); 62 81 end 63 82 end % }}}
Note:
See TracChangeset
for help on using the changeset viewer.