Class AbstractODESolver

java.lang.Object
org.opensourcephysics.numerics.AbstractODESolver
All Implemented Interfaces:
ODESolver
Direct Known Subclasses:
Butcher5, Euler, EulerRichardson, Fehlberg8, Heun3, LeapFrog, Ralston2, RK4, Verlet

public abstract class AbstractODESolver extends Object implements ODESolver
AbstractODE provides a common superclass for ODESolvers.
Version:
1.0
Author:
Wolfgang Christian
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
    protected ODE
     
    protected double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs the ODESolver for a system of ordinary differential equations.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Gets the step size.
    void
    initialize(double _stepSize)
    Initializes the ODE solver.
    void
    setStepSize(double _stepSize)
    Sets the step size.
    abstract double
    Steps (advances) the differential equations by the stepSize.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • stepSize

      protected double stepSize
    • numEqn

      protected int numEqn
    • ode

      protected ODE ode
  • Constructor Details

    • AbstractODESolver

      public AbstractODESolver(ODE _ode)
      Constructs the ODESolver for a system of ordinary differential equations.
      Parameters:
      _ode - the system of differential equations.
  • Method Details

    • step

      public abstract 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
      Returns:
      the step size
    • setStepSize

      public void setStepSize(double _stepSize)
      Sets the step size. The step size remains fixed in this algorithm
      Specified by:
      setStepSize in interface ODESolver
      Parameters:
      _stepSize -
    • initialize

      public void initialize(double _stepSize)
      Initializes the ODE solver. The rate array is allocated. The number of differential equations is determined by invoking getState().length on the ODE.
      Specified by:
      initialize in interface ODESolver
      Parameters:
      _stepSize -
    • getStepSize

      public double getStepSize()
      Gets the step size. The stepsize is constant in this algorithm
      Specified by:
      getStepSize in interface ODESolver
      Returns:
      the step size