Changeset 12958
- Timestamp:
- 08/09/12 15:57:18 (13 years ago)
- 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 2 2 from fielddisplay import fielddisplay 3 3 4 class autodiff :4 class autodiff(object): 5 5 #properties 6 6 def __init__(self): -
issm/trunk-jpl/src/m/classes/balancethickness.py
r12123 r12958 1 1 #module imports 2 2 from fielddisplay import fielddisplay 3 class balancethickness :3 class balancethickness(object): 4 4 #properties 5 5 def __init__(self): -
issm/trunk-jpl/src/m/classes/basalforcings.py
r12949 r12958 5 5 from WriteData import * 6 6 7 class basalforcings: 7 class basalforcings(object): 8 """ 9 BASAL FORCINGS class definition 10 11 Usage: 12 basalforcings=basalforcings(); 13 """ 14 8 15 #properties 9 16 def __init__(self): … … 17 24 18 25 #}}} 19 def __repr__( obj):26 def __repr__(self): 20 27 # {{{ Display 21 28 string=" basal forcings parameters:" 22 29 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]")) 26 33 return string 27 34 #}}} 28 def setdefaultparameters( obj):35 def setdefaultparameters(self): 29 36 # {{{setdefaultparameters 30 return obj37 return self 31 38 #}}} 32 39 -
issm/trunk-jpl/src/m/classes/constants.py
r12949 r12958 5 5 from WriteData import * 6 6 7 class constants: 7 class constants(object): 8 """ 9 CONSTANTS class definition 10 11 Usage: 12 constants=constants(); 13 """ 14 8 15 #properties 9 16 def __init__(self): … … 17 24 18 25 #}}} 19 def __repr__( obj):26 def __repr__(self): 20 27 # {{{ Display 21 28 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")) 25 32 26 33 … … 28 35 #}}} 29 36 30 def setdefaultparameters( obj):37 def setdefaultparameters(self): 31 38 # {{{setdefaultparameters 32 39 33 40 #acceleration due to gravity (m/s^2) 34 obj.g=9.8141 self.g=9.81 35 42 36 43 #converstion from year to seconds 37 obj.yts=365*24*360044 self.yts=365*24*3600 38 45 39 46 #the reference temperature for enthalpy model (cf Aschwanden) 40 obj.referencetemperature=223.1547 self.referencetemperature=223.15 41 48 42 return obj49 return self 43 50 #}}} 44 51 -
issm/trunk-jpl/src/m/classes/debug.py
r12123 r12958 1 1 #module imports 2 2 from fielddisplay import fielddisplay 3 from WriteData import * 3 4 4 class debug: 5 class debug(object): 6 """ 7 DEBUG class definition 8 9 Usage: 10 debug=debug(); 11 """ 12 5 13 #properties 6 14 def __init__(self): 7 15 # {{{ Properties 8 self.valgrind=False 9 self.gprof = False 16 self.valgrind = False 17 self.gprof = False 18 self.profiling = False 10 19 11 20 #set defaults … … 13 22 14 23 #}}} 15 def __repr__( obj):24 def __repr__(self): 16 25 # {{{ Display 17 26 string=" debug parameters:" 18 27 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)')) 21 31 return string 22 32 #}}} 23 33 24 def setdefaultparameters( obj):34 def setdefaultparameters(self): 25 35 # {{{setdefaultparameters 26 return obj36 return self 27 37 #}}} 28 38 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 2 2 from fielddisplay import fielddisplay 3 3 4 class diagnostic :4 class diagnostic(object): 5 5 #properties 6 6 def __init__(self): -
issm/trunk-jpl/src/m/classes/flaim.py
r12038 r12958 2 2 from fielddisplay import fielddisplay 3 3 4 class flaim :4 class flaim(object): 5 5 #properties 6 6 def __init__(self): -
issm/trunk-jpl/src/m/classes/flowequation.py
r12949 r12958 6 6 from WriteData import * 7 7 8 class flowequation: 8 class flowequation(object): 9 """ 10 FLOWEQUATION class definition 11 12 Usage: 13 flowequation=flowequation(); 14 """ 15 9 16 #properties 10 17 def __init__(self): … … 24 31 25 32 #}}} 26 def __repr__( obj):33 def __repr__(self): 27 34 # {{{ Display 28 35 string=' flow equation parameters:' 29 36 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)')) 38 45 return string 39 46 #}}} 40 47 41 def setdefaultparameters( obj):48 def setdefaultparameters(self): 42 49 # {{{setdefaultparameters 43 return obj50 return self 44 51 #}}} 45 52 -
issm/trunk-jpl/src/m/classes/friction.py
r12949 r12958 5 5 from WriteData import * 6 6 7 class friction: 7 class friction(object): 8 """ 9 FRICTION class definition 10 11 Usage: 12 friction=friction(); 13 """ 14 8 15 #properties 9 16 def __init__(self): … … 17 24 18 25 #}}} 19 def __repr__( obj):26 def __repr__(self): 20 27 # {{{ Display 21 28 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")) 25 32 return string 26 33 #}}} 27 34 28 def setdefaultparameters( obj):35 def setdefaultparameters(self): 29 36 # {{{setdefaultparameters 30 return obj37 return self 31 38 #}}} 32 39 -
issm/trunk-jpl/src/m/classes/geometry.py
r12949 r12958 5 5 from WriteData import * 6 6 7 class geometry: 7 class geometry(object): 8 """ 9 GEOMETRY class definition 10 11 Usage: 12 geometry=geometry(); 13 """ 14 8 15 #properties 9 16 def __init__(self): … … 19 26 20 27 #}}} 21 def __repr__( obj):28 def __repr__(self): 22 29 # {{{ Display 23 30 24 31 string=" geometry parameters:" 25 32 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')) 31 38 return string 32 39 #}}} 33 40 34 def setdefaultparameters( obj):41 def setdefaultparameters(self): 35 42 # {{{setdefaultparameters 36 return obj43 return self 37 44 #}}} 38 45 -
issm/trunk-jpl/src/m/classes/groundingline.py
r12123 r12958 2 2 from fielddisplay import fielddisplay 3 3 4 class groundingline :4 class groundingline(object): 5 5 #properties 6 6 def __init__(self): -
issm/trunk-jpl/src/m/classes/hydrology.py
r12123 r12958 2 2 from fielddisplay import fielddisplay 3 3 4 class hydrology :4 class hydrology(object): 5 5 #properties 6 6 def __init__(self): -
issm/trunk-jpl/src/m/classes/initialization.py
r12949 r12958 6 6 from WriteData import * 7 7 8 class initialization: 8 class initialization(object): 9 """ 10 INITIALIZATION class definition 11 12 Usage: 13 initialization=initialization(); 14 """ 15 9 16 #properties 10 17 def __init__(self): … … 24 31 25 32 #}}} 26 def __repr__( obj):33 def __repr__(self): 27 34 # {{{ Display 28 35 string=' initial field values:' 29 36 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')) 38 45 39 46 return string 40 47 #}}} 41 48 42 def setdefaultparameters( obj):49 def setdefaultparameters(self): 43 50 # {{{setdefaultparameters 44 return obj51 return self 45 52 #}}} 46 53 47 def checkconsistency( obj,md,solution,analyses): # {{{54 def checkconsistency(self,md,solution,analyses): # {{{ 48 55 if DiagnosticHorizAnalysisEnum in analyses: 49 56 if not any(numpy.isnan(md.initialization.vx) or numpy.isnan(md.initialization.vy)): … … 73 80 # }}} 74 81 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) 83 90 # }}} 84 91 -
issm/trunk-jpl/src/m/classes/inversion.py
r12123 r12958 2 2 from fielddisplay import fielddisplay 3 3 4 class inversion :4 class inversion(object): 5 5 #properties 6 6 def __init__(self): -
issm/trunk-jpl/src/m/classes/mask.py
r12949 r12958 5 5 from WriteData import * 6 6 7 class mask: 7 class mask(object): 8 """ 9 MASK class definition 10 11 Usage: 12 mask=mask(); 13 """ 14 8 15 #properties 9 16 def __init__(self): … … 20 27 21 28 #}}} 22 def __repr__( obj):29 def __repr__(self): 23 30 # {{{ Display 24 31 25 32 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")) 32 39 return string 33 40 #}}} 34 41 35 def setdefaultparameters( obj):42 def setdefaultparameters(self): 36 43 # {{{setdefaultparameters 37 return obj44 return self 38 45 #}}} 39 46 -
issm/trunk-jpl/src/m/classes/materials.py
r12949 r12958 5 5 from WriteData import * 6 6 7 class materials: 7 class materials(object): 8 """ 9 MATERIALS class definition 10 11 Usage: 12 materials=materials(); 13 """ 14 8 15 #properties 9 16 def __init__(self): … … 25 32 self.setdefaultparameters() 26 33 #}}} 27 def __repr__( obj):34 def __repr__(self): 28 35 # {{{ Display 29 36 string=" Materials:" 30 37 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""")) 44 51 45 52 return string 46 53 #}}} 47 def setdefaultparameters( obj):54 def setdefaultparameters(self): 48 55 # {{{setdefaultparameters 49 56 #ice density (kg/m^3) 50 obj.rho_ice=91757 self.rho_ice=917 51 58 52 59 #water density (kg/m^3) 53 obj.rho_water=102360 self.rho_water=1023 54 61 55 62 #water viscosity (N.s/m^2) 56 obj.mu_water=0.00178763 self.mu_water=0.001787 57 64 58 65 #ice heat capacity cp (J/kg/K) 59 obj.heatcapacity=209366 self.heatcapacity=2093 60 67 61 68 #ice latent heat of fusion L (J/kg) 62 obj.latentheat=3.34*10**569 self.latentheat=3.34*10**5 63 70 64 71 #ice thermal conductivity (W/m/K) 65 obj.thermalconductivity=2.472 self.thermalconductivity=2.4 66 73 67 74 #the melting point of ice at 1 atmosphere of pressure in K 68 obj.meltingpoint=273.1575 self.meltingpoint=273.15 69 76 70 77 #rate of change of melting point with pressure (K/Pa) 71 obj.beta=9.8*10**-878 self.beta=9.8*10**-8 72 79 73 80 #mixed layer (ice-water interface) heat capacity (J/kg/K) 74 obj.mixed_layer_capacity=397481 self.mixed_layer_capacity=3974 75 82 76 83 #thermal exchange velocity (ice-water interface) (m/s) 77 obj.thermal_exchange_velocity=1.00*10**-484 self.thermal_exchange_velocity=1.00*10**-4 78 85 79 86 #Rheology law: what is the temperature dependence of B with T 80 87 #available: none, paterson and arrhenius 81 obj.rheology_law='Paterson'82 return obj88 self.rheology_law='Paterson' 89 return self 83 90 #}}} 84 91 -
issm/trunk-jpl/src/m/classes/mesh.py
r12949 r12958 6 6 from MatlabFuncs import * 7 7 8 class mesh: 8 class mesh(object): 9 """ 10 MESH class definition 11 12 Usage: 13 mesh=mesh(); 14 """ 15 9 16 #properties 10 17 def __init__(self): … … 54 61 55 62 #}}} 56 def __repr__( obj):63 def __repr__(self): 57 64 # {{{ Display 58 65 59 if obj.dimension==3:66 if self.dimension==3: 60 67 string="\n%s"%(" Elements and vertices of the original 2d mesh:") 61 68 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")) 67 74 68 75 string="%s\n%s" %(string,"Elements and vertices of the extruded 3d mesh:") 69 76 else: 70 77 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")) 79 86 80 87 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")) 97 104 98 105 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")) 101 108 102 109 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"" ")) 106 113 return string 107 114 #}}} 108 115 109 def setdefaultparameters( obj):116 def setdefaultparameters(self): 110 117 # {{{setdefaultparameters 111 118 … … 115 122 #give a good memory/time ration. This value can be checked in 116 123 #trunk/test/Miscellaneous/runme.m 117 obj.average_vertex_connectivity=25118 119 return obj124 self.average_vertex_connectivity=25 125 126 return self 120 127 #}}} 121 128 -
issm/trunk-jpl/src/m/classes/miscellaneous.py
r12123 r12958 2 2 from fielddisplay import fielddisplay 3 3 4 class miscellaneous :4 class miscellaneous(object): 5 5 #properties 6 6 def __init__(self): -
issm/trunk-jpl/src/m/classes/private.py
r12949 r12958 2 2 from fielddisplay import fielddisplay 3 3 4 class private :4 class private(object): 5 5 #properties 6 6 def __init__(self): -
issm/trunk-jpl/src/m/classes/prognostic.py
r12123 r12958 2 2 from fielddisplay import fielddisplay 3 3 4 class prognostic :4 class prognostic(object): 5 5 #properties 6 6 def __init__(self): -
issm/trunk-jpl/src/m/classes/qmu.py
r12123 r12958 2 2 from fielddisplay import fielddisplay 3 3 4 class qmu :4 class qmu(object): 5 5 #properties 6 6 def __init__(self): -
issm/trunk-jpl/src/m/classes/radaroverlay.py
r12123 r12958 2 2 from fielddisplay import fielddisplay 3 3 4 class radaroverlay :4 class radaroverlay(object): 5 5 #properties 6 6 def __init__(self): -
issm/trunk-jpl/src/m/classes/rifts.py
r12123 r12958 1 1 #module imports 2 import numpy 2 3 from fielddisplay import fielddisplay 4 from EnumDefinitions import * 5 from checkfield import * 6 from WriteData import * 7 from isnans import * 3 8 4 class rifts: 9 class rifts(object): 10 """ 11 RIFTS class definition 12 13 Usage: 14 rifts=rifts(); 15 """ 16 5 17 #properties 6 18 def __init__(self): … … 13 25 14 26 #}}} 15 def __repr__( obj):27 def __repr__(self): 16 28 # {{{ Display 17 29 string=' rifts parameters:' 18 30 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','')) 21 33 return string 22 34 #}}} 23 35 24 def setdefaultparameters( obj):36 def setdefaultparameters(self): 25 37 # {{{setdefaultparameters 26 return obj38 return self 27 39 #}}} 28 40 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 1 1 #module imports 2 2 from fielddisplay import fielddisplay 3 from EnumDefinitions import * 4 from checkfield import * 5 from WriteData import * 3 6 4 class settings: 7 class settings(object): 8 """ 9 SETTINGS class definition 10 11 Usage: 12 settings=settings(); 13 """ 14 5 15 #properties 6 16 def __init__(self): … … 16 26 17 27 #}}} 18 def __repr__( obj):28 def __repr__(self): 19 29 # {{{ Display 20 30 string=" general settings parameters:" 21 31 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")) 27 37 return string 28 38 #}}} 29 39 30 def setdefaultparameters( obj):40 def setdefaultparameters(self): 31 41 # {{{setdefaultparameters 32 42 33 43 #are we short in memory ? (0 faster but requires more memory) 34 obj.lowmem=044 self.lowmem=0 35 45 36 46 #i/o: 37 obj.io_gather=147 self.io_gather=1 38 48 39 49 #results frequency by default every step 40 obj.output_frequency=150 self.output_frequency=1 41 51 42 52 #do not use patches by default (difficult to plot) 43 obj.results_as_patches=053 self.results_as_patches=0 44 54 45 55 #this option can be activated to load automatically the results … … 47 57 #N minutes that is generated once the solution has converged 48 58 #0 to desactivate 49 obj.waitonlock=float('Inf')59 self.waitonlock=float('Inf') 50 60 51 return obj61 return self 52 62 #}}} 53 63 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 1 from ismumps import * 2 from mumpsoptions import * 3 from iluasmoptions import * 4 from MatlabFuncs import * 5 from EnumDefinitions import * 6 from checkfield import * 7 8 class 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 11 18 if ismumps: 12 self. options=[["NoneAnalysis",mumpsoptions()]]19 self.NoneAnalysis=mumpsoptions() 13 20 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() 24 22 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: 32 93 #this option has only one argument 33 string="%s%s%s"%(string," -",option[0])34 el if len(option)==2:94 fid.write("-%s\n" % optionname) 95 else: 35 96 #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)) 42 101 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) 46 103 47 string2="%s\n%s"%(string2," %s -> '%s'"%(analysis,string))48 return string249 #}}} 104 fid.close() 105 # }}} 106 -
issm/trunk-jpl/src/m/classes/steadystate.py
r12123 r12958 2 2 from fielddisplay import fielddisplay 3 3 4 class steadystate :4 class steadystate(object): 5 5 #properties 6 6 def __init__(self): -
issm/trunk-jpl/src/m/classes/surfaceforcings.py
r12949 r12958 5 5 from WriteData import * 6 6 7 class surfaceforcings: 7 class surfaceforcings(object): 8 """ 9 SURFACEFORCING Class definition 10 11 Usage: 12 surfaceforcings=surfaceforcings(); 13 """ 14 8 15 #properties 9 16 def __init__(self): … … 32 39 33 40 #}}} 34 def __repr__( obj):41 def __repr__(self): 35 42 # {{{ Display 36 43 string=" surface forcings parameters:" 37 44 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')) 57 64 58 65 return string 59 66 #}}} 60 67 61 def setdefaultparameters( obj):68 def setdefaultparameters(self): 62 69 # {{{setdefaultparameters 63 70 64 71 #pdd method not used in default mode 65 obj.ispdd=066 obj.issmbgradients=067 obj.isdelta18o=072 self.ispdd=0 73 self.issmbgradients=0 74 self.isdelta18o=0 68 75 69 return obj76 return self 70 77 #}}} 71 78 -
issm/trunk-jpl/src/m/classes/thermal.py
r12123 r12958 2 2 from fielddisplay import fielddisplay 3 3 4 class thermal :4 class thermal(object): 5 5 #properties 6 6 def __init__(self): -
issm/trunk-jpl/src/m/classes/timestepping.py
r12949 r12958 5 5 from WriteData import * 6 6 7 class timestepping: 7 class timestepping(object): 8 """ 9 TIMESTEPPING Class definition 10 11 Usage: 12 timestepping=timestepping(); 13 """ 14 8 15 #properties 9 16 def __init__(self): … … 19 26 20 27 #}}} 21 def __repr__( obj):28 def __repr__(self): 22 29 # {{{ Display 23 30 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")) 29 36 return string 30 37 #}}} 31 38 32 def setdefaultparameters( obj):39 def setdefaultparameters(self): 33 40 # {{{setdefaultparameters 34 41 35 42 #time between 2 time steps 36 obj.time_step=1/243 self.time_step=1/2 37 44 38 45 #final time 39 obj.final_time=10*obj.time_step46 self.final_time=10*self.time_step 40 47 41 48 #time adaptation? 42 obj.time_adapt=043 obj.cfl_coefficient=.549 self.time_adapt=0 50 self.cfl_coefficient=.5 44 51 45 return obj52 return self 46 53 #}}} 47 54 -
issm/trunk-jpl/src/m/classes/transient.py
r12123 r12958 2 2 from fielddisplay import fielddisplay 3 3 4 class transient :4 class transient(object): 5 5 #properties 6 6 def __init__(self): -
issm/trunk-jpl/src/m/classes/verbose.py
r12938 r12958 1 1 from pairoptions import * 2 2 from MatlabFuncs import * 3 from EnumDefinitions import * 3 4 from WriteData import * 4 from EnumDefinitions import *5 5 6 6 class verbose(object):
Note:
See TracChangeset
for help on using the changeset viewer.