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, tolFields 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 TypeMethodDescriptionintGets the error code.doubleGets the step size.voidinitialize(double stepSize) Initializes the ODE solver.voidSets the number of error messages if ODE solver did not converge.voidsetMaxIterations(int n) Sets the maximum number of iterations.voidsetStepSize(double stepSize) Method setStepSizedoublestep()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:
stepin interfaceODESolver- Overrides:
stepin 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:
initializein interfaceODESolver- Overrides:
initializein classDormandPrince45- Parameters:
stepSize-
-
setStepSize
public void setStepSize(double stepSize) Method setStepSize- Specified by:
setStepSizein interfaceODESolver- Overrides:
setStepSizein 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:
getStepSizein interfaceODESolver- Overrides:
getStepSizein classDormandPrince45- Returns:
- the step size
-
getErrorCode
public int getErrorCode()Gets the error code. Error codes: ODEAdaptiveSolver.NO_ERROR ODEAdaptiveSolver.DID_NOT_CONVERGE- Specified by:
getErrorCodein interfaceODEAdaptiveSolver- Overrides:
getErrorCodein classDormandPrince45- Returns:
- int
-