Package org.opensourcephysics.numerics
Class RK45MultiStep
java.lang.Object
org.opensourcephysics.numerics.DormandPrince45
org.opensourcephysics.numerics.RK45
org.opensourcephysics.numerics.RK45MultiStep
- All Implemented Interfaces:
ODEAdaptiveSolver
,ODESolver
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
FieldsFields 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
ConstructorsConstructorDescriptionRK45MultiStep
(ODE _ode) Constructs the RK45MultiStep ODESolver for a system of ordinary differential equations. -
Method Summary
Modifier and TypeMethodDescriptionint
Gets the error code.double
Gets the step size.void
initialize
(double stepSize) Initializes the ODE solver.void
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 setStepSizedouble
step()
Steps (advances) the differential equations by the stepSize.Methods inherited from class org.opensourcephysics.numerics.DormandPrince45
enableRuntimeExpecptions, getTolerance, setTolerance
-
Field Details
-
maxIterations
protected int maxIterations
-
-
Constructor Details
-
RK45MultiStep
Constructs the RK45MultiStep ODESolver for a system of ordinary differential equations.- Parameters:
_ode
- the system of differential equations.
-
-
Method Details
-
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 interfaceODESolver
- Overrides:
step
in classDormandPrince45
- 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 interfaceODESolver
- Overrides:
initialize
in classDormandPrince45
- Parameters:
stepSize
-
-
setStepSize
public void setStepSize(double stepSize) Method setStepSize- Specified by:
setStepSize
in interfaceODESolver
- Overrides:
setStepSize
in classDormandPrince45
- 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 interfaceODESolver
- Overrides:
getStepSize
in classDormandPrince45
- 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 interfaceODEAdaptiveSolver
- Overrides:
getErrorCode
in classDormandPrince45
- Returns:
- int
-