Class BogackiShampine23Integrator

java.lang.Object
org.apache.commons.math3.ode.AbstractIntegrator
org.apache.commons.math3.ode.nonstiff.AdaptiveStepsizeIntegrator
org.apache.commons.math3.ode.nonstiff.EmbeddedRungeKuttaIntegrator
org.apache.commons.math3.ode.nonstiff.BogackiShampine23Integrator
All Implemented Interfaces:
org.apache.commons.math3.ode.FirstOrderIntegrator, org.apache.commons.math3.ode.ODEIntegrator

public class BogackiShampine23Integrator extends org.apache.commons.math3.ode.nonstiff.EmbeddedRungeKuttaIntegrator
Bogacki-Shampine 3(2) embedded Runge-Kutta integrator, the method MATLAB's ode23 implements.

LINE's fluid solver selects a fast and an accurate non-stiff integrator by tolerance, mirroring ode_solve.m, whose fast handle is @ode23. Apache Commons Math 3.6.1 ships no order-3 embedded Runge-Kutta method, so the JAR previously stood HighamHall54Integrator in that slot and ran the fast arm at order 5(4). This class closes that order mismatch.

The Butcher tableau is the one published in Bogacki and Shampine, "A 3(2) pair of Runge-Kutta formulas", Appl. Math. Lett. 2(4):321-325, 1989: three stages advance the solution and a fourth, first-same-as-last stage evaluates the drift at the new point, serving both the second-order error estimate and the first stage of the next step.

This class lives in the Commons Math package because EmbeddedRungeKuttaIntegrator's constructor takes a RungeKuttaStepInterpolator, which is package private and therefore not nameable from any other package; the code itself is original to LINE.

Since:
1.0
See Also:
  • BogackiShampine23StepInterpolator
  • Field Summary

    Fields inherited from class org.apache.commons.math3.ode.nonstiff.AdaptiveStepsizeIntegrator

    mainSetDimension, scalAbsoluteTolerance, scalRelativeTolerance, vecAbsoluteTolerance, vecRelativeTolerance

    Fields inherited from class org.apache.commons.math3.ode.AbstractIntegrator

    isLastStep, resetOccurred, stepHandlers, stepSize, stepStart
  • Constructor Summary

    Constructors
    Constructor
    Description
    BogackiShampine23Integrator(double minStep, double maxStep, double[] vecAbsoluteTolerance, double[] vecRelativeTolerance)
    Builds an integrator with per-component tolerances.
    BogackiShampine23Integrator(double minStep, double maxStep, double scalAbsoluteTolerance, double scalRelativeTolerance)
    Builds an integrator with scalar tolerances.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected double
    estimateError(double[][] yDotK, double[] y0, double[] y1, double h)
    int
    Returns the order of the propagated solution, which sets the step-size control exponent, matching the 1/3 power ode23 uses.

    Methods inherited from class org.apache.commons.math3.ode.nonstiff.EmbeddedRungeKuttaIntegrator

    getMaxGrowth, getMinReduction, getSafety, integrate, setMaxGrowth, setMinReduction, setSafety

    Methods inherited from class org.apache.commons.math3.ode.nonstiff.AdaptiveStepsizeIntegrator

    filterStep, getCurrentStepStart, getMaxStep, getMinStep, initializeStep, resetInternalState, sanityChecks, setInitialStepSize, setStepSizeControl, setStepSizeControl

    Methods inherited from class org.apache.commons.math3.ode.AbstractIntegrator

    acceptStep, addEventHandler, addEventHandler, addStepHandler, clearEventHandlers, clearStepHandlers, computeDerivatives, getCounter, getCurrentSignedStepsize, getEvaluations, getEvaluationsCounter, getEventHandlers, getExpandable, getMaxEvaluations, getName, getStepHandlers, initIntegration, integrate, setEquations, setMaxEvaluations, setStateInitialized

    Methods inherited from class java.lang.Object

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

    • BogackiShampine23Integrator

      public BogackiShampine23Integrator(double minStep, double maxStep, double scalAbsoluteTolerance, double scalRelativeTolerance)
      Builds an integrator with scalar tolerances.
      Parameters:
      minStep - minimal step, the sign is irrelevant
      maxStep - maximal step, the sign is irrelevant
      scalAbsoluteTolerance - allowed absolute error
      scalRelativeTolerance - allowed relative error
    • BogackiShampine23Integrator

      public BogackiShampine23Integrator(double minStep, double maxStep, double[] vecAbsoluteTolerance, double[] vecRelativeTolerance)
      Builds an integrator with per-component tolerances.
      Parameters:
      minStep - minimal step, the sign is irrelevant
      maxStep - maximal step, the sign is irrelevant
      vecAbsoluteTolerance - allowed absolute error, one entry per component
      vecRelativeTolerance - allowed relative error, one entry per component
  • Method Details

    • getOrder

      public int getOrder()
      Returns the order of the propagated solution, which sets the step-size control exponent, matching the 1/3 power ode23 uses.
      Specified by:
      getOrder in class org.apache.commons.math3.ode.nonstiff.EmbeddedRungeKuttaIntegrator
      Returns:
      3
    • estimateError

      protected double estimateError(double[][] yDotK, double[] y0, double[] y1, double h)
      Specified by:
      estimateError in class org.apache.commons.math3.ode.nonstiff.EmbeddedRungeKuttaIntegrator