ODE
solver for ordinary differential equations (ODE)
Let us solve ordinary differential equations (
ODE) of the form
\begin{align} A \frac{dY}{dt} + B Y = Q,\end{align}
where \( Y\) is the unknown variable to be integrated and \( A, B, Q\) are user given.
The numerical scheme of second order in time, which is used in
MESHFREE to solve this type of equations, is Crank-Nicolson-like.
\begin{align} \left( A^{n+1} + A^n \right) \cdot \frac{Y^{n+1} - Y^n}{ \Delta t} + \left( B^{n+1} Y^{n+1} + B^n Y^n \right) = Q^{n+1} + Q^n\end{align}
The resulting equation for the unknown is:
\begin{align} Y^{n+1} = \frac{1}{ \frac{1}{\Delta t} (A^{n+1} + A^n)+B^{n+1}} \cdot \left( Q^{n+1} + Q^n + \left( \frac{1}{\Delta t} (A^{n+1} + A^n) - B^n \right) \cdot Y^n \right)\end{align}
In
USER_common_variables the n-th
ODE to be solved is defined by:
A,
B,
Q: parameters in the model equation which are subject to
RightHandSideExpression
(
Equations,
Curves, etc. which also might vary in time)
Y0: initial value of the solution at start time which is also subject to
RightHandSideExpression,
however, it is only evaluated at the beginning of the simulation.
Note: Currently, the number of
ODE is limited to 1000.
The result of the time integration of an
ODE can be retrieved by
Equations (see
ode())
and, therefore, be used in all other functionalities of
USER_common_variables.