public abstract class AdaptiveStepsizeIntegrator extends AbstractIntegrator
These algorithms perform integration with stepsize control, which means the user does not specify the integration step but rather a tolerance on error. The error threshold is computed as
threshold_i = absTol_i + relTol_i * max(abs(ym), abs(ym + 1))where absTol_i is the absolute tolerance for component i of the state vector and relTol_i is the relative tolerance for the same component. The user can also use only two scalar values absTol and relTol which will be used for all components.
If the Ordinary Differential Equations is an extended ODE
rather than a basic ODE
, then
only the primary part
of the state vector is used for
stepsize control, not the complete state vector.
If the estimated error for ym+1 is such that
sqrt((sum(errEst_i / threshold_i) ˆ 2) / n) < 1(where n is the main set dimension) then the step is accepted, otherwise the step is rejected and a new attempt is made with a new stepsize.
Modifier and Type | Field and Description |
---|---|
protected int |
mainSetDimension
Main set dimension.
|
protected double |
scalAbsoluteTolerance
Allowed absolute scalar error.
|
protected double |
scalRelativeTolerance
Allowed relative scalar error.
|
protected double[] |
vecAbsoluteTolerance
Allowed absolute vectorial error.
|
protected double[] |
vecRelativeTolerance
Allowed relative vectorial error.
|
isLastStep, resetOccurred, stepHandlers, stepSize, stepStart
Constructor and Description |
---|
AdaptiveStepsizeIntegrator(String name,
double minStepIn,
double maxStepIn,
double[] vecAbsoluteToleranceIn,
double[] vecRelativeToleranceIn)
Build an integrator with the given stepsize bounds.
|
AdaptiveStepsizeIntegrator(String name,
double minStepIn,
double maxStepIn,
double scalAbsoluteToleranceIn,
double scalRelativeToleranceIn)
Build an integrator with the given stepsize bounds.
|
Modifier and Type | Method and Description |
---|---|
protected double |
filterStep(double h,
boolean forward,
boolean acceptSmall)
Filter the integration step.
|
double |
getCurrentStepStart()
Get the current value of the step start time ti.
|
double |
getMaxStep()
Get the maximal step.
|
double |
getMinStep()
Get the minimal step.
|
double |
initializeStep(boolean forward,
int order,
double[] scale,
double t0,
double[] y0,
double[] yDot0,
double[] y1,
double[] yDot1,
double t)
Initialize the integration step.
|
abstract void |
integrate(ExpandableStatefulODE equations,
double t)
Integrate a set of differential equations up to the given time.
|
protected void |
resetInternalState()
Reset internal state to dummy values.
|
protected void |
sanityChecks(ExpandableStatefulODE equations,
double t)
Check the integration span.
|
void |
setInitialStepSize(double initialStepSize)
Set the initial step size.
|
void |
setStepSizeControl(double minimalStep,
double maximalStep,
double[] absoluteTolerance,
double[] relativeTolerance)
Set the adaptive step size control parameters.
|
void |
setStepSizeControl(double minimalStep,
double maximalStep,
double absoluteTolerance,
double relativeTolerance)
Set the adaptive step size control parameters.
|
acceptStep, addEventHandler, addEventHandler, addStepHandler, clearEventHandlers, clearStepHandlers, computeDerivatives, getCurrentSignedStepsize, getEvaluations, getEventHandlers, getMaxEvaluations, getName, getStepHandlers, initIntegration, integrate, setEquations, setMaxEvaluations, setStateInitialized
protected double scalAbsoluteTolerance
protected double scalRelativeTolerance
protected double[] vecAbsoluteTolerance
protected double[] vecRelativeTolerance
protected int mainSetDimension
public AdaptiveStepsizeIntegrator(String name, double minStepIn, double maxStepIn, double scalAbsoluteToleranceIn, double scalRelativeToleranceIn)
name
- name of the methodminStepIn
- minimal step (sign is irrelevant, regardless of
integration direction, forward or backward), the last step can
be smaller than thismaxStepIn
- maximal step (sign is irrelevant, regardless of
integration direction, forward or backward), the last step can
be smaller than thisscalAbsoluteToleranceIn
- allowed absolute errorscalRelativeToleranceIn
- allowed relative errorpublic AdaptiveStepsizeIntegrator(String name, double minStepIn, double maxStepIn, double[] vecAbsoluteToleranceIn, double[] vecRelativeToleranceIn)
name
- name of the methodminStepIn
- minimal step (sign is irrelevant, regardless of
integration direction, forward or backward), the last step can
be smaller than thismaxStepIn
- maximal step (sign is irrelevant, regardless of
integration direction, forward or backward), the last step can
be smaller than thisvecAbsoluteToleranceIn
- allowed absolute errorvecRelativeToleranceIn
- allowed relative errorpublic void setStepSizeControl(double minimalStep, double maximalStep, double absoluteTolerance, double relativeTolerance)
A side effect of this method is to also reset the initial step so it will be automatically computed by the
integrator if setInitialStepSize
is not called by the user.
minimalStep
- minimal step (must be positive even for backward
integration), the last step can be smaller than thismaximalStep
- maximal step (must be positive even for backward
integration)absoluteTolerance
- allowed absolute errorrelativeTolerance
- allowed relative errorpublic void setStepSizeControl(double minimalStep, double maximalStep, double[] absoluteTolerance, double[] relativeTolerance)
A side effect of this method is to also reset the initial step so it will be automatically computed by the
integrator if setInitialStepSize
is not called by the user.
minimalStep
- minimal step (must be positive even for backward
integration), the last step can be smaller than thismaximalStep
- maximal step (must be positive even for backward
integration)absoluteTolerance
- allowed absolute errorrelativeTolerance
- allowed relative errorpublic void setInitialStepSize(double initialStepSize)
This method allows the user to specify an initial positive step size instead of letting the integrator guess it by itself. If this method is not called before integration is started, the initial step size will be estimated by the integrator.
initialStepSize
- initial step size to use (must be positive even
for backward integration ; providing a negative value or a value
outside of the min/max step interval will lead the integrator to
ignore the value and compute the initial step size by itself)protected void sanityChecks(ExpandableStatefulODE equations, double t)
sanityChecks
in class AbstractIntegrator
equations
- set of differential equationst
- target time for the integrationpublic double initializeStep(boolean forward, int order, double[] scale, double t0, double[] y0, double[] yDot0, double[] y1, double[] yDot1, double t)
forward
- forward integration indicatororder
- order of the methodscale
- scaling vector for the state vector (can be shorter than state vector)t0
- start timey0
- state vector at t0yDot0
- first time derivative of y0y1
- work array for a state vectoryDot1
- work array for the first time derivative of y1t
- final integration timeMaxCountExceededException
- if the number of functions evaluations is exceededDimensionMismatchException
- if arrays dimensions do not match equations settingsprotected double filterStep(double h, boolean forward, boolean acceptSmall)
h
- signed stepforward
- forward integration indicatoracceptSmall
- if true, steps smaller than the minimal value
are silently increased up to this value, if false such small
steps generate an exceptionNumberIsTooSmallException
- if the step is too small and acceptSmall is falsepublic abstract void integrate(ExpandableStatefulODE equations, double t)
This method solves an Initial Value Problem (IVP).
The set of differential equations is composed of a main set, which can be extended by some sets of secondary equations. The set of equations must be already set up with initial time and partial states. At integration completion, the final time and partial states will be available in the same object.
Since this method stores some internal state variables made available in its public interface during integration
(AbstractIntegrator.getCurrentSignedStepsize()
), it is not thread-safe.
integrate
in class AbstractIntegrator
equations
- complete set of differential equations to integratet
- target time for the integration
(can be set to a value smaller than t0
for backward integration)public double getCurrentStepStart()
This method can be called during integration (typically by the object implementing the
differential equations
problem) if the value of the current step that is attempted is needed.
The result is undefined if the method is called outside of calls to integrate
.
getCurrentStepStart
in interface ODEIntegrator
getCurrentStepStart
in class AbstractIntegrator
protected void resetInternalState()
public double getMinStep()
public double getMaxStep()
Copyright © 2017 CNES. All rights reserved.