LALSimulation  5.4.0.1-fe68b98
LALSimInspiralTaylorF2NLTides.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007 Jolien Creighton, B.S. Sathyaprakash, Thomas Cokelaer
3  * Copyright (C) 2012 Leo Singer, Evan Ochsner, Les Wade, Alex Nitz
4  * Assembled from code found in:
5  * - LALInspiralStationaryPhaseApproximation2.c
6  * - LALInspiralChooseModel.c
7  * - LALInspiralSetup.c
8  * - LALSimInspiralTaylorF2ReducedSpin.c
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with with program; see the file COPYING. If not, write to the
22  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23  * MA 02110-1301 USA
24  */
25 
26 #include <stdlib.h>
27 #include <math.h>
28 #include <lal/Date.h>
29 #include <lal/FrequencySeries.h>
30 #include <lal/LALConstants.h>
31 #include <lal/Sequence.h>
32 #include <lal/LALDatatypes.h>
33 #include <lal/LALSimInspiral.h>
34 #include <lal/Units.h>
35 #include <lal/XLALError.h>
37 
38 #ifndef _OPENMP
39 #define omp ignore
40 #endif
41 
42 /**
43  * @addtogroup LALSimInspiralTaylorXX_c
44  * @{
45  *
46  * @name Routines for TaylorF2-NLTides Waveforms
47  *
48  * @{
49  */
50 
51 /** \brief Returns structure containing TaylorF2 phasing coefficients for given
52  * physical parameters.
53  */
55  PNPhasingSeries **pn, /**< phasing coefficients (output) */
56  const REAL8 m1, /**< mass of body 1 */
57  const REAL8 m2, /**< mass of body 2 */
58  const REAL8 chi1, /**< aligned spin parameter of body 1 */
59  const REAL8 chi2, /**< aligned spin parameter of body 2 */
60  LALDict *p /**< LAL dictionary containing accessory parameters */
61  )
62 {
63  PNPhasingSeries *pfa;
64 
65  if (!pn) XLAL_ERROR(XLAL_EFAULT);
66  if (*pn) XLAL_ERROR(XLAL_EFAULT);
67 
68 
69  pfa = (PNPhasingSeries *) LALMalloc(sizeof(PNPhasingSeries));
70 
71  XLALSimInspiralPNPhasing_F2(pfa, m1, m2, chi1, chi2, chi1*chi1, chi2*chi2, chi1*chi2, p);
72 
73  *pn = pfa;
74 
75  return XLAL_SUCCESS;
76 }
77 
78 /*
79 The function which computes the phase shift as a function of frequency
80 */
82  REAL8Sequence *dphi, /**<the arrary for the NL phase errors, should be the same length as freqs */
83  const REAL8Sequence *freqs, /**< frequency array [Hz], should be the same length as dphi */
84  const REAL8 Anl1, /**< the amplitude of the phase shift from m1 */
85  const REAL8 n1, /**< the spectral index of the phase shift from m1 */
86  const REAL8 fo1, /**< the 'turn-on' frequency for the phase shift in m1 [Hz] */
87  const REAL8 m1_SI, /**< the primary mass [kg] */
88  const REAL8 Anl2, /**< the amplitude of the phase shift from m2 */
89  const REAL8 n2, /**< the spectral index of the phase shift from m2 */
90  const REAL8 fo2, /**< the 'turn-on' frequency for the phase shift in m2 [Hz]*/
91  const REAL8 m2_SI /**< the secondary mass [kg] */
92  )
93 {
94  /*
95  We compute this from a basic post-newtonian expansion that includes dissipation from the tides as an extra energy sink
96  In particular, we assume 0th order gravitational radiation loss and orbital energy and add terms like
97  Edot_1 = 2*N1*Y1*Esat1
98  where
99  N is the number of modes participating
100  Y is the growth rate of the instability
101  Esat is the energy at which unstable modes saturate
102  Thus
103  Edot_1 = 2*pi^2 * m1*m2/(m1+m2) * G^(2/3) * m1*(2/3) * fref^(5/3) * Anl1 * (f/fref)^(2+n1) * Theta(f-fo1)
104  and similarly for Edot_2
105  Assuming the phase shift introduced is small (Anl <~ 1e-5 for 1.4-1.4 BNS), we expand the resulting integral for the phase as a power series and truncate it after the first term.
106  This yields the resulting phase contribution, which is strictly negative.
107  */
108 
109  // set up constants outside of loop
110  REAL8 fref = 100 ; // Hz
111 
112  REAL8 Mtot = m1_SI + m2_SI ;
113  REAL8 Mchirp = pow((m1_SI*m2_SI), 0.6) / pow(Mtot, 0.2) ;
114 
115  REAL8 a1 = n1 - 3. ;
116  REAL8 a2 = n2 - 3. ;
117 
118  REAL8 C2 = (50. * pow(2., 2./3.) / 3072.) * pow(pow(LAL_C_SI, 3.) / (LAL_G_SI * Mchirp * fref * LAL_PI), 10./3.) ;
119  // there is a possible sign error here, which may depend on conventions in LALInference
120  REAL8 C1, b1, b2 ;
121  if (n1==3){
122  C1 = C2 * pow(m1_SI/Mtot, 2./3.) * Anl1 ;
123  b1 = log(fo1) ;
124  } else { //n1!=3
125  C1 = C2 * pow(m1_SI/Mtot, 2./3.) * Anl1 * pow(fref, -a1) / a1 ;
126  b1 = pow(fo1, a1) ;
127  }
128  if (n2==3) {
129  C2 = C2 * pow(m2_SI/Mtot, 2./3.) * Anl2 ;
130  b2 = log(fo2) ;
131  } else { //n2!=3
132  C2 = C2 * pow(m2_SI/Mtot, 2./3.) * Anl2 * pow(fref, -a2) / a2 ;
133  b2 = pow(fo2, a2) ;
134  }
135 
136  // iterate through freqs and fill in
137  UINT4 i = 0;
138  REAL8 f ;
139  if (fo1 < fo2 ) {
140  while ((i<freqs->length) && (freqs->data[i] < fo1)) {
141  dphi->data[i] = 0.0 ;
142  i++ ;
143  }
144  if (n1==3) {
145  while ((i<freqs->length) && (freqs->data[i] < fo2)) {
146  dphi->data[i] = C1 * ( log(freqs->data[i]) - b1 ) ;
147  i++ ;
148  }
149  if (n2==3) {
150  while (i<freqs->length) {
151  f = log( freqs->data[i] ) ;
152  dphi->data[i] = C1 * ( f - b1 ) + C2 * ( f - b2 ) ;
153  i++ ;
154  }
155  } else { //n2!=3
156  while (i<freqs->length) {
157  f = freqs->data[i] ;
158  dphi->data[i] = C1 * ( log( f ) - b1 ) + C2 * ( pow(f, a2) - b2 ) ;
159  i++ ;
160  }
161  }
162  } else { //n1!=3
163  while ((i<freqs->length) && (freqs->data[i] < fo2)) {
164  dphi->data[i] = C1 * ( pow(freqs->data[i], a1) - b1 ) ;
165  i++ ;
166  }
167  if (n2==3) {
168  while (i<freqs->length) {
169  f = freqs->data[i] ;
170  dphi->data[i] = C1 * ( pow(f, a1) - b1 ) + C2 * ( log( f ) - b2 ) ;
171  i++ ;
172  }
173  } else { //n2!=3
174  while (i<freqs->length) {
175  f = freqs->data[i] ;
176  dphi->data[i] = C1 * ( pow(f, a1) - b1 ) + C2 * ( pow(f, a2) - b2 ) ;
177  i++ ;
178  }
179  }
180  }
181  } else { // fo2 <= fo1
182  while ((i<freqs->length) && (freqs->data[i] < fo2)) {
183  dphi->data[i] = 0.0 ;
184  i++ ;
185  }
186  if (n2==3) {
187  while ((i<freqs->length) && (freqs->data[i] < fo1)) {
188  dphi->data[i] = C2 * ( log(freqs->data[i]) - b2 ) ;
189  i++ ;
190  }
191  if (n1==3) {
192  while (i<freqs->length) {
193  f = log( freqs->data[i] ) ;
194  dphi->data[i] = C2 * ( f - b2 ) + C1 * ( f - b1 ) ;
195  i++ ;
196  }
197  } else { //n1!=3
198  while (i<freqs->length) {
199  f = freqs->data[i] ;
200  dphi->data[i] = C2 * ( log( f ) - b2 ) + C1 * ( pow(f, a1) - b1 ) ;
201  i++ ;
202  }
203  }
204  } else { //n2!=3
205  while ((i<freqs->length) && (freqs->data[i] < fo1)) {
206  dphi->data[i] = C2 * ( pow(freqs->data[i], a2) - b2 ) ;
207  i++ ;
208  }
209  if (n1==3) {
210  while (i<freqs->length) {
211  f = freqs->data[i] ;
212  dphi->data[i] = C2 * ( pow(f, a2) - b2 ) + C1 * ( log( f ) - b1 ) ;
213  i++ ;
214  }
215  } else { //n1!=3
216  while (i<freqs->length) {
217  f = freqs->data[i] ;
218  dphi->data[i] = C2 * ( pow(f, a2) - b2 ) + C1 * ( pow(f, a1) - b1 ) ;
219  i++ ;
220  }
221  }
222  }
223  }
224  return XLAL_SUCCESS;
225 }
226 
228  COMPLEX16FrequencySeries **htilde_out, /**< FD waveform */
229  const REAL8Sequence *freqs, /**< frequency points at which to evaluate the waveform (Hz) */
230  const REAL8 phi_ref, /**< reference orbital phase (rad) */
231  const REAL8 m1_SI, /**< mass of companion 1 (kg) */
232  const REAL8 m2_SI, /**< mass of companion 2 (kg) */
233  const REAL8 S1z, /**< z component of the spin of companion 1 */
234  const REAL8 S2z, /**< z component of the spin of companion 2 */
235  const REAL8 f_ref, /**< Reference GW frequency (Hz) - if 0 reference point is coalescence */
236  const REAL8 shft, /**< time shift to be applied to frequency-domain phase (sec)*/
237  const REAL8 r, /**< distance of source (m) */
238  LALDict *p /**< Linked list containing the extra testing GR parameters >**/
239  )
240 {
241 
242  if (!htilde_out) XLAL_ERROR(XLAL_EFAULT);
243  if (!freqs) XLAL_ERROR(XLAL_EFAULT);
244  /* external: SI; internal: solar masses */
245  const REAL8 m1 = m1_SI / LAL_MSUN_SI;
246  const REAL8 m2 = m2_SI / LAL_MSUN_SI;
247  const REAL8 m = m1 + m2;
248  const REAL8 m_sec = m * LAL_MTSUN_SI; /* total mass in seconds */
249  const REAL8 eta = m1 * m2 / (m * m);
250  const REAL8 piM = LAL_PI * m_sec;
251  const REAL8 m1OverM = m1 / m;
252  const REAL8 m2OverM = m2 / m;
253  REAL8 amp0;
254  size_t i;
255  COMPLEX16 *data = NULL;
256  LIGOTimeGPS tC = {0, 0};
257  INT4 iStart = 0;
258 
259  COMPLEX16FrequencySeries *htilde = NULL;
260 
261  if (*htilde_out) { //case when htilde_out has been allocated in XLALSimInspiralTaylorF2
262  htilde = *htilde_out;
263  iStart = htilde->data->length - freqs->length; //index shift to fill pre-allocated data
264  if(iStart < 0) XLAL_ERROR(XLAL_EFAULT);
265  }
266  else { //otherwise allocate memory here
267  htilde = XLALCreateCOMPLEX16FrequencySeries("htilde: FD waveform", &tC, freqs->data[0], 0., &lalStrainUnit, freqs->length);
268  if (!htilde) XLAL_ERROR(XLAL_EFUNC);
270  }
271 
272  /* phasing coefficients */
273  PNPhasingSeries pfa;
274  XLALSimInspiralPNPhasing_F2(&pfa, m1, m2, S1z, S2z, S1z*S1z, S2z*S2z, S1z*S2z, p);
275 
276  REAL8 pfaN = 0.; REAL8 pfa1 = 0.;
277  REAL8 pfa2 = 0.; REAL8 pfa3 = 0.; REAL8 pfa4 = 0.;
278  REAL8 pfa5 = 0.; REAL8 pfl5 = 0.;
279  REAL8 pfa6 = 0.; REAL8 pfl6 = 0.;
280  REAL8 pfa7 = 0.;
281 
283  switch (phaseO)
284  {
285  case -1:
286  case 7:
287  pfa7 = pfa.v[7];
288 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
289  __attribute__ ((fallthrough));
290 #endif
291  case 6:
292  pfa6 = pfa.v[6];
293  pfl6 = pfa.vlogv[6];
294 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
295  __attribute__ ((fallthrough));
296 #endif
297  case 5:
298  pfa5 = pfa.v[5];
299  pfl5 = pfa.vlogv[5];
300 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
301  __attribute__ ((fallthrough));
302 #endif
303  case 4:
304  pfa4 = pfa.v[4];
305 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
306  __attribute__ ((fallthrough));
307 #endif
308  case 3:
309  pfa3 = pfa.v[3];
310 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
311  __attribute__ ((fallthrough));
312 #endif
313  case 2:
314  pfa2 = pfa.v[2];
315 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
316  __attribute__ ((fallthrough));
317 #endif
318  case 1:
319  pfa1 = pfa.v[1];
320 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
321  __attribute__ ((fallthrough));
322 #endif
323  case 0:
324  pfaN = pfa.v[0];
325  break;
326  default:
327  XLAL_ERROR(XLAL_ETYPE, "Invalid phase PN order %d", phaseO);
328  }
329 
330  /* Validate expansion order arguments.
331  * This must be done here instead of in the OpenMP parallel loop
332  * because when OpenMP parallelization is turned on, early exits
333  * from loops (via return or break statements) are not permitted.
334  */
335 
336  /* Validate amplitude PN order. */
338  switch (amplitudeO)
339  {
340  case -1:
341  case 7:
342  case 6:
343  case 5:
344  case 4:
345  case 3:
346  case 2:
347  case 0:
348  break;
349  default:
350  XLAL_ERROR(XLAL_ETYPE, "Invalid amplitude PN order %d", amplitudeO);
351  }
352 
353  /* Generate tidal terms separately.
354  * Enums specifying tidal order are in LALSimInspiralWaveformFlags.h
355  */
356  REAL8 pft10 = 0.;
357  REAL8 pft12 = 0.;
361  {
364  pft12 = pfaN * (lambda1*XLALSimInspiralTaylorF2Phasing_12PNTidalCoeff(m1OverM) + lambda2*XLALSimInspiralTaylorF2Phasing_12PNTidalCoeff(m2OverM) );
365 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
366  __attribute__ ((fallthrough));
367 #endif
369  pft10 = pfaN * ( lambda1*XLALSimInspiralTaylorF2Phasing_10PNTidalCoeff(m1OverM) + lambda2*XLALSimInspiralTaylorF2Phasing_10PNTidalCoeff(m2OverM) );
370 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
371  __attribute__ ((fallthrough));
372 #endif
374  break;
375  default:
377  }
378 
379  /* The flux and energy coefficients below are used to compute SPA amplitude corrections */
380 
381  /* flux coefficients */
382  const REAL8 FTaN = XLALSimInspiralPNFlux_0PNCoeff(eta);
383  const REAL8 FTa2 = XLALSimInspiralPNFlux_2PNCoeff(eta);
384  const REAL8 FTa3 = XLALSimInspiralPNFlux_3PNCoeff(eta);
385  const REAL8 FTa4 = XLALSimInspiralPNFlux_4PNCoeff(eta);
386  const REAL8 FTa5 = XLALSimInspiralPNFlux_5PNCoeff(eta);
387  const REAL8 FTl6 = XLALSimInspiralPNFlux_6PNLogCoeff(eta);
388  const REAL8 FTa6 = XLALSimInspiralPNFlux_6PNCoeff(eta);
389  const REAL8 FTa7 = XLALSimInspiralPNFlux_7PNCoeff(eta);
390 
391  /* energy coefficients */
392  const REAL8 dETaN = 2. * XLALSimInspiralPNEnergy_0PNCoeff(eta);
393  const REAL8 dETa1 = 2. * XLALSimInspiralPNEnergy_2PNCoeff(eta);
394  const REAL8 dETa2 = 3. * XLALSimInspiralPNEnergy_4PNCoeff(eta);
395  const REAL8 dETa3 = 4. * XLALSimInspiralPNEnergy_6PNCoeff(eta);
396 
397 
398  /* Perform some initial checks */
399  if (m1_SI <= 0) XLAL_ERROR(XLAL_EDOM);
400  if (m2_SI <= 0) XLAL_ERROR(XLAL_EDOM);
401  if (f_ref < 0) XLAL_ERROR(XLAL_EDOM);
402  if (r <= 0) XLAL_ERROR(XLAL_EDOM);
403 
404  /* extrinsic parameters */
405  amp0 = -4. * m1 * m2 / r * LAL_MRSUN_SI * LAL_MTSUN_SI * sqrt(LAL_PI/12.L);
406 
407  data = htilde->data->data;
408 
409  /* Compute the SPA phase at the reference point
410  * N.B. f_ref == 0 means we define the reference time/phase at "coalescence"
411  * when the frequency approaches infinity. In that case,
412  * the integrals Eq. 3.15 of arXiv:0907.0700 vanish when evaluated at
413  * f_ref == infinity. If f_ref is finite, we must compute the SPA phase
414  * evaluated at f_ref, store it as ref_phasing and subtract it off.
415  */
416  REAL8 ref_phasing = 0.;
417  if( f_ref != 0. ) {
418  const REAL8 vref = cbrt(piM*f_ref);
419  const REAL8 logvref = log(vref);
420  const REAL8 v2ref = vref * vref;
421  const REAL8 v3ref = vref * v2ref;
422  const REAL8 v4ref = vref * v3ref;
423  const REAL8 v5ref = vref * v4ref;
424  const REAL8 v6ref = vref * v5ref;
425  const REAL8 v7ref = vref * v6ref;
426  const REAL8 v8ref = vref * v7ref;
427  const REAL8 v9ref = vref * v8ref;
428  const REAL8 v10ref = vref * v9ref;
429  const REAL8 v12ref = v2ref * v10ref;
430  ref_phasing += pfa7 * v7ref;
431  ref_phasing += (pfa6 + pfl6 * logvref) * v6ref;
432  ref_phasing += (pfa5 + pfl5 * logvref) * v5ref;
433  ref_phasing += pfa4 * v4ref;
434  ref_phasing += pfa3 * v3ref;
435  ref_phasing += pfa2 * v2ref;
436  ref_phasing += pfa1 * vref;
437  ref_phasing += pfaN;
438 
439  /* Tidal terms in reference phasing */
440  ref_phasing += pft12 * v12ref;
441  ref_phasing += pft10 * v10ref;
442 
443  ref_phasing /= v5ref;
444  } /* End of if(f_ref != 0) block */
445 
446  /******************************************************
447  * compute phase change due to non-linear tidal effects
448  *******************************************************/
449 
450  // array storing non-linear phase shift
451  REAL8Sequence *nonlinear_phasing = NULL;
452  nonlinear_phasing = XLALCreateREAL8Sequence(freqs->length);
453 
460 
461  XLALSimInspiralTaylorF2NLPhase( nonlinear_phasing, freqs, Anl1, n1, f1, m1_SI, Anl2, n2, f2, m2_SI );
462 
463  #pragma omp parallel for
464  for (i = 0; i < freqs->length; i++) {
465  const REAL8 f = freqs->data[i];
466  const REAL8 v = cbrt(piM*f);
467  const REAL8 logv = log(v);
468  const REAL8 v2 = v * v;
469  const REAL8 v3 = v * v2;
470  const REAL8 v4 = v * v3;
471  const REAL8 v5 = v * v4;
472  const REAL8 v6 = v * v5;
473  const REAL8 v7 = v * v6;
474  const REAL8 v8 = v * v7;
475  const REAL8 v9 = v * v8;
476  const REAL8 v10 = v * v9;
477  const REAL8 v12 = v2 * v10;
478  REAL8 phasing = 0.;
479  REAL8 dEnergy = 0.;
480  REAL8 flux = 0.;
481  REAL8 amp;
482 
483  phasing += pfa7 * v7;
484  phasing += (pfa6 + pfl6 * logv) * v6;
485  phasing += (pfa5 + pfl5 * logv) * v5;
486  phasing += pfa4 * v4;
487  phasing += pfa3 * v3;
488  phasing += pfa2 * v2;
489  phasing += pfa1 * v;
490  phasing += pfaN;
491 
492  /* Tidal terms in phasing */
493  phasing += pft12 * v12;
494  phasing += pft10 * v10;
495 
496  /* WARNING! Amplitude orders beyond 0 have NOT been reviewed!
497  * Use at your own risk. The default is to turn them off.
498  * These do not currently include spin corrections.
499  * Note that these are not higher PN corrections to the amplitude.
500  * They are the corrections to the leading-order amplitude arising
501  * from the stationary phase approximation. See for instance
502  * Eq 6.9 of arXiv:0810.5336
503  */
504  switch (amplitudeO)
505  {
506  case 7:
507  flux += FTa7 * v7;
508 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
509  __attribute__ ((fallthrough));
510 #endif
511  case 6:
512  flux += (FTa6 + FTl6*logv) * v6;
513  dEnergy += dETa3 * v6;
514 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
515  __attribute__ ((fallthrough));
516 #endif
517  case 5:
518  flux += FTa5 * v5;
519 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
520  __attribute__ ((fallthrough));
521 #endif
522  case 4:
523  flux += FTa4 * v4;
524  dEnergy += dETa2 * v4;
525 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
526  __attribute__ ((fallthrough));
527 #endif
528  case 3:
529  flux += FTa3 * v3;
530 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
531  __attribute__ ((fallthrough));
532 #endif
533  case 2:
534  flux += FTa2 * v2;
535  dEnergy += dETa1 * v2;
536 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
537  __attribute__ ((fallthrough));
538 #endif
539  case -1: /* Default to no SPA amplitude corrections */
540  case 0:
541  flux += 1.;
542  dEnergy += 1.;
543  }
544 
545  phasing /= v5;
546  flux *= FTaN * v10;
547  dEnergy *= dETaN * v;
548  // Note the factor of 2 b/c phi_ref is orbital phase
549  phasing += shft * f - 2.*phi_ref - ref_phasing + nonlinear_phasing->data[i];
550  amp = amp0 * sqrt(-dEnergy/flux) * v;
551  data[i+iStart] = amp * cos(phasing - LAL_PI_4)
552  - amp * sin(phasing - LAL_PI_4) * 1.0j;
553  }
554 
555  // free memory associated with nonlinear_phasing
556  XLALDestroyREAL8Sequence( nonlinear_phasing ) ;
557 
558  *htilde_out = htilde;
559  return XLAL_SUCCESS;
560 }
561 
562 /**
563  * Computes the stationary phase approximation to the Fourier transform of
564  * a chirp waveform. The amplitude is given by expanding \f$1/\sqrt{\dot{F}}\f$.
565  * If the PN order is set to -1, then the highest implemented order is used.
566  *
567  * @note f_ref is the GW frequency at which phi_ref is defined. The most common
568  * choice in the literature is to choose the reference point as "coalescence",
569  * when the frequency becomes infinite. This is the behavior of the code when
570  * f_ref==0. If f_ref > 0, phi_ref sets the orbital phase at that GW frequency.
571  *
572  * See arXiv:0810.5336 and arXiv:astro-ph/0504538 for spin corrections
573  * to the phasing.
574  * See arXiv:1303.7412 for spin-orbit phasing corrections at 3 and 3.5PN order
575  *
576  * The spin and tidal order enums are defined in LALSimInspiralWaveformFlags.h
577  */
579  COMPLEX16FrequencySeries **htilde_out, /**< FD waveform */
580  const REAL8 phi_ref, /**< reference orbital phase (rad) */
581  const REAL8 deltaF, /**< frequency resolution */
582  const REAL8 m1_SI, /**< mass of companion 1 (kg) */
583  const REAL8 m2_SI, /**< mass of companion 2 (kg) */
584  const REAL8 S1z, /**< z component of the spin of companion 1 */
585  const REAL8 S2z, /**< z component of the spin of companion 2 */
586  const REAL8 fStart, /**< start GW frequency (Hz) */
587  const REAL8 fEnd, /**< highest GW frequency (Hz) of waveform generation - if 0, end at Schwarzschild ISCO */
588  const REAL8 f_ref, /**< Reference GW frequency (Hz) - if 0 reference point is coalescence */
589  const REAL8 r, /**< distance of source (m) */
590  LALDict *p /**< Linked list containing the extra testing GR parameters >**/
591  )
592 {
593  /* external: SI; internal: solar masses */
594  const REAL8 m1 = m1_SI / LAL_MSUN_SI;
595  const REAL8 m2 = m2_SI / LAL_MSUN_SI;
596  const REAL8 m = m1 + m2;
597  const REAL8 m_sec = m * LAL_MTSUN_SI; /* total mass in seconds */
598  // const REAL8 eta = m1 * m2 / (m * m);
599  const REAL8 piM = LAL_PI * m_sec;
600  const REAL8 vISCO = 1. / sqrt(6.);
601  const REAL8 fISCO = vISCO * vISCO * vISCO / piM;
602  //const REAL8 m1OverM = m1 / m;
603  // const REAL8 m2OverM = m2 / m;
604  REAL8 shft, f_max;
605  size_t i, n;
606  INT4 iStart;
607  REAL8Sequence *freqs = NULL;
608  LIGOTimeGPS tC = {0, 0};
609  int ret;
610 
611  COMPLEX16FrequencySeries *htilde = NULL;
612 
613  /* Perform some initial checks */
614  if (!htilde_out) XLAL_ERROR(XLAL_EFAULT);
615  if (*htilde_out) XLAL_ERROR(XLAL_EFAULT);
616  if (m1_SI <= 0) XLAL_ERROR(XLAL_EDOM);
617  if (m2_SI <= 0) XLAL_ERROR(XLAL_EDOM);
618  if (fStart <= 0) XLAL_ERROR(XLAL_EDOM);
619  if (f_ref < 0) XLAL_ERROR(XLAL_EDOM);
620  if (r <= 0) XLAL_ERROR(XLAL_EDOM);
621 
622  /* allocate htilde */
623  if ( fEnd == 0. ) // End at ISCO
624  f_max = fISCO;
625  else // End at user-specified freq.
626  f_max = fEnd;
627  if (f_max <= fStart) XLAL_ERROR(XLAL_EDOM);
628 
629  n = (size_t) (f_max / deltaF + 1);
630  XLALGPSAdd(&tC, -1 / deltaF); /* coalesce at t=0 */
631  htilde = XLALCreateCOMPLEX16FrequencySeries("htilde: FD waveform", &tC, 0.0, deltaF, &lalStrainUnit, n);
632  if (!htilde) XLAL_ERROR(XLAL_EFUNC);
633  memset(htilde->data->data, 0, n * sizeof(COMPLEX16));
635 
636  /* Fill with non-zero vals from fStart to f_max */
637  iStart = (INT4) ceil(fStart / deltaF);
638 
639  /* Sequence of frequencies where waveform model is to be evaluated */
640  freqs = XLALCreateREAL8Sequence(n - iStart);
641 
642  /* extrinsic parameters */
643  shft = LAL_TWOPI * (tC.gpsSeconds + 1e-9 * tC.gpsNanoSeconds);
644 
645  #pragma omp parallel for
646  for (i = iStart; i < n; i++) {
647  freqs->data[i-iStart] = i * deltaF;
648  }
649  ret = XLALSimInspiralTaylorF2CoreNLTides(&htilde, freqs, phi_ref, m1_SI, m2_SI,
650  S1z, S2z, f_ref, shft, r, p);
651 
653 
654  *htilde_out = htilde;
655 
656  return ret;
657 }
658 
659 /** @} */
660 /** @} */
#define LALMalloc(n)
const double b1
const double b2
static REAL8 UNUSED C2(REAL8 e0, REAL8 f0)
static REAL8 UNUSED C1(REAL8 Mtotal)
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 void UNUSED XLALSimInspiralPNPhasing_F2(PNPhasingSeries *pfa, const REAL8 m1, const REAL8 m2, const REAL8 chi1L, const REAL8 chi2L, const REAL8 chi1sq, const REAL8 chi2sq, const REAL8 chi1dotchi2, LALDict *p)
static REAL8 UNUSED XLALSimInspiralPNEnergy_6PNCoeff(REAL8 eta)
static REAL8 UNUSED XLALSimInspiralTaylorF2Phasing_12PNTidalCoeff(REAL8 mByM)
static REAL8 UNUSED XLALSimInspiralTaylorF2Phasing_10PNTidalCoeff(REAL8 mByM)
REAL8 XLALSimInspiralWaveformParamsLookupNLTidesN2(LALDict *params)
REAL8 XLALSimInspiralWaveformParamsLookupNLTidesN1(LALDict *params)
REAL8 XLALSimInspiralWaveformParamsLookupNLTidesA2(LALDict *params)
REAL8 XLALSimInspiralWaveformParamsLookupTidalLambda2(LALDict *params)
REAL8 XLALSimInspiralWaveformParamsLookupNLTidesF1(LALDict *params)
REAL8 XLALSimInspiralWaveformParamsLookupTidalLambda1(LALDict *params)
REAL8 XLALSimInspiralWaveformParamsLookupNLTidesF2(LALDict *params)
REAL8 XLALSimInspiralWaveformParamsLookupNLTidesA1(LALDict *params)
INT4 XLALSimInspiralWaveformParamsLookupPNPhaseOrder(LALDict *params)
INT4 XLALSimInspiralWaveformParamsLookupPNAmplitudeOrder(LALDict *params)
INT4 XLALSimInspiralWaveformParamsLookupPNTidalOrder(LALDict *params)
double i
Definition: bh_ringdown.c:118
double e
Definition: bh_ringdown.c:117
const double pn
const double a2
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_G_SI
#define LAL_MRSUN_SI
double complex COMPLEX16
double REAL8
uint32_t UINT4
int32_t INT4
@ LAL_SIM_INSPIRAL_TIDAL_ORDER_5PN
@ LAL_SIM_INSPIRAL_TIDAL_ORDER_6PN
@ LAL_SIM_INSPIRAL_TIDAL_ORDER_ALL
@ LAL_SIM_INSPIRAL_TIDAL_ORDER_0PN
int XLALSimInspiralTaylorF2CoreNLTides(COMPLEX16FrequencySeries **htilde_out, const REAL8Sequence *freqs, const REAL8 phi_ref, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 S1z, const REAL8 S2z, const REAL8 f_ref, const REAL8 shft, const REAL8 r, LALDict *p)
int XLALSimInspiralTaylorF2AlignedPhasingNLTides(PNPhasingSeries **pn, const REAL8 m1, const REAL8 m2, const REAL8 chi1, const REAL8 chi2, LALDict *p)
Returns structure containing TaylorF2 phasing coefficients for given physical parameters.
int XLALSimInspiralTaylorF2NLTides(COMPLEX16FrequencySeries **htilde_out, const REAL8 phi_ref, const REAL8 deltaF, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 S1z, const REAL8 S2z, const REAL8 fStart, const REAL8 fEnd, const REAL8 f_ref, const REAL8 r, LALDict *p)
Computes the stationary phase approximation to the Fourier transform of a chirp waveform.
int XLALSimInspiralTaylorF2NLPhase(REAL8Sequence *dphi, const REAL8Sequence *freqs, const REAL8 Anl1, const REAL8 n1, const REAL8 fo1, const REAL8 m1_SI, const REAL8 Anl2, const REAL8 n2, const REAL8 fo2, const REAL8 m2_SI)
static const INT4 r
static const INT4 m
void XLALDestroyREAL8Sequence(REAL8Sequence *sequence)
REAL8Sequence * XLALCreateREAL8Sequence(size_t length)
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
XLAL_ETYPE
XLAL_EINVAL
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
list p
double fref
Definition: sgwb.c:107
COMPLEX16Sequence * data
COMPLEX16 * data
INT4 gpsNanoSeconds
REAL8 vlogv[PN_PHASING_SERIES_MAX_ORDER+1]
REAL8 v[PN_PHASING_SERIES_MAX_ORDER+1]
REAL8 * data
double f_max
Definition: unicorn.c:23