
ODESolver |
ptolemy.domains.ct.kernel.ODESolver |
Abstract base class for ODE solvers. The key methods for the class
are fireDynamicActors and fireStateTransitionActors. CT directors call these methods to
resolve the initial states in a future time in the continuous phase
of execution of a complete iteration. See ptolemy.domains.ct.kernel.CTMultiSolverDirector for explanation of initial states and phases
of executions. The process of resolving the initial states in a
future time is also known as an integration. A complete integration
is composed of one or more rounds of executions. One round of
execution consists of calling fireDynamicActors() once followed by
calling fireStateTransitionActors() once. How the states are
resolved are solver dependent. Derived classes need to implement
these methods according to their ODE solving algorithms.
The behavior of integrators also changes when changing the ODE solver,
so this class provides some methods for the integrators too, including the
fire() method and the step size control related methods. Here we use the
strategy and delegation design patterns. CTBaseIntegrator delegates its
corresponding methods to this class. And subclasses of this class provide
concrete implementations of these methods.
How many rounds are needed in one integration is solver dependent. For some
solving algorithms, (i.e. the so called explicit methods) the number of
rounds is fixed. For some others (i.e. implicit methods), the number of
rounds can not be decided beforehand.
A round counter is a counter for the number of rounds in one integration.
It helps the solvers to decide how to behave under different rounds.
The round counter can be retrieved by the _getRoundCount() method.
The _incrementRoundCount() method will increase the counter by one,
and _resetRoundCount() will always reset the counter to 0. These methods are
protected because they are only used by solvers and CT directors.
In this class, two methods _isConverged and _voteForConverged are defined to let CT directors know the status
of resolved states. If multiple integrators exist, only when all of
them vote true for converged, will the _isConverged() return
true. Another related method is resolveStates(), which
always returns true in this base class. However, in the solvers
that implement the implicit solving methods, this method may return
false if the maximum number of iterations is reached but states
have not been resolved.
Conceptually, ODE solvers do not maintain simulation parameters,
like step sizes and error tolerance.
They get these parameters from the director. So the same set of parameters
are shared by all the solvers in a simulation.
Author(s): Jie Liu, Haiyang Zheng
Version:$Id: ODESolver.java,v 1.93 2006/04/14 18:35:58 hyzheng Exp $
Pt.Proposed Rating:Green (hyzheng)
Pt.Accepted Rating:Green (hyzheng)