Package esys :: Package escript :: Module modelframe :: Class Simulation
[show private | hide private]
[frames | no frames]

Type Simulation

    object --+            
             |            
LinkableObject --+        
                 |        
      ParameterSet --+    
                     |    
                 Model --+
                         |
                        Simulation


A Simulation object is special Model which runs a sequence of Models.

The methods doInitialization, finalize, getSafeTimeStepSize, doStepPreprocessing, terminateIteration, doStepPostprocessing, doFinalization are executing the corresponding methods of the models in the simulation.
Method Summary
  __init__(self, models, **kwargs)
Initiates a simulation from a list of models.
  __getitem__(self, i)
Returns the i-th model.
  __len__(self)
Returns the number of models.
  __repr__(self)
Returns a string representation of the Simulation.
  __setitem__(self, i, value)
Sets the i-th model.
  __str__(self)
Returning Simulation as a string.
  doFinalization(self)
Finalalizes the time stepping for all models.
  doInitialization(self)
Initializes all models.
  doStep(self, dt)
Executes the iteration step at a time step for all model:
  doStepPostprocessing(self, dt)
Finalalizes the iteration process for all models.
  doStepPreprocessing(self, dt)
Initializes the time step for all models.
  finalize(self)
Returns True if any of the models is to be finalized.
  fromDom(cls, doc)
(Class method)
  getSafeTimeStepSize(self, dt)
Returns a time step size which can safely be used by all models.
  iterModels(self)
Returns an iterator over the models.
  run(self, check_point)
Run the simulation by performing essentially:
  terminateIteration(self)
Returns True if all iterations for all models are terminated.
  toDom(self, document, node)
toDom method of Simulation class.
  writeXML(self, ostream)
Writes the object as an XML object into an output stream.
    Inherited from ParameterSet
  __delattr__(self, name)
Removes the attribute name.
  __iter__(self)
Creates an iterator over the parameter and their values.
  declareParameter(self, **parameters)
Declares a new parameter(s) and its (their) initial value.
  declareParameters(self, parameters)
Declares a set of parameters.
  releaseParameters(self, name)
Removes parameter name from the paramameters.
  showParameters(self)
Returns a descrition of the parameters.
    Inherited from LinkableObject
  __getattr__(self, name)
Returns the value of attribute name.
  __setattr__(self, name, value)
Sets the value for attribute name.
  getAttributeObject(self, name)
Return the object stored for attribute name.
  hasAttribute(self, name)
Returns True if self as attribute name.
  trace(self, msg)
If debugging is on, print the message, otherwise do nothing
    Inherited from object
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle

Class Variable Summary
int FAILED_TIME_STEPS_MAX = 20                                                                    
int MAX_ITER_STEPS = 50                                                                    
    Inherited from Model
float UNDEF_DT = 1.0000000000000001e+300                                               
    Inherited from LinkableObject
count number_sequence = <itertools.count object at 0x401ff100>

Instance Method Details

__init__(self, models=[], **kwargs)
(Constructor)

Initiates a simulation from a list of models.
Overrides:
esys.escript.modelframe.Model.__init__

__getitem__(self, i)
(Indexing operator)

Returns the i-th model.

__len__(self)
(Length operator)

Returns the number of models.

__repr__(self)
(Representation operator)

Returns a string representation of the Simulation.
Overrides:
esys.escript.modelframe.ParameterSet.__repr__

__setitem__(self, i, value)
(Index assignment operator)

Sets the i-th model.

__str__(self)
(Informal representation operator)

Returning Simulation as a string.
Overrides:
esys.escript.modelframe.Model.__str__

doFinalization(self)

Finalalizes the time stepping for all models.
Overrides:
esys.escript.modelframe.Model.doFinalization

doInitialization(self)

Initializes all models.
Overrides:
esys.escript.modelframe.Model.doInitialization

doStep(self, dt)

Executes the iteration step at a time step for all model:
   self.doStepPreprocessing(dt)
   while not self.terminateIteration(): 
       for all models: 
           self.doStep(dt)
       self.doStepPostprocessing(dt)
Overrides:
esys.escript.modelframe.Model.doStep

doStepPostprocessing(self, dt)

Finalalizes the iteration process for all models.
Overrides:
esys.escript.modelframe.Model.doStepPostprocessing

doStepPreprocessing(self, dt)

Initializes the time step for all models.
Overrides:
esys.escript.modelframe.Model.doStepPreprocessing

finalize(self)

Returns True if any of the models is to be finalized.
Overrides:
esys.escript.modelframe.Model.finalize

getSafeTimeStepSize(self, dt)

Returns a time step size which can safely be used by all models.

This is the minimum over the time step sizes of all models.
Overrides:
esys.escript.modelframe.Model.getSafeTimeStepSize

iterModels(self)

Returns an iterator over the models.

run(self, check_point=None)

Run the simulation by performing essentially:
   self.doInitialization()
   while not self.finalize():
       dt=self.getSafeTimeStepSize()
       self.doStep(dt)
       if n%check_point==0: 
           self.writeXML() 
   self.doFinalization()

If one of the models in throws a FailedTimeStepError exception a new time step size is computed through getSafeTimeStepSize() and the time step is repeated.

If one of the models in throws a IterationDivergenceError exception the time step size is halved and the time step is repeated.

In both cases the time integration is given up after Simulation.FAILED_TIME_STEPS_MAX attempts.

terminateIteration(self)

Returns True if all iterations for all models are terminated.
Overrides:
esys.escript.modelframe.Model.terminateIteration

toDom(self, document, node)

toDom method of Simulation class.
Overrides:
esys.escript.modelframe.Model.toDom

writeXML(self, ostream=<epydoc.imports._DevNull instance at 0x402244cc>)

Writes the object as an XML object into an output stream.
Overrides:
esys.escript.modelframe.Model.writeXML

Class Variable Details

FAILED_TIME_STEPS_MAX

Type:
int
Value:
20                                                                    

MAX_ITER_STEPS

Type:
int
Value:
50                                                                    

Generated by Epydoc 2.1 on Thu Apr 27 11:16:25 2006 http://epydoc.sf.net