public class ExplicitRK23Solver extends ContinuousODESolver
dx/dt = f(x, t), x(0) = x0it does the following:
K0 = f(x(n), tn); K1 = f(x(n)+0.5*h*K0, tn+0.5*h); K2 = f(x(n)+0.75*h*K1, tn+0.75*h); x(n+1) = x(n)+(2/9)*h*K0+(1/3)*h*K0+(4/9)*h*K2; K3 = f(x(n+1), tn+h);, and error control:
LTE = h*[(-5.0/72.0)*K0 + (1.0/12.0)*K1 + (1.0/9.0)*K2 + (-1.0/8.0)*K3]
If the LTE is less than the error tolerance, then this step is considered successful, and the next integration step is predicted as:
h' = 0.8*Math.pow((ErrorTolerance/LTE), 1.0/3.0)This is a second order method, but uses a third order procedure to estimate the local truncation error.
Modifier and Type | Field and Description |
---|---|
protected static double[] |
_TIME_INCREMENTS
The ratio of time increments within one integration step.
|
_director
Constructor and Description |
---|
ExplicitRK23Solver() |
Modifier and Type | Method and Description |
---|---|
protected int |
_getRound()
Return the current round.
|
protected double |
_getRoundTimeIncrement()
Get the current round factor.
|
protected boolean |
_isStepFinished()
Return true if the current integration step is finished.
|
protected void |
_reset()
Reset the solver, indicating to it that we are starting an
integration step.
|
protected void |
_setRound(int round)
Set the round for the next integration step.
|
int |
getIntegratorAuxVariableCount()
Return the number of time increments plus one (to store the
truncation error).
|
void |
integratorIntegrate(ContinuousIntegrator integrator)
Fire the given integrator.
|
boolean |
integratorIsAccurate(ContinuousIntegrator integrator)
Return true if the integration is accurate for the given
integrator.
|
double |
integratorSuggestedStepSize(ContinuousIntegrator integrator)
Provide the predictedStepSize() method for the integrators
under this solver.
|
_debug, _isDebugging, _makeSolverOf
protected static final double[] _TIME_INCREMENTS
public final int getIntegratorAuxVariableCount()
getIntegratorAuxVariableCount
in class ContinuousODESolver
public void integratorIntegrate(ContinuousIntegrator integrator) throws IllegalActionException
integratorIntegrate
in class ContinuousODESolver
integrator
- 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(ContinuousIntegrator integrator)
integratorIsAccurate
in class ContinuousODESolver
integrator
- The integrator of that calls this method.public double integratorSuggestedStepSize(ContinuousIntegrator integrator)
integratorSuggestedStepSize
in class ContinuousODESolver
integrator
- The integrator of that calls this method.protected int _getRound()
_getRound
in class ContinuousODESolver
protected final double _getRoundTimeIncrement()
_getRoundTimeIncrement
in class ContinuousODESolver
ContinuousODESolver._isStepFinished()
protected final boolean _isStepFinished()
_isStepFinished
in class ContinuousODESolver
_reset()
protected final void _reset()
_reset
in class ContinuousODESolver
protected void _setRound(int round)
_setRound
in class ContinuousODESolver
round
- The round for the next integration step.ContinuousODESolver.getIntegratorAuxVariableCount()