public class ComplexODEConverter extends Object
complex Ordinary
Differential Equations
into real ones
.
This class is a wrapper around a ComplexOrdinaryDifferentialEquation
which
allow to use a ODEIntegrator
to integrate it.
The transformation is done by changing the n dimension state vector to a 2n dimension vector, where the even components are real parts and odd components are imaginary parts.
One should be aware that the data is duplicated during the
transformation process and that for each call to computeDerivatives
, this wrapper does copy 4n scalars : 2n before
the call to computeDerivatives
in order to dispatch the y state vector,
and 2n after the call to gather zDot. Since the underlying problem
by itself perhaps also needs to copy data and dispatch the arrays
into domain objects, this has an impact on both memory and CPU usage.
The only way to avoid this duplication is to perform the transformation
at the problem level, i.e. to implement the problem as a first order one
and then avoid using this class.
The proper way to use the converter is as follows:
ODEIntegrator integrator = ...build some integrator...; ComplexOrdinaryDifferentialEquation complexEquations = ...set up the complex problem...; ComplexODEState initialState = ...set up initial state...; ComplexODEConverter converter = new ComplexODEConverter(); ComplexODEStateAndDerivative finalstate = converter.convertStateAndDerivative(integrator.integrate(converter.convertEquations(complexEquations), converter.convertState(initialState), t);
If there are complex secondary equations
, they must be converted
too and both the converted primary equations and converted secondary equations must be
combined together using ExpandableODE
as usual for regular real equations.
ComplexOrdinaryDifferentialEquation
,
OrdinaryDifferentialEquation
Constructor and Description |
---|
ComplexODEConverter() |
Modifier and Type | Method and Description |
---|---|
OrdinaryDifferentialEquation |
convertEquations(ComplexOrdinaryDifferentialEquation equations)
Convert an equations set.
|
SecondaryODE |
convertSecondaryEquations(ComplexSecondaryODE equations)
Convert a secondary equations set.
|
ODEState |
convertState(ComplexODEState state)
Convert a complex state (typically the initial state).
|
ComplexODEStateAndDerivative |
convertState(ODEStateAndDerivative state)
Convert a real state and derivatives (typically the final state or some intermediate state for
step handling or event handling).
|
public OrdinaryDifferentialEquation convertEquations(ComplexOrdinaryDifferentialEquation equations)
equations
- equations to convertpublic SecondaryODE convertSecondaryEquations(ComplexSecondaryODE equations)
equations
- equations to convertpublic ODEState convertState(ComplexODEState state)
state
- state to convertpublic ComplexODEStateAndDerivative convertState(ODEStateAndDerivative state)
state
- state to convertCopyright © 2016-2021 CS GROUP. All rights reserved.