Hex  1.0
Hydrogen-electron collision solver
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Functions
ode.h File Reference
#include <gsl/gsl_odeiv2.h>
#include "misc.h"
Include dependency graph for ode.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DIVERGENCE_THRESHOLD   100
 
#define ABORT_ON_OVERFLOW   0
 
#define RETURN_ON_OVERFLOW   1
 
#define NORMALIZE_ON_OVERFLOW   2
 

Functions

int solve2 (double xg[], int N, double h, double yg[][2], int(*derivs)(double, const double[2], double[2], void *), void *data, int flag)
 Second-order differential equation solver. More...
 

Macro Definition Documentation

#define ABORT_ON_OVERFLOW   0
#define DIVERGENCE_THRESHOLD   100
#define NORMALIZE_ON_OVERFLOW   2
#define RETURN_ON_OVERFLOW   1

Function Documentation

int solve2 ( double  xg[],
int  N,
double  h,
double  yg[][2],
int(*)(double, const double[2], double[2], void *)  derivs,
void *  data,
int  flag 
)

This routine is adapted from the O₂scl file "ode_iv_solve.h". The modification it the following:

  • When the solution reaches some dangerously high absolute value, the function either exits (returning the last solved index that was kept inside the limits) or renormalizes the up-to-now solution so that the overflow is avoided.
    Parameters
    xgIndependent variable grid.
    NSize of the grid.
    hGrid spacing.
    yg(out) Solution.
    derivsSecond derivative callback of the signature
    * int derivs(double x, const double y[2], double dydx[2], void* params)
    *
    dataCustom data pointer to pass to the "derivs" routine.
    flagBehaviour on overflow, one of { ABORT_ON_OVERFLOW | RETURN_ON_OVERFLOW | NORMALIZE_ON_OVERFLOW }.
    Returns
    N for successful run of n < N for forced terminantion on overflow, where n is the index of last valid field in yg and ypg.