Package org.hipparchus.ode.nonstiff
Class AdamsFieldIntegrator<T extends CalculusFieldElement<T>>
java.lang.Object
org.hipparchus.ode.AbstractFieldIntegrator<T>
org.hipparchus.ode.nonstiff.AdaptiveStepsizeFieldIntegrator<T>
org.hipparchus.ode.MultistepFieldIntegrator<T>
org.hipparchus.ode.nonstiff.AdamsFieldIntegrator<T>
- Type Parameters:
T
- the type of the field elements
- All Implemented Interfaces:
FieldODEIntegrator<T>
- Direct Known Subclasses:
AdamsBashforthFieldIntegrator
,AdamsMoultonFieldIntegrator
public abstract class AdamsFieldIntegrator<T extends CalculusFieldElement<T>>
extends MultistepFieldIntegrator<T>
Base class for
Adams-Bashforth
and
Adams-Moulton
integrators.-
Field Summary
Fields inherited from class org.hipparchus.ode.MultistepFieldIntegrator
nordsieck, scaled
-
Constructor Summary
ConstructorDescriptionAdamsFieldIntegrator
(Field<T> field, String name, int nSteps, int order, double minStep, double maxStep, double[] vecAbsoluteTolerance, double[] vecRelativeTolerance) Build an Adams integrator with the given order and step control parameters.AdamsFieldIntegrator
(Field<T> field, String name, int nSteps, int order, double minStep, double maxStep, double scalAbsoluteTolerance, double scalRelativeTolerance) Build an Adams integrator with the given order and step control parameters. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract double
errorEstimation
(T[] previousState, T predictedTime, T[] predictedState, T[] predictedScaled, FieldMatrix<T> predictedNordsieck) Estimate error.protected abstract org.hipparchus.ode.nonstiff.AdamsFieldStateInterpolator<T>
finalizeStep
(T stepSize, T[] predictedState, T[] predictedScaled, Array2DRowFieldMatrix<T> predictedNordsieck, boolean isForward, FieldODEStateAndDerivative<T> globalPreviousState, FieldODEStateAndDerivative<T> globalCurrentState, FieldEquationsMapper<T> equationsMapper) Finalize the step.protected Array2DRowFieldMatrix<T>
initializeHighOrderDerivatives
(T h, T[] t, T[][] y, T[][] yDot) Initialize the high order scaled derivatives at step start.integrate
(FieldExpandableODE<T> equations, FieldODEState<T> initialState, T finalTime) Integrate the differential equations up to the given time.updateHighOrderDerivativesPhase1
(Array2DRowFieldMatrix<T> highOrder) Update the high order scaled derivatives for Adams integrators (phase 1).void
updateHighOrderDerivativesPhase2
(T[] start, T[] end, Array2DRowFieldMatrix<T> highOrder) Update the high order scaled derivatives Adams integrators (phase 2).Methods inherited from class org.hipparchus.ode.MultistepFieldIntegrator
computeStepGrowShrinkFactor, getMaxGrowth, getMinReduction, getNSteps, getSafety, getStarterIntegrator, rescale, setMaxGrowth, setMinReduction, setSafety, setStarterIntegrator, start
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
-
Constructor Details
-
AdamsFieldIntegrator
public AdamsFieldIntegrator(Field<T> field, String name, int nSteps, int order, double minStep, double maxStep, double scalAbsoluteTolerance, double scalRelativeTolerance) throws MathIllegalArgumentException Build an Adams integrator with the given order and step control parameters.- Parameters:
field
- field to which the time and state vector elements belongname
- name of the methodnSteps
- number of steps of the method excluding the one being computedorder
- order of the methodminStep
- minimal step (sign is irrelevant, regardless of integration direction, forward or backward), the last step can be smaller than thismaxStep
- maximal step (sign is irrelevant, regardless of integration direction, forward or backward), the last step can be smaller than thisscalAbsoluteTolerance
- allowed absolute errorscalRelativeTolerance
- allowed relative error- Throws:
MathIllegalArgumentException
- if order is 1 or less
-
AdamsFieldIntegrator
public AdamsFieldIntegrator(Field<T> field, String name, int nSteps, int order, double minStep, double maxStep, double[] vecAbsoluteTolerance, double[] vecRelativeTolerance) throws IllegalArgumentException Build an Adams integrator with the given order and step control parameters.- Parameters:
field
- field to which the time and state vector elements belongname
- name of the methodnSteps
- number of steps of the method excluding the one being computedorder
- order of the methodminStep
- minimal step (sign is irrelevant, regardless of integration direction, forward or backward), the last step can be smaller than thismaxStep
- maximal step (sign is irrelevant, regardless of integration direction, forward or backward), the last step can be smaller than thisvecAbsoluteTolerance
- allowed absolute errorvecRelativeTolerance
- allowed relative error- Throws:
IllegalArgumentException
- if order is 1 or less
-
-
Method Details
-
integrate
public FieldODEStateAndDerivative<T> integrate(FieldExpandableODE<T> equations, FieldODEState<T> initialState, T finalTime) throws MathIllegalArgumentException, MathIllegalStateException Integrate the differential equations up to the given time.This method solves an Initial Value Problem (IVP).
Since this method stores some internal state variables made available in its public interface during integration (
FieldODEIntegrator.getCurrentSignedStepsize()
), it is not thread-safe.- Parameters:
equations
- differential equations to integrateinitialState
- initial state (time, primary and secondary state vectors)finalTime
- target time for the integration (can be set to a value smaller thant0
for backward integration)- Returns:
- final state, its time will be the same as
finalTime
if integration reached its target, but may be different if someFieldODEEventHandler
stops it at some point. - Throws:
MathIllegalArgumentException
- if integration step is too smallMathIllegalStateException
- if the number of functions evaluations is exceeded
-
initializeHighOrderDerivatives
Initialize the high order scaled derivatives at step start.- Specified by:
initializeHighOrderDerivatives
in classMultistepFieldIntegrator<T extends CalculusFieldElement<T>>
- 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)
-
updateHighOrderDerivativesPhase1
public Array2DRowFieldMatrix<T> updateHighOrderDerivativesPhase1(Array2DRowFieldMatrix<T> highOrder) Update the high order scaled derivatives for Adams integrators (phase 1).The complete update of high order derivatives has a form similar to: \[ r_{n+1} = (s_1(n) - s_1(n+1)) P^{-1} u + P^{-1} A P r_n \] this method computes the P-1 A P rn part.
- Parameters:
highOrder
- high order scaled derivatives (h2/2 y'', ... hk/k! y(k))- Returns:
- updated high order derivatives
- See Also:
-
updateHighOrderDerivativesPhase2
public void updateHighOrderDerivativesPhase2(T[] start, T[] end, Array2DRowFieldMatrix<T> highOrder) Update the high order scaled derivatives Adams integrators (phase 2).The complete update of high order derivatives has a form similar to: \[ r_{n+1} = (s_1(n) - s_1(n+1)) P^{-1} u + P^{-1} A P r_n \] this method computes the (s1(n) - s1(n+1)) P-1 u part.
Phase 1 of the update must already have been performed.
- Parameters:
start
- first order scaled derivatives at step startend
- first order scaled derivatives at step endhighOrder
- high order scaled derivatives, will be modified (h2/2 y'', ... hk/k! y(k))- See Also:
-
errorEstimation
protected abstract double errorEstimation(T[] previousState, T predictedTime, T[] predictedState, T[] predictedScaled, FieldMatrix<T> predictedNordsieck) Estimate error.- Parameters:
previousState
- state vector at step startpredictedTime
- time at step endpredictedState
- predicted state vector at step endpredictedScaled
- predicted value of the scaled derivatives at step endpredictedNordsieck
- predicted value of the Nordsieck vector at step end- Returns:
- estimated normalized local discretization error
- Since:
- 2.0
-
finalizeStep
protected abstract org.hipparchus.ode.nonstiff.AdamsFieldStateInterpolator<T> finalizeStep(T stepSize, T[] predictedState, T[] predictedScaled, Array2DRowFieldMatrix<T> predictedNordsieck, boolean isForward, FieldODEStateAndDerivative<T> globalPreviousState, FieldODEStateAndDerivative<T> globalCurrentState, FieldEquationsMapper<T> equationsMapper) Finalize the step.- Parameters:
stepSize
- step size used in the scaled and Nordsieck arrayspredictedState
- predicted state at end of steppredictedScaled
- predicted first scaled derivativepredictedNordsieck
- predicted Nordsieck vectorisForward
- integration direction indicatorglobalPreviousState
- start of the global stepglobalCurrentState
- end of the global stepequationsMapper
- mapper for ODE equations primary and secondary components- Returns:
- step interpolator
- Since:
- 2.0
-