LALSimulation  5.4.0.1-fe68b98
LALSimInspiralTaylorLength.c
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2007 David Churches, B.S. Sathyaprakash, Drew Keppel
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with with program; see the file COPYING. If not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301 USA
18 */
19 
20 /**
21  * \author Sathyaprakash, B. S.
22  * \file
23  * \ingroup LALSimInspiral_h
24  *
25  * \brief NONE
26  *
27  * This module outputs
28  * \f{equation}{
29  * tofv = t - t_0 + m \int_{v_0}^{v} \frac{E'(v)}{{\cal F}(v)} \, dv\,.
30  * \f}
31  * where the constants \f$t,\f$ \f$t_0,\f$ \f$v_0,\f$ and functions in the integrand
32  * \f$E'(v)\f$ and \f${\cal F}(v)\f$ are defined in the \c void structure <tt>params.</tt>
33  *
34  */
35 
36 #include <math.h>
37 #include <lal/LALStdlib.h>
38 #include <lal/LALConstants.h>
39 #include <lal/LALSimInspiral.h>
40 #include <lal/XLALGSL.h>
41 #include <gsl/gsl_integration.h>
42 
45 
46 static REAL8
48  REAL8 v,
49  void *params
50  )
51 {
52 
53  TofVIntegrandIn *ak = NULL;
54 
55  if ( !params )
57 
58  if ( v <= 0.0 || v >= 1.0 )
60 
61  ak = (TofVIntegrandIn *) params;
62 
63  return ak->dEnergy( v, ak->coeffs ) / ak->flux( v, ak->coeffs );
64 }
65 
66 static REAL8
68  REAL8 v,
69  void *params
70  )
71 {
72  void *funcParams;
73  REAL8 (*funcToIntegrate)(REAL8, void *);
74  REAL8 xmin, xmax;
75  TofVIntegrandIn in2;
76  TofVIn *in1;
77  REAL8 answer, error;
78  REAL8 sign;
79 
80 
81  if (params == NULL)
83  if (v <= 0.)
85  if (v >= 1.)
87 
88  sign = 1.0;
89 
90 
91  in1 = (TofVIn *) params;
92 
93  funcToIntegrate = XLALSimInspiralTofVIntegrand;
94  xmin = in1->v0;
95  xmax = v;
96 
97  in2.dEnergy = in1->dEnergy;
98  in2.flux = in1->flux;
99  in2.coeffs = in1->coeffs;
100 
101  funcParams = (void *) &in2;
102 
103  if (v==in1->v0)
104  {
105  return in1->t - in1->t0;
106  }
107 
108  if(in1->v0 > v)
109  {
110  xmin = v;
111  xmax = in1->v0;
112  sign = -1.0;
113  }
114 
115  gsl_function F;
116  F.function = funcToIntegrate;
117  F.params = funcParams;
118  const INT4 N=1000;
119  const REAL8 eps=1.e-7;
120  INT4 gslStatus;
121  gsl_integration_workspace * w = gsl_integration_workspace_alloc (N);
122  XLAL_CALLGSL(gslStatus = gsl_integration_qags(&F, xmin, xmax, 0, eps, N, w, &answer, &error));
123 
124  if (XLAL_IS_REAL8_FAIL_NAN(answer)||(gslStatus!=0))
126 
127  return in1->t - in1->t0 + in1->totalmass*answer*sign;
128 }
129 
130 REAL8
132  REAL8 deltaT, /**< sampling interval */
133  REAL8 m1, /**< mass of companion 1 */
134  REAL8 m2, /**< mass of companion 2 */
135  REAL8 f_min, /**< start frequency */
136  int O /**< twice post-Newtonian order */
137  )
138 {
140  REAL8 m = m1 + m2;
141  REAL8 eta = m1 * m2 / (m * m);
142  m *= LAL_G_SI / pow(LAL_C_SI, 3.0); /* convert totalmass from kilograms to seconds */
143  REAL8 v0 = cbrt(LAL_PI * m * f_min);
144 
145  REAL8 oneby6 = 1./6.;
146  REAL8 lso, vlso, vn, tofv;
147  TofVIn in1;
148  void *in2;
149 
150 /* Taylor coefficients of dE(v)/dv. (NOTE v and NOT x) */
151  akEF.dETaN = 2.0 * XLALSimInspiralPNEnergy_0PNCoeff(eta);
152  akEF.dETa1 = 2.0 * XLALSimInspiralPNEnergy_2PNCoeff(eta);
153  akEF.dETa2 = 3.0 * XLALSimInspiralPNEnergy_4PNCoeff(eta);
154  akEF.dETa3 = 4.0 * XLALSimInspiralPNEnergy_6PNCoeff(eta);
155 
156 /* Taylor coefficients of flux. */
165  akEF.FTa8 = - 117.5043907226773;
166  akEF.FTl8 = 52.74308390022676;
167 
168  lso = sqrt(oneby6);
169  vlso = 0; //- set but not used
170 
171 /* Location of the 0PN and 1PN T- and P-approximant last stable orbit: */
172  akEF.vlsoT0 = lso;
173  akEF.vlsoP0 = lso;
174  akEF.vlsoP2 = lso;
175 /*
176  vlsoT2 = 6./(9.+eta);
177  This correct value makes vlso too large for vlsoT2 hence use 1/sqrt(6)
178 */
179  akEF.vlsoT2 = lso;
180 
181  switch (O)
182  {
183  case 0:
184  vn = akEF.vlso = vlso = akEF.vlsoT0;
186  in1.flux = XLALSimInspiralFt0;
187  break;
188  case 1:
189  XLALPrintError("XLAL Error - %s: PN approximant not supported for requested PN order\n", __func__);
191  break;
192  case 2:
193  vn = akEF.vlso = vlso = akEF.vlsoT2;
195  in1.flux = XLALSimInspiralFt2;
196  break;
197  case 3:
198  vn = akEF.vlso = vlso = akEF.vlsoT2;
200  in1.flux = XLALSimInspiralFt3;
201  break;
202  case 4:
203 /*
204  The value vlsoT4 is too large and doesn't work sometimes;
205  so we use vlsoT2.
206 */
207  vn = akEF.vlso = vlso = akEF.vlsoT2;
209  in1.flux = XLALSimInspiralFt4;
210  break;
211  case 5:
212 /*
213  The value vlsoT4 is too large and doesn't work with 2.5 PN
214  Taylor approximant; so we use vlsoT2.
215 */
216  vn = akEF.vlso = vlso = akEF.vlsoT2;
218  in1.flux = XLALSimInspiralFt5;
219  break;
220  case 6:
221 /*
222  vlsoT6 is as yet undetermined and vlsoT4 is too large in
223  certain cases (TaylorT2 crashes for (1.4,10)); using vlsoT2;
224 */
225  vn = akEF.vlso = vlso = akEF.vlsoT2;
227  in1.flux = XLALSimInspiralFt6;
228  break;
229  case -1: // Use the highest PN order available, move if higher terms added
230  case 7:
231  vn = akEF.vlso = vlso = akEF.vlsoT2;
233  in1.flux = XLALSimInspiralFt7;
234  break;
235  case 8:
236  XLALPrintError("XLAL Error - %s: PN approximant not supported for requested PN order\n", __func__);
238  break;
239  default:
240  XLALPrintError("XLAL Error - %s: Unknown PN order in switch\n", __func__);
242  }
243 
244  vn = cbrt(LAL_PI * m / (2. * deltaT));
245  vn = (vn < vlso) ? vn : vlso;
246 
247  in1.t=0.0;
248  in1.v0=v0;
249  in1.t0=0.;
250  in1.vlso=akEF.vlso;
251  in1.totalmass = m;
252  in1.coeffs = &akEF;
253 
254  in2 = (void *) &in1;
255 
256  tofv = XLALSimInspiralTofV(vn, in2);
257  if (XLAL_IS_REAL8_FAIL_NAN(tofv))
259 
260  return -tofv - deltaT;
261 }
static REAL8 UNUSED XLALSimInspiralPNFlux_5PNCoeff(REAL8 eta)
static REAL8 UNUSED XLALSimInspiralPNEnergy_4PNCoeff(REAL8 eta)
static REAL8 UNUSED XLALSimInspiralPNFlux_0PNCoeff(REAL8 eta)
Computes the flux PN Coefficients.
static REAL8 UNUSED XLALSimInspiralPNFlux_3PNCoeff(REAL8 UNUSED eta)
static REAL8 UNUSED XLALSimInspiralPNEnergy_2PNCoeff(REAL8 eta)
static REAL8 UNUSED XLALSimInspiralPNFlux_4PNCoeff(REAL8 eta)
static REAL8 UNUSED XLALSimInspiralPNEnergy_0PNCoeff(REAL8 eta)
Computes the PN Coefficients for using in the PN energy equation.
static REAL8 UNUSED XLALSimInspiralPNFlux_2PNCoeff(REAL8 eta)
static REAL8 UNUSED XLALSimInspiralPNFlux_7PNCoeff(REAL8 eta)
static REAL8 UNUSED XLALSimInspiralPNFlux_6PNCoeff(REAL8 eta)
static REAL8 UNUSED XLALSimInspiralPNFlux_6PNLogCoeff(REAL8 UNUSED eta)
static REAL8 UNUSED XLALSimInspiralPNEnergy_6PNCoeff(REAL8 eta)
static REAL8 XLALSimInspiralTofVIntegrand(REAL8 v, void *params)
REAL8 XLALSimInspiralTaylorLength(REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, int O)
static REAL8 XLALSimInspiralTofV(REAL8 v, void *params)
Module containing the energy and flux functions for waveform generation.
static REAL8 UNUSED XLALSimInspiralFt0(REAL8 v, expnCoeffsdEnergyFlux *ak)
static REAL8 UNUSED XLALSimInspiralFt2(REAL8 v, expnCoeffsdEnergyFlux *ak)
static REAL8 UNUSED XLALSimInspiraldEt4(REAL8 v, expnCoeffsdEnergyFlux *ak)
static REAL8 UNUSED XLALSimInspiralFt4(REAL8 v, expnCoeffsdEnergyFlux *ak)
static REAL8 UNUSED XLALSimInspiraldEt2(REAL8 v, expnCoeffsdEnergyFlux *ak)
static REAL8 UNUSED XLALSimInspiraldEt0(REAL8 v, expnCoeffsdEnergyFlux *ak)
static REAL8 UNUSED XLALSimInspiralFt7(REAL8 v, expnCoeffsdEnergyFlux *ak)
static REAL8 UNUSED XLALSimInspiraldEt6(REAL8 v, expnCoeffsdEnergyFlux *ak)
static REAL8 UNUSED XLALSimInspiralFt6(REAL8 v, expnCoeffsdEnergyFlux *ak)
static REAL8 UNUSED XLALSimInspiralFt5(REAL8 v, expnCoeffsdEnergyFlux *ak)
static REAL8 UNUSED XLALSimInspiralFt3(REAL8 v, expnCoeffsdEnergyFlux *ak)
static REAL8TimeSeries * error(const REAL8TimeSeries *s1, const REAL8TimeSeries *s0)
#define XLAL_CALLGSL(statement)
const double w
#define LAL_C_SI
#define LAL_PI
#define LAL_G_SI
double REAL8
int32_t INT4
static const INT4 m
static const REAL4 eps
#define XLAL_ERROR_REAL8(...)
#define XLAL_ERROR(...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_IS_REAL8_FAIL_NAN(val)
XLAL_EFAULT
XLAL_EFUNC
XLAL_EDOM
XLAL_EINVAL
int N
EnergyFunction dEnergy
expnCoeffsdEnergyFlux * coeffs
FluxFunction flux
expnCoeffsdEnergyFlux * coeffs
Definition: burst.c:245
double f_min
Definition: unicorn.c:22
double deltaT
Definition: unicorn.c:24