org.opensourcephysics.numerics
Class RK45MultiStep

java.lang.Object
  extended by org.opensourcephysics.numerics.DormandPrince45
      extended by org.opensourcephysics.numerics.RK45
          extended by org.opensourcephysics.numerics.RK45MultiStep
All Implemented Interfaces:
ODEAdaptiveSolver, ODESolver

public class RK45MultiStep
extends RK45

Title: RK45MultiStep Description: Perform multiple RK4/5 ODE steps so that a uniform step size is maintained

Version:
1.0
Author:
Wolfgang Christian

Field Summary
protected  int maxIterations
           
 
Fields inherited from class org.opensourcephysics.numerics.DormandPrince45
enableExceptions, tol
 
Fields inherited from interface org.opensourcephysics.numerics.ODEAdaptiveSolver
BISECTION_EVENT_NOT_FOUND, DID_NOT_CONVERGE, NO_ERROR
 
Constructor Summary
RK45MultiStep(ODE _ode)
          Constructs the RK45MultiStep ODESolver for a system of ordinary differential equations.
 
Method Summary
 int getErrorCode()
          Gets the error code.
 double getStepSize()
          Gets the step size.
 void initialize(double stepSize)
          Initializes the ODE solver.
 void setMaximumNumberOfErrorMessages(int n)
          Sets the number of error messages if ODE solver did not converge.
 void setMaxIterations(int n)
          Sets the maximum number of iterations.
 void setStepSize(double stepSize)
          Method setStepSize
 double step()
          Steps (advances) the differential equations by the stepSize.
 
Methods inherited from class org.opensourcephysics.numerics.DormandPrince45
enableRuntimeExpecptions, getTolerance, setTolerance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxIterations

protected int maxIterations
Constructor Detail

RK45MultiStep

public RK45MultiStep(ODE _ode)
Constructs the RK45MultiStep ODESolver for a system of ordinary differential equations.

Parameters:
_ode - the system of differential equations.
Method Detail

step

public double step()
Steps (advances) the differential equations by the stepSize. The ODESolver invokes the ODE's getRate method to obtain the initial state of the system. The ODESolver then advances the solution and copies the new state into the state array at the end of the solution step.

Specified by:
step in interface ODESolver
Overrides:
step in class DormandPrince45
Returns:
the step size

setMaxIterations

public void setMaxIterations(int n)
Sets the maximum number of iterations.

Parameters:
n - maximum

setMaximumNumberOfErrorMessages

public void setMaximumNumberOfErrorMessages(int n)
Sets the number of error messages if ODE solver did not converge.

Parameters:
n - int

initialize

public void initialize(double stepSize)
Initializes the ODE solver. Temporary state and rate arrays are allocated by invoking the superclass method.

Specified by:
initialize in interface ODESolver
Overrides:
initialize in class DormandPrince45
Parameters:
stepSize -

setStepSize

public void setStepSize(double stepSize)
Method setStepSize

Specified by:
setStepSize in interface ODESolver
Overrides:
setStepSize in class DormandPrince45
Parameters:
stepSize -

getStepSize

public double getStepSize()
Gets the step size. The step size is the fixed step size, not the size of the RK4/5 steps that are combined into a single step.

Specified by:
getStepSize in interface ODESolver
Overrides:
getStepSize in class DormandPrince45
Returns:
the step size

getErrorCode

public int getErrorCode()
Gets the error code. Error codes: ODEAdaptiveSolver.NO_ERROR ODEAdaptiveSolver.DID_NOT_CONVERGE

Specified by:
getErrorCode in interface ODEAdaptiveSolver
Overrides:
getErrorCode in class DormandPrince45
Returns:
int