source: issm/trunk-jpl/src/m/classes/steadystate.py@ 13023

Last change on this file since 13023 was 13023, checked in by jschierm, 13 years ago

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

File size: 1.8 KB
Line 
1#module imports
2import numpy
3from fielddisplay import fielddisplay
4from EnumDefinitions import *
5from checkfield import *
6from WriteData import *
7
8class steadystate(object):
9 """
10 STEADYSTATE class definition
11
12 Usage:
13 steadystate=steadystate();
14 """
15
16 #properties
17 def __init__(self):
18 # {{{ Properties
19 self.reltol = 0
20 self.maxiter = 0
21 self.requested_outputs = float('NaN')
22
23 #set defaults
24 self.setdefaultparameters()
25
26 #}}}
27 def __repr__(self):
28 # {{{ Display
29 string=' steadystate solution parameters:'
30 string="%s\n%s"%(string,fielddisplay(self,'reltol','relative tolerance criterion'))
31 string="%s\n%s"%(string,fielddisplay(self,'maxiter','maximum number of iterations'))
32 string="%s\n%s"%(string,fielddisplay(self,'requested_outputs','additional requested outputs'))
33 return string
34 #}}}
35
36 def setdefaultparameters(self):
37 # {{{setdefaultparameters
38
39 #maximum of steady state iterations
40 self.maxiter=100
41
42 #Relative tolerance for the steadystate convertgence
43 self.reltol=0.01
44
45 return self
46 #}}}
47
48 def checkconsistency(self,md,solution,analyses): # {{{
49
50 #Early return
51 if not solution==SteadystateSolutionEnum():
52 return md
53
54 if not md.timestepping.time_step==0:
55 md.checkmessage("for a steadystate computation, timestepping.time_step must be zero.")
56
57 if numpy.isnan(md.diagnostic.reltol):
58 md.checkmessage("for a steadystate computation, diagnostic.reltol (relative convergence criterion) must be defined!")
59
60 return md
61 # }}}
62
63 def marshall(self,fid): # {{{
64 WriteData(fid,'object',self,'fieldname','reltol','format','Double')
65 WriteData(fid,'object',self,'fieldname','maxiter','format','Integer')
66 WriteData(fid,'object',self,'fieldname','requested_outputs','format','DoubleMat','mattype',3)
67 # }}}
68
Note: See TracBrowser for help on using the repository browser.