Class AdaptiveSwimUtilities
java.lang.Object
cnuphys.adaptiveSwim.AdaptiveSwimUtilities
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intdriver(double h, IDerivative deriv, IAdaptiveStopper stopper, IAdaptiveAdvance advancer, double eps, double[] uf) Basic adaptive step size driver that tries to integrate from s = 0 to s = sf, where sf is in the stopper object.static intgetSector(double phi) Get the sector [1..6] from the phi valuestatic voidSet the debug levelstatic voidsetMaxNumberSteps(int maxSteps) Set the maximum number of steps beyond which an error occursstatic voidsingleButcherStep(double s, double[] u, double[] du, double h, IDerivative deriv, double[] uf, double[] error, ButcherTableau tableau) Take a single step using a Butcher tableaustatic voidsingleRK4Step(double s, double[] u, double[] du, double h, IDerivative deriv, double[] uf) Take a single step using basic fourth order RK
-
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 startderiv- 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 stepeps- 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 variableu- the current state vectordu- the current derivativesh- the step sizederiv- can compute the rhs of the diffy quf- 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 variableu- the current state vectordu- the current derivativesh- the step sizederiv- can compute the rhs of the diffy quf- the state vector after the step (output)error- the error estimate (output)tableau- the Butcher tableau
-
setDebugLevel
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]
-