PLUTO  4.4-patch2
Functions
cooling_ode_solver.c File Reference

Integration methods for cooling netowrk ODEs. More...

#include "pluto.h"
#include "cooling_defs.h"

Functions

double SolveODE_CK45 (double *v0, double *k1, double *v5th, double dt, double tol, intList *vars)
 
double SolveODE_RK4 (double *v0, double *k1, double *v4th, double dt, intList *var_list)
 
double SolveODE_RKF12 (double *v0, double *k1, double *v2nd, double dt, intList *vars)
 
double SolveODE_RKF23 (double *v0, double *k1, double *v3rd, double dt, intList *vars)
 

Detailed Description

Solve the system of ordinary differential equations describing optically thin cooling and ionization network (if any).

References

Authors
A. Mignone (migno.nosp@m.ne@t.nosp@m.o.inf.nosp@m.n.it)
O. Tesileanu B. Vaidya
Date
April 08, 2019

Function Documentation

◆ SolveODE_CK45()

double SolveODE_CK45 ( double *  v0,
double *  k1,
double *  v5th,
double  dt,
double  tol,
intList vars 
)

Explicit 5th order adaptive step size Cash-Karp integrator. Attempt to integrate the cooling network with a single step if the error is within the given tolerance. Otherwise, reduce the time step and repeat the integration as many times as necessary.

Parameters
[in]v_ininitial condition array
[in]k_inright hand side, R(v_in)
[out]v5thfinal solution array
[in]dtthe time step we want to achieve
[in]tolthe relative tolerance
[in]*varsthe list of dependent variables
Returns
The suggested time step for the next iteration.

◆ SolveODE_RK4()

double SolveODE_RK4 ( double *  v0,
double *  k1,
double *  v4th,
double  dt,
intList var_list 
)

Solve the system of ODE with a standard RK4 integrator (no adaptive step).

◆ SolveODE_RKF12()

double SolveODE_RKF12 ( double *  v0,
double *  k1,
double *  v2nd,
double  dt,
intList vars 
)

Explicit 2nd order integrator with 1st-order embedded solution. Attempt to integrate the cooling network with a single step if the error is within the given tolerance. The error is computed from the difference between 1st and 2nd order solutions.

Parameters
[in]v0initial condition array
[in]k1right hand side, R(v0)
[out]v2ndfinal solution array
[in]dtthe time step we want to achieve
[in]*varsthe list of dependent variables
Returns
The (scaled) error between 1st and 2nd-order solutions

◆ SolveODE_RKF23()

double SolveODE_RKF23 ( double *  v0,
double *  k1,
double *  v3rd,
double  dt,
intList vars 
)

Explicit 3rd order integrator with 2nd-order embedded solution. Attempt to integrate the cooling network with a single step if the error is within the given tolerance.

\[ y^{\rm 3rd} = y_0 + dt*(k1 + k2 + 4*k3)/6 k1 = RHS(y(0)) k2 = RHS(y(0) + dt*k1) k3 = RHS(y(0) + 0.25*dt*(k1 + k2)) y(2nd) = y(0) + dt*(k1 + k2)/2 \]

The error is computed from the difference between 1st and 2nd order solutions.

Parameters
[in]v0initial condition array
[in]k1right hand side, R(v0)
[out]v2ndfinal solution array
[in]dtthe time step we want to achieve
[in]*varsthe list of dependent variables
Returns
The (scaled) error between 2nd and 3rd-order solutions