LALSimulation  5.4.0.1-fe68b98
LALSimInspiralTaylorF2ReducedSpinTidal.c
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2011 P. Ajith, N. Fotopoulos, J. Read
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 /**
32  * @addtogroup LALSimInspiralTaylorF2ReducedSpin_c
33  * @{
34  */
35 
36 /**
37  * Generate the "reduced-spin templates" proposed in http://arxiv.org/abs/1107.1267
38  * Add the tidal phase terms from http://arxiv.org/abs/1101.1673 (Eqs. 3.9, 3.10)
39  * The chi parameter should be determined from XLALSimInspiralTaylorF2ReducedSpinComputeChi.
40  */
42  COMPLEX16FrequencySeries **htilde, /**< FD waveform */
43  const REAL8 phic, /**< orbital coalescence phase (rad) */
44  const REAL8 deltaF, /**< frequency resolution (Hz) */
45  const REAL8 m1_SI, /**< mass of companion 1 (kg) */
46  const REAL8 m2_SI, /**< mass of companion 2 (kg) */
47  const REAL8 chi, /**< dimensionless aligned-spin param */
48  const REAL8 lam1, /**< (tidal deformability of mass 1) / (mass of body 1)^5 (dimensionless) */
49  const REAL8 lam2, /**< (tidal deformability of mass 2) / (mass of body 2)^5 (dimensionless) */
50  const REAL8 fStart, /**< start GW frequency (Hz) */
51  const REAL8 fEnd, /**< highest GW frequency (Hz) of waveform generation - if 0, end at Schwarzschild ISCO */
52  const REAL8 r, /**< distance of source (m) */
53  const INT4 phaseO, /**< twice PN phase order */
54  const INT4 ampO /**< twice PN amplitude order */
55  ) {
56  /* external: SI; internal: solar masses */
57  const REAL8 m1 = m1_SI / LAL_MSUN_SI;
58  const REAL8 m2 = m2_SI / LAL_MSUN_SI;
59  const REAL8 m = m1 + m2;
60  const REAL8 m_sec = m * LAL_MTSUN_SI; /* total mass in seconds */
61  const REAL8 eta = m1 * m2 / (m * m);
62  const REAL8 xi1 = m1 / m;
63  const REAL8 xi2 = m2 / m;
64  const REAL8 piM = LAL_PI * m_sec;
65  const REAL8 mSevenBySix = -7./6.;
66  const REAL8 vISCO = 1. / sqrt(6.);
67  const REAL8 fISCO = vISCO * vISCO * vISCO / piM;
68  REAL8 v0 = 1.0; /* v0=c */
69  REAL8 shft, amp0, f_max;
70  REAL8 psiNewt, psi2, psi3, psi4, psi5, psi6, psi6L, psi7, psi3S, psi4S, psi5S, psi10T1, psi10T2, psi10, psi12T1, psi12T2, psi12;
71  REAL8 alpha2, alpha3, alpha4, alpha5, alpha6, alpha6L, alpha7, alpha3S, alpha4S, alpha5S;
72  size_t i, n, iStart;
73  COMPLEX16 *data = NULL;
74  LIGOTimeGPS tStart = {0, 0};
75 
76  /* check inputs for sanity */
77  if (*htilde) XLAL_ERROR(XLAL_EFAULT);
78  if (m1_SI <= 0) XLAL_ERROR(XLAL_EDOM);
79  if (m2_SI <= 0) XLAL_ERROR(XLAL_EDOM);
80  if (fabs(chi) > 1) XLAL_ERROR(XLAL_EDOM);
81  if (fStart <= 0) XLAL_ERROR(XLAL_EDOM);
82  if (r <= 0) XLAL_ERROR(XLAL_EDOM);
83  if (ampO > 7) XLAL_ERROR(XLAL_EDOM); /* only implemented to pN 3.5 */
84  if (phaseO > 7) XLAL_ERROR(XLAL_EDOM); /* only implemented to pN 3.5 */
85 
86  /* allocate htilde */
87  if ( fEnd == 0. ) // End at ISCO
88  f_max = fISCO;
89  else // End at user-specified freq.
90  f_max = fEnd;
91  n = (size_t) (f_max / deltaF + 1);
92  XLALGPSAdd(&tStart, -1 / deltaF); /* coalesce at t=0 */
93  *htilde = XLALCreateCOMPLEX16FrequencySeries("htilde: FD waveform", &tStart, 0.0, deltaF, &lalStrainUnit, n);
94  if (!(*htilde)) XLAL_ERROR(XLAL_EFUNC);
95  memset((*htilde)->data->data, 0, n * sizeof(COMPLEX16));
96  XLALUnitMultiply(&((*htilde)->sampleUnits), &((*htilde)->sampleUnits), &lalSecondUnit);
97 
98  /* extrinsic parameters */
99  amp0 = -pow(m_sec, 5./6.) * sqrt(5. * eta / 24.) / (cbrt(LAL_PI * LAL_PI) * r / LAL_C_SI);
100  shft = LAL_TWOPI * (tStart.gpsSeconds + 1e-9 * tStart.gpsNanoSeconds);
101 
102  /* spin terms in the amplitude and phase (in terms of the reduced
103  * spin parameter */
104  psi3S = 113.*chi/3.;
105  psi4S = 63845.*(-81. + 4.*eta)*chi*chi/(8.*pow(-113. + 76.*eta, 2.));
106  psi5S = -565.*(-146597. + 135856.*eta + 17136.*eta*eta)*chi/(2268.*(-113. + 76.*eta));
107 
108  alpha3S = (113.*chi)/24.;
109  alpha4S = (12769.*chi*chi*(-81. + 4.*eta))/(32.*pow(-113. + 76.*eta,2));
110  alpha5S = (-113.*chi*(502429. - 591368.*eta + 1680*eta*eta))/(16128.*(-113 + 76*eta));
111 
112  /* tidal terms in the phase */
113  psi10T2 = -24./xi2 * (1. + 11. * xi1) * lam2 * xi2*xi2*xi2*xi2*xi2;
114  psi10T1 = -24./xi1 * (1. + 11. * xi2) * lam1 * xi1*xi1*xi1*xi1*xi1;
115  psi12T2 = -5./28./xi2 * (3179. - 919.* xi2 - 2286.* xi2*xi2 + 260.* xi2*xi2*xi2)* lam2 * xi2*xi2*xi2*xi2*xi2;
116  psi12T1 = -5./28./xi1 * (3179. - 919.* xi1 - 2286.* xi1*xi1 + 260.* xi1*xi1*xi1)* lam1 * xi1*xi1*xi1*xi1*xi1;
117 
118  /* coefficients of the phase at PN orders from 0 to 3.5PN */
119  psiNewt = 3./(128.*eta);
120  psi2 = 3715./756. + 55.*eta/9.;
121  psi3 = psi3S - 16.*LAL_PI;
122  psi4 = 15293365./508032. + 27145.*eta/504. + 3085.*eta*eta/72. + psi4S;
123  psi5 = (38645.*LAL_PI/756. - 65.*LAL_PI*eta/9. + psi5S);
124  psi6 = 11583231236531./4694215680. - (640.*LAL_PI*LAL_PI)/3. - (6848.*LAL_GAMMA)/21.
125  + (-5162.983708047263 + 2255.*LAL_PI*LAL_PI/12.)*eta
126  + (76055.*eta*eta)/1728. - (127825.*eta*eta*eta)/1296.;
127  psi6L = -6848./21.;
128  psi7 = (77096675.*LAL_PI)/254016. + (378515.*LAL_PI*eta)/1512.
129  - (74045.*LAL_PI*eta*eta)/756.;
130  psi10 = psi10T1+psi10T2;
131  psi12 = psi12T1+psi12T2;
132 
133  /* amplitude coefficients */
134  alpha2 = 1.1056547619047619 + (11*eta)/8.;
135  alpha3 = -LAL_TWOPI + alpha3S;
136  alpha4 = 0.8939214212884228 + (18913*eta)/16128. + (1379*eta*eta)/1152. + alpha4S;
137  alpha5 = (-4757*LAL_PI)/1344. + (57*eta*LAL_PI)/16. + alpha5S;
138  alpha6 = -58.601030974347324 + (3526813753*eta)/2.7869184e7 -
139  (1041557*eta*eta)/258048. + (67999*eta*eta*eta)/82944. +
140  (10*LAL_PI*LAL_PI)/3. - (451*eta*LAL_PI*LAL_PI)/96.;
141  alpha6L = 856/105.;
142  alpha7 = (-5111593*LAL_PI)/2.709504e6 - (72221*eta*LAL_PI)/24192. -
143  (1349*eta*eta*LAL_PI)/24192.;
144 
145  /* select the terms according to the PN order chosen */
146  switch (ampO) {
147  case 0:
148  case 1:
149  alpha2 = 0.;
150 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
151  __attribute__ ((fallthrough));
152 #endif
153  case 2:
154  alpha3 = 0.;
155 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
156  __attribute__ ((fallthrough));
157 #endif
158  case 3:
159  alpha4 = 0.;
160 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
161  __attribute__ ((fallthrough));
162 #endif
163  case 4:
164  alpha5 = 0.;
165 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
166  __attribute__ ((fallthrough));
167 #endif
168  case 5:
169  alpha6 = 0.;
170  alpha6L = 0.;
171 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
172  __attribute__ ((fallthrough));
173 #endif
174  case 6:
175  alpha7 = 0.;
176 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
177  __attribute__ ((fallthrough));
178 #endif
179  default:
180  break;
181  }
182 
183  switch (phaseO) {
184  case 0:
185  case 1:
186  psi2 = 0.;
187 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
188  __attribute__ ((fallthrough));
189 #endif
190  case 2:
191  psi3 = 0.;
192 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
193  __attribute__ ((fallthrough));
194 #endif
195  case 3:
196  psi4 = 0.;
197 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
198  __attribute__ ((fallthrough));
199 #endif
200  case 4:
201  psi5 = 0.;
202 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
203  __attribute__ ((fallthrough));
204 #endif
205  case 5:
206  psi6 = 0.;
207  psi6L = 0.;
208 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
209  __attribute__ ((fallthrough));
210 #endif
211  case 6:
212  psi7 = 0.;
213 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
214  __attribute__ ((fallthrough));
215 #endif
216  default:
217  break;
218  }
219 
220  /* Fill with non-zero vals from fStart to lesser of fEnd, fISCO */
221  iStart = (size_t) ceil(fStart / deltaF);
222  data = (*htilde)->data->data;
223  const REAL8 logv0=log(v0);
224  const REAL8 log4=log(4.0);
225 
226  for (i = iStart; i < n; i++) {
227  /* fourier frequency corresponding to this bin */
228  const REAL8 f = i * deltaF;
229  const REAL8 v3 = piM*f;
230 
231  /* PN expansion parameter */
232  REAL8 Psi, amp;
233  const REAL8 v = cbrt(v3);
234  const REAL8 logv=log(v);
235  const REAL8 v2 = v*v;
236  const REAL8 v4 = v3*v;
237  const REAL8 v5 = v4*v;
238  const REAL8 v6 = v3*v3;
239  const REAL8 v7 = v6*v;
240  const REAL8 v10 = v5*v5;
241  const REAL8 v12 = v6*v6;
242 
243  /* compute the phase and amplitude */
244  Psi = psiNewt / v5 * (1.
245  + psi2 * v2 + psi3 * v3 + psi4 * v4
246  + psi5 * v5 * (1. + 3. * (logv - logv0))
247  + (psi6 + psi6L * (log4 + logv)) * v6 + psi7 * v7)
248  + psi10 * v10 + psi12 * v12;
249 
250  amp = amp0 * pow(f, mSevenBySix) * (1.
251  + alpha2 * v2 + alpha3 * v3 + alpha4 * v4 + alpha5 * v5
252  + (alpha6 + alpha6L * (LAL_GAMMA + (log4 + logv))) * v6
253  + alpha7 * v7);
254 
255  data[i] = amp * cos(Psi + shft * f - 2.*phic - LAL_PI_4) - I * (amp * sin(Psi + shft * f - 2.*phic - LAL_PI_4));
256  }
257 
258  return XLAL_SUCCESS;
259 }
260 
261 /** @} */
double i
Definition: bh_ringdown.c:118
double e
Definition: bh_ringdown.c:117
const double xi2
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
int32_t INT4
int XLALSimInspiralTaylorF2ReducedSpinTidal(COMPLEX16FrequencySeries **htilde, const REAL8 phic, const REAL8 deltaF, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 chi, const REAL8 lam1, const REAL8 lam2, const REAL8 fStart, const REAL8 fEnd, const REAL8 r, const INT4 phaseO, const INT4 ampO)
Generate the "reduced-spin templates" proposed in http://arxiv.org/abs/1107.1267 Add the tidal phase ...
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