One typical use case is the computation of the Jacobian matrix for some ODE. In this case, the primary set of equations corresponds to the raw ODE, and we add to this set another bunch of secondary equations which represent the Jacobian matrix of the primary set.
We want the integrator to use only the primary set to estimate the
errors and hence the step sizes. It should not use the secondary
equations in this computation. The integrator will
be able to know where the primary set ends and so where the secondary sets begin.
FirstOrderDifferentialEquations, JacobianMatrices
| Modifier and Type | Class and Description |
|---|---|
| private static class | ExpandableStatefulODE.
Components of the compound stateful ODE. |
| Modifier and Type | Field and Description |
|---|---|
| private List | components
Components of the expandable ODE. |
| private final FirstOrderDifferentialEquations | primary
Primary differential equation. |
| private final EquationsMapper | primaryMapper
Mapper for primary equation. |
| private final double[] | primaryState
State. |
| private final double[] | primaryStateDot
State derivative. |
| private double | time
Time. |
| Access | Constructor and Description |
|---|---|
| public | ExpandableStatefulODE(final FirstOrderDifferentialEquations
the primary set of differential equations to be integrated. primary)Build an expandable set from its primary ODE set. |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: index of the secondary equation in the expanded statesecondary equations set secondary)Add a set of secondary equations to be integrated along with the primary set. |
| public void | computeDerivatives(final double
current value of the independent time variable t, final double[] array containing the current value of the complete state vector y, final double[] placeholder array where to put the time derivative of the complete state vector yDot)Get the current time derivative of the complete state vector. |
| public double[] | |
| public FirstOrderDifferentialEquations | Returns: primary set of differential equationsGet the primary set of differential equations. |
| public EquationsMapper | Returns: mapper for the primary setGet an equations mapper for the primary equations set. |
| public double[] | |
| public double[] | Returns: primary part of the current state derivativeGet primary part of the current state derivative. |
| public EquationsMapper[] | Returns: equations mappers for the secondary equations setsGet the equations mappers for the secondary equations sets. |
| public double[] | Returns: secondary part of the current stateindex of the part to set as returned by index)addSecondaryEquations(SecondaryEquations)Get secondary part of the current state. |
| public double[] | Returns: secondary part of the current state derivativeindex of the part to set as returned by index)addSecondaryEquations(SecondaryEquations)Get secondary part of the current state derivative. |
| public double | |
| public int | Returns: dimension of the complete set of equationsReturn the dimension of the complete set of equations. |
| public void | setCompleteState(final double[]
complete current state to copy data from completeState)Set the complete current state. |
| public void | setPrimaryState(final double[]
primary part of the current state primaryState)Set primary part of the current state. |
| public void | setSecondaryState(final int
index of the part to set as returned by index, final double[] addSecondaryEquations(SecondaryEquations)secondary part of the current state secondaryState)Set secondary part of the current state. |
| public void |
| components | back to summary |
|---|---|
| private List<ExpandableStatefulODE. Components of the expandable ODE. | |
| primary | back to summary |
|---|---|
| private final FirstOrderDifferentialEquations primary Primary differential equation. | |
| primaryMapper | back to summary |
|---|---|
| private final EquationsMapper primaryMapper Mapper for primary equation. | |
| primaryState | back to summary |
|---|---|
| private final double[] primaryState State. | |
| primaryStateDot | back to summary |
|---|---|
| private final double[] primaryStateDot State derivative. | |
| time | back to summary |
|---|---|
| private double time Time. | |
| ExpandableStatefulODE | back to summary |
|---|---|
| public ExpandableStatefulODE(final FirstOrderDifferentialEquations primary) Build an expandable set from its primary ODE set.
| |
| addSecondaryEquations | back to summary |
|---|---|
| public int addSecondaryEquations(final SecondaryEquations secondary) Add a set of secondary equations to be integrated along with the primary set.
| |
| computeDerivatives | back to summary |
|---|---|
| public void computeDerivatives(final double t, final double[] y, final double[] yDot) throws MaxCountExceededException, DimensionMismatchException Get the current time derivative of the complete state vector.
| |
| getCompleteState | back to summary |
|---|---|
| public double[] getCompleteState() throws DimensionMismatchException Get the complete current state.
| |
| getPrimary | back to summary |
|---|---|
| public FirstOrderDifferentialEquations getPrimary() Get the primary set of differential equations.
| |
| getPrimaryMapper | back to summary |
|---|---|
| public EquationsMapper getPrimaryMapper() Get an equations mapper for the primary equations set.
| |
| getPrimaryState | back to summary |
|---|---|
| public double[] getPrimaryState() Get primary part of the current state.
| |
| getPrimaryStateDot | back to summary |
|---|---|
| public double[] getPrimaryStateDot() Get primary part of the current state derivative.
| |
| getSecondaryMappers | back to summary |
|---|---|
| public EquationsMapper[] getSecondaryMappers() Get the equations mappers for the secondary equations sets.
| |
| getSecondaryState | back to summary |
|---|---|
| public double[] getSecondaryState(final int index) Get secondary part of the current state.
| |
| getSecondaryStateDot | back to summary |
|---|---|
| public double[] getSecondaryStateDot(final int index) Get secondary part of the current state derivative.
| |
| getTime | back to summary |
|---|---|
| public double getTime() Get current time.
| |
| getTotalDimension | back to summary |
|---|---|
| public int getTotalDimension() Return the dimension of the complete set of equations. The complete set of equations correspond to the primary set plus all secondary sets.
| |
| setCompleteState | back to summary |
|---|---|
| public void setCompleteState(final double[] completeState) throws DimensionMismatchException Set the complete current state.
| |
| setPrimaryState | back to summary |
|---|---|
| public void setPrimaryState(final double[] primaryState) throws DimensionMismatchException Set primary part of the current state.
| |
| setSecondaryState | back to summary |
|---|---|
| public void setSecondaryState(final int index, final double[] secondaryState) throws DimensionMismatchException Set secondary part of the current state.
| |
| setTime | back to summary |
|---|---|
| public void setTime(final double time) Set current time.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final SecondaryEquations | equation
Secondary differential equation. |
| private final EquationsMapper | mapper
Mapper between local and complete arrays. |
| private final double[] | state
State. |
| private final double[] | stateDot
State derivative. |
| Access | Constructor and Description |
|---|---|
| pack-priv | SecondaryComponent(final SecondaryEquations
secondary differential equation equation, final int index to use for the first element in the complete arrays firstIndex)Simple constructor. |
| equation | back to summary |
|---|---|
| private final SecondaryEquations equation Secondary differential equation. | |
| mapper | back to summary |
|---|---|
| private final EquationsMapper mapper Mapper between local and complete arrays. | |
| state | back to summary |
|---|---|
| private final double[] state State. | |
| stateDot | back to summary |
|---|---|
| private final double[] stateDot State derivative. | |
| SecondaryComponent | back to summary |
|---|---|
| pack-priv SecondaryComponent(final SecondaryEquations equation, final int firstIndex) Simple constructor.
| |