|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.domains.ct.kernel.ODESolver
ptolemy.domains.ct.kernel.solver.ExplicitRK45Solver
public class ExplicitRK45Solver
This class implements a fourth-order Runge-Kutta ODE solving method. The algorithm was introduced in "A Variable Order Runge-Kutta Method for Initial Value Problems with Rapidly Varying Right-Hand Sides" by J. R. Cash and Alan H. Karp, ACM Transactions on Mathematical Software, vol 16, pp. 201-222, 1990. For completeness, a brief explanation of the algorithm is explained below.
For an ODE of the form:
dx(t)/dt = f(x(t), t), x(0) = x0it does the following:
K0 = f(x(n), tn); K1 = f(x(n) + 0.2*K0*h, tn + 0.2*h); K2 = f(x(n) + (3.0/40*K0 + 9.0/40*K1)*h, tn + 0.3*h); K3 = f(x(n) + (0.3*K0 - 0.9*K1 + 1.2*K2)*h, tn + 0.6*h); K4 = f(x(n) + (-11/54*K0 + 5.0/2*K1 -70/27*K2 + 35/27*K3)*h, tn + 1.0*h); K5 = f(x(n) + (1631/55296*K0 + 175/512*K1 + 575/13824*K2 + 3544275/110592*K3 + 253/4096*K4)*h, tn + 7/8*h); x(n+1) = x(n)+(37/378*K0 + 250/621*K2 + 125.0/594*K3 + 512.0/1771*K5)*h;, and error control:
LTE = [(37.0/378 - 2825.0/27648)*K0 + (250.0/621 - 18575.0/48384)*K2 + (125.0/594 - 13525.0/55296)*K3 + (0.0 - 277.0/14336)*K4 + (512.0/1771 - 0.25)*K5]*h.
If the LTE is less than the error tolerance, then this step size h is considered successful, and the next integration step size h' is predicted as:
h' = h * Math.pow((ErrorTolerance/LTE), 1.0/5.0)This is a fourth order method, but uses a fifth order procedure to estimate the local truncation error.
It takes 6 steps for this solver to resolve a state with an integration step size. A round counter is used to record which step this solver performs.
| Green (hyzheng) |
| Green (hyzheng) |
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
|---|
NamedObj.ContainedObjectsIterator |
| Field Summary | |
|---|---|
private static double[][] |
_B
B coefficients |
private static java.lang.String |
_DEFAULT_NAME
The name of the solver |
private static double[] |
_E
E coefficients |
private static int |
_order
The order of the algorithm. |
private static double[] |
_timeInc
The ratio of time increments within one integration step. |
| 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 | |
|---|---|
ExplicitRK45Solver()
Construct a solver in the default workspace. |
|
ExplicitRK45Solver(Workspace workspace)
Construct a solver in the given workspace. |
|
| Method Summary | |
|---|---|
protected void |
_advanceModelTime()
Override the method in the base abstract class to advance the model time. |
void |
fireStateTransitionActors()
Fire state transition actors. |
int |
getAmountOfHistoryInformation()
Return 0 to indicate that no history information is needed by this solver. |
int |
getIntegratorAuxVariableCount()
Return 7 to indicate that 7 auxiliary variables are needed by this solver. |
void |
integratorFire(CTBaseIntegrator integrator)
Fire the given integrator. |
boolean |
integratorIsAccurate(CTBaseIntegrator integrator)
Return true if the integration is accurate for the given integrator. |
double |
integratorPredictedStepSize(CTBaseIntegrator integrator)
Predict the next step size for the integrators executed under this solver. |
| Methods inherited from class ptolemy.domains.ct.kernel.ODESolver |
|---|
_getRoundCount, _getSchedule, _incrementRoundCount, _isConverged, _makeSolverOf, _resetRoundCount, _setConverged, _voteForConverged, fireDynamicActors, getContainer, resolveStates |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final java.lang.String _DEFAULT_NAME
private static final double[] _timeInc
private static final double[][] _B
private static final double[] _E
private static final int _order
| Constructor Detail |
|---|
public ExplicitRK45Solver()
public ExplicitRK45Solver(Workspace workspace)
workspace - Object for synchronization and version tracking.| Method Detail |
|---|
public void fireStateTransitionActors()
throws IllegalActionException
fireStateTransitionActors in class ODESolverIllegalActionException - If thrown in the super class.public final int getAmountOfHistoryInformation()
getAmountOfHistoryInformation in class ODESolverpublic final int getIntegratorAuxVariableCount()
getIntegratorAuxVariableCount in class ODESolver
public void integratorFire(CTBaseIntegrator integrator)
throws IllegalActionException
integratorFire in class ODESolverintegrator - The integrator of that calls this method.
IllegalActionException - If there is no director, or can not
read input, or can not send output.public boolean integratorIsAccurate(CTBaseIntegrator integrator)
integratorIsAccurate in class ODESolverintegrator - The integrator of that calls this method.
public double integratorPredictedStepSize(CTBaseIntegrator integrator)
integratorPredictedStepSize in class ODESolverintegrator - The integrator that calls this method.
protected void _advanceModelTime()
throws IllegalActionException
_advanceModelTime in class ODESolverIllegalActionException - If thrown in the super class or the
model time can not be set.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||