Changeset 22849


Ignore:
Timestamp:
06/18/18 13:51:28 (7 years ago)
Author:
Mathieu Morlighem
Message:

NEW: added support for different effective pressure, only works for friction right now, to be extended later

Location:
issm/trunk-jpl/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Loads/Friction.cpp

    r22847 r22849  
    670670        *palpha2=alpha2;
    671671}/*}}}*/
     672
    672673IssmDouble 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 */
    679675
    680676        /*diverse: */
    681677        int         coupled_flag;
     678        IssmDouble  thickness,base,sealevel;
     679        IssmDouble  p_ice,p_water;
    682680        IssmDouble  Neff;
    683681
     
    688686        switch(coupled_flag){
    689687                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;
    698694                                 }
    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:
    701721                        element->GetInputValue(&Neff,gauss,FrictionEffectivePressureEnum);
    702722                        break;
    703                 case 2:
     723                case 4:
    704724                        element->GetInputValue(&Neff,gauss,EffectivePressureTimeAverageEnum);
    705725                        break;
  • issm/trunk-jpl/src/m/classes/friction.m

    r21935 r22849  
    2020                                case 0
    2121                                case 1
     22                                case 2
     23                                case 3
    2224                                        self.effective_pressure=project3d(md,'vector',self.effective_pressure,'type','node','layer',1);
    23                                 case 2
     25                                case 4
    2426                                        error('not implemented yet');
    2527                                otherwise
     
    3941                function self = setdefaultparameters(self) % {{{
    4042
     43                        self.coupling = 0;
     44
    4145                end % }}}
    4246                function md = checkconsistency(self,md,solution,analyses) % {{{
     
    4953                        md = checkfield(md,'fieldname','friction.q','NaN',1,'Inf',1,'size',[md.mesh.numberofelements 1]);
    5054                        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]);
    5256                        switch self.coupling
    5357                                case 0
    5458                                case 1
     59                                case 2
     60                                case 3
    5561                                        md = checkfield(md,'fieldname','friction.effective_pressure','NaN',1,'Inf',1,'timeseries',1);
    56                                 case 2
     62                                case 4
    5763                                        error('not implemented yet');
    5864                                otherwise
     
    6672                        fielddisplay(self,'q','q exponent');
    6773                        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)');
    6975                end % }}}
    7076                function marshall(self,prefix,md,fid) % {{{
  • issm/trunk-jpl/src/m/classes/friction.py

    r22842 r22849  
    2929                string="%s\n%s"%(string,fielddisplay(self,"p","p exponent"))
    3030                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)'))
    3232                string="%s\n%s"%(string,fielddisplay(self,'effective_pressure','Effective Pressure for the forcing if not coupled [Pa]'))
    3333                return string
     
    3838                self.q=project3d(md,'vector',self.q,'type','element')
    3939                #if self.coupling==0: #doesnt work with empty loop, so just skip it?
    40                 if self.coupling==1:
     40                if self.coupling==3:
    4141                        self.effective_pressure=project3d(md,'vector',self.effective_pressure,'type','node','layer',1)
    42                 elif self.coupling==2:
     42                elif self.coupling==4:
    4343                        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')
    4646                return self
    4747        #}}}
     
    5858                md = checkfield(md,'fieldname','friction.q','NaN',1,'Inf',1,'size',[md.mesh.numberofelements])
    5959                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:
    6262                        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')
    6565                return md
    6666        # }}}
     
    7171                WriteData(fid,prefix,'object',self,'fieldname','q','format','DoubleMat','mattype',2)
    7272                WriteData(fid,prefix,'class','friction','object',self,'fieldname','coupling','format','Integer')
    73                 if self.coupling==1:
     73                if self.coupling==3:
    7474                        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:
    7676                        raise ValueError('md.friction.coupling larger than 2, not supported yet')
    7777        # }}}
Note: See TracChangeset for help on using the changeset viewer.