NAME
diffeqn_op - integrate differential equation
PROTOTYPE
unitptr diffeqn_op( int iNumOperands, int iDim, unitptr uHost)
ARGUMENTS
- int iNumOperands
- number of operands called at each step to compute vector y=F(x,t) of first derivatives
- int iDim
- dimension of state vector x (same as dimension of derivative vector y )
- unitptr uHost
- host unit of created unit
INTERFACE:
- X_in[2]
- lower bound t0 and upper bound t1 of integration
interval [t0,t1]
- Y_in[Dim]
- starting values of state vector x at t=t0
- Z_in[Dim]
- vector of first derivatives dx/dt (this input
must be obtained from the operand units!)
- EPS_in[3]
- integration parameters: eps (required accurracy),
guessed step size and minimum allowed step size.
- CTL_in[1]
- control input: step size parameter h, initialized
with guessed step size.
- X_out[1]:
- current value of time variable t
(must be used by the operand units;
this value is updated by the diff_eqn unit
before each call of its operands)
- Y_out[iDim]:
- value of state vector x at current time t.
Contains result after execution of diff_eqn
- Z_out[2]:
- nr1 of good and nr2 of bad steps
DESCRIPTION:
Integrates the system of first order differential equations
dx(t)
----- = F(x(t),t), (1)
dt
over a time interval [t0,t1], using an adaptive stepsize
Runge-Kutta method. x(t) is the Dim dimensional state vector,
whose initial value x(t0) must be provided at input field Y_in,
and F(.) is a vector-valued function that must provide values
for the Dim first time derivatives at time t.
F(.) must be given in form of a number of operand units that
compute F(.) from x(t) and t. Suitable values for t and
x must be taken from the diffeqn_op unit (output fields
0 and 1), and the computed result vector F must be fed back
to input field Z_in[] of the diffeqn_op unit. All necessary
calls of the operand units (including the necessary
prior assignments of values to t and x(t) ) are then
performed entirely under the control of the diffeqn_op
operator unit.
EXECUTION:
The first execution call (after creation of the unit or
after the last INIT or RESET) integrates the ODE (1)
from t=t0 to t=t0+h, with h given by h=CTL_in[0] and
an initial value of x(t0)[i]=.Y_in[i], ( i=0..Dim-1 ).
After the execution call, X_out[0] will contain the
incremented time t=t0+h, and Y_out[] will contain the
elements of the associated state vector x(t0+h).
Each successive call will continue the integration for
another time increment h (which may be changed, if desired),
using the previously computed values for t and x(t) as
the new initial conditions.
Internally, a single execution call of the diffeqn_op unit makes a
number of execution calls to its operand units (for
various intermediate values of t and x(t) ) to integrate
the underlying ODE from t=t0 to t=t1. Uses internally
the rungekutta4 - unit. After the execution step is complete,
Y_out holds the new value x(t1) of the state vector.
CONTROL MODES:
- NST_INIT,NST_RESET:
- set X_out[0]=t0 (the start of the
integration interval) and replace output values Y_out[] by
current initial values at Y_in[]. Z_out[] will be zeroed.
The next execution call will then integrate the ODE (1)
from t=t0 to t=t0+h with h given by h=CTL_in[0],
using initial values x(t0)[i]=.Y_in[i], ( i=0..Dim-1 ).
After the execution call, X_out[0] will contain the
incremented time t=t0+h, and Y_out[] will contain the
elements of the associated state vector x(t0+h).
SEE ALSO:
rungekutta4
FILE
/local/homes/rhaschke/nst7/man/../o.linx86_64//../foldersrc/nst_math.c