gsl_bsimp Class Template Reference

Bulirsch-Stoer implicit ODE stepper (GSL). More...

#include <gsl_bsimp.h>


Detailed Description

template<class param_t, class func_t, class jac_func_t, class vec_t = ovector_base, class alloc_vec_t = ovector, class alloc_t = ovector_alloc, class mat_t = omatrix_base, class alloc_mat_t = omatrix, class mat_alloc_t = omatrix_alloc>
class gsl_bsimp< param_t, func_t, jac_func_t, vec_t, alloc_vec_t, alloc_t, mat_t, alloc_mat_t, mat_alloc_t >

Bulirsch-Stoer implicit ODE stepper (GSL).

Bader-Deuflhard implicit extrapolative stepper (Bader83).

Note:
The variable h_next was defined in the original GSL version has been removed here, as it was unused by the stepper routine.
Things to document:
More detailed documentation
Todo:
Ensure error handling is sensible if the "derivs" or jacobian functions return a non-zero value
Todo:
Create an example with a stiff diff eq. which requires this kind of stepper
Idea for future:
I don't like setting yerr to GSL_POSINF, there should be a better way to force an adaptive stepper which is calling this stepper to readjust the stepsize.
Idea for future:
Some of these functions can be moved out of this header file
Idea for future:
Rework internal arrays as uvectors?
Idea for future:
The function step_local() is actually its own ODE stepper and could be reimplemented as an object of type odestep

Definition at line 87 of file gsl_bsimp.h.


Public Member Functions

int reset ()
 Reset stepper.
virtual int step (double x, double h, size_t n, vec_t &y, vec_t &dydx, vec_t &yout, vec_t &yerr, vec_t &dydx_out, param_t &pa, func_t &derivs, jac_func_t &jac)
 Perform an integration step.

Protected Member Functions

int compute_weights (const double y[], double w[], size_t n)
 Compute weights.
size_t deuf_kchoice (double eps2, size_t dimension)
 Calculate a choice for the "order" of the method, using the Deuflhard criteria.
int poly_extrap (gsl_matrix *dloc, const double x[], const unsigned int i_step, const double x_i, const vec_t &y_i, vec_t &y_0, vec_t &y_0_err, double work[])
 Polynomial extrapolation.
int step_local (const double t0, const double h_total, const unsigned int n_step, const double y[], const double yp_loc[], const vec_t &dfdt_loc, const mat_t &dfdy_loc, vec_t &y_out)
 Basic implicit Bulirsch-Stoer step.
int allocate (size_t n)
 Allocate memory for a system of size n.
void free ()
 Free allocated memory.

Protected Attributes

size_t dim
 Size of allocated vectors.
alloc_t ao
 Memory allocator for objects of type alloc_vec_t.
mat_alloc_t mo
 Memory allocator for objects of type alloc_mat_t.
func_t * funcp
 Function specifying derivatives.
jac_func_t * jfuncp
 Jacobian.
param_t * pap
 User-specified paramter.
gsl_matrix * d
 Workspace for extrapolation.
gsl_matrix * a_mat
 Workspace for linear system matrix.
double ex_wk [sequence_max]
 Workspace for extrapolation.
size_t order
 Order of last step.
State info
size_t k_current
size_t k_choice
double eps
Workspace for extrapolation step
double * yp
double * y_save
double * yerr_save
double * y_extrap_save
alloc_vec_t y_extrap_sequence
double * extrap_work
alloc_vec_t dfdt
alloc_vec_t y_temp
alloc_vec_t delta_temp
double * weight
alloc_mat_t dfdy
Workspace for the basic stepper
alloc_vec_t rhs_temp
double * delta

Static Protected Attributes

static const int sequence_count = 8
 Desc.
static const int sequence_max = 7
 Desc.

Member Function Documentation

size_t deuf_kchoice ( double  eps2,
size_t  dimension 
) [inline, protected]

Calculate a choice for the "order" of the method, using the Deuflhard criteria.

Used in the allocate() function.

Definition at line 178 of file gsl_bsimp.h.

int poly_extrap ( gsl_matrix *  dloc,
const double  x[],
const unsigned int  i_step,
const double  x_i,
const vec_t &  y_i,
vec_t &  y_0,
vec_t &  y_0_err,
double  work[] 
) [inline, protected]

Polynomial extrapolation.

Compute the step of index i_step using polynomial extrapolation to evaulate functions by fitting a polynomial to estimates (x_i,y_i) and output the result to y_0 and y_0_err.

The index i_step begins with zero.

Definition at line 234 of file gsl_bsimp.h.

virtual int step ( double  x,
double  h,
size_t  n,
vec_t &  y,
vec_t &  dydx,
vec_t &  yout,
vec_t &  yerr,
vec_t &  dydx_out,
param_t &  pa,
func_t &  derivs,
jac_func_t &  jac 
) [inline, virtual]

Perform an integration step.

Given initial value of the n-dimensional function in y and the derivative in dydx (which must generally be computed beforehand) at the point x, take a step of size h giving the result in yout, the uncertainty in yerr, and the new derivative in dydx_out (at x+h) using function derivs to calculate derivatives. Implementations which do not calculate yerr and/or dydx_out do not reference these variables so that a blank vec_t can be given. All of the implementations allow yout=y and dydx_out=dydx if necessary.

Definition at line 498 of file gsl_bsimp.h.

int step_local ( const double  t0,
const double  h_total,
const unsigned int  n_step,
const double  y[],
const double  yp_loc[],
const vec_t &  dfdt_loc,
const mat_t &  dfdy_loc,
vec_t &  y_out 
) [inline, protected]

Basic implicit Bulirsch-Stoer step.

Divide the step h_total into n_step smaller steps and do the Bader-Deuflhard semi-implicit iteration. This function starts at t0 with function values y, derivatives yp_loc, and information from the Jacobian to compute the final value y_out.

Definition at line 284 of file gsl_bsimp.h.


Field Documentation

double ex_wk[sequence_max] [protected]

Workspace for extrapolation.

(This state variable was named 'x' in GSL.)

Definition at line 126 of file gsl_bsimp.h.


The documentation for this class was generated from the following file:

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page