Class MultistepFieldIntegrator<T extends CalculusFieldElement<T>>
- Type Parameters:
T
- the type of the field elements
- All Implemented Interfaces:
FieldODEIntegrator<T>
- Direct Known Subclasses:
AdamsFieldIntegrator
We define scaled derivatives si(n) at step n as: \[ \left\{\begin{align} s_1(n) &= h y'_n \text{ for first derivative}\\ s_2(n) &= \frac{h^2}{2} y_n'' \text{ for second derivative}\\ s_3(n) &= \frac{h^3}{6} y_n''' \text{ for third derivative}\\ &\cdots\\ s_k(n) &= \frac{h^k}{k!} y_n^{(k)} \text{ for } k^\mathrm{th} \text{ derivative} \end{align}\right. \]
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: \[ r_n = [ s_2(n), s_3(n) \ldots s_k(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.
-
Field Summary
Modifier and TypeFieldDescriptionprotected Array2DRowFieldMatrix<T>
Nordsieck matrix of the higher scaled derivatives.protected T[]
First scaled derivative (h y'). -
Constructor Summary
ModifierConstructorDescriptionprotected
MultistepFieldIntegrator
(Field<T> field, String name, int nSteps, int order, double minStep, double maxStep, double[] vecAbsoluteTolerance, double[] vecRelativeTolerance) Build a multistep integrator with the given stepsize bounds.protected
MultistepFieldIntegrator
(Field<T> field, String name, int nSteps, int order, double minStep, double maxStep, double scalAbsoluteTolerance, double scalRelativeTolerance) Build a multistep integrator with the given stepsize bounds. -
Method Summary
Modifier and TypeMethodDescriptionprotected double
computeStepGrowShrinkFactor
(double error) Compute step grow/shrink factor according to normalized error.double
Get the maximal growth factor for stepsize control.double
Get the minimal reduction factor for stepsize control.int
Get the number of steps of the multistep method (excluding the one being computed).double
Get the safety factor for stepsize control.Get the starter integrator.protected abstract Array2DRowFieldMatrix<T>
initializeHighOrderDerivatives
(T h, T[] t, T[][] y, T[][] yDot) Initialize the high order scaled derivatives at step start.protected void
Rescale the instance.void
setMaxGrowth
(double maxGrowth) Set the maximal growth factor for stepsize control.void
setMinReduction
(double minReduction) Set the minimal reduction factor for stepsize control.void
setSafety
(double safety) Set the safety factor for stepsize control.void
setStarterIntegrator
(FieldODEIntegrator<T> starterIntegrator) Set the starter integrator.protected void
start
(FieldExpandableODE<T> equations, FieldODEState<T> initialState, T t) Start the integration.Methods inherited from class org.hipparchus.ode.nonstiff.AdaptiveStepsizeFieldIntegrator
getMaxStep, getMinStep, getStepSizeHelper, initializeStep, resetInternalState, sanityChecks, setInitialStepSize, setStepSizeControl, setStepSizeControl
Methods inherited from class org.hipparchus.ode.AbstractFieldIntegrator
acceptStep, addEventDetector, addStepEndHandler, addStepHandler, clearEventDetectors, clearStepEndHandlers, clearStepHandlers, computeDerivatives, getCurrentSignedStepsize, getEquations, getEvaluations, getEvaluationsCounter, getEventDetectors, getField, getMaxEvaluations, getName, getStepEndHandlers, getStepHandlers, getStepSize, getStepStart, incrementEvaluations, initIntegration, isLastStep, resetOccurred, setIsLastStep, setMaxEvaluations, setStateInitialized, setStepSize, setStepStart
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.hipparchus.ode.FieldODEIntegrator
integrate
-
Field Details
-
scaled
First scaled derivative (h y'). -
nordsieck
Nordsieck matrix of the higher scaled derivatives.(h2/2 y'', h3/6 y''' ..., hk/k! y(k))
-
-
Constructor Details
-
MultistepFieldIntegrator
protected MultistepFieldIntegrator(Field<T> field, String name, int nSteps, int order, double minStep, double maxStep, double scalAbsoluteTolerance, double scalRelativeTolerance) throws MathIllegalArgumentException Build a multistep integrator with the given stepsize bounds.The default starter integrator is set to the
Dormand-Prince 8(5,3)
integrator with some defaults settings.The default max growth factor is set to a quite low value: 21/order.
- Parameters:
field
- field to which the time and state vector elements belongname
- name of the methodnSteps
- number of steps of the multistep method (excluding the one being computed)order
- order of the methodminStep
- minimal step (must be positive even for backward integration), the last step can be smaller than thismaxStep
- maximal step (must be positive even for backward integration)scalAbsoluteTolerance
- allowed absolute errorscalRelativeTolerance
- allowed relative error- Throws:
MathIllegalArgumentException
- if number of steps is smaller than 2
-
MultistepFieldIntegrator
protected MultistepFieldIntegrator(Field<T> field, String name, int nSteps, int order, double minStep, double maxStep, double[] vecAbsoluteTolerance, double[] vecRelativeTolerance) Build a multistep integrator with the given stepsize bounds.The default starter integrator is set to the
Dormand-Prince 8(5,3)
integrator with some defaults settings.The default max growth factor is set to a quite low value: 21/order.
- Parameters:
field
- field to which the time and state vector elements belongname
- name of the methodnSteps
- number of steps of the multistep method (excluding the one being computed)order
- order of the methodminStep
- minimal step (must be positive even for backward integration), the last step can be smaller than thismaxStep
- maximal step (must be positive even for backward integration)vecAbsoluteTolerance
- allowed absolute errorvecRelativeTolerance
- allowed relative error
-
-
Method Details
-
getStarterIntegrator
Get the starter integrator.- Returns:
- starter integrator
-
setStarterIntegrator
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.
- Parameters:
starterIntegrator
- starter integrator
-
start
protected void start(FieldExpandableODE<T> equations, FieldODEState<T> initialState, T t) throws MathIllegalArgumentException, MathIllegalStateException 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.
- Parameters:
equations
- complete set of differential equations to integrateinitialState
- initial state (time, primary and secondary state vectors)t
- target time for the integration (can be set to a value smaller thant0
for backward integration)- Throws:
MathIllegalArgumentException
- if arrays dimension do not match equations settingsMathIllegalArgumentException
- if integration step is too smallMathIllegalStateException
- if the number of functions evaluations is exceededMathIllegalArgumentException
- if the location of an event cannot be bracketed
-
initializeHighOrderDerivatives
protected abstract Array2DRowFieldMatrix<T> initializeHighOrderDerivatives(T h, T[] t, T[][] y, T[][] yDot) Initialize the high order scaled derivatives at step start.- Parameters:
h
- step size to use for scalingt
- first steps timesy
- first steps statesyDot
- first steps derivatives- Returns:
- Nordieck vector at first step (h2/2 y''n, h3/6 y'''n ... hk/k! y(k)n)
-
getMinReduction
public double getMinReduction()Get the minimal reduction factor for stepsize control.- Returns:
- minimal reduction factor
-
setMinReduction
public void setMinReduction(double minReduction) Set the minimal reduction factor for stepsize control.- Parameters:
minReduction
- minimal reduction factor
-
getMaxGrowth
public double getMaxGrowth()Get the maximal growth factor for stepsize control.- Returns:
- maximal growth factor
-
setMaxGrowth
public void setMaxGrowth(double maxGrowth) Set the maximal growth factor for stepsize control.- Parameters:
maxGrowth
- maximal growth factor
-
getSafety
public double getSafety()Get the safety factor for stepsize control.- Returns:
- safety factor
-
setSafety
public void setSafety(double safety) Set the safety factor for stepsize control.- Parameters:
safety
- safety factor
-
getNSteps
public int getNSteps()Get the number of steps of the multistep method (excluding the one being computed).- Returns:
- number of steps of the multistep method (excluding the one being computed)
-
rescale
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.
- Parameters:
newStepSize
- new step size to use in the scaled and Nordsieck arrays
-
computeStepGrowShrinkFactor
protected double computeStepGrowShrinkFactor(double error) Compute step grow/shrink factor according to normalized error.- Parameters:
error
- normalized error of the current step- Returns:
- grow/shrink factor for next step
-