diff --git a/ordinary-differential-equations/ode-system.lisp b/ordinary-differential-equations/ode-system.lisp index 18a46e41c96fee453967125d7715c57232dc609b..7d757593227460cdcb4d7364f0766d6a858ce952 100644 --- a/ordinary-differential-equations/ode-system.lisp +++ b/ordinary-differential-equations/ode-system.lisp @@ -1,9 +1,9 @@ ;******************************************************** -; file: ordinary-differential-equations.lisp -; description: ODE initial value problems +; file: ode-system.lisp +; description: ODE system setup ; date: Sun Apr 15 2007 - 14:19 ; author: Liam Healy -; modified: Sun Sep 23 2007 - 18:26 +; modified: Mon Sep 24 2007 - 21:33 ;******************************************************** ;;; $Id: $ diff --git a/ordinary-differential-equations/stepping.lisp b/ordinary-differential-equations/stepping.lisp new file mode 100644 index 0000000000000000000000000000000000000000..78182fb75073974c1ee7e132f28fa96bc173d2db --- /dev/null +++ b/ordinary-differential-equations/stepping.lisp @@ -0,0 +1,111 @@ +;******************************************************** +; file: stepping.lisp +; description: Stepping functions for ODE systems +; date: Mon Sep 24 2007 - 21:33 +; author: Liam Healy +; modified: Mon Sep 24 2007 - 22:42 +;******************************************************** +;;; $Id: $ + +(in-package :gsl) + +(defun-gsl step-allocate (step-type dim) + "gsl_odeiv_step_alloc" + ((step-type :pointer) (dim :size)) + :c-return :pointer + :documentation + "Allocate a new instance of a stepping function of + type @var{T} for a system of @var{dim} dimensions, + returning the pointer.") + +(defun-gsl step-reset (stepper) + "gsl_odeiv_step_reset" + ((stepper :pointer)) + :documentation + "Reset the stepping function @var{s}. It should be used whenever + the next use of @var{s} will not be a continuation of a previous + step.") + +(defun-gsl step-free (stepper) + "gsl_odeiv_step_free" + ((stepper :pointer)) + :c-return :void + :documentation + "Free all the memory associated with the stepping function.") + +(defun-gsl step-name (stepper) + "gsl_odeiv_step_name" + ((stepper :pointer)) + :c-return :string + :documentation "The name of the stepping function.") + +(defun-gsl step-order (stepper) + "gsl_odeiv_step_order" + ((stepper :pointer)) + :c-return :uint + :documentation "The order of the stepping function on the previous + step, which can vary if the stepping function itself is adaptive.") + +(defun-gsl step-apply + (stepper time step-size y yerr dydt-in dydt-out dydt) + "gsl_odeiv_step_apply" + ((stepper :pointer) + (time :double) + (step-size :double) + (y :pointer) + (yerr :pointer) + (dydt-in :pointer) + (dydt-out :pointer) + (dydt :pointer)) + :documentation + "Apply the stepping function stepper to the system of + equations defined by @var{dydt}, using the step size step-size to advance + the system from time @var{t} and state @var{y} to time @var{t}+@var{h}. + The new state of the system is stored in @var{y} on output, with an + estimate of the absolute error in each component stored in @var{yerr}. + If the argument @var{dydt_in} is not null it should point an array + containing the derivatives for the system at time @var{t} on input. This + is optional as the derivatives will be computed internally if they are + not provided, but allows the reuse of existing derivative information. + On output the new derivatives of the system at time @var{t}+@var{h} will + be stored in @var{dydt_out} if it is not null. + + If the user-supplied functions defined in the system @var{dydt} return a + status other than @code{GSL_SUCCESS} the step will be aborted. In this + case, the elements of @var{y} will be restored to their pre-step values + and the error code from the user-supplied function will be returned. To + distinguish between error codes from the user-supplied functions and + those from @code{gsl_odeiv_step_apply} itself, any user-defined return + values should be distinct from the standard GSL error codes.") + +(defvar *step-rk2* (cffi:foreign-symbol-pointer "gsl_odeiv_step_rk2") + "Embedded Runge-Kutta (2, 3) method.") + +(defvar *step-rk4* (cffi:foreign-symbol-pointer "gsl_odeiv_step_rk4") + "4th order (classical) Runge-Kutta.") + +(defvar *step-rkf45* (cffi:foreign-symbol-pointer "gsl_odeiv_step_rkf45") + "Embedded Runge-Kutta-Fehlberg (4, 5) method. This method is a good + general-purpose integrator.") + +(defvar *step-rkck* (cffi:foreign-symbol-pointer "gsl_odeiv_step_rkck") + "Embedded Runge-Kutta Cash-Karp (4, 5) method.") + +(defvar *step-rk8pd* (cffi:foreign-symbol-pointer "gsl_odeiv_step_rk8pd") + "Embedded Runge-Kutta Prince-Dormand (8,9) method.") + +(defvar *step-rk2imp* (cffi:foreign-symbol-pointer "gsl_odeiv_step_rk2imp") + "Implicit 2nd order Runge-Kutta at Gaussian points.") + +(defvar *step-rk4imp* (cffi:foreign-symbol-pointer "gsl_odeiv_step_rk4imp") + "Implicit 4th order Runge-Kutta at Gaussian points.") + +(defvar *step-bsimp* (cffi:foreign-symbol-pointer "gsl_odeiv_step_bsimp") + "Implicit Bulirsch-Stoer method of Bader and Deuflhard. This algorithm + requires the Jacobian.") + +(defvar *step-gear1* (cffi:foreign-symbol-pointer "gsl_odeiv_step_gear1") + "M=1 implicit Gear method.") + +(defvar *step-gear2* (cffi:foreign-symbol-pointer "gsl_odeiv_step_gear2") + "M=2 implicit Gear method.")