ptolemy.domains.ct.kernel.solver
Class BackwardEulerSolver

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.domains.ct.kernel.ODESolver
          extended by ptolemy.domains.ct.kernel.solver.FixedStepSolver
              extended by ptolemy.domains.ct.kernel.solver.BackwardEulerSolver
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class BackwardEulerSolver
extends FixedStepSolver

The Backward Euler ODE solver. For an ODE

 x' = f(x, u, t), x(0) = x0
 
This solver uses the following formula to solve it:
 x(t+h) = x(t) + h*x'(t+h)
 
where x(t) is the current state, x(t+h) is the next state, h is the step size, and x'(t+h) is the derivative of x at t+h. The formula above is an algebraic equation, and this solver uses fixed point iteration to solve it.

This solver does not perform step size control even when the states do not converge after the maximum number of iterations is reached. However, CT directors may try to reduce step size. This solver does not give suggestions on choosing step size.

Since:
Ptolemy II 0.2
Version:
$Id: BackwardEulerSolver.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Jie Liu, Haiyang Zheng
See Also:
Serialized Form
Accepted Rating:
Green (hyzheng)
Proposed Rating:
Green (hyzheng)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
private static java.lang.String _DEFAULT_NAME
          Name of this Solver.
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Constructor Summary
BackwardEulerSolver()
          Construct a solver in the default workspace with the name "CT_Backward_Euler_Solver".
BackwardEulerSolver(Workspace workspace)
          Construct a solver in the given workspace with the name "CT_Backward_Euler_Solver".
 
Method Summary
 void integratorFire(CTBaseIntegrator integrator)
          Fire the integrator to resolve states.
 boolean resolveStates()
          Return true if the resolved states have converged.
 
Methods inherited from class ptolemy.domains.ct.kernel.solver.FixedStepSolver
_advanceModelTime, fireDynamicActors, fireStateTransitionActors, getAmountOfHistoryInformation, getIntegratorAuxVariableCount, integratorIsAccurate, integratorPredictedStepSize
 
Methods inherited from class ptolemy.domains.ct.kernel.ODESolver
_getRoundCount, _getSchedule, _incrementRoundCount, _isConverged, _makeSolverOf, _resetRoundCount, _setConverged, _voteForConverged, getContainer
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getContainedObject, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateExistence, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setName, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_DEFAULT_NAME

private static final java.lang.String _DEFAULT_NAME
Name of this Solver.

See Also:
Constant Field Values
Constructor Detail

BackwardEulerSolver

public BackwardEulerSolver()
Construct a solver in the default workspace with the name "CT_Backward_Euler_Solver". The solver is added to the list of objects in the workspace. Increment the version number of the workspace.


BackwardEulerSolver

public BackwardEulerSolver(Workspace workspace)
Construct a solver in the given workspace with the name "CT_Backward_Euler_Solver". If the workspace argument is null, use the default workspace. The solver is added to the list of objects in the workspace. Increment the version number of the workspace.

Parameters:
workspace - Object for synchronization and version tracking
Method Detail

integratorFire

public void integratorFire(CTBaseIntegrator integrator)
                    throws IllegalActionException
Fire the integrator to resolve states. Vote false for convergence if a fixed-point solution is not found.

Specified by:
integratorFire in class ODESolver
Parameters:
integrator - The integrator to be fired.
Throws:
IllegalActionException - If there is no director, or can not read input, or can not send output.

resolveStates

public boolean resolveStates()
                      throws IllegalActionException
Return true if the resolved states have converged. Return false if states have not converged but the number of iterations reaches the maxIterations number. Meanwhile, the round count is reset.

Overrides:
resolveStates in class ODESolver
Returns:
True if the resolved states have converged.
Throws:
IllegalActionException - Not thrown in this base class.