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 main set
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.
Constructor and Description |
---|
AdaptiveStepsizeIntegrator(java.lang.String name,
double minStep,
double maxStep,
double[] vecAbsoluteTolerance,
double[] vecRelativeTolerance)
Build an integrator with the given stepsize bounds.
|
AdaptiveStepsizeIntegrator(java.lang.String name,
double minStep,
double maxStep,
double scalAbsoluteTolerance,
double scalRelativeTolerance)
Build an integrator with the given stepsize bounds.
|
Modifier and Type | Method and Description |
---|---|
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(FirstOrderDifferentialEquations equations,
boolean forward,
int order,
double[] scale,
double t0,
double[] y0,
double[] yDot0,
double[] y1,
double[] yDot1)
Initialize the integration step.
|
abstract double |
integrate(FirstOrderDifferentialEquations equations,
double t0,
double[] y0,
double t,
double[] y)
Integrate the differential equations up to the given time.
|
void |
setInitialStepSize(double initialStepSize)
Set the initial step size.
|
addEventHandler, addStepHandler, clearEventHandlers, clearStepHandlers, computeDerivatives, getCurrentSignedStepsize, getEvaluations, getEventHandlers, getMaxEvaluations, getName, getStepHandlers, setMaxEvaluations
public AdaptiveStepsizeIntegrator(java.lang.String name, double minStep, double maxStep, double scalAbsoluteTolerance, double scalRelativeTolerance)
name
- name 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 errorpublic AdaptiveStepsizeIntegrator(java.lang.String name, double minStep, double maxStep, double[] vecAbsoluteTolerance, double[] vecRelativeTolerance)
name
- name 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 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)public double initializeStep(FirstOrderDifferentialEquations equations, boolean forward, int order, double[] scale, double t0, double[] y0, double[] yDot0, double[] y1, double[] yDot1) throws DerivativeException
equations
- differential equations setforward
- 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 y1DerivativeException
- this exception is propagated to
the caller if the underlying user function triggers onepublic abstract double integrate(FirstOrderDifferentialEquations equations, double t0, double[] y0, double t, double[] y) throws DerivativeException, IntegratorException
This method solves an Initial Value Problem (IVP).
Since this method stores some internal state variables made
available in its public interface during integration (ODEIntegrator.getCurrentSignedStepsize()
), it is not thread-safe.
equations
- differential equations to integratet0
- initial timey0
- initial value of the state vector at t0t
- target time for the integration
(can be set to a value smaller than t0
for backward integration)y
- placeholder where to put the state vector at each successful
step (and hence at the end of integration), can be the same object as y0EventHandler
stops it at some point.DerivativeException
- this exception is propagated to the caller if
the underlying user function triggers oneIntegratorException
- if the integrator cannot perform integrationpublic 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
public double getMinStep()
public double getMaxStep()
Copyright © 2010 - 2023 Adobe. All Rights Reserved