PLUTO  4.4-patch2
Functions
math_ode.c File Reference

Ordinary differential equation solvers. More...

#include "pluto.h"

Functions

void ODE_Solve (double *y0, int nvar, double xbeg, double xend, double dx, void(*rhs)(double, double *, double *), int method)
 

Detailed Description

Author
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
Date
Sep 12, 2018

Function Documentation

◆ ODE_Solve()

void ODE_Solve ( double *  y0,
int  nvar,
double  xbeg,
double  xend,
double  dx,
void(*)(double, double *, double *)  rhs,
int  method 
)

Main driver for the numerical integration of a system of standard ordinary differential equations (ODEs) of the type

\[ \frac{dy}{dx} = f(x,y) \]

where x is the independent variable and y[] is a vector of unknowns.

Parameters
[in,out]y0on input, y0 is an array containing the initial condition at x=xbeg; on output it is replaced by the value of the function at x=xend
[in]nvaran integer number specifying the number of variable (i.e. the dimension of y0[])
[in]xbegthe initial integration point
[in]xendthe final integration point
[in]dxthe initial (suggested) step size
[in]rhsa pointer to a function of the form rhs(x,*y,*f) giving the right hand side $f(x,y)$ of the ODE.
[in]methodan integer specifying the integration algorithm. Possible choices are ODE_RK2 (fixed step size, 2nd order Runge-Kutta), ODE_RK4 (fixed step size, 4th order Runge-Kutta), ODE_CK45 (adaptive step size, 5th order Cash-Karp algorithm).