Class AdaptiveSwimUtilities

java.lang.Object
cnuphys.adaptiveSwim.AdaptiveSwimUtilities

public class AdaptiveSwimUtilities extends Object
  • Field Details

    • MIN_STEPSIZE

      public static final double MIN_STEPSIZE
      See Also:
    • MAX_NUMSTEP

      public static int MAX_NUMSTEP
  • Constructor Details

    • AdaptiveSwimUtilities

      public AdaptiveSwimUtilities()
  • Method Details

    • driver

      public static int driver(double h, IDerivative deriv, IAdaptiveStopper stopper, IAdaptiveAdvance advancer, double eps, double[] uf) throws AdaptiveSwimException
      Basic adaptive step size driver that tries to integrate from s = 0 to s = sf, where sf is in the stopper object. Often this will terminate because the stopper stops the integration before sf is reached.
      Parameters:
      h - the step size at the start
      deriv - the derivative computer (interface). This is where the problem specificity resides.
      stopper - will be used to exit the integration early because some condition has been reached.
      advancer - takes the next single step
      eps - tolerance (e.g., 1.0e-6)
      uf - will hold final state vector
      Returns:
      the number of steps used.
      Throws:
      AdaptiveSwimException
    • singleRK4Step

      public static void singleRK4Step(double s, double[] u, double[] du, double h, IDerivative deriv, double[] uf)
      Take a single step using basic fourth order RK
      Parameters:
      s - the independent variable
      u - the current state vector
      du - the current derivatives
      h - the step size
      deriv - can compute the rhs of the diffy q
      uf - the state vector after the step
    • singleButcherStep

      public static void singleButcherStep(double s, double[] u, double[] du, double h, IDerivative deriv, double[] uf, double[] error, ButcherTableau tableau)
      Take a single step using a Butcher tableau
      Parameters:
      s - the independent variable
      u - the current state vector
      du - the current derivatives
      h - the step size
      deriv - can compute the rhs of the diffy q
      uf - the state vector after the step (output)
      error - the error estimate (output)
      tableau - the Butcher tableau
    • setDebugLevel

      public static void setDebugLevel(AdaptiveSwimUtilities.DebugLevel level)
      Set the debug level
      Parameters:
      level - the new debug level
    • setMaxNumberSteps

      public static void setMaxNumberSteps(int maxSteps)
      Set the maximum number of steps beyond which an error occurs
      Parameters:
      maxSteps - the maximum number of steps. Default is 2000.
    • getSector

      public static int getSector(double phi)
      Get the sector [1..6] from the phi value
      Parameters:
      phi - the value of phi in degrees
      Returns:
      the sector [1..6]