public class ExpandableStatefulODE
extends java.lang.Object
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.SecondaryComponent
Components of the compound stateful ODE.
|
Modifier and Type | Field and Description |
---|---|
private java.util.List<ExpandableStatefulODE.SecondaryComponent> |
components
Components of the expandable ODE.
|
private FirstOrderDifferentialEquations |
primary
Primary differential equation.
|
private EquationsMapper |
primaryMapper
Mapper for primary equation.
|
private double[] |
primaryState
State.
|
private double[] |
primaryStateDot
State derivative.
|
private double |
time
Time.
|
Constructor and Description |
---|
ExpandableStatefulODE(FirstOrderDifferentialEquations primary)
Build an expandable set from its primary ODE set.
|
Modifier and Type | Method and Description |
---|---|
int |
addSecondaryEquations(SecondaryEquations secondary)
Add a set of secondary equations to be integrated along with the primary set.
|
void |
computeDerivatives(double t,
double[] y,
double[] yDot)
Get the current time derivative of the complete state vector.
|
double[] |
getCompleteState()
Get the complete current state.
|
FirstOrderDifferentialEquations |
getPrimary()
Get the primary set of differential equations.
|
EquationsMapper |
getPrimaryMapper()
Get an equations mapper for the primary equations set.
|
double[] |
getPrimaryState()
Get primary part of the current state.
|
double[] |
getPrimaryStateDot()
Get primary part of the current state derivative.
|
EquationsMapper[] |
getSecondaryMappers()
Get the equations mappers for the secondary equations sets.
|
double[] |
getSecondaryState(int index)
Get secondary part of the current state.
|
double[] |
getSecondaryStateDot(int index)
Get secondary part of the current state derivative.
|
double |
getTime()
Get current time.
|
int |
getTotalDimension()
Return the dimension of the complete set of equations.
|
void |
setCompleteState(double[] completeState)
Set the complete current state.
|
void |
setPrimaryState(double[] primaryState)
Set primary part of the current state.
|
void |
setSecondaryState(int index,
double[] secondaryState)
Set secondary part of the current state.
|
void |
setTime(double time)
Set current time.
|
private final FirstOrderDifferentialEquations primary
private final EquationsMapper primaryMapper
private double time
private final double[] primaryState
private final double[] primaryStateDot
private java.util.List<ExpandableStatefulODE.SecondaryComponent> components
public ExpandableStatefulODE(FirstOrderDifferentialEquations primary)
primary
- the primary set of differential equations to be integrated.public FirstOrderDifferentialEquations getPrimary()
public int getTotalDimension()
The complete set of equations correspond to the primary set plus all secondary sets.
public void computeDerivatives(double t, double[] y, double[] yDot) throws MaxCountExceededException, DimensionMismatchException
t
- current value of the independent time variabley
- array containing the current value of the complete state vectoryDot
- placeholder array where to put the time derivative of the complete state vectorMaxCountExceededException
- if the number of functions evaluations is exceededDimensionMismatchException
- if arrays dimensions do not match equations settingspublic int addSecondaryEquations(SecondaryEquations secondary)
secondary
- secondary equations setpublic EquationsMapper getPrimaryMapper()
getSecondaryMappers()
public EquationsMapper[] getSecondaryMappers()
getPrimaryMapper()
public void setTime(double time)
time
- current timepublic double getTime()
public void setPrimaryState(double[] primaryState) throws DimensionMismatchException
primaryState
- primary part of the current stateDimensionMismatchException
- if the dimension of the array does not
match the primary setpublic double[] getPrimaryState()
public double[] getPrimaryStateDot()
public void setSecondaryState(int index, double[] secondaryState) throws DimensionMismatchException
index
- index of the part to set as returned by addSecondaryEquations(SecondaryEquations)
secondaryState
- secondary part of the current stateDimensionMismatchException
- if the dimension of the partial state does not
match the selected equations set dimensionpublic double[] getSecondaryState(int index)
index
- index of the part to set as returned by addSecondaryEquations(SecondaryEquations)
public double[] getSecondaryStateDot(int index)
index
- index of the part to set as returned by addSecondaryEquations(SecondaryEquations)
public void setCompleteState(double[] completeState) throws DimensionMismatchException
completeState
- complete current state to copy data fromDimensionMismatchException
- if the dimension of the complete state does not
match the complete equations sets dimensionpublic double[] getCompleteState() throws DimensionMismatchException
DimensionMismatchException
- if the dimension of the complete state does not
match the complete equations sets dimensionCopyright (c) 2003-2014 Apache Software Foundation