Changeset 12958


Ignore:
Timestamp:
08/09/12 15:57:18 (13 years ago)
Author:
jschierm
Message:

NEW: Another bunch more python checkconsistency and marshall methods for sub-classes (plus other minor changes).

Location:
issm/trunk-jpl/src/m
Files:
1 added
31 edited

Legend:

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

    r12123 r12958  
    22from fielddisplay import fielddisplay
    33
    4 class autodiff:
     4class autodiff(object):
    55        #properties
    66        def __init__(self):
  • issm/trunk-jpl/src/m/classes/balancethickness.py

    r12123 r12958  
    11#module imports
    22from fielddisplay import fielddisplay
    3 class balancethickness:
     3class balancethickness(object):
    44        #properties
    55        def __init__(self):
  • issm/trunk-jpl/src/m/classes/basalforcings.py

    r12949 r12958  
    55from WriteData import *
    66
    7 class basalforcings:
     7class basalforcings(object):
     8        """
     9        BASAL FORCINGS class definition
     10
     11           Usage:
     12              basalforcings=basalforcings();
     13        """
     14
    815        #properties
    916        def __init__(self):
     
    1724
    1825                #}}}
    19         def __repr__(obj):
     26        def __repr__(self):
    2027                # {{{ Display
    2128                string="   basal forcings parameters:"
    2229
    23                 string="%s\n\n%s"%(string,fielddisplay(obj,"melting_rate","basal melting rate (positive if melting)"))
    24                 string="%s\n%s"%(string,fielddisplay(obj,"melting_rate_correction","additional melting applied when the grounding line retreats"))
    25                 string="%s\n%s"%(string,fielddisplay(obj,"geothermalflux","geothermal heat flux [W/m^2]"))
     30                string="%s\n\n%s"%(string,fielddisplay(self,"melting_rate","basal melting rate (positive if melting)"))
     31                string="%s\n%s"%(string,fielddisplay(self,"melting_rate_correction","additional melting applied when the grounding line retreats"))
     32                string="%s\n%s"%(string,fielddisplay(self,"geothermalflux","geothermal heat flux [W/m^2]"))
    2633                return string
    2734                #}}}
    28         def setdefaultparameters(obj):
     35        def setdefaultparameters(self):
    2936                # {{{setdefaultparameters
    30                 return obj
     37                return self
    3138        #}}}
    3239
  • issm/trunk-jpl/src/m/classes/constants.py

    r12949 r12958  
    55from WriteData import *
    66
    7 class constants:
     7class constants(object):
     8        """
     9        CONSTANTS class definition
     10
     11           Usage:
     12              constants=constants();
     13        """
     14
    815        #properties
    916        def __init__(self):
     
    1724
    1825                #}}}
    19         def __repr__(obj):
     26        def __repr__(self):
    2027                # {{{ Display
    2128                string="   constants parameters:"
    22                 string="%s\n\n%s"%(string,fielddisplay(obj,"g","gravitational acceleration"))
    23                 string="%s\n%s"%(string,fielddisplay(obj,"yts","number of seconds in a year"))
    24                 string="%s\n%s"%(string,fielddisplay(obj,"referencetemperature","reference temperature used in the enthalpy model"))
     29                string="%s\n\n%s"%(string,fielddisplay(self,"g","gravitational acceleration"))
     30                string="%s\n%s"%(string,fielddisplay(self,"yts","number of seconds in a year"))
     31                string="%s\n%s"%(string,fielddisplay(self,"referencetemperature","reference temperature used in the enthalpy model"))
    2532
    2633
     
    2835                #}}}
    2936               
    30         def setdefaultparameters(obj):
     37        def setdefaultparameters(self):
    3138                # {{{setdefaultparameters
    3239               
    3340                #acceleration due to gravity (m/s^2)
    34                 obj.g=9.81
     41                self.g=9.81
    3542
    3643                #converstion from year to seconds
    37                 obj.yts=365*24*3600
     44                self.yts=365*24*3600
    3845
    3946                #the reference temperature for enthalpy model (cf Aschwanden)
    40                 obj.referencetemperature=223.15
     47                self.referencetemperature=223.15
    4148
    42                 return obj
     49                return self
    4350        #}}}
    4451
  • issm/trunk-jpl/src/m/classes/debug.py

    r12123 r12958  
    11#module imports
    22from fielddisplay import fielddisplay
     3from WriteData import *
    34
    4 class debug:
     5class debug(object):
     6        """
     7        DEBUG class definition
     8
     9           Usage:
     10              debug=debug();
     11        """
     12
    513        #properties
    614        def __init__(self):
    715                # {{{ Properties
    8                 self.valgrind=False
    9                 self.gprof   = False
     16                self.valgrind  = False
     17                self.gprof     = False
     18                self.profiling = False
    1019               
    1120                #set defaults
     
    1322
    1423                #}}}
    15         def __repr__(obj):
     24        def __repr__(self):
    1625                # {{{ Display
    1726                string="   debug parameters:"
    1827
    19                 string="%s\n\n%s"%(string,fielddisplay(obj,"valgrind","use Valgrind to debug (0 or 1)"))
    20                 string="%s\n%s"%(string,fielddisplay(obj,"gprof","use gnu-profiler to find out where the time is spent"))
     28                string="%s\n\n%s"%(string,fielddisplay(self,"valgrind","use Valgrind to debug (0 or 1)"))
     29                string="%s\n%s"%(string,fielddisplay(self,"gprof","use gnu-profiler to find out where the time is spent"))
     30                string="%s\n%s"%(string,fielddisplay(self,'profiling','enables profiling (memory, flops, time)'))
    2131                return string
    2232                #}}}
    2333               
    24         def setdefaultparameters(obj):
     34        def setdefaultparameters(self):
    2535                # {{{setdefaultparameters
    26                 return obj
     36                return self
    2737        #}}}
    2838
     39        def marshall(self,fid):    # {{{
     40                WriteData(fid,'object',self,'fieldname','profiling','format','Boolean')
     41        # }}}
     42
  • issm/trunk-jpl/src/m/classes/diagnostic.py

    r12123 r12958  
    22from fielddisplay import fielddisplay
    33
    4 class diagnostic:
     4class diagnostic(object):
    55        #properties
    66        def __init__(self):
  • issm/trunk-jpl/src/m/classes/flaim.py

    r12038 r12958  
    22from fielddisplay import fielddisplay
    33
    4 class flaim:
     4class flaim(object):
    55        #properties
    66        def __init__(self):
  • issm/trunk-jpl/src/m/classes/flowequation.py

    r12949 r12958  
    66from WriteData import *
    77
    8 class flowequation:
     8class flowequation(object):
     9        """
     10        FLOWEQUATION class definition
     11
     12           Usage:
     13              flowequation=flowequation();
     14        """
     15
    916        #properties
    1017        def __init__(self):
     
    2431
    2532                #}}}
    26         def __repr__(obj):
     33        def __repr__(self):
    2734                # {{{ Display
    2835                string='   flow equation parameters:'
    2936
    30                 string="%s\n\n%s"%(string,fielddisplay(obj,'ismacayealpattyn','is the macayeal or pattyn approximation used ?'))
    31                 string="%s\n%s"%(string,fielddisplay(obj,'ishutter','is the shallow ice approximation used ?'))
    32                 string="%s\n%s"%(string,fielddisplay(obj,'isstokes','are the Full-Stokes equations used ?'))
    33                 string="%s\n%s"%(string,fielddisplay(obj,'vertex_equation','flow equation for each vertex'))
    34                 string="%s\n%s"%(string,fielddisplay(obj,'element_equation','flow equation for each element'))
    35                 string="%s\n%s"%(string,fielddisplay(obj,'bordermacayeal','vertices on MacAyeal''s border (for tiling)'))
    36                 string="%s\n%s"%(string,fielddisplay(obj,'borderpattyn','vertices on Pattyn''s border (for tiling)'))
    37                 string="%s\n%s"%(string,fielddisplay(obj,'borderstokes','vertices on Stokes'' border (for tiling)'))
     37                string="%s\n\n%s"%(string,fielddisplay(self,'ismacayealpattyn','is the macayeal or pattyn approximation used ?'))
     38                string="%s\n%s"%(string,fielddisplay(self,'ishutter','is the shallow ice approximation used ?'))
     39                string="%s\n%s"%(string,fielddisplay(self,'isstokes','are the Full-Stokes equations used ?'))
     40                string="%s\n%s"%(string,fielddisplay(self,'vertex_equation','flow equation for each vertex'))
     41                string="%s\n%s"%(string,fielddisplay(self,'element_equation','flow equation for each element'))
     42                string="%s\n%s"%(string,fielddisplay(self,'bordermacayeal','vertices on MacAyeal''s border (for tiling)'))
     43                string="%s\n%s"%(string,fielddisplay(self,'borderpattyn','vertices on Pattyn''s border (for tiling)'))
     44                string="%s\n%s"%(string,fielddisplay(self,'borderstokes','vertices on Stokes'' border (for tiling)'))
    3845                return string
    3946                #}}}
    4047               
    41         def setdefaultparameters(obj):
     48        def setdefaultparameters(self):
    4249                # {{{setdefaultparameters
    43                 return obj
     50                return self
    4451        #}}}
    4552
  • issm/trunk-jpl/src/m/classes/friction.py

    r12949 r12958  
    55from WriteData import *
    66
    7 class friction:
     7class friction(object):
     8        """
     9        FRICTION class definition
     10
     11           Usage:
     12              friction=friction();
     13        """
     14
    815        #properties
    916        def __init__(self):
     
    1724
    1825                #}}}
    19         def __repr__(obj):
     26        def __repr__(self):
    2027                # {{{ Display
    2128                string="Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p"
    22                 string="%s\n\n%s"%(string,fielddisplay(obj,"coefficient","friction coefficient [SI]"))
    23                 string="%s\n%s"%(string,fielddisplay(obj,"p","p exponent"))
    24                 string="%s\n%s"%(string,fielddisplay(obj,"q","q exponent"))
     29                string="%s\n\n%s"%(string,fielddisplay(self,"coefficient","friction coefficient [SI]"))
     30                string="%s\n%s"%(string,fielddisplay(self,"p","p exponent"))
     31                string="%s\n%s"%(string,fielddisplay(self,"q","q exponent"))
    2532                return string
    2633                #}}}
    2734
    28         def setdefaultparameters(obj):
     35        def setdefaultparameters(self):
    2936                # {{{setdefaultparameters
    30                 return obj
     37                return self
    3138        #}}}
    3239
  • issm/trunk-jpl/src/m/classes/geometry.py

    r12949 r12958  
    55from WriteData import *
    66
    7 class geometry:
     7class geometry(object):
     8        """
     9        GEOMETRY class definition
     10
     11           Usage:
     12              geometry=geometry();
     13        """
     14
    815        #properties
    916        def __init__(self):
     
    1926
    2027                #}}}
    21         def __repr__(obj):
     28        def __repr__(self):
    2229                # {{{ Display
    2330
    2431                string="   geometry parameters:"
    2532
    26                 string="%s\n\n%s"%(string,fielddisplay(obj,'surface','surface elevation'))
    27                 string="%s\n%s"%(string,fielddisplay(obj,'thickness','ice thickness'))
    28                 string="%s\n%s"%(string,fielddisplay(obj,'bed','bed elevation'))
    29                 string="%s\n%s"%(string,fielddisplay(obj,'bathymetry','bathymetry elevation'))
    30                 string="%s\n%s"%(string,fielddisplay(obj,'hydrostatic_ratio','coefficient for ice shelves'' thickness correction: hydrostatic_ratio H_obs+ (1-hydrostatic_ratio) H_hydro'))
     33                string="%s\n\n%s"%(string,fielddisplay(self,'surface','surface elevation'))
     34                string="%s\n%s"%(string,fielddisplay(self,'thickness','ice thickness'))
     35                string="%s\n%s"%(string,fielddisplay(self,'bed','bed elevation'))
     36                string="%s\n%s"%(string,fielddisplay(self,'bathymetry','bathymetry elevation'))
     37                string="%s\n%s"%(string,fielddisplay(self,'hydrostatic_ratio','coefficient for ice shelves'' thickness correction: hydrostatic_ratio H_obs+ (1-hydrostatic_ratio) H_hydro'))
    3138                return string
    3239                #}}}
    3340               
    34         def setdefaultparameters(obj):
     41        def setdefaultparameters(self):
    3542                # {{{setdefaultparameters
    36                 return obj
     43                return self
    3744        #}}}
    3845
  • issm/trunk-jpl/src/m/classes/groundingline.py

    r12123 r12958  
    22from fielddisplay import fielddisplay
    33
    4 class groundingline:
     4class groundingline(object):
    55        #properties
    66        def __init__(self):
  • issm/trunk-jpl/src/m/classes/hydrology.py

    r12123 r12958  
    22from fielddisplay import fielddisplay
    33
    4 class hydrology:
     4class hydrology(object):
    55        #properties
    66        def __init__(self):
  • issm/trunk-jpl/src/m/classes/initialization.py

    r12949 r12958  
    66from WriteData import *
    77
    8 class initialization:
     8class initialization(object):
     9        """
     10        INITIALIZATION class definition
     11
     12           Usage:
     13              initialization=initialization();
     14        """
     15
    916        #properties
    1017        def __init__(self):
     
    2431
    2532                #}}}
    26         def __repr__(obj):
     33        def __repr__(self):
    2734                # {{{ Display
    2835                string='   initial field values:'
    2936
    30                 string="%s\n%s"%(string,fielddisplay(obj,'vx','x component of velocity'))
    31                 string="%s\n%s"%(string,fielddisplay(obj,'vy','y component of velocity'))
    32                 string="%s\n%s"%(string,fielddisplay(obj,'vz','z component of velocity'))
    33                 string="%s\n%s"%(string,fielddisplay(obj,'vel','velocity norm'))
    34                 string="%s\n%s"%(string,fielddisplay(obj,'pressure','pressure field'))
    35                 string="%s\n%s"%(string,fielddisplay(obj,'temperature','temperature in Kelvins'))
    36                 string="%s\n%s"%(string,fielddisplay(obj,'watercolumn','thickness of subglacial water'))
    37                 string="%s\n%s"%(string,fielddisplay(obj,'waterfraction','fraction of water in the ice'))
     37                string="%s\n%s"%(string,fielddisplay(self,'vx','x component of velocity'))
     38                string="%s\n%s"%(string,fielddisplay(self,'vy','y component of velocity'))
     39                string="%s\n%s"%(string,fielddisplay(self,'vz','z component of velocity'))
     40                string="%s\n%s"%(string,fielddisplay(self,'vel','velocity norm'))
     41                string="%s\n%s"%(string,fielddisplay(self,'pressure','pressure field'))
     42                string="%s\n%s"%(string,fielddisplay(self,'temperature','temperature in Kelvins'))
     43                string="%s\n%s"%(string,fielddisplay(self,'watercolumn','thickness of subglacial water'))
     44                string="%s\n%s"%(string,fielddisplay(self,'waterfraction','fraction of water in the ice'))
    3845
    3946                return string
    4047                #}}}
    4148               
    42         def setdefaultparameters(obj):
     49        def setdefaultparameters(self):
    4350                # {{{setdefaultparameters
    44                 return obj
     51                return self
    4552        #}}}
    4653
    47         def checkconsistency(obj,md,solution,analyses):    # {{{
     54        def checkconsistency(self,md,solution,analyses):    # {{{
    4855                if DiagnosticHorizAnalysisEnum in analyses:
    4956                        if not any(numpy.isnan(md.initialization.vx) or numpy.isnan(md.initialization.vy)):
     
    7380        # }}}
    7481
    75         def marshall(obj,fid):    # {{{
    76                 WriteData(fid,'data',obj.vx,'format','DoubleMat','mattype',1,'enum',VxEnum)
    77                 WriteData(fid,'data',obj.vy,'format','DoubleMat','mattype',1,'enum',VyEnum)
    78                 WriteData(fid,'data',obj.vz,'format','DoubleMat','mattype',1,'enum',VzEnum)
    79                 WriteData(fid,'data',obj.pressure,'format','DoubleMat','mattype',1,'enum',PressureEnum)
    80                 WriteData(fid,'data',obj.temperature,'format','DoubleMat','mattype',1,'enum',TemperatureEnum)
    81                 WriteData(fid,'data',obj.watercolumn,'format','DoubleMat','mattype',1,'enum',WatercolumnEnum)
    82                 WriteData(fid,'data',obj.waterfraction,'format','DoubleMat','mattype',1,'enum',WaterfractionEnum)
     82        def marshall(self,fid):    # {{{
     83                WriteData(fid,'data',self.vx,'format','DoubleMat','mattype',1,'enum',VxEnum)
     84                WriteData(fid,'data',self.vy,'format','DoubleMat','mattype',1,'enum',VyEnum)
     85                WriteData(fid,'data',self.vz,'format','DoubleMat','mattype',1,'enum',VzEnum)
     86                WriteData(fid,'data',self.pressure,'format','DoubleMat','mattype',1,'enum',PressureEnum)
     87                WriteData(fid,'data',self.temperature,'format','DoubleMat','mattype',1,'enum',TemperatureEnum)
     88                WriteData(fid,'data',self.watercolumn,'format','DoubleMat','mattype',1,'enum',WatercolumnEnum)
     89                WriteData(fid,'data',self.waterfraction,'format','DoubleMat','mattype',1,'enum',WaterfractionEnum)
    8390        # }}}
    8491
  • issm/trunk-jpl/src/m/classes/inversion.py

    r12123 r12958  
    22from fielddisplay import fielddisplay
    33
    4 class inversion:
     4class inversion(object):
    55        #properties
    66        def __init__(self):
  • issm/trunk-jpl/src/m/classes/mask.py

    r12949 r12958  
    55from WriteData import *
    66
    7 class mask:
     7class mask(object):
     8        """
     9        MASK class definition
     10
     11           Usage:
     12              mask=mask();
     13        """
     14
    815        #properties
    916        def __init__(self):
     
    2027
    2128                #}}}
    22         def __repr__(obj):
     29        def __repr__(self):
    2330                # {{{ Display
    2431
    2532                string="";
    26                 string="%s\n%s"%(string,fielddisplay(obj,"elementonfloatingice","element on floating ice flags list"))
    27                 string="%s\n%s"%(string,fielddisplay(obj,"vertexonfloatingice","vertex on floating ice flags list"))
    28                 string="%s\n%s"%(string,fielddisplay(obj,"elementongroundedice","element on grounded ice  list"))
    29                 string="%s\n%s"%(string,fielddisplay(obj,"vertexongroundedice","vertex on grounded ice flags list"))
    30                 string="%s\n%s"%(string,fielddisplay(obj,"elementonwater","element on water flags list"))
    31                 string="%s\n%s"%(string,fielddisplay(obj,"vertexonwater","vertex on water flags list"))
     33                string="%s\n%s"%(string,fielddisplay(self,"elementonfloatingice","element on floating ice flags list"))
     34                string="%s\n%s"%(string,fielddisplay(self,"vertexonfloatingice","vertex on floating ice flags list"))
     35                string="%s\n%s"%(string,fielddisplay(self,"elementongroundedice","element on grounded ice  list"))
     36                string="%s\n%s"%(string,fielddisplay(self,"vertexongroundedice","vertex on grounded ice flags list"))
     37                string="%s\n%s"%(string,fielddisplay(self,"elementonwater","element on water flags list"))
     38                string="%s\n%s"%(string,fielddisplay(self,"vertexonwater","vertex on water flags list"))
    3239                return string
    3340                #}}}
    3441               
    35         def setdefaultparameters(obj):
     42        def setdefaultparameters(self):
    3643                # {{{setdefaultparameters
    37                 return obj
     44                return self
    3845        #}}}
    3946
  • issm/trunk-jpl/src/m/classes/materials.py

    r12949 r12958  
    55from WriteData import *
    66
    7 class materials:
     7class materials(object):
     8        """
     9        MATERIALS class definition
     10
     11           Usage:
     12              materials=materials();
     13        """
     14
    815        #properties
    916        def __init__(self):
     
    2532                self.setdefaultparameters()
    2633                #}}}
    27         def __repr__(obj):
     34        def __repr__(self):
    2835                # {{{ Display
    2936                string="   Materials:"
    3037
    31                 string="%s\n\n%s"%(string,fielddisplay(obj,"rho_ice","ice density [kg/m^3]"))
    32                 string="%s\n%s"%(string,fielddisplay(obj,"rho_water","water density [kg/m^3]"))
    33                 string="%s\n%s"%(string,fielddisplay(obj,"mu_water","water viscosity [N s/m^2]"))
    34                 string="%s\n%s"%(string,fielddisplay(obj,"heatcapacity","heat capacity [J/kg/K]"))
    35                 string="%s\n%s"%(string,fielddisplay(obj,"thermalconductivity","ice thermal conductivity [W/m/K]"))
    36                 string="%s\n%s"%(string,fielddisplay(obj,"meltingpoint","melting point of ice at 1atm in K"))
    37                 string="%s\n%s"%(string,fielddisplay(obj,"latentheat","latent heat of fusion [J/m^3]"))
    38                 string="%s\n%s"%(string,fielddisplay(obj,"beta","rate of change of melting point with pressure [K/Pa]"))
    39                 string="%s\n%s"%(string,fielddisplay(obj,"mixed_layer_capacity","mixed layer capacity [W/kg/K]"))
    40                 string="%s\n%s"%(string,fielddisplay(obj,"thermal_exchange_velocity","thermal exchange velocity [m/s]"))
    41                 string="%s\n%s"%(string,fielddisplay(obj,"rheology_B","flow law parameter [Pa/s^(1/n)]"))
    42                 string="%s\n%s"%(string,fielddisplay(obj,"rheology_n","Glen""s flow law exponent"))
    43                 string="%s\n%s"%(string,fielddisplay(obj,"rheology_law","law for the temperature dependance of the rheology: ""None"", ""Paterson"" or ""Arrhenius"""))
     38                string="%s\n\n%s"%(string,fielddisplay(self,"rho_ice","ice density [kg/m^3]"))
     39                string="%s\n%s"%(string,fielddisplay(self,"rho_water","water density [kg/m^3]"))
     40                string="%s\n%s"%(string,fielddisplay(self,"mu_water","water viscosity [N s/m^2]"))
     41                string="%s\n%s"%(string,fielddisplay(self,"heatcapacity","heat capacity [J/kg/K]"))
     42                string="%s\n%s"%(string,fielddisplay(self,"thermalconductivity","ice thermal conductivity [W/m/K]"))
     43                string="%s\n%s"%(string,fielddisplay(self,"meltingpoint","melting point of ice at 1atm in K"))
     44                string="%s\n%s"%(string,fielddisplay(self,"latentheat","latent heat of fusion [J/m^3]"))
     45                string="%s\n%s"%(string,fielddisplay(self,"beta","rate of change of melting point with pressure [K/Pa]"))
     46                string="%s\n%s"%(string,fielddisplay(self,"mixed_layer_capacity","mixed layer capacity [W/kg/K]"))
     47                string="%s\n%s"%(string,fielddisplay(self,"thermal_exchange_velocity","thermal exchange velocity [m/s]"))
     48                string="%s\n%s"%(string,fielddisplay(self,"rheology_B","flow law parameter [Pa/s^(1/n)]"))
     49                string="%s\n%s"%(string,fielddisplay(self,"rheology_n","Glen""s flow law exponent"))
     50                string="%s\n%s"%(string,fielddisplay(self,"rheology_law","law for the temperature dependance of the rheology: ""None"", ""Paterson"" or ""Arrhenius"""))
    4451
    4552                return string
    4653                #}}}
    47         def setdefaultparameters(obj):
     54        def setdefaultparameters(self):
    4855                # {{{setdefaultparameters
    4956                #ice density (kg/m^3)
    50                 obj.rho_ice=917
     57                self.rho_ice=917
    5158
    5259                #water density (kg/m^3)
    53                 obj.rho_water=1023
     60                self.rho_water=1023
    5461
    5562                #water viscosity (N.s/m^2)
    56                 obj.mu_water=0.001787 
     63                self.mu_water=0.001787 
    5764
    5865                #ice heat capacity cp (J/kg/K)
    59                 obj.heatcapacity=2093
     66                self.heatcapacity=2093
    6067
    6168                #ice latent heat of fusion L (J/kg)
    62                 obj.latentheat=3.34*10**5
     69                self.latentheat=3.34*10**5
    6370
    6471                #ice thermal conductivity (W/m/K)
    65                 obj.thermalconductivity=2.4
     72                self.thermalconductivity=2.4
    6673
    6774                #the melting point of ice at 1 atmosphere of pressure in K
    68                 obj.meltingpoint=273.15
     75                self.meltingpoint=273.15
    6976
    7077                #rate of change of melting point with pressure (K/Pa)
    71                 obj.beta=9.8*10**-8
     78                self.beta=9.8*10**-8
    7279
    7380                #mixed layer (ice-water interface) heat capacity (J/kg/K)
    74                 obj.mixed_layer_capacity=3974
     81                self.mixed_layer_capacity=3974
    7582
    7683                #thermal exchange velocity (ice-water interface) (m/s)
    77                 obj.thermal_exchange_velocity=1.00*10**-4
     84                self.thermal_exchange_velocity=1.00*10**-4
    7885
    7986                #Rheology law: what is the temperature dependence of B with T
    8087                #available: none, paterson and arrhenius
    81                 obj.rheology_law='Paterson'
    82                 return obj
     88                self.rheology_law='Paterson'
     89                return self
    8390                #}}}
    8491
  • issm/trunk-jpl/src/m/classes/mesh.py

    r12949 r12958  
    66from MatlabFuncs import *
    77
    8 class mesh:
     8class mesh(object):
     9        """
     10        MESH class definition
     11
     12           Usage:
     13              mesh=mesh();
     14        """
     15
    916        #properties
    1017        def __init__(self):
     
    5461
    5562                #}}}
    56         def __repr__(obj):
     63        def __repr__(self):
    5764                # {{{ Display
    5865
    59                 if obj.dimension==3:
     66                if self.dimension==3:
    6067                        string="\n%s"%("      Elements and vertices of the original 2d mesh:")
    6168                       
    62                         string="%s\n%s"%(string,fielddisplay(obj,"numberofelements2d","number of elements"))
    63                         string="%s\n%s"%(string,fielddisplay(obj,"numberofvertices2d","number of vertices"))
    64                         string="%s\n%s"%(string,fielddisplay(obj,"elements2d","index into (x,y,z), coordinates of the vertices"))
    65                         string="%s\n%s"%(string,fielddisplay(obj,"x2d","vertices x coordinate"))
    66                         string="%s\n%s"%(string,fielddisplay(obj,"y2d","vertices y coordinate"))
     69                        string="%s\n%s"%(string,fielddisplay(self,"numberofelements2d","number of elements"))
     70                        string="%s\n%s"%(string,fielddisplay(self,"numberofvertices2d","number of vertices"))
     71                        string="%s\n%s"%(string,fielddisplay(self,"elements2d","index into (x,y,z), coordinates of the vertices"))
     72                        string="%s\n%s"%(string,fielddisplay(self,"x2d","vertices x coordinate"))
     73                        string="%s\n%s"%(string,fielddisplay(self,"y2d","vertices y coordinate"))
    6774
    6875                        string="%s\n%s" %(string,"Elements and vertices of the extruded 3d mesh:")
    6976                else:
    7077                        string="\n%s"%("      Elements and vertices:")
    71                 string="%s\n%s"%(string,fielddisplay(obj,"numberofelements","number of elements"))
    72                 string="%s\n%s"%(string,fielddisplay(obj,"numberofvertices","number of vertices"))
    73                 string="%s\n%s"%(string,fielddisplay(obj,"elements","index into (x,y,z), coordinates of the vertices"))
    74                 string="%s\n%s"%(string,fielddisplay(obj,"x","vertices x coordinate"))
    75                 string="%s\n%s"%(string,fielddisplay(obj,"y","vertices y coordinate"))
    76                 string="%s\n%s"%(string,fielddisplay(obj,"z","vertices z coordinate"))
    77                 string="%s\n%s"%(string,fielddisplay(obj,"edges","edges of the 2d mesh (vertex1 vertex2 element1 element2)"))
    78                 string="%s\n%s"%(string,fielddisplay(obj,"numberofedges","number of edges of the 2d mesh"))
     78                string="%s\n%s"%(string,fielddisplay(self,"numberofelements","number of elements"))
     79                string="%s\n%s"%(string,fielddisplay(self,"numberofvertices","number of vertices"))
     80                string="%s\n%s"%(string,fielddisplay(self,"elements","index into (x,y,z), coordinates of the vertices"))
     81                string="%s\n%s"%(string,fielddisplay(self,"x","vertices x coordinate"))
     82                string="%s\n%s"%(string,fielddisplay(self,"y","vertices y coordinate"))
     83                string="%s\n%s"%(string,fielddisplay(self,"z","vertices z coordinate"))
     84                string="%s\n%s"%(string,fielddisplay(self,"edges","edges of the 2d mesh (vertex1 vertex2 element1 element2)"))
     85                string="%s\n%s"%(string,fielddisplay(self,"numberofedges","number of edges of the 2d mesh"))
    7986
    8087                string="%s%s"%(string,"\n      Properties:")
    81                 string="%s\n%s"%(string,fielddisplay(obj,"dimension","mesh dimension (2d or 3d)"))
    82                 string="%s\n%s"%(string,fielddisplay(obj,"numberoflayers","number of extrusion layers"))
    83                 string="%s\n%s"%(string,fielddisplay(obj,"vertexonbed","lower vertices flags list"))
    84                 string="%s\n%s"%(string,fielddisplay(obj,"elementonbed","lower elements flags list"))
    85                 string="%s\n%s"%(string,fielddisplay(obj,"vertexonsurface","upper vertices flags list"))
    86                 string="%s\n%s"%(string,fielddisplay(obj,"elementonsurface","upper elements flags list"))
    87                 string="%s\n%s"%(string,fielddisplay(obj,"uppervertex","upper vertex list (NaN for vertex on the upper surface)"))
    88                 string="%s\n%s"%(string,fielddisplay(obj,"upperelements","upper element list (NaN for element on the upper layer)"))
    89                 string="%s\n%s"%(string,fielddisplay(obj,"lowervertex","lower vertex list (NaN for vertex on the lower surface)"))
    90                 string="%s\n%s"%(string,fielddisplay(obj,"lowerelements","lower element list (NaN for element on the lower layer"))
    91                 string="%s\n%s"%(string,fielddisplay(obj,"vertexonboundary","vertices on the boundary of the domain flag list"))
    92                 string="%s\n%s"%(string,fielddisplay(obj,"segments","edges on domain boundary (vertex1 vertex2 element)"))
    93                 string="%s\n%s"%(string,fielddisplay(obj,"segmentmarkers","number associated to each segment"))
    94                 string="%s\n%s"%(string,fielddisplay(obj,"vertexconnectivity","list of vertices connected to vertex_i"))
    95                 string="%s\n%s"%(string,fielddisplay(obj,"elementconnectivity","list of vertices connected to element_i"))
    96                 string="%s\n%s"%(string,fielddisplay(obj,"average_vertex_connectivity","average number of vertices connected to one vertex"))
     88                string="%s\n%s"%(string,fielddisplay(self,"dimension","mesh dimension (2d or 3d)"))
     89                string="%s\n%s"%(string,fielddisplay(self,"numberoflayers","number of extrusion layers"))
     90                string="%s\n%s"%(string,fielddisplay(self,"vertexonbed","lower vertices flags list"))
     91                string="%s\n%s"%(string,fielddisplay(self,"elementonbed","lower elements flags list"))
     92                string="%s\n%s"%(string,fielddisplay(self,"vertexonsurface","upper vertices flags list"))
     93                string="%s\n%s"%(string,fielddisplay(self,"elementonsurface","upper elements flags list"))
     94                string="%s\n%s"%(string,fielddisplay(self,"uppervertex","upper vertex list (NaN for vertex on the upper surface)"))
     95                string="%s\n%s"%(string,fielddisplay(self,"upperelements","upper element list (NaN for element on the upper layer)"))
     96                string="%s\n%s"%(string,fielddisplay(self,"lowervertex","lower vertex list (NaN for vertex on the lower surface)"))
     97                string="%s\n%s"%(string,fielddisplay(self,"lowerelements","lower element list (NaN for element on the lower layer"))
     98                string="%s\n%s"%(string,fielddisplay(self,"vertexonboundary","vertices on the boundary of the domain flag list"))
     99                string="%s\n%s"%(string,fielddisplay(self,"segments","edges on domain boundary (vertex1 vertex2 element)"))
     100                string="%s\n%s"%(string,fielddisplay(self,"segmentmarkers","number associated to each segment"))
     101                string="%s\n%s"%(string,fielddisplay(self,"vertexconnectivity","list of vertices connected to vertex_i"))
     102                string="%s\n%s"%(string,fielddisplay(self,"elementconnectivity","list of vertices connected to element_i"))
     103                string="%s\n%s"%(string,fielddisplay(self,"average_vertex_connectivity","average number of vertices connected to one vertex"))
    97104
    98105                string="%s%s"%(string,"\n      Extracted model:")
    99                 string="%s\n%s"%(string,fielddisplay(obj,"extractedvertices","vertices extracted from the model"))
    100                 string="%s\n%s"%(string,fielddisplay(obj,"extractedelements","elements extracted from the model"))
     106                string="%s\n%s"%(string,fielddisplay(self,"extractedvertices","vertices extracted from the model"))
     107                string="%s\n%s"%(string,fielddisplay(self,"extractedelements","elements extracted from the model"))
    101108
    102109                string="%s%s"%(string,"\n      Projection:")
    103                 string="%s\n%s"%(string,fielddisplay(obj,"lat","vertices latitude"))
    104                 string="%s\n%s"%(string,fielddisplay(obj,"long","vertices longitude"))
    105                 string="%s\n%s"%(string,fielddisplay(obj,"hemisphere","Indicate hemisphere ""n"" or ""s"" "))
     110                string="%s\n%s"%(string,fielddisplay(self,"lat","vertices latitude"))
     111                string="%s\n%s"%(string,fielddisplay(self,"long","vertices longitude"))
     112                string="%s\n%s"%(string,fielddisplay(self,"hemisphere","Indicate hemisphere ""n"" or ""s"" "))
    106113                return string
    107114                #}}}
    108115               
    109         def setdefaultparameters(obj):
     116        def setdefaultparameters(self):
    110117                # {{{setdefaultparameters
    111118               
     
    115122                #give a good memory/time ration. This value can be checked in
    116123                #trunk/test/Miscellaneous/runme.m
    117                 obj.average_vertex_connectivity=25
    118 
    119                 return obj
     124                self.average_vertex_connectivity=25
     125
     126                return self
    120127        #}}}
    121128
  • issm/trunk-jpl/src/m/classes/miscellaneous.py

    r12123 r12958  
    22from fielddisplay import fielddisplay
    33
    4 class miscellaneous:
     4class miscellaneous(object):
    55        #properties
    66        def __init__(self):
  • issm/trunk-jpl/src/m/classes/private.py

    r12949 r12958  
    22from fielddisplay import fielddisplay
    33
    4 class private:
     4class private(object):
    55        #properties
    66        def __init__(self):
  • issm/trunk-jpl/src/m/classes/prognostic.py

    r12123 r12958  
    22from fielddisplay import fielddisplay
    33
    4 class prognostic:
     4class prognostic(object):
    55        #properties
    66        def __init__(self):
  • issm/trunk-jpl/src/m/classes/qmu.py

    r12123 r12958  
    22from fielddisplay import fielddisplay
    33
    4 class qmu:
     4class qmu(object):
    55        #properties
    66        def __init__(self):
  • issm/trunk-jpl/src/m/classes/radaroverlay.py

    r12123 r12958  
    22from fielddisplay import fielddisplay
    33
    4 class radaroverlay:
     4class radaroverlay(object):
    55        #properties
    66        def __init__(self):
  • issm/trunk-jpl/src/m/classes/rifts.py

    r12123 r12958  
    11#module imports
     2import numpy
    23from fielddisplay import fielddisplay
     4from EnumDefinitions import *
     5from checkfield import *
     6from WriteData import *
     7from isnans import *
    38
    4 class rifts:
     9class rifts(object):
     10        """
     11        RIFTS class definition
     12
     13           Usage:
     14              rifts=rifts();
     15        """
     16
    517        #properties
    618        def __init__(self):
     
    1325
    1426                #}}}
    15         def __repr__(obj):
     27        def __repr__(self):
    1628                # {{{ Display
    1729                string='   rifts parameters:'
    1830
    19                 string="%s\n\n%s"%(string,fielddisplay(obj,'riftstruct','structure containing all rift information (vertices coordinates, segments, type of melange, ...)'))
    20                 string="%s\n%s"%(string,fielddisplay(obj,'riftproperties',''))
     31                string="%s\n\n%s"%(string,fielddisplay(self,'riftstruct','structure containing all rift information (vertices coordinates, segments, type of melange, ...)'))
     32                string="%s\n%s"%(string,fielddisplay(self,'riftproperties',''))
    2133                return string
    2234                #}}}
    2335               
    24         def setdefaultparameters(obj):
     36        def setdefaultparameters(self):
    2537                # {{{setdefaultparameters
    26                 return obj
     38                return self
    2739        #}}}
    2840
     41        def checkconsistency(self,md,solution,analyses):    # {{{
     42                if (not self.riftstruct) or any(isnans(self.riftstruct)):
     43                        numrifts=0
     44                else:
     45                        numrifts=len(self.riftstruct)
     46
     47                if numrifts:
     48                        if not md.mesh.dimension==2:
     49                                md.checkmessage("models with rifts are only supported in 2d for now!")
     50                        if not isinstance(self.riftstruct,list):
     51                                md.checkmessage("rifts.riftstruct should be a structure!")
     52                        if any(md.mesh.segmentmarkers>=2):
     53                                #We have segments with rift markers, but no rift structure!
     54                                md.checkmessage("model should be processed for rifts (run meshprocessrifts)!")
     55                        md = checkfield(md,'rifts.riftstruct.fill','values',[WaterEnum(),AirEnum(),IceEnum(),MelangeEnum()])
     56                else:
     57                        if any(numpy.logical_not(isnans(self.riftstruct))):
     58                                md.checkmessage("riftstruct shoud be NaN since numrifts is 0!")
     59
     60                return md
     61        # }}}
     62
     63        def marshall(self,fid):    # {{{
     64
     65                #Process rift info
     66                if (not self.riftstruct) or any(isnans(self.riftstruct)):
     67                        numrifts=0
     68                else:
     69                        numrifts=len(self.riftstruct)
     70
     71                numpairs=0
     72                for i in xrange(0,numrifts):
     73                        numpairs+=numpy.size(self.riftstruct[i].penaltypairs,0)
     74
     75                # 2 for nodes + 2 for elements+ 2 for  normals + 1 for length + 1 for fill + 1 for friction + 1 for fraction + 1 for fractionincrement + 1 for state.
     76                data=numpy.zeros(numpairs,12)
     77                count=0
     78                for i in xrange(0,numrifts):
     79                        numpairsforthisrift=numpy.size(self.riftstruct[i]['penaltypairs'],0)
     80                        data[count:count+numpairsforthisrift-1,0:6]=self.riftstruct[i]['penaltypairs']
     81                        data[count:count+numpairsforthisrift-1,7]=self.riftstruct[i]['fill']
     82                        data[count:count+numpairsforthisrift-1,8]=self.riftstruct[i]['friction']
     83                        data[count:count+numpairsforthisrift-1,9]=self.riftstruct[i]['fraction']
     84                        data[count:count+numpairsforthisrift-1,10]=self.riftstruct[i]['fractionincrement']
     85                        data[count:count+numpairsforthisrift-1,11]=self.riftstruct[i]['state']
     86                        count+=numpairsforthisrift
     87
     88                WriteData(fid,'data',numrifts,'enum',RiftsNumriftsEnum,'format','Integer')
     89                WriteData(fid,'data',data,'enum',RiftsRiftstructEnum,'format','DoubleMat','mattype',3)
     90        # }}}
     91
  • issm/trunk-jpl/src/m/classes/settings.py

    r12123 r12958  
    11#module imports
    22from fielddisplay import fielddisplay
     3from EnumDefinitions import *
     4from checkfield import *
     5from WriteData import *
    36
    4 class settings:
     7class settings(object):
     8        """
     9        SETTINGS class definition
     10
     11           Usage:
     12              settings=settings();
     13        """
     14
    515        #properties
    616        def __init__(self):
     
    1626
    1727                #}}}
    18         def __repr__(obj):
     28        def __repr__(self):
    1929                # {{{ Display
    2030                string="   general settings parameters:"
    2131
    22                 string="%s\n%s"%(string,fielddisplay(obj,"io_gather","I/O gathering strategy for result outputs (default 1)"))
    23                 string="%s\n%s"%(string,fielddisplay(obj,"lowmem","is the memory limited ? (0 or 1)"))
    24                 string="%s\n%s"%(string,fielddisplay(obj,"results_as_patches","provide results as patches for each element (0 or 1)"))
    25                 string="%s\n%s"%(string,fielddisplay(obj,"output_frequency","frequency at which results are saved in all solutions with multiple time_steps"))
    26                 string="%s\n%s"%(string,fielddisplay(obj,"waitonlock","maximum number of minutes to wait for batch results, or return 0"))
     32                string="%s\n%s"%(string,fielddisplay(self,"io_gather","I/O gathering strategy for result outputs (default 1)"))
     33                string="%s\n%s"%(string,fielddisplay(self,"lowmem","is the memory limited ? (0 or 1)"))
     34                string="%s\n%s"%(string,fielddisplay(self,"results_as_patches","provide results as patches for each element (0 or 1)"))
     35                string="%s\n%s"%(string,fielddisplay(self,"output_frequency","frequency at which results are saved in all solutions with multiple time_steps"))
     36                string="%s\n%s"%(string,fielddisplay(self,"waitonlock","maximum number of minutes to wait for batch results, or return 0"))
    2737                return string
    2838                #}}}
    2939               
    30         def setdefaultparameters(obj):
     40        def setdefaultparameters(self):
    3141                # {{{setdefaultparameters
    3242               
    3343                #are we short in memory ? (0 faster but requires more memory)
    34                 obj.lowmem=0
     44                self.lowmem=0
    3545
    3646                #i/o:
    37                 obj.io_gather=1
     47                self.io_gather=1
    3848
    3949                #results frequency by default every step
    40                 obj.output_frequency=1
     50                self.output_frequency=1
    4151
    4252                #do not use patches by default (difficult to plot)
    43                 obj.results_as_patches=0
     53                self.results_as_patches=0
    4454
    4555                #this option can be activated to load automatically the results
     
    4757                #N minutes that is generated once the solution has converged
    4858                #0 to desactivate
    49                 obj.waitonlock=float('Inf')
     59                self.waitonlock=float('Inf')
    5060
    51                 return obj
     61                return self
    5262        #}}}
    5363
     64        def checkconsistency(self,md,solution,analyses):    # {{{
     65                md = checkfield(md,'settings.io_gather','numel',1,'values',[0,1])
     66                md = checkfield(md,'settings.lowmem','numel',1,'values',[0,1])
     67                md = checkfield(md,'settings.results_as_patches','numel',1,'values',[0,1])
     68                md = checkfield(md,'settings.output_frequency','numel',1,'>=',1)
     69                md = checkfield(md,'settings.waitonlock','numel',1)
     70
     71                return md
     72        # }}}
     73
     74        def marshall(self,fid):    # {{{
     75                WriteData(fid,'object',self,'fieldname','io_gather','format','Boolean')
     76                WriteData(fid,'object',self,'fieldname','lowmem','format','Boolean')
     77                WriteData(fid,'object',self,'fieldname','results_as_patches','format','Boolean')
     78                WriteData(fid,'object',self,'fieldname','output_frequency','format','Integer')
     79                WriteData(fid,'object',self,'fieldname','waitonlock','format','Boolean')
     80        # }}}
     81
  • issm/trunk-jpl/src/m/classes/solver.py

    r12038 r12958  
    1 #module imports {{{
    2 import fielddisplay
    3 import ismumps
    4 from  mumpsoptions import *
    5 from  iluasmoptions import *
    6 #}}}
    7 class solver:
    8         #properties
    9         def __init__(self):
    10                 # {{{ Properties
     1from ismumps import *
     2from mumpsoptions import *
     3from iluasmoptions import *
     4from MatlabFuncs import *
     5from EnumDefinitions import *
     6from checkfield import *
     7
     8class solver(object):
     9        """
     10        SOLVER class definition
     11
     12           Usage:
     13              obj=solver();
     14        """
     15
     16        def __init__(self):    # {{{
     17                #MUMPS is the default solver
    1118                if ismumps:
    12                         self.options=[["NoneAnalysis",mumpsoptions()]]
     19                        self.NoneAnalysis=mumpsoptions()
    1320                else:
    14                         self.options=[["NoneAnalysis",iluasmoptions()]]
    15                 #}}}
    16         def __repr__(obj):
    17                 # {{{ Display
    18                
    19                 string2="   solver parameters:"
    20                 for i in range(len(obj.options)):
    21                         option=obj.options[i]
    22                         analysis=option[0]
    23                         ioptions=option[1]
     21                        self.NoneAnalysis=iluasmoptions()
    2422
    25                         string=""
    26                         for i in range(len(ioptions)):
    27                                 option=ioptions[i]
    28                                 if not option:
    29                                         #do nothing
    30                                         pass
    31                                 elif len(option)==1:
     23                #The other properties are dynamic
     24        # }}}
     25
     26        def addoptions(self,analysis,*args):    # {{{
     27                # Usage example:
     28                #    md.solver=addoptions(md.solver,DiagnosticHorizAnalysisEnum,stokesoptions());
     29                #    md.solver=addoptions(md.solver,DiagnosticHorizAnalysisEnum);
     30
     31                #Convert analysis from enum to string
     32#               need EnumToString
     33#               analysis=EnumToString(analysis)
     34
     35                #Create dynamic property if property does not exist yet
     36                if not hasattr(self,analysis):
     37#                       exec("self.%s = None" % analysis)
     38                        setattr(self,analysis,None)
     39
     40                #Add solver options to analysis
     41                if len(args)==1:
     42                        setattr(self,analysis,args[0])
     43
     44                return self
     45        # }}}
     46
     47        def __repr__(self):    # {{{
     48                s ="List of solver options per analysis:\n\n"
     49                for analysis in vars(self).iterkeys():
     50                        s+="%s :\n" % analysis
     51                        s+="%s\n" % getattr(self,analysis)
     52
     53                return s
     54        # }}}
     55
     56        def checkconsistency(self,md,solution,analyses):    # {{{
     57                for analysis in vars(self).iterkeys():
     58                        if not getattr(self,analysis):
     59                                md.checkmessage("md.solver.%s is empty" % analysis)
     60
     61                return md
     62        # }}}
     63
     64        def PetscFile(self,filename):    # {{{
     65                """
     66                PETSCFILE - build petsc file
     67
     68                   Build a Petsc compatible options file, from the solver model field  + return options string
     69
     70                   Usage:     PetscFile(solver,filename);
     71                """
     72
     73                #open file for writing
     74                try:
     75                        fid=open(filename,'w')
     76                except IOError as e:
     77                        raise IOError("PetscFile error: could not open '%s' for writing." % filename)
     78
     79                #write header
     80                fid.write("%s%s%s\n" % ('%Petsc options file: ',filename,' written from Matlab solver array'))
     81
     82                #start writing options
     83                for analysis in vars(self).iterkeys():
     84                        options=getattr(self,analysis)
     85
     86                        #first write analysis:
     87                        fid.write("\n+%s\n" % analysis)    #append a + to recognize it's an analysis enum
     88
     89                        #now, write options
     90                        for optionname,optionvalue in options.iteritems():
     91
     92                                if not optionvalue:
    3293                                        #this option has only one argument
    33                                         string="%s%s%s"%(string," -",option[0])
    34                                 elif len(option)==2:
     94                                        fid.write("-%s\n" % optionname)
     95                                else:
    3596                                        #option with value. value can be string or scalar
    36                                         if isinstance(option[1],float):
    37                                                 string="%s%s%s%s%s"%(string," -",option[0]," ","%g"%(option[1]))
    38                                         elif isinstance(option[1],str):
    39                                                 string="%s%s%s%s%s"%(string," -",option[0]," ",option[1])
    40                                         elif isinstance(option[1],int):
    41                                                 string="%s%s%s%s%s"%(string," -",option[0]," ","%i"%(option[1]))
     97                                        if   isinstance(optionvalue,(bool,int,float)):
     98                                                fid.write("-%s %g\n" % (optionname,optionvalue))
     99                                        elif isinstance(optionvalue,str):
     100                                                fid.write("-%s %s\n" % (optionname,optionvalue))
    42101                                        else:
    43                                                 raise RuntimeError("%s%s%s"%("PetscString error: option #","%i"%(i)," is not well formatted"))
    44                                 else:
    45                                         raise RuntimeError("%s%s%s"%("PetscString error: option #","%i"%(i)," is not well formatted"))
     102                                                raise TypeError("PetscFile error: option '%s' is not well formatted." % optionname)
    46103
    47                         string2="%s\n%s"%(string2,"   %s -> '%s'"%(analysis,string))
    48                 return string2
    49         #}}}
     104                fid.close()
     105        # }}}
     106
  • issm/trunk-jpl/src/m/classes/steadystate.py

    r12123 r12958  
    22from fielddisplay import fielddisplay
    33
    4 class steadystate:
     4class steadystate(object):
    55        #properties
    66        def __init__(self):
  • issm/trunk-jpl/src/m/classes/surfaceforcings.py

    r12949 r12958  
    55from WriteData import *
    66
    7 class surfaceforcings:
     7class surfaceforcings(object):
     8        """
     9        SURFACEFORCING Class definition
     10
     11           Usage:
     12              surfaceforcings=surfaceforcings();
     13        """
     14
    815        #properties
    916        def __init__(self):
     
    3239
    3340                #}}}
    34         def __repr__(obj):
     41        def __repr__(self):
    3542                # {{{ Display
    3643                string="   surface forcings parameters:"
    3744
    38                 string="%s\n\n%s"%(string,fielddisplay(obj,'precipitation','surface precipitation [m/yr water eq]'))
    39                 string="%s\n%s"%(string,fielddisplay(obj,'mass_balance','surface mass balance [m/yr ice eq]'))
    40                 string="%s\n%s"%(string,fielddisplay(obj,'ispdd','is pdd activated (0 or 1, default is 0)'))
    41                 string="%s\n%s"%(string,fielddisplay(obj,'isdelta18o','is temperature and precipitation delta18o parametrisation activated (0 or 1, default is 0)'))
    42                 string="%s\n%s"%(string,fielddisplay(obj,'monthlytemperatures','monthly surface temperatures [Kelvin], required if pdd is activated and delta18o not activated'))
    43                 string="%s\n%s"%(string,fielddisplay(obj,'precipitation','surface precipitation [m/yr water eq]'))
    44                 string="%s\n%s"%(string,fielddisplay(obj,'temperatures_presentday','monthly present day surface temperatures [Kelvin], required if pdd is activated and delta18o activated'))
    45                 string="%s\n%s"%(string,fielddisplay(obj,'temperatures_lgm','monthly LGM surface temperatures [Kelvin], required if pdd is activated and delta18o activated'))
    46                 string="%s\n%s"%(string,fielddisplay(obj,'precipitations_presentday','monthly surface precipitation [m/yr water eq], required if pdd is activated and delta18o activated'))
    47                 string="%s\n%s"%(string,fielddisplay(obj,'delta18o','delta18o, required if pdd is activated and delta18o activated'))
    48                 string="%s\n%s"%(string,fielddisplay(obj,'delta18o_surface','surface elevation of the delta18o site, required if pdd is activated and delta18o activated'))
    49                 string="%s\n%s"%(string,fielddisplay(obj,'issmbgradients','is smb gradients method activated (0 or 1, default is 0)'))
    50                 string="%s\n%s"%(string,fielddisplay(obj,'hc',' elevation of intersection between accumulation and ablation regime required if smb gradients is activated'))
    51                 string="%s\n%s"%(string,fielddisplay(obj,'smb_pos_max',' maximum value of positive smb required if smb gradients is activated'))
    52                 string="%s\n%s"%(string,fielddisplay(obj,'smb_pos_min',' minimum value of positive smb required if smb gradients is activated'))
    53                 string="%s\n%s"%(string,fielddisplay(obj,'a_pos',' intercept of hs - smb regression line for accumulation regime required if smb gradients is activated'))
    54                 string="%s\n%s"%(string,fielddisplay(obj,'b_pos',' slope of hs - smb regression line for accumulation regime required if smb gradients is activated'))
    55                 string="%s\n%s"%(string,fielddisplay(obj,'a_neg',' intercept of hs - smb regression line for ablation regime required if smb gradients is activated'))
    56                 string="%s\n%s"%(string,fielddisplay(obj,'b_neg',' slope of hs - smb regression line for ablation regime required if smb gradients is activated'))
     45                string="%s\n\n%s"%(string,fielddisplay(self,'precipitation','surface precipitation [m/yr water eq]'))
     46                string="%s\n%s"%(string,fielddisplay(self,'mass_balance','surface mass balance [m/yr ice eq]'))
     47                string="%s\n%s"%(string,fielddisplay(self,'ispdd','is pdd activated (0 or 1, default is 0)'))
     48                string="%s\n%s"%(string,fielddisplay(self,'isdelta18o','is temperature and precipitation delta18o parametrisation activated (0 or 1, default is 0)'))
     49                string="%s\n%s"%(string,fielddisplay(self,'monthlytemperatures','monthly surface temperatures [Kelvin], required if pdd is activated and delta18o not activated'))
     50                string="%s\n%s"%(string,fielddisplay(self,'precipitation','surface precipitation [m/yr water eq]'))
     51                string="%s\n%s"%(string,fielddisplay(self,'temperatures_presentday','monthly present day surface temperatures [Kelvin], required if pdd is activated and delta18o activated'))
     52                string="%s\n%s"%(string,fielddisplay(self,'temperatures_lgm','monthly LGM surface temperatures [Kelvin], required if pdd is activated and delta18o activated'))
     53                string="%s\n%s"%(string,fielddisplay(self,'precipitations_presentday','monthly surface precipitation [m/yr water eq], required if pdd is activated and delta18o activated'))
     54                string="%s\n%s"%(string,fielddisplay(self,'delta18o','delta18o, required if pdd is activated and delta18o activated'))
     55                string="%s\n%s"%(string,fielddisplay(self,'delta18o_surface','surface elevation of the delta18o site, required if pdd is activated and delta18o activated'))
     56                string="%s\n%s"%(string,fielddisplay(self,'issmbgradients','is smb gradients method activated (0 or 1, default is 0)'))
     57                string="%s\n%s"%(string,fielddisplay(self,'hc',' elevation of intersection between accumulation and ablation regime required if smb gradients is activated'))
     58                string="%s\n%s"%(string,fielddisplay(self,'smb_pos_max',' maximum value of positive smb required if smb gradients is activated'))
     59                string="%s\n%s"%(string,fielddisplay(self,'smb_pos_min',' minimum value of positive smb required if smb gradients is activated'))
     60                string="%s\n%s"%(string,fielddisplay(self,'a_pos',' intercept of hs - smb regression line for accumulation regime required if smb gradients is activated'))
     61                string="%s\n%s"%(string,fielddisplay(self,'b_pos',' slope of hs - smb regression line for accumulation regime required if smb gradients is activated'))
     62                string="%s\n%s"%(string,fielddisplay(self,'a_neg',' intercept of hs - smb regression line for ablation regime required if smb gradients is activated'))
     63                string="%s\n%s"%(string,fielddisplay(self,'b_neg',' slope of hs - smb regression line for ablation regime required if smb gradients is activated'))
    5764
    5865                return string
    5966                #}}}
    6067               
    61         def setdefaultparameters(obj):
     68        def setdefaultparameters(self):
    6269                # {{{setdefaultparameters
    6370                 
    6471                #pdd method not used in default mode
    65                 obj.ispdd=0
    66                 obj.issmbgradients=0
    67                 obj.isdelta18o=0
     72                self.ispdd=0
     73                self.issmbgradients=0
     74                self.isdelta18o=0
    6875
    69                 return obj
     76                return self
    7077        #}}}
    7178
  • issm/trunk-jpl/src/m/classes/thermal.py

    r12123 r12958  
    22from fielddisplay import fielddisplay
    33
    4 class thermal:
     4class thermal(object):
    55        #properties
    66        def __init__(self):
  • issm/trunk-jpl/src/m/classes/timestepping.py

    r12949 r12958  
    55from WriteData import *
    66
    7 class timestepping:
     7class timestepping(object):
     8        """
     9        TIMESTEPPING Class definition
     10
     11           Usage:
     12              timestepping=timestepping();
     13        """
     14
    815        #properties
    916        def __init__(self):
     
    1926
    2027                #}}}
    21         def __repr__(obj):
     28        def __repr__(self):
    2229                # {{{ Display
    2330                string="   timestepping parameters:"
    24                 string="%s\n\n%s"%(string,fielddisplay(obj,"start_time","simulation starting time [yrs]"))
    25                 string="%s\n%s"%(string,fielddisplay(obj,"final_time","final time to stop the simulation [yrs]"))
    26                 string="%s\n%s"%(string,fielddisplay(obj,"time_step","length of time steps [yrs]"))
    27                 string="%s\n%s"%(string,fielddisplay(obj,"time_adapt","use cfl condition to define time step ? (0 or 1) "))
    28                 string="%s\n%s"%(string,fielddisplay(obj,"cfl_coefficient","coefficient applied to cfl condition"))
     31                string="%s\n\n%s"%(string,fielddisplay(self,"start_time","simulation starting time [yrs]"))
     32                string="%s\n%s"%(string,fielddisplay(self,"final_time","final time to stop the simulation [yrs]"))
     33                string="%s\n%s"%(string,fielddisplay(self,"time_step","length of time steps [yrs]"))
     34                string="%s\n%s"%(string,fielddisplay(self,"time_adapt","use cfl condition to define time step ? (0 or 1) "))
     35                string="%s\n%s"%(string,fielddisplay(self,"cfl_coefficient","coefficient applied to cfl condition"))
    2936                return string
    3037                #}}}
    3138               
    32         def setdefaultparameters(obj):
     39        def setdefaultparameters(self):
    3340                # {{{setdefaultparameters
    3441               
    3542                #time between 2 time steps
    36                 obj.time_step=1/2
     43                self.time_step=1/2
    3744
    3845                #final time
    39                 obj.final_time=10*obj.time_step
     46                self.final_time=10*self.time_step
    4047
    4148                #time adaptation?
    42                 obj.time_adapt=0
    43                 obj.cfl_coefficient=.5
     49                self.time_adapt=0
     50                self.cfl_coefficient=.5
    4451
    45                 return obj
     52                return self
    4653        #}}}
    4754
  • issm/trunk-jpl/src/m/classes/transient.py

    r12123 r12958  
    22from fielddisplay import fielddisplay
    33
    4 class transient:
     4class transient(object):
    55        #properties
    66        def __init__(self):
  • issm/trunk-jpl/src/m/classes/verbose.py

    r12938 r12958  
    11from pairoptions import *
    22from MatlabFuncs import *
     3from EnumDefinitions import *
    34from WriteData import *
    4 from EnumDefinitions import *
    55
    66class verbose(object):
Note: See TracChangeset for help on using the changeset viewer.