Changeset 22849
- Timestamp:
- 06/18/18 13:51:28 (7 years ago)
- Location:
- issm/trunk-jpl/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Loads/Friction.cpp
r22847 r22849 670 670 *palpha2=alpha2; 671 671 }/*}}}*/ 672 672 673 IssmDouble Friction::EffectivePressure(Gauss* gauss){/*{{{*/ 673 /*Get effective pressure as a function of 674 * - coupling 675 * - type 676 * Neff=rho_ice*g*thickness+rho_ice*g*base 677 */ 678 674 /*Get effective pressure as a function of flag */ 679 675 680 676 /*diverse: */ 681 677 int coupled_flag; 678 IssmDouble thickness,base,sealevel; 679 IssmDouble p_ice,p_water; 682 680 IssmDouble Neff; 683 681 … … 688 686 switch(coupled_flag){ 689 687 case 0:{ 690 IssmDouble thickness,base,sealevel; 691 element->GetInputValue(&thickness, gauss,ThicknessEnum); 692 element->GetInputValue(&base, gauss,BaseEnum); 693 element->GetInputValue(&sealevel, gauss,SealevelEnum); 694 IssmDouble rho_water = element->GetMaterialParameter(MaterialsRhoSeawaterEnum); 695 IssmDouble rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum); 696 IssmDouble gravity = element->GetMaterialParameter(ConstantsGEnum); 697 Neff=gravity*(rho_ice*thickness+rho_water*(base-sealevel)); 688 element->GetInputValue(&thickness, gauss,ThicknessEnum); 689 IssmDouble rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum); 690 IssmDouble gravity = element->GetMaterialParameter(ConstantsGEnum); 691 p_ice = gravity*rho_ice*thickness; 692 p_water = 0.; 693 Neff = p_ice - p_water; 698 694 } 699 break; 700 case 1: 695 break; 696 case 1:{ 697 element->GetInputValue(&thickness, gauss,ThicknessEnum); 698 element->GetInputValue(&base, gauss,BaseEnum); 699 element->GetInputValue(&sealevel, gauss,SealevelEnum); 700 IssmDouble rho_water = element->GetMaterialParameter(MaterialsRhoSeawaterEnum); 701 IssmDouble rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum); 702 IssmDouble gravity = element->GetMaterialParameter(ConstantsGEnum); 703 p_ice = gravity*rho_ice*thickness; 704 p_water = max(0.,rho_water*gravity*(sealevel-base)); 705 Neff = p_ice - p_water; 706 } 707 break; 708 case 2:{ 709 element->GetInputValue(&thickness, gauss,ThicknessEnum); 710 element->GetInputValue(&base, gauss,BaseEnum); 711 element->GetInputValue(&sealevel, gauss,SealevelEnum); 712 IssmDouble rho_water = element->GetMaterialParameter(MaterialsRhoSeawaterEnum); 713 IssmDouble rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum); 714 IssmDouble gravity = element->GetMaterialParameter(ConstantsGEnum); 715 p_ice = gravity*rho_ice*thickness; 716 p_water = rho_water*gravity*(sealevel-base); 717 Neff = p_ice - p_water; 718 } 719 break; 720 case 3: 701 721 element->GetInputValue(&Neff,gauss,FrictionEffectivePressureEnum); 702 722 break; 703 case 2:723 case 4: 704 724 element->GetInputValue(&Neff,gauss,EffectivePressureTimeAverageEnum); 705 725 break; -
issm/trunk-jpl/src/m/classes/friction.m
r21935 r22849 20 20 case 0 21 21 case 1 22 case 2 23 case 3 22 24 self.effective_pressure=project3d(md,'vector',self.effective_pressure,'type','node','layer',1); 23 case 225 case 4 24 26 error('not implemented yet'); 25 27 otherwise … … 39 41 function self = setdefaultparameters(self) % {{{ 40 42 43 self.coupling = 0; 44 41 45 end % }}} 42 46 function md = checkconsistency(self,md,solution,analyses) % {{{ … … 49 53 md = checkfield(md,'fieldname','friction.q','NaN',1,'Inf',1,'size',[md.mesh.numberofelements 1]); 50 54 md = checkfield(md,'fieldname','friction.p','NaN',1,'Inf',1,'size',[md.mesh.numberofelements 1]); 51 md = checkfield(md,'fieldname','friction.coupling','numel',[1],'values',[0 1 2]);55 md = checkfield(md,'fieldname','friction.coupling','numel',[1],'values',[0:4]); 52 56 switch self.coupling 53 57 case 0 54 58 case 1 59 case 2 60 case 3 55 61 md = checkfield(md,'fieldname','friction.effective_pressure','NaN',1,'Inf',1,'timeseries',1); 56 case 262 case 4 57 63 error('not implemented yet'); 58 64 otherwise … … 66 72 fielddisplay(self,'q','q exponent'); 67 73 fielddisplay(self,'effective_pressure','Effective Pressure for the forcing if not coupled [Pa]'); 68 fielddisplay(self,'coupling','Coupling flag : 0 for default, 1 for forcing(provide md.friction.effective_pressure) and 2 for coupled(not implemented yet)');74 fielddisplay(self,'coupling','Coupling flag 0: uniform sheet (negative pressure ok, default), 1: ice pressure only, 2: water pressure assuming uniform sheet (no negative pressure), 3: use provided effective_pressure, 4: used coupled model (not implemented yet)'); 69 75 end % }}} 70 76 function marshall(self,prefix,md,fid) % {{{ -
issm/trunk-jpl/src/m/classes/friction.py
r22842 r22849 29 29 string="%s\n%s"%(string,fielddisplay(self,"p","p exponent")) 30 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)'))31 string="%s\n%s"%(string,fielddisplay(self,'coupling','Coupling flag 0: uniform sheet (negative pressure ok, default), 1: ice pressure only, 2: water pressure assuming uniform sheet (no negative pressure), 3: use provided effective_pressure, 4: used coupled model (not implemented yet)')) 32 32 string="%s\n%s"%(string,fielddisplay(self,'effective_pressure','Effective Pressure for the forcing if not coupled [Pa]')) 33 33 return string … … 38 38 self.q=project3d(md,'vector',self.q,'type','element') 39 39 #if self.coupling==0: #doesnt work with empty loop, so just skip it? 40 if self.coupling== 1:40 if self.coupling==3: 41 41 self.effective_pressure=project3d(md,'vector',self.effective_pressure,'type','node','layer',1) 42 elif self.coupling== 2:42 elif self.coupling==4: 43 43 raise ValueError('coupling not supported yet') 44 elif self.coupling > 2:45 raise ValueError('md.friction.coupling larger than 2, not supported yet')44 elif self.coupling > 4: 45 raise ValueError('md.friction.coupling larger than 4, not supported yet') 46 46 return self 47 47 #}}} … … 58 58 md = checkfield(md,'fieldname','friction.q','NaN',1,'Inf',1,'size',[md.mesh.numberofelements]) 59 59 md = checkfield(md,'fieldname','friction.p','NaN',1,'Inf',1,'size',[md.mesh.numberofelements]) 60 md = checkfield(md,'fieldname','friction.coupling','numel',[1],'values',[0,1,2 ])61 if self.coupling== 1:60 md = checkfield(md,'fieldname','friction.coupling','numel',[1],'values',[0,1,2,3,4]) 61 if self.coupling==3: 62 62 md = checkfield(md,'fieldname','friction.effective_pressure','NaN',1,'Inf',1,'timeseries',1) 63 elif self.coupling > 2:64 raise ValueError('md.friction.coupling larger than 2, not supported yet')63 elif self.coupling > 4: 64 raise ValueError('md.friction.coupling larger than 4, not supported yet') 65 65 return md 66 66 # }}} … … 71 71 WriteData(fid,prefix,'object',self,'fieldname','q','format','DoubleMat','mattype',2) 72 72 WriteData(fid,prefix,'class','friction','object',self,'fieldname','coupling','format','Integer') 73 if self.coupling== 1:73 if self.coupling==3: 74 74 WriteData(fid,prefix,'class','friction','object',self,'fieldname','effective_pressure','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts) 75 elif self.coupling > 2:75 elif self.coupling > 4: 76 76 raise ValueError('md.friction.coupling larger than 2, not supported yet') 77 77 # }}}
Note:
See TracChangeset
for help on using the changeset viewer.