Module responsible for integration of differential equations, useful when setting equilibria or integrating the equilibrium equation. Contains subroutines to numerically solve the following systems of differential equations: These are solved using a fifth-order Runge-Kutta method.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=dp), | intent(in) | :: | x |
Numerically integrates the differential equation
using a fifth-order Runge-Kutta method.
The functions A(x) and B(x) are passed as arguments and should be conform to the
given interface, that is, these should be real(dp)
functions which take a single
real(dp), intent(in)
argument.
The integration is performed on the interval [x0, x1] with a stepsize of
dh = (x1 - x0) / (nbpoints - 1)
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=dp), | intent(in) | :: | x0 | start of x-interval |
||
real(kind=dp), | intent(in) | :: | x1 | end of x-interval |
||
procedure(func) | :: | ax_func | function to calculate A(x) |
|||
procedure(func) | :: | bx_func | function to calculate B(x) |
|||
integer, | intent(in) | :: | nbpoints | number of points, determines stepsize |
||
real(kind=dp), | intent(in) | :: | yinit | initial value of y |
||
real(kind=dp), | intent(out), | allocatable | :: | yvalues(:) | integrated values of y |
|
real(kind=dp), | intent(out), | optional | allocatable | :: | xvalues(:) | x-values corresponding to integrated y-values |
Calculates the Runge-Kutta coefficients and calculates the fourth and fifth order solutions for step i+1 based on the values at step i.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=dp), | intent(in) | :: | xi | current x value |
||
real(kind=dp), | intent(in) | :: | dh | current step size |
||
procedure(func) | :: | ax_func | function to calculate A(x) |
|||
procedure(func) | :: | bx_func | function to calculate B(x) |
|||
real(kind=dp), | intent(in) | :: | yi | current y value |
||
real(kind=dp), | intent(out) | :: | ysolrk4 | fourth order solution |
||
real(kind=dp), | intent(out) | :: | ysolrk5 | fifth order solution |