LAL  7.5.0.1-ec27e42
LALAdaptiveRungeKuttaIntegrator.h
Go to the documentation of this file.
1 #ifndef _LALADAPTIVERUNGEKUTTAINTEGRATOR_H
2 #define _LALADAPTIVERUNGEKUTTAINTEGRATOR_H
3 
4 #include <gsl/gsl_odeiv.h>
5 #include <gsl/gsl_spline.h>
6 
7 #include <lal/LALGSL.h>
8 #include <lal/SeqFactories.h>
9 
10 #if defined(__cplusplus)
11 extern "C" {
12 #elif 0
13 } /* so that editors will match preceding brace */
14 #endif
15 
16 /**
17  * \defgroup LALAdaptiveRungeKuttaIntegrator_h Header LALAdaptiveRungeKuttaIntegrator.h
18  * \ingroup lal_utilities
19  * \author Vallisneri, M.
20  * \brief Adaptive Runge-Kutta4
21  *
22  * <ul>
23  * <li> \c integrator Integration structure (quasi-class). Created using <tt>XLALAdaptiveRungeKuttaIntegratorInit()</tt>.
24  * ...</li>
25  * </ul>
26  *
27  * ### Description ###
28  *
29  * The code \ref LALAdaptiveRungeKuttaIntegrator.c evolves a system of \f$n\f$ coupled first--order differential equations.
30  * Internally, it uses GSL routines to perform adaptive-step evolution, and then interpolates the resulting
31  * trajectories to a fixed step size.
32  *
33  * Prior to evolving a system using <tt>XLALAdaptiveRungeKutta4()</tt>, it is necessary to create an integrator structure using
34  * <tt>XLALAdaptiveRungeKuttaIntegratorInit()</tt>. Once you are done with the integrator, free it with <tt>XLALAdaptiveRungeKuttaIntegratorFree()</tt>.
35  *
36  * ### Algorithm ###
37  *
38  * TBF.
39  *
40  * ### Uses ###
41  *
42  * For updated SpinTaylor waveforms.
43  *
44  * ### Notes ###
45  *
46  * None so far...
47  *
48  */
49 /** @{ */
50 
51 typedef struct tagLALAdaptiveRungeKuttaIntegrator
52 {
53  gsl_odeiv_step *step;
54  gsl_odeiv_control *control;
55  gsl_odeiv_evolve *evolve;
56 
57  gsl_odeiv_system *sys;
58 
59  int (* dydt) (double t, const double y[], double dydt[], void * params);
60  int (* stop) (double t, const double y[], double dydt[], void * params);
61 
62  int retries; /* retries with smaller step when derivatives encounter singularity */
63  int stopontestonly; /* stop only on test, use tend to size buffers only */
64 
67 
69  int (* dydt) (double t, const double y[], double dydt[], void * params),
70  int (* stop) (double t, const double y[], double dydt[], void * params),
71  double eps_abs, double eps_rel
72  );
73 
74 /* OPTIMIZED */
75 /**
76  * Eighth-order Runge-Kutta ODE integrator using Runge-Kutta-Fehlberg steps
77  * with adaptive step size control. Intended for use in time domain
78  * waveform generation routines based on SEOBNRv2,3,4 models.
79  */
80 
82  int (* dydt) (double t, const double y[], double dydt[], void * params),
83  int (* stop) (double t, const double y[], double dydt[], void * params),
84  double eps_abs, double eps_rel
85  );
86 /* END OPTIMIZED */
87 
89 
91  void *params,
92  REAL8 *yinit,
93  REAL8 tinit, REAL8 tend, REAL8 deltat,
94  REAL8Array **yout
95  );
96 /* OPTIMIZED */
97 /**
98  * Fourth-order Runge-Kutta ODE integrator using Runge-Kutta-Fehlberg steps
99  * with adaptive step size control. Intended for use in time domain
100  * waveform generation routines based on SEOBNRv2,3,4 models. This method
101  * does not includes any interpolation.
102  * deltat_or_h0 is the initial step size to be tried
103  * min_deltat_or_h0 is the minimal step size to enforce -- 0 to ignore
104  */
106  void * params, REAL8 * yinit, REAL8 tinit, REAL8 tend, REAL8 deltat_or_h0, REAL8 min_deltat_or_h0,
107  REAL8Array ** t_and_yout,INT4 EOBversion);
109  void * params, REAL8 * yinit, REAL8 tinit, REAL8 tend, REAL8 deltat,
110  REAL8Array ** sparse_output, REAL8Array ** dense_output);
111 /* END OPTIMIZED */
112 
114  void *params,
115  REAL8 *yinit,
116  REAL8 tinit,
117  REAL8 tend_in,
118  REAL8 deltat,
119  REAL8Array **yout
120  );
121 
123  void *params,
124  REAL8 *yinit,
125  REAL8 tinit,
126  REAL8 tend_in,
127  REAL8 y1_final,
128  REAL8 deltat
129  );
130 
131 /**
132  * Fourth-order Runge-Kutta ODE integrator using Runge-Kutta-Fehlberg (RKF45)
133  * steps with adaptive step size control. Intended for use in Fourier domain
134  * waveform generation routines based on SpinTaylorTN models.
135  *
136  * The method is described in
137  *
138  * Abramowitz & Stegun, Handbook of Mathematical Functions, Tenth Printing,
139  * National Bureau of Standards, Washington, DC, 1972
140  * (available online at http://people.math.sfu.ca/~cbm/aands/ )
141  *
142  * This method is equivalent to XLALAdaptiveRungeKutta4 and
143  * XLALAdaptiveRungeKutta4Hermite, but does not includes any interpolation.
144  *
145  * Memory is allocated in steps of LAL_MAX_RK4_STEPS.
146  */
147 int XLALAdaptiveRungeKutta4IrregularIntervals( LALAdaptiveRungeKuttaIntegrator *integrator, /**< struct holding dydt, stopping test, stepper, etc. */
148  void *params, /**< params struct used to compute dydt and stopping test */
149  REAL8 *yinit, /**< pass in initial values of all variables - overwritten to final values */
150  REAL8 tinit, /**< integration start time */
151  REAL8 tend_in, /**< maximum integration time */
152  REAL8Array **yout /**< array holding the unevenly sampled output */
153  );
154 
155 /** @} */
156 
157 #if 0
158 { /* so that editors will match succeeding brace */
159 #elif defined(__cplusplus)
160 }
161 #endif
162 
163 #endif /* _LALADAPTIVERUNGEKUTTAINTEGRATOR_H */
int XLALAdaptiveRungeKutta4(LALAdaptiveRungeKuttaIntegrator *integrator, void *params, REAL8 *yinit, REAL8 tinit, REAL8 tend, REAL8 deltat, REAL8Array **yout)
void XLALAdaptiveRungeKuttaFree(LALAdaptiveRungeKuttaIntegrator *integrator)
int XLALAdaptiveRungeKutta4IrregularIntervals(LALAdaptiveRungeKuttaIntegrator *integrator, void *params, REAL8 *yinit, REAL8 tinit, REAL8 tend_in, REAL8Array **yout)
Fourth-order Runge-Kutta ODE integrator using Runge-Kutta-Fehlberg (RKF45) steps with adaptive step s...
LALAdaptiveRungeKuttaIntegrator * XLALAdaptiveRungeKutta4InitEighthOrderInstead(int dim, int(*dydt)(double t, const double y[], double dydt[], void *params), int(*stop)(double t, const double y[], double dydt[], void *params), double eps_abs, double eps_rel)
Eighth-order Runge-Kutta ODE integrator using Runge-Kutta-Fehlberg steps with adaptive step size cont...
int XLALAdaptiveRungeKutta4NoInterpolate(LALAdaptiveRungeKuttaIntegrator *integrator, void *params, REAL8 *yinit, REAL8 tinit, REAL8 tend, REAL8 deltat_or_h0, REAL8 min_deltat_or_h0, REAL8Array **t_and_yout, INT4 EOBversion)
Fourth-order Runge-Kutta ODE integrator using Runge-Kutta-Fehlberg steps with adaptive step size cont...
int XLALAdaptiveRungeKuttaDenseandSparseOutput(LALAdaptiveRungeKuttaIntegrator *integrator, void *params, REAL8 *yinit, REAL8 tinit, REAL8 tend, REAL8 deltat, REAL8Array **sparse_output, REAL8Array **dense_output)
int XLALAdaptiveRungeKutta4HermiteOnlyFinal(LALAdaptiveRungeKuttaIntegrator *integrator, void *params, REAL8 *yinit, REAL8 tinit, REAL8 tend_in, REAL8 y1_final, REAL8 deltat)
Fourth-order Runge-Kutta ODE integrator using Runge-Kutta-Fehlberg (RKF45) steps with adaptive step s...
int XLALAdaptiveRungeKutta4Hermite(LALAdaptiveRungeKuttaIntegrator *integrator, void *params, REAL8 *yinit, REAL8 tinit, REAL8 tend_in, REAL8 deltat, REAL8Array **yout)
Fourth-order Runge-Kutta ODE integrator using Runge-Kutta-Fehlberg (RKF45) steps with adaptive step s...
LALAdaptiveRungeKuttaIntegrator * XLALAdaptiveRungeKutta4Init(int dim, int(*dydt)(double t, const double y[], double dydt[], void *params), int(*stop)(double t, const double y[], double dydt[], void *params), double eps_abs, double eps_rel)
double REAL8
Double precision real floating-point number (8 bytes).
int32_t INT4
Four-byte signed integer.
Multidimentional array of REAL8, see DATATYPE-Array types for more details.
Definition: LALDatatypes.h:226