We define scaled derivatives si(n) at step n as:
s1(n) = h y'n for first derivative s2(n) = h2/2 y''n for second derivative s3(n) = h3/6 y'''n for third derivative ... sk(n) = hk/k! y(k)n for kth derivative
Rather than storing several previous steps separately, this implementation uses the Nordsieck vector with higher degrees scaled derivatives all taken at the same step (yn, s1(n) and rn) where rn is defined as:
rn = [ s2(n), s3(n) ... sk(n) ]T(we omit the k index in the notation for clarity)
Multistep integrators with Nordsieck representation are highly sensitive to large step changes because when the step is multiplied by factor a, the kth component of the Nordsieck vector is multiplied by ak and the last components are the least accurate ones. The default max growth factor is therefore set to a quite low value: 21/order.
org.apache.commons.math3.ode.nonstiff.AdamsBashforthFieldIntegrator , org.apache.commons.math3.ode.nonstiff.AdamsMoultonFieldIntegrator
| Modifier and Type | Class and Description |
|---|---|
| private class | MultistepFieldIntegrator.
Specialized step handler storing the first step. |
| private static class | MultistepFieldIntegrator.
Marker exception used ONLY to stop the starter integrator after first step. |
| Modifier and Type | Field and Description |
|---|---|
| private double | exp
Stepsize control exponent. |
| private double | maxGrowth
Maximal growth factor for stepsize control. |
| private double | minReduction
Minimal reduction factor for stepsize control. |
| protected Array2DRowFieldMatrix | nordsieck
Nordsieck matrix of the higher scaled derivatives. |
| private final int | nSteps
Number of steps of the multistep method (excluding the one being computed). |
| private double | safety
Safety factor for stepsize control. |
| protected T[] | scaled
First scaled derivative (h y'). |
| private FirstOrderFieldIntegrator | starter
Starter integrator. |
| Access | Constructor and Description |
|---|---|
| protected | MultistepFieldIntegrator(final Field<T>
field to which the time and state vector elements belong field, final String name of the method name, final int number of steps of the multistep method
(excluding the one being computed) nSteps, final int order of the method order, final double minimal step (must be positive even for backward
integration), the last step can be smaller than this minStep, final double maximal step (must be positive even for backward
integration) maxStep, final double allowed absolute error scalAbsoluteTolerance, final double allowed relative error scalRelativeTolerance)Build a multistep integrator with the given stepsize bounds. |
| protected | MultistepFieldIntegrator(final Field<T>
field to which the time and state vector elements belong field, final String name of the method name, final int number of steps of the multistep method
(excluding the one being computed) nSteps, final int order of the method order, final double minimal step (must be positive even for backward
integration), the last step can be smaller than this minStep, final double maximal step (must be positive even for backward
integration) maxStep, final double[] allowed absolute error vecAbsoluteTolerance, final double[] allowed relative error vecRelativeTolerance)Build a multistep integrator with the given stepsize bounds. |
| Modifier and Type | Method and Description |
|---|---|
| protected T | Returns: grow/shrink factor for next stepnormalized error of the current step error)Compute step grow/shrink factor according to normalized error. |
| public double | |
| public double | Returns: minimal reduction factorGet the minimal reduction factor for stepsize control. |
| public int | Returns: number of steps of the multistep method (excluding the one being computed)Get the number of steps of the multistep method (excluding the one being computed). |
| public double | |
| public FirstOrderFieldIntegrator | |
| protected abstract Array2DRowFieldMatrix | Returns: Nordieck vector at first step (h2/2 y''n, h3/6 y'''n ... hk/k! y(k)n)step size to use for scaling h, final T[] first steps times t, final T[][] first steps states y, final T[][] first steps derivatives yDot)Initialize the high order scaled derivatives at step start. |
| protected void | rescale(final T
new step size to use in the scaled and Nordsieck arrays newStepSize)Rescale the instance. |
| public void | setMaxGrowth(final double
maximal growth factor maxGrowth)Set the maximal growth factor for stepsize control. |
| public void | setMinReduction(final double
minimal reduction factor minReduction)Set the minimal reduction factor for stepsize control. |
| public void | |
| public void | setStarterIntegrator(FirstOrderFieldIntegrator<T>
starter integrator starterIntegrator)Set the starter integrator. |
| protected void | start(final FieldExpandableODE<T>
complete set of differential equations to integrate equations, final FieldODEState<T> initial state (time, primary and secondary state vectors) initialState, final T target time for the integration
(can be set to a value smaller than t)t0 for backward integration)Start the integration. |
| exp | back to summary |
|---|---|
| private double exp Stepsize control exponent. | |
| maxGrowth | back to summary |
|---|---|
| private double maxGrowth Maximal growth factor for stepsize control. | |
| minReduction | back to summary |
|---|---|
| private double minReduction Minimal reduction factor for stepsize control. | |
| nordsieck | back to summary |
|---|---|
| protected Array2DRowFieldMatrix<T> nordsieck Nordsieck matrix of the higher scaled derivatives. (h2/2 y'', h3/6 y''' ..., hk/k! y(k)) | |
| nSteps | back to summary |
|---|---|
| private final int nSteps Number of steps of the multistep method (excluding the one being computed). | |
| safety | back to summary |
|---|---|
| private double safety Safety factor for stepsize control. | |
| scaled | back to summary |
|---|---|
| protected T[] scaled First scaled derivative (h y'). | |
| starter | back to summary |
|---|---|
| private FirstOrderFieldIntegrator<T> starter Starter integrator. | |
| MultistepFieldIntegrator | back to summary |
|---|---|
| protected MultistepFieldIntegrator(final Field<T> field, final String name, final int nSteps, final int order, final double minStep, final double maxStep, final double scalAbsoluteTolerance, final double scalRelativeTolerance) throws NumberIsTooSmallException Build a multistep integrator with the given stepsize bounds. The default starter integrator is set to the The default max growth factor is set to a quite low value: 21/order.
| |
| MultistepFieldIntegrator | back to summary |
|---|---|
| protected MultistepFieldIntegrator(final Field<T> field, final String name, final int nSteps, final int order, final double minStep, final double maxStep, final double[] vecAbsoluteTolerance, final double[] vecRelativeTolerance) Build a multistep integrator with the given stepsize bounds. The default starter integrator is set to the The default max growth factor is set to a quite low value: 21/order.
| |
| computeStepGrowShrinkFactor | back to summary |
|---|---|
| protected T computeStepGrowShrinkFactor(final T error) Compute step grow/shrink factor according to normalized error.
| |
| getMaxGrowth | back to summary |
|---|---|
| public double getMaxGrowth() Get the maximal growth factor for stepsize control.
| |
| getMinReduction | back to summary |
|---|---|
| public double getMinReduction() Get the minimal reduction factor for stepsize control.
| |
| getNSteps | back to summary |
|---|---|
| public int getNSteps() Get the number of steps of the multistep method (excluding the one being computed).
| |
| getSafety | back to summary |
|---|---|
| public double getSafety() Get the safety factor for stepsize control.
| |
| getStarterIntegrator | back to summary |
|---|---|
| public FirstOrderFieldIntegrator Get the starter integrator.
| |
| initializeHighOrderDerivatives | back to summary |
|---|---|
| protected abstract Array2DRowFieldMatrix Initialize the high order scaled derivatives at step start.
| |
| rescale | back to summary |
|---|---|
| protected void rescale(final T newStepSize) Rescale the instance. Since the scaled and Nordsieck arrays are shared with the caller, this method has the side effect of rescaling this arrays in the caller too.
| |
| setMaxGrowth | back to summary |
|---|---|
| public void setMaxGrowth(final double maxGrowth) Set the maximal growth factor for stepsize control.
| |
| setMinReduction | back to summary |
|---|---|
| public void setMinReduction(final double minReduction) Set the minimal reduction factor for stepsize control.
| |
| setSafety | back to summary |
|---|---|
| public void setSafety(final double safety) Set the safety factor for stepsize control.
| |
| setStarterIntegrator | back to summary |
|---|---|
| public void setStarterIntegrator(FirstOrderFieldIntegrator<T> starterIntegrator) Set the starter integrator. The various step and event handlers for this starter integrator will be managed automatically by the multi-step integrator. Any user configuration for these elements will be cleared before use.
| |
| start | back to summary |
|---|---|
| protected void start(final FieldExpandableODE<T> equations, final FieldODEState<T> initialState, final T t) throws DimensionMismatchException, NumberIsTooSmallException, MaxCountExceededException, NoBracketingException Start the integration. This method computes one step using the underlying starter integrator, and initializes the Nordsieck vector at step start. The starter integrator purpose is only to establish initial conditions, it does not really change time by itself. The top level multistep integrator remains in charge of handling time propagation and events handling as it will starts its own computation right from the beginning. In a sense, the starter integrator can be seen as a dummy one and so it will never trigger any user event nor call any user step handler.
| |
| Modifier and Type | Field and Description |
|---|---|
| private int | count
Steps counter. |
| private final FieldEquationsMapper | mapper
Equation mapper. |
| private FieldODEStateAndDerivative | savedStart
Saved start. |
| private final T[] | t
First steps times. |
| private final T[][] | y
First steps states. |
| private final T[][] | yDot
First steps derivatives. |
| Access | Constructor and Description |
|---|---|
| pack-priv | FieldNordsieckInitializer(final FieldEquationsMapper<T>
equation mapper mapper, final int number of start points (including the initial point) nbStartPoints)Simple constructor. |
| Modifier and Type | Method and Description |
|---|---|
| public void | handleStep(FieldStepInterpolator<T>
interpolator for the last accepted step. For
efficiency purposes, the various integrators reuse the same
object on each call, so if the instance wants to keep it across
all calls (for example to provide at the end of the integration a
continuous model valid throughout the integration range, as the
interpolator, boolean ContinuousOutputModel class does), it should build a local copy
using the clone method of the interpolator and store this copy.
Keeping only a reference to the interpolator and reusing it will
result in unpredictable behavior (potentially crashing the application).true if the step is the last one isLast)Implements org. Handle the last accepted step |
| public void | init(final FieldODEStateAndDerivative<T>
initial time, state vector and derivative initialState, T target time for the integration finalTime)Implements org. Initialize step handler at the start of an ODE integration. |
| count | back to summary |
|---|---|
| private int count Steps counter. | |
| mapper | back to summary |
|---|---|
| private final FieldEquationsMapper<T> mapper Equation mapper. | |
| savedStart | back to summary |
|---|---|
| private FieldODEStateAndDerivative<T> savedStart Saved start. | |
| t | back to summary |
|---|---|
| private final T[] t First steps times. | |
| y | back to summary |
|---|---|
| private final T[][] y First steps states. | |
| yDot | back to summary |
|---|---|
| private final T[][] yDot First steps derivatives. | |
| FieldNordsieckInitializer | back to summary |
|---|---|
| pack-priv FieldNordsieckInitializer(final FieldEquationsMapper<T> mapper, final int nbStartPoints) Simple constructor.
| |
| handleStep | back to summary |
|---|---|
| public void handleStep(FieldStepInterpolator<T> interpolator, boolean isLast) throws MaxCountExceededException Implements org. Doc from org. Handle the last accepted step
| |
| init | back to summary |
|---|---|
| public void init(final FieldODEStateAndDerivative<T> initialState, T finalTime) Implements org. Doc from org. Initialize step handler at the start of an ODE integration. This method is called once at the start of the integration. It may be used by the step handler to initialize some internal data if needed.
| |
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Serializable version identifier.
|
| Access | Constructor and Description |
|---|---|
| pack-priv |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. Serializable version identifier. | |
| InitializationCompletedMarkerException | back to summary |
|---|---|
| pack-priv InitializationCompletedMarkerException() Simple constructor. | |