LALSimulation  5.4.0.1-fe68b98
LALSimInspiralTaylorF2ReducedSpin.c
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2011 P. Ajith, N. Fotopoulos
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 #include <complex.h>
21 #include <stdlib.h>
22 #include <math.h>
23 #include <lal/Date.h>
24 #include <lal/FrequencySeries.h>
25 #include <lal/LALConstants.h>
26 #include <lal/LALDatatypes.h>
27 #include <lal/LALSimInspiral.h>
28 #include <lal/Units.h>
29 #include <lal/XLALError.h>
30 
31 #define Pi_p2 9.8696044010893586188344909998761511
32 #define Pi_p2by3 2.1450293971110256000774441009412356
33 #define log4 1.3862943611198906188344642429163531
34 
35 /**
36  * @addtogroup LALSimInspiralTaylorF2ReducedSpin_c
37  * @brief Routines for generating TaylorF2 reduced spin inspiral waveforms.
38  * @{
39  */
40 
41 /**
42  * Compute the dimensionless, aligned-spin parameter chi as used in the
43  * TaylorF2RedSpin waveform. This is different from chi in IMRPhenomB!
44  * Reference: http://arxiv.org/abs/1107.1267, paragraph 3.
45  */
47  const REAL8 m1, /**< mass of companion 1 */
48  const REAL8 m2, /**< mass of companion 2 */
49  const REAL8 s1z, /**< dimensionless spin of companion 1 */
50  const REAL8 s2z /**< dimensionless spin of companion 2 */
51 ) {
52  const REAL8 m = m1 + m2;
53  const REAL8 eta = m1 * m2 / (m * m);
54  const REAL8 delta = (m1 - m2) / m;
55  const REAL8 chi_s = (s1z + s2z) / 2.;
56  const REAL8 chi_a = (s1z - s2z) / 2.;
57 
58  /* sanity checks */
59  if (m1 <= 0) XLAL_ERROR(XLAL_EDOM);
60  if (m2 <= 0) XLAL_ERROR(XLAL_EDOM);
61  if (fabs(s1z) > 1) XLAL_ERROR(XLAL_EDOM);
62  if (fabs(s2z) > 1) XLAL_ERROR(XLAL_EDOM);
63 
64  return chi_s * (1. - 76. * eta / 113.) + delta * chi_a;
65 }
66 
67 /**
68  * Driver routine to compute a non-precessing post-Newtonian inspiral waveform
69  * in the frequency domain, described in http://arxiv.org/abs/1107.1267.
70  *
71  * The chi parameter should be determined from
72  * XLALSimInspiralTaylorF2ReducedSpinComputeChi.
73  *
74  * A note from Evan Ochsner on differences with respect to TaylorF2:
75  *
76  * The amplitude-corrected SPA/F2 waveforms are derived and explicitly given in
77  * <http://arxiv.org/abs/gr-qc/0607092> Sec. II and Appendix A (non-spinning)
78  * and <http://arxiv.org/abs/0810.5336> Sec. VI and Appendix D (spin-aligned).
79  *
80  * The difference between F2 and F2ReducedSpin is that F2ReducedSpin always
81  * keeps only the leading-order TD amplitude multiplying the 2nd harmonic (
82  * A_(2,0)(t) in Eq. 2.3 of the first paper OR alpha/beta_2^(0)(t) in Eq. 6.7
83  * of the second paper) but expands out the \f$1/\sqrt{\dot{F}}\f$ ( Eq. 5.3 OR Eq.
84  * 6.10-6.11 resp.) to whichever order is given as 'ampO' in the code.
85  *
86  * On the other hand, the F2 model in the papers above will PN expand BOTH the
87  * TD amplitude and the factor \f$1/\sqrt{\dot{F}}\f$, take their product, and keep
88  * all terms up to the desired amplitude order, as in Eq. 6.13-6.14 of the
89  * second paper.
90  *
91  * In particular, the F2ReducedSpin will always have only the 2nd harmonic, but
92  * F2 will have multiple harmonics starting at ampO = 0.5PN. Even if you were
93  * to compare just the 2nd harmonic, you would have a difference starting at
94  * 1PN ampO, because the F2 has a 1PN TD amp. correction to the 2nd harmonic
95  * (alpha/beta_2^(2)(t)) which will not be accounted for by the F2ReducedSpin.
96  * So, the two should agree when ampO=0, but will be different in any other
97  * case.
98  */
100  COMPLEX16FrequencySeries **htilde, /**< FD waveform */
101  const REAL8 phic, /**< orbital coalescence phase (rad) */
102  const REAL8 deltaF, /**< frequency resolution (Hz) */
103  const REAL8 m1_SI, /**< mass of companion 1 (kg) */
104  const REAL8 m2_SI, /**< mass of companion 2 (kg) */
105  const REAL8 chi, /**< dimensionless aligned-spin param */
106  const REAL8 fStart, /**< start GW frequency (Hz) */
107  const REAL8 fEnd, /**< highest GW frequency (Hz) of waveform generation - if 0, end at Schwarzschild ISCO */
108  const REAL8 r, /**< distance of source (m) */
109  const INT4 phaseO, /**< twice PN phase order */
110  const INT4 ampO /**< twice PN amplitude order */
111  ) {
112  /* external: SI; internal: solar masses */
113  const REAL8 m1 = m1_SI / LAL_MSUN_SI;
114  const REAL8 m2 = m2_SI / LAL_MSUN_SI;
115  const REAL8 m = m1 + m2;
116  const REAL8 m_sec = m * LAL_MTSUN_SI; /* total mass in seconds */
117  const REAL8 eta = m1 * m2 / (m * m);
118  const REAL8 etap2 = eta * eta;
119  const REAL8 etap3 = etap2 * eta;
120  const REAL8 piM = LAL_PI * m_sec;
121  const REAL8 mSevenBySix = -7./6.;
122  const REAL8 vISCO = 1. / sqrt(6.);
123  const REAL8 fISCO = vISCO * vISCO * vISCO / piM;
124  REAL8 v0 = 1.0; /* v0=c */
125  REAL8 logv0 = log(v0);
126  logv0 = log(1.);
127  REAL8 shft, amp0, f_max;
128  REAL8 psiNewt, psi2, psi3, psi4, psi5, psi6, psi6L, psi7, psi3S, psi4S, psi5S;
129  REAL8 alpha2, alpha3, alpha4, alpha5, alpha6, alpha6L, alpha7, alpha3S, alpha4S, alpha5S;
130  REAL8 eta_fac = -113. + 76. * eta;
131  size_t i, n, iStart;
132  COMPLEX16 *data = NULL;
133  LIGOTimeGPS tStart = {0, 0};
134 
135  /* check inputs for sanity */
136  if (*htilde) XLAL_ERROR(XLAL_EFAULT);
137  if (deltaF <= 0) XLAL_ERROR(XLAL_EDOM);
138  if (m1_SI <= 0) XLAL_ERROR(XLAL_EDOM);
139  if (m2_SI <= 0) XLAL_ERROR(XLAL_EDOM);
140  if (fabs(chi) > 1) XLAL_ERROR(XLAL_EDOM);
141  if (fStart <= 0) XLAL_ERROR(XLAL_EDOM);
142  if (r <= 0) XLAL_ERROR(XLAL_EDOM);
143  if (ampO > 7) XLAL_ERROR(XLAL_EDOM); /* only implemented to pN 3.5 */
144  if (phaseO > 7) XLAL_ERROR(XLAL_EDOM); /* only implemented to pN 3.5 */
145 
146  /* allocate htilde */
147  if ( fEnd == 0. ) // End at ISCO
148  f_max = fISCO;
149  else // End at user-specified freq.
150  f_max = fEnd;
151  n = (size_t) (f_max / deltaF + 1);
152  XLALGPSAdd(&tStart, -1 / deltaF); /* coalesce at t=0 */
153  *htilde = XLALCreateCOMPLEX16FrequencySeries("htilde: FD waveform", &tStart, 0.0, deltaF, &lalStrainUnit, n);
154  if (!(*htilde)) XLAL_ERROR(XLAL_EFUNC);
155  memset((*htilde)->data->data, 0, n * sizeof(COMPLEX16));
156  XLALUnitMultiply(&((*htilde)->sampleUnits), &((*htilde)->sampleUnits), &lalSecondUnit);
157 
158  /* extrinsic parameters */
159  amp0 = -pow(m_sec, 5./6.) * sqrt(5.*eta / 24.) / (Pi_p2by3 * r / LAL_C_SI);
160  shft = LAL_TWOPI * (tStart.gpsSeconds + 1e-9 * tStart.gpsNanoSeconds);
161 
162  /* spin terms in the amplitude and phase (in terms of the reduced
163  * spin parameter */
164  psi3S = 113.*chi/3.;
165  psi4S = 63845.*(-81. + 4.*eta)*chi*chi/(8. * eta_fac * eta_fac);
166  psi5S = -565.*(-146597. + 135856.*eta + 17136.*etap2)*chi/(2268.*eta_fac);
167 
168  alpha3S = (113.*chi)/24.;
169  alpha4S = (12769.*chi*chi*(-81. + 4.*eta))/(32. * eta_fac * eta_fac);
170  alpha5S = (-113.*chi*(502429. - 591368.*eta + 1680*etap2))/(16128.*eta_fac);
171 
172  /* coefficients of the phase at PN orders from 0 to 3.5PN */
173  psiNewt = 3./(128.*eta);
174  psi2 = 3715./756. + 55.*eta/9.;
175  psi3 = psi3S - 16.*LAL_PI;
176  psi4 = 15293365./508032. + 27145.*eta/504. + 3085.*eta*eta/72. + psi4S;
177  psi5 = (38645.*LAL_PI/756. - 65.*LAL_PI*eta/9. + psi5S);
178  psi6 = 11583231236531./4694215680. - (640.*Pi_p2)/3. - (6848.*LAL_GAMMA)/21.
179  + (-5162.983708047263 + 2255.*Pi_p2/12.)*eta
180  + (76055.*etap2)/1728. - (127825.*etap3)/1296.;
181  psi6L = -6848./21.;
182  psi7 = (77096675.*LAL_PI)/254016. + (378515.*LAL_PI*eta)/1512.
183  - (74045.*LAL_PI*eta*eta)/756.;
184 
185  /* amplitude coefficients */
186  alpha2 = 1.1056547619047619 + (11*eta)/8.;
187  alpha3 = -LAL_TWOPI + alpha3S;
188  alpha4 = 0.8939214212884228 + (18913*eta)/16128. + (1379*etap2)/1152. + alpha4S;
189  alpha5 = (-4757*LAL_PI)/1344. + (57*eta*LAL_PI)/16. + alpha5S;
190  alpha6 = -58.601030974347324 + (3526813753*eta)/2.7869184e7 -
191  (1041557*etap2)/258048. + (67999*etap3)/82944. +
192  (10*Pi_p2)/3. - (451*eta*Pi_p2)/96.;
193  alpha6L = 856/105.;
194  alpha7 = (-5111593*LAL_PI)/2.709504e6 - (72221*eta*LAL_PI)/24192. -
195  (1349*etap2*LAL_PI)/24192.;
196 
197  /* select the terms according to the PN order chosen */
198  switch (ampO) {
199  case 0:
200  case 1:
201  alpha2 = 0.;
202 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
203  __attribute__ ((fallthrough));
204 #endif
205  case 2:
206  alpha3 = 0.;
207 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
208  __attribute__ ((fallthrough));
209 #endif
210  case 3:
211  alpha4 = 0.;
212 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
213  __attribute__ ((fallthrough));
214 #endif
215  case 4:
216  alpha5 = 0.;
217 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
218  __attribute__ ((fallthrough));
219 #endif
220  case 5:
221  alpha6 = 0.;
222  alpha6L = 0.;
223 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
224  __attribute__ ((fallthrough));
225 #endif
226  case 6:
227  alpha7 = 0.;
228 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
229  __attribute__ ((fallthrough));
230 #endif
231  default:
232  break;
233  }
234 
235  switch (phaseO) {
236  case 0:
237  case 1:
238  psi2 = 0.;
239 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
240  __attribute__ ((fallthrough));
241 #endif
242  case 2:
243  psi3 = 0.;
244 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
245  __attribute__ ((fallthrough));
246 #endif
247  case 3:
248  psi4 = 0.;
249 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
250  __attribute__ ((fallthrough));
251 #endif
252  case 4:
253  psi5 = 0.;
254 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
255  __attribute__ ((fallthrough));
256 #endif
257  case 5:
258  psi6 = 0.;
259  psi6L = 0.;
260 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
261  __attribute__ ((fallthrough));
262 #endif
263  case 6:
264  psi7 = 0.;
265 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
266  __attribute__ ((fallthrough));
267 #endif
268  default:
269  break;
270  }
271 
272  /* Fill with non-zero vals from fStart to f_max */
273  iStart = (size_t) ceil(fStart / deltaF);
274  data = (*htilde)->data->data;
275  for (i = iStart; i < n; i++) {
276  /* fourier frequency corresponding to this bin */
277  const REAL8 f = i * deltaF;
278  const REAL8 v3 = piM*f;
279 
280  /* PN expansion parameter */
281  REAL8 v, v2, v4, v5, v6, v7, logv, Psi, amp;
282  v = cbrt(v3);
283  v2 = v*v; v4 = v3*v; v5 = v4*v; v6 = v3*v3; v7 = v6*v;
284  logv = log(v);
285 
286  /* compute the phase and amplitude */
287  Psi = psiNewt / v5 * (1.
288  + psi2 * v2 + psi3 * v3 + psi4 * v4
289  + psi5 * v5 * (1. + 3. * (logv - logv0))
290  + (psi6 + psi6L * (log4 + logv)) * v6 + psi7 * v7);
291 
292  amp = amp0 * pow(f, mSevenBySix) * (1.
293  + alpha2 * v2 + alpha3 * v3 + alpha4 * v4 + alpha5 * v5
294  + (alpha6 + alpha6L * (LAL_GAMMA + log4 + logv)) * v6
295  + alpha7 * v7);
296 
297  data[i] = amp * cos(Psi + shft * f - 2.*phic - LAL_PI_4)
298  - I * (amp * sin(Psi + shft * f - 2.*phic - LAL_PI_4));
299  }
300 
301  return XLAL_SUCCESS;
302 }
303 
304 /**
305  * Compute the chirp time of the "reduced-spin" templates
306  */
308  const REAL8 fStart, /**< start GW frequency (Hz) */
309  const REAL8 m1_SI, /**< mass of companion 1 (kg) */
310  const REAL8 m2_SI, /**< mass of companion 2 (kg) */
311  const REAL8 chi, /**< dimensionless aligned-spin param */
312  const INT4 O /**< twice PN phase order */
313  ) {
314  const REAL8 m1 = m1_SI / LAL_MSUN_SI;
315  const REAL8 m2 = m2_SI / LAL_MSUN_SI;
316  const REAL8 m = m1+m2;
317  const REAL8 eta = m1*m2/(m*m);
318  const REAL8 eta2 = eta*eta;
319  const REAL8 chi2 = chi*chi;
320  const REAL8 sigma0 = (-12769*(-81. + 4.*eta))/(16.*(-113. + 76.*eta)*(-113. + 76.*eta));
321  const REAL8 gamma0 = (565*(-146597. + 135856.*eta + 17136.*eta2))/(2268.*(-113. + 76.*eta));
322 
323  REAL8 v = cbrt(LAL_PI * m * LAL_MTSUN_SI * fStart);
324  REAL8 vk = v; /* v^k */
325  REAL8 tau = 1.; /* chirp time */
326  REAL8 tk[8]; /* chirp time coefficients up to 3.5 PN */
327  size_t k;
328  UINT4 order = (UINT4) O;
329 
330  if (fStart <= 0) XLAL_ERROR(XLAL_EDOM);
331  if (m1_SI <= 0) XLAL_ERROR(XLAL_EDOM);
332  if (m2_SI <= 0) XLAL_ERROR(XLAL_EDOM);
333  if (fabs(chi) > 1) XLAL_ERROR(XLAL_EDOM);
334  if (O > 7) XLAL_ERROR(XLAL_EDOM); /* only implemented to pN 3.5 */
335  if (O == -1) order = 7; /* to be changed to use #define MAX_PHASE_ORDER in LALSimInspiral.h */
336 
337  /* chirp time coefficients up to 3.5PN */
338  tk[0] = (5.*m*LAL_MTSUN_SI)/(256.*pow(v,8)*eta);
339  tk[1] = 0.;
340  tk[2] = 2.9484126984126986 + (11*eta)/3.;
341  tk[3] = (-32*LAL_PI)/5. + (226.*chi)/15.;
342  tk[4] = 6.020630590199042 - 2*sigma0*chi2 + (5429*eta)/504. + (617*eta2)/72.;
343  tk[5] = (3*gamma0*chi)/5. - (7729*LAL_PI)/252. + (13*LAL_PI*eta)/3.;
344  tk[6] = -428.291776175525 + (128*Pi_p2)/3. + (6848*LAL_GAMMA)/105. + (3147553127*eta)/3.048192e6 -
345  (451*Pi_p2*eta)/12. - (15211*eta2)/1728. + (25565*eta2*eta)/1296. + (6848*log(4*v))/105.;
346  tk[7] = (-15419335*LAL_PI)/127008. - (75703*LAL_PI*eta)/756. + (14809*LAL_PI*eta2)/378.;
347 
348  /* compute chirp time */
349  for (k = 2; k <= order; k++) {
350  vk *= v;
351  tau += tk[k] * vk;
352  }
353  tau *= tk[0];
354 
355  return tau;
356 }
357 
358 /** @} */
static double double delta
static double tau(const double a, const double b, const sysq *system)
Internal function that computes the spin-spin couplings.
double i
Definition: bh_ringdown.c:118
double e
Definition: bh_ringdown.c:117
sigmaKerr data[0]
#define __attribute__(x)
COMPLEX16FrequencySeries * XLALCreateCOMPLEX16FrequencySeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaF, const LALUnit *sampleUnits, size_t length)
#define LAL_C_SI
#define LAL_MSUN_SI
#define LAL_PI
#define LAL_TWOPI
#define LAL_MTSUN_SI
#define LAL_PI_4
#define LAL_GAMMA
double complex COMPLEX16
double REAL8
uint32_t UINT4
int32_t INT4
int XLALSimInspiralTaylorF2ReducedSpin(COMPLEX16FrequencySeries **htilde, const REAL8 phic, const REAL8 deltaF, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 chi, const REAL8 fStart, const REAL8 fEnd, const REAL8 r, const INT4 phaseO, const INT4 ampO)
Driver routine to compute a non-precessing post-Newtonian inspiral waveform in the frequency domain,...
REAL8 XLALSimInspiralTaylorF2ReducedSpinChirpTime(const REAL8 fStart, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 chi, const INT4 O)
Compute the chirp time of the "reduced-spin" templates.
REAL8 XLALSimInspiralTaylorF2ReducedSpinComputeChi(const REAL8 m1, const REAL8 m2, const REAL8 s1z, const REAL8 s2z)
Compute the dimensionless, aligned-spin parameter chi as used in the TaylorF2RedSpin waveform.
static const INT4 r
static const INT4 m
const LALUnit lalStrainUnit
const LALUnit lalSecondUnit
LALUnit * XLALUnitMultiply(LALUnit *output, const LALUnit *unit1, const LALUnit *unit2)
#define XLAL_ERROR(...)
XLAL_SUCCESS
XLAL_EFAULT
XLAL_EFUNC
XLAL_EDOM
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
INT4 gpsNanoSeconds
double f_max
Definition: unicorn.c:23