Changeset 28030


Ignore:
Timestamp:
12/19/23 21:01:48 (15 months ago)
Author:
jdquinn
Message:

CHG: MATLAB -> Python; cleanup

Location:
issm/trunk-jpl/src/m/classes
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/frictioncoulomb.m

    r27164 r28030  
    66classdef frictioncoulomb
    77        properties (SetAccess=public)
    8                 coefficient        = NaN;
    9                 p                  = NaN;
    10                 q                  = NaN;
    11                 coefficientcoulomb = NaN;
    12                 coupling        = 0;
    13                 effective_pressure = NaN;
     8                coefficient              = NaN;
     9                p                        = NaN;
     10                q                        = NaN;
     11                coefficientcoulomb       = NaN;
     12                coupling                 = 0;
     13                effective_pressure       = NaN;
    1414                effective_pressure_limit = 0;
    1515        end
     
    2727                                        error('not implemented yet');
    2828                                otherwise
    29                                         error('not supported yet');             
     29                                        error('not supported yet');
    3030                        end
    3131                end % }}}
     
    5252                        md = checkfield(md,'fieldname','friction.p','NaN',1,'Inf',1,'size',[md.mesh.numberofelements 1]);
    5353                        md = checkfield(md,'fieldname','friction.coupling','numel',[1],'values',[0 1 2]);
    54                         md = checkfield(md,'fieldname','friction.effective_pressure_limit','numel',[1],'>=',0);                 
     54                        md = checkfield(md,'fieldname','friction.effective_pressure_limit','numel',[1],'>=',0);
     55
    5556                        switch self.coupling
    5657                                case 0
     
    6061                                        error('not implemented yet');
    6162                                otherwise
    62                                         error('not supported yet');             
     63                                        error('not supported yet');
    6364                        end
    6465                end % }}}
     
    7172                        fielddisplay(self,'effective_pressure','Effective Pressure for the forcing if not coupled [Pa]');
    7273                        fielddisplay(self,'coupling','Coupling flag: 0 for default, 1 for forcing(provide md.friction.effective_pressure)  and 2 for coupled(not implemented yet)');
    73                         fielddisplay(self,'effective_pressure_limit','Neff do not allow to fall below a certain limit: effective_pressure_limit*rho_ice*g*thickness (default 0)');     
     74                        fielddisplay(self,'effective_pressure_limit','Neff do not allow to fall below a certain limit: effective_pressure_limit*rho_ice*g*thickness (default 0)');
    7475                        end % }}}
    7576                function marshall(self,prefix,md,fid) % {{{
     77                        yts=md.constants.yts;
    7678
    7779                        WriteData(fid,prefix,'name','md.friction.law','data',7,'format','Integer');
    78                         WriteData(fid,prefix,'object',self,'fieldname','coefficient','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
     80                        WriteData(fid,prefix,'object',self,'fieldname','coefficient','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
    7981                        WriteData(fid,prefix,'object',self,'fieldname','coefficientcoulomb','format','DoubleMat','mattype',1);
    8082                        WriteData(fid,prefix,'object',self,'fieldname','p','format','DoubleMat','mattype',2);
     
    8587                                case 0
    8688                                case 1
    87                                         WriteData(fid,prefix,'class','friction','object',self,'fieldname','effective_pressure','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
     89                                        WriteData(fid,prefix,'class','friction','object',self,'fieldname','effective_pressure','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
    8890                                case 2
    8991                                        error('not implemented yet');
    9092                                otherwise
    91                                         error('not supported yet');             
     93                                        error('not supported yet');
    9294                        end
    9395
  • issm/trunk-jpl/src/m/classes/frictioncoulomb.py

    r27458 r28030  
    77
    88
    9 class frictioncoulomb(object):
    10     """FRICTIONCOULOMB class definition
     9class frictioncoulomb():
     10    """frictioncoulomb class definition
    1111
    1212    Usage:
     
    1414    """
    1515
    16     def __init__(self):  # {{{
     16    def __init__(self, *args):  # {{{
    1717        self.coefficient = np.nan
    1818        self.coefficientcoulomb = np.nan
     
    2323        self.effective_pressure_limit = 0
    2424
    25         self.setdefaultparameters()
     25        nargs = len(args)
     26
     27        if nargs == 0:
     28            self.setdefaultparameters()
     29        else:
     30            raise Exception('constructor not supported')
    2631    # }}}
    2732
     
    7782
    7883    def marshall(self, prefix, md, fid):  # {{{
     84        yts = md.constants.yts
     85
    7986        WriteData(fid, prefix, 'name', 'md.friction.law', 'data', 7, 'format', 'Integer')
    80         WriteData(fid, prefix, 'object', self, 'fieldname', 'coefficient', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
     87        WriteData(fid, prefix, 'object', self, 'fieldname', 'coefficient', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    8188        WriteData(fid, prefix, 'object', self, 'fieldname', 'coefficientcoulomb', 'format', 'DoubleMat', 'mattype', 1)
    8289        WriteData(fid, prefix, 'object', self, 'fieldname', 'p', 'format', 'DoubleMat', 'mattype', 2)
     
    8592        WriteData(fid, prefix, 'object', self, 'class', 'friction', 'fieldname', 'effective_pressure_limit', 'format', 'Double')
    8693        if self.coupling == 1:
    87             WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'effective_pressure', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
     94            WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'effective_pressure', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    8895        elif self.coupling == 2:
    8996            raise ValueError('not implemented yet')
  • issm/trunk-jpl/src/m/classes/frictionregcoulomb.m

    r27478 r28030  
    3939                end % }}}
    4040                function disp(self) % {{{
    41                         %See Joughin et al. 2019 (equivalent form by Matt Trevers, poster at AGU 2022) https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2019GL082526
    42                         disp('Regularized Couloub friction law (Joughin et al., 2019) parameters:');
    43                         disp('   Regularized Couloub friction law reads:');
     41                        %See Joughin et al. 2019 (equivalent form by Matt Trevers, poster at AGU 2022) https://agupubs.onlinelåibrary.wiley.com/doi/full/10.1029/2019GL082526
     42                        disp('Regularized Coulomb friction law (Joughin et al., 2019) parameters:');
     43                        disp('   Regularized Coulomb friction law reads:');
    4444                        disp('                       C^2 |u|^(1/m)         ');
    4545                        disp('      tau_b = -  ____________________________');
    46                         disp('                        (|u|/u0 + 1)^(1/m)   ');
     46                        disp('                     (|u|/u0 + 1)^(1/m)      ');
    4747                        disp(' ');
    4848                        fielddisplay(self,'C','friction coefficient [SI]');
    4949                        fielddisplay(self,'m','m exponent (set to m=3 in original paper)');
    50                         fielddisplay(self,'u0','velocity controling plastic limit');
     50                        fielddisplay(self,'u0','velocity controlling plastic limit');
    5151                end % }}}
    5252                function marshall(self,prefix,md,fid) % {{{
     
    5454
    5555                        WriteData(fid,prefix,'name','md.friction.law','data',14,'format','Integer');
    56                         WriteData(fid,prefix,'class','friction','object',self,'fieldname','C','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
     56                        WriteData(fid,prefix,'class','friction','object',self,'fieldname','C','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
    5757                        WriteData(fid,prefix,'class','friction','object',self,'fieldname','u0','format','Double','scale',1/yts);
    5858                        WriteData(fid,prefix,'class','friction','object',self,'fieldname','m','format','DoubleMat','mattype',2);
  • issm/trunk-jpl/src/m/classes/frictionregcoulomb2.m

    r27509 r28030  
    22%
    33%   Usage:
    4 %      frictionregcoulomb=frictionregcoulomb();
     4%      frictionregcoulomb2=frictionregcoulomb2();
    55
    66classdef frictionregcoulomb2
    77        properties (SetAccess=public)
    8                 C  = NaN;
    9                 K  = NaN;
    10                 m  = NaN;
     8                C                        = NaN;
     9                K                        = NaN;
     10                m                        = NaN;
    1111                effective_pressure_limit = 0;
    1212        end
     
    4343                function disp(self) % {{{
    4444                        %See Zoet and Iverson 2020 or Choi et al., 2022
    45                         disp('Regularized Couloub friction law 2 parameters:');
    46                         disp('   Regularized Couloub friction law reads:');
     45                        disp('Regularized Coulomb friction law 2 parameters:');
     46                        disp('   Regularized Coulomb friction law reads:');
    4747                        disp('                       C N |u|^(1/m)         ');
    4848                        disp('      tau_b = -  ____________________________');
    49                         disp('                        (|u| + (K*N)^m)^(1/m)   ');
     49                        disp('                   (|u| + (K*N)^m)^(1/m)     ');
    5050                        disp(' ');
    5151                        fielddisplay(self,'C','friction coefficient [SI]');
    5252                        fielddisplay(self,'m','m exponent');
    53                         fielddisplay(self,'K','(K*N)^m to be velocity controling plastic limit');
     53                        fielddisplay(self,'K','(K*N)^m to be velocity controlling plastic limit');
    5454                        fielddisplay(self,'effective_pressure_limit','Neff do not allow to fall below a certain limit: effective_pressure_limit*rho_ice*g*thickness (default 0)');
    5555                end % }}}
     
    5858
    5959                        WriteData(fid,prefix,'name','md.friction.law','data',15,'format','Integer');
    60                         WriteData(fid,prefix,'class','friction','object',self,'fieldname','C','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    61                         WriteData(fid,prefix,'class','friction','object',self,'fieldname','K','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
     60                        WriteData(fid,prefix,'class','friction','object',self,'fieldname','C','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
     61                        WriteData(fid,prefix,'class','friction','object',self,'fieldname','K','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
    6262                        WriteData(fid,prefix,'class','friction','object',self,'fieldname','m','format','DoubleMat','mattype',2);
    6363                        WriteData(fid,prefix,'object',self,'class','friction','fieldname','effective_pressure_limit','format','Double');
Note: See TracChangeset for help on using the changeset viewer.