LALSimulation  5.4.0.1-fe68b98
LALSimInspiralTaylorT2.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011 Drew Keppel, J. Creighton, S. Fairhurst, B. Krishnan, L. Santamaria, Stas Babak, David Churches, B.S. Sathyaprakash, Craig Robinson , Thomas Cokelaer, Evan Ochsner, Les Wade
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 <math.h>
21 
22 #include <lal/LALSimInspiral.h>
23 #include <lal/FindRoot.h>
24 #include <lal/LALConstants.h>
25 #include <lal/LALStdlib.h>
26 #include <lal/TimeSeries.h>
27 #include <lal/Units.h>
28 
30 #include "check_series_macros.h"
31 
32 #ifdef __GNUC__
33 #define UNUSED __attribute__ ((unused))
34 #else
35 #define UNUSED
36 #endif
37 
38 typedef struct
39 tagexpnCoeffsTaylorT2 {
40  /* Taylor expansion coefficents in t(v)*/
41  REAL8 tvaN, tva2, tva3, tva4, tva5, tva6, tva7, tvl6, tva10, tva12;
42  /* Taylor expansion coefficents in phi(v)*/
43  REAL8 pvaN, pva2, pva3, pva4, pva5, pva6, pva7, pvl6, pva10, pva12;
44 
45  /* sampling rate and interval*/
46  REAL8 samplingrate, samplinginterval;
47  /* symmetric mass ratio, total mass*/
48  REAL8 eta, totalmass, chi1, chi2;
49 
50  /* initial and final values of frequency, time, velocity; lso
51  values of velocity and frequency; final phase.*/
52  REAL8 f0, fn, t0, tn, v0, vn, vf, vlso, flso, phiC;
53 
54  /* last stable orbit and pole defined by various Taylor and P-approximants*/
55  REAL8 vlsoT0, vlsoT2, vlsoT4, vlsoT6;
57 
59  REAL8 td,
60  expnCoeffsTaylorT2 *ak);
61 
63  REAL8 td,
64  void *ak);
65 
66 typedef struct
67 tagexpnFuncTaylorT2
68 {
72 
73 typedef struct
74 tagSimInspiralToffInput
75 {
90 
91 static REAL8
93  REAL8 f,
94  void *params
95  )
96 {
97  SimInspiralToffInput *toffIn;
98  REAL8 v, v8;
99  REAL8 toff;
100 
101  if (params == NULL)
103  if (f <= 0)
105 
106  toffIn = (SimInspiralToffInput *) params;
107 
108  if (toffIn->t < 0)
110 
111 
112  v = cbrt(toffIn->piM * f);
113  v8 = pow(v,8.);
114 
115  toff = - toffIn->t + toffIn->tc
116  + toffIn->tN / v8;
117 
118  return toff;
119 }
120 
121 static REAL8
123  REAL8 f,
124  void *params
125  )
126 {
127  SimInspiralToffInput *toffIn;
128  REAL8 v, v2, v8, v10, v12;
129  REAL8 toff;
130 
131  if (params == NULL)
133  if (f <= 0)
135 
136  toffIn = (SimInspiralToffInput *) params;
137 
138  if (toffIn->t < 0)
140 
141 
142  v = cbrt(toffIn->piM * f);
143  v2 = v*v;
144  v8 = v2*v2*v2*v2;
145  v10 = v8*v2;
146  v12 = v10*v2;
147 
148  toff = - toffIn->t + toffIn->tc
149  + toffIn->tN / v8 * (1.
150  + toffIn->t2 * v2
151  + toffIn->t10 * v10
152  + toffIn->t12 * v12);
153 
154  return toff;
155 }
156 
157 static REAL8
159  REAL8 f,
160  void *params
161  )
162 {
163  SimInspiralToffInput *toffIn;
164  REAL8 v, v2, v3, v8, v10, v12;
165  REAL8 toff;
166 
167  if (params == NULL)
169  if (f <= 0)
171 
172  toffIn = (SimInspiralToffInput *) params;
173 
174  if (toffIn->t < 0)
176 
177 
178  v = cbrt(toffIn->piM * f);
179  v2 = v*v;
180  v3 = v2*v;
181  v8 = v3*v3*v2;
182  v10 = v8*v2;
183  v12 = v10*v2;
184 
185  toff = - toffIn->t + toffIn->tc
186  + toffIn->tN / v8 * (1.
187  + toffIn->t2 * v2
188  + toffIn->t3 * v3
189  + toffIn->t10 * v10
190  + toffIn->t12 * v12);
191 
192  return toff;
193 }
194 
195 static REAL8
197  REAL8 f,
198  void *params
199  )
200 {
201  SimInspiralToffInput *toffIn;
202  REAL8 v, v2, v3, v4, v8, v10, v12;
203  REAL8 toff;
204 
205  if (params == NULL)
207  if (f <= 0)
209 
210  toffIn = (SimInspiralToffInput *) params;
211 
212  if (toffIn->t < 0)
214 
215 
216  v = cbrt(toffIn->piM * f);
217  v2 = v*v;
218  v3 = v2*v;
219  v4 = v3*v;
220  v8 = v4*v4;
221  v10 = v8*v2;
222  v12 = v10*v2;
223 
224  toff = - toffIn->t + toffIn->tc
225  + toffIn->tN / v8 * (1.
226  + toffIn->t2 * v2
227  + toffIn->t3 * v3
228  + toffIn->t4 * v4
229  + toffIn->t10 * v10
230  + toffIn->t12 * v12);
231 
232  return toff;
233 }
234 
235 static REAL8
237  REAL8 f,
238  void *params
239  )
240 {
241  SimInspiralToffInput *toffIn;
242  REAL8 v, v2, v3, v4, v5, v8, v10, v12;
243  REAL8 toff;
244 
245  if (params == NULL)
247  if (f <= 0)
249 
250  toffIn = (SimInspiralToffInput *) params;
251 
252  if (toffIn->t < 0)
254 
255 
256  v = cbrt(toffIn->piM * f);
257  v2 = v*v;
258  v3 = v2*v;
259  v4 = v3*v;
260  v5 = v4*v;
261  v8 = v4*v4;
262  v10 = v8*v2;
263  v12 = v10*v2;
264 
265  toff = - toffIn->t + toffIn->tc
266  + toffIn->tN / v8 * (1.
267  + toffIn->t2 * v2
268  + toffIn->t3 * v3
269  + toffIn->t4 * v4
270  + toffIn->t5 * v5
271  + toffIn->t10 * v10
272  + toffIn->t12 * v12);
273 
274  return toff;
275 }
276 
277 static REAL8
279  REAL8 f,
280  void *params
281  )
282 {
283 
284  SimInspiralToffInput *toffIn;
285  REAL8 v, v2, v3, v4, v5, v6, v8, v10, v12;
286  REAL8 toff;
287 
288  if (params == NULL)
290  if (f <= 0)
292 
293  toffIn = (SimInspiralToffInput *) params;
294 
295  if (toffIn->t < 0)
297 
298 
299  v = cbrt(toffIn->piM * f);
300  v2 = v*v;
301  v3 = v2*v;
302  v4 = v3*v;
303  v5 = v4*v;
304  v6 = v5*v;
305  v8 = v6*v2;
306  v10 = v8*v2;
307  v12 = v10*v2;
308 
309  toff = - toffIn->t + toffIn->tc
310  + toffIn->tN / v8 * (1.
311  + toffIn->t2 * v2
312  + toffIn->t3 * v3
313  + toffIn->t4 * v4
314  + toffIn->t5 * v5
315  + (toffIn->t6 + toffIn->tl6 * log(16.*v2)) * v6
316  + toffIn->t10 * v10
317  + toffIn->t12 * v12);
318 
319  return toff;
320 }
321 
322 static REAL8
324  REAL8 f,
325  void *params
326  )
327 {
328  SimInspiralToffInput *toffIn;
329  REAL8 v, v2, v3, v4, v5, v6, v7, v8, v10, v12;
330  REAL8 toff;
331 
332  if (params == NULL)
334  if (f <= 0)
336 
337  toffIn = (SimInspiralToffInput *) params;
338 
339  if (toffIn->t < 0)
341 
342 
343  v = cbrt(toffIn->piM*f);
344  v2 = v*v;
345  v3 = v2*v;
346  v4 = v3*v;
347  v5 = v4*v;
348  v6 = v5*v;
349  v7 = v6*v;
350  v8 = v7*v;
351  v10 = v8*v2;
352  v12 = v10*v2;
353 
354  toff = - toffIn->t + toffIn->tc
355  + toffIn->tN / v8 * (1.
356  + toffIn->t2 * v2
357  + toffIn->t3 * v3
358  + toffIn->t4 * v4
359  + toffIn->t5 * v5
360  + (toffIn->t6 + toffIn->tl6 * log(16.*v2)) * v6
361  + toffIn->t7 * v7
362  + toffIn->t10 * v10
363  + toffIn->t12 * v12);
364 
365  return toff;
366 }
367 
368 
369 static REAL8
371  REAL8 v,
373  )
374 {
375  REAL8 v5;
376  REAL8 phase;
377 
378  if (ak == NULL)
380 
381  v5 = pow(v,5.);
382  phase = ak->phiC
383  + ak->pvaN / v5;
384 
385  return phase;
386 }
387 
388 static REAL8
390  REAL8 v,
392  )
393 {
394  REAL8 v2,v5,v10,v12;
395  REAL8 phase;
396 
397  if (ak == NULL)
399 
400  v2 = v*v;
401  v5 = v2*v2*v;
402  v10 = v5*v5;
403  v12 = v10*v2;
404  phase = ak->phiC
405  + ak->pvaN / v5 * ( 1. +
406  + ak->pva2 * v2
407  + ak->pva10 * v10
408  + ak->pva12 * v12);
409 
410  return phase;
411 }
412 
413 static REAL8
415  REAL8 v,
417  )
418 {
419  REAL8 v2,v3,v5,v10,v12;
420  REAL8 phase;
421 
422  if (ak == NULL)
424 
425  v2 = v*v;
426  v3 = v2*v;
427  v5 = v3*v2;
428  v10 = v5*v5;
429  v12 = v10*v2;
430  phase = ak->phiC
431  + ak->pvaN / v5 * ( 1. +
432  + ak->pva2 * v2
433  + ak->pva3 * v3
434  + ak->pva10 * v10
435  + ak->pva12 * v12);
436 
437  return phase;
438 }
439 
440 static REAL8
442  REAL8 v,
444  )
445 {
446  REAL8 v2,v3,v4,v5,v10,v12;
447  REAL8 phase;
448 
449  if (ak == NULL)
451 
452  v2 = v*v;
453  v3 = v2*v;
454  v4 = v3*v;
455  v5 = v4*v;
456  v10 = v5*v5;
457  v12 = v10*v2;
458  phase = ak->phiC
459  + ak->pvaN / v5 * ( 1. +
460  + ak->pva2 * v2
461  + ak->pva3 * v3
462  + ak->pva4 * v4
463  + ak->pva10 * v10
464  + ak->pva12 * v12);
465 
466  return phase;
467 }
468 
469 static REAL8
471  REAL8 v,
473  )
474 {
475  REAL8 v2,v3,v4,v5,v10,v12;
476  REAL8 phase;
477 
478  if (ak == NULL)
480 
481  v2 = v*v;
482  v3 = v2*v;
483  v4 = v3*v;
484  v5 = v4*v;
485  v10 = v5*v5;
486  v12 = v10*v2;
487  phase = ak->phiC
488  + ak->pvaN / v5 * ( 1. +
489  + ak->pva2 * v2
490  + ak->pva3 * v3
491  + ak->pva4 * v4
492  + ak->pva5 * log(v/ak->vlso) * v5
493  + ak->pva10 * v10
494  + ak->pva12 * v12);
495 
496  return phase;
497 }
498 
499 static REAL8
501  REAL8 v,
503  )
504 {
505  REAL8 v2,v3,v4,v5,v6,v10,v12;
506  REAL8 phase;
507 
508  if (ak == NULL)
510 
511  v2 = v*v;
512  v3 = v2*v;
513  v4 = v3*v;
514  v5 = v4*v;
515  v6 = v5*v;
516  v10 = v5*v5;
517  v12 = v10*v2;
518  phase = ak->phiC
519  + ak->pvaN / v5 * ( 1. +
520  + ak->pva2 * v2
521  + ak->pva3 * v3
522  + ak->pva4 * v4
523  + ak->pva5 * log(v/ak->vlso) * v5
524  + (ak->pva6 + ak->pvl6*log(16.*v2)) * v6
525  + ak->pva10 * v10
526  + ak->pva12 * v12);
527 
528  return phase;
529 }
530 
531 static REAL8
533  REAL8 v,
535  )
536 {
537  REAL8 v2,v3,v4,v5,v6,v7,v10,v12;
538  REAL8 phase;
539 
540  if (ak == NULL)
542 
543  v2 = v*v;
544  v3 = v2*v;
545  v4 = v3*v;
546  v5 = v4*v;
547  v6 = v5*v;
548  v7 = v6*v;
549  v10 = v5*v5;
550  v12 = v10*v2;
551  phase = ak->phiC
552  + ak->pvaN / v5 * ( 1. +
553  + ak->pva2 * v2
554  + ak->pva3 * v3
555  + ak->pva4 * v4
556  + ak->pva5 * log(v/ak->vlso) * v5
557  + (ak->pva6 + ak->pvl6*log(16.*v2)) * v6
558  + ak->pva7 * v7
559  + ak->pva10 * v10
560  + ak->pva12 * v12);
561 
562  return phase;
563 }
564 
565 
566 /*
567  * Set up the expnCoeffsTaylorT3 and expnFuncTaylorT3 structures for
568  * generating a TaylorT3 waveform.
569  *
570  * Inputs given in SI units.
571  */
573  expnCoeffsTaylorT2 *ak, /**< coefficients for TaylorT2 evolution [modified] */
574  expnFuncTaylorT2 *f, /**< functions for TaylorT2 evolution [modified] */
575  REAL8 deltaT, /**< sampling interval */
576  REAL8 m1, /**< mass of companion 1 */
577  REAL8 m2, /**< mass of companion 2 */
578  REAL8 lambda1, /**< (tidal deformability of body 1)/(mass of body 1)^5 */
579  REAL8 lambda2, /**< (tidal deformability of body 2)/(mass of body 2)^5 */
580  LALSimInspiralTidalOrder tideO, /**< twice PN order of tidal effects */
581  REAL8 f_min, /**< start frequency */
582  int O /**< twice post-Newtonian order */
583  )
584 {
585  REAL8 eta, lso, chi1, chi2;
586  REAL8 oneby6 = 1./6.;
587 
588  ak->t0 = 0;
589  ak->totalmass = m1 + m2;
590  eta = ak->eta = m1 * m2 / (ak->totalmass * ak->totalmass);
591  chi1 = ak->chi1 = m1/ak->totalmass;
592  chi2 = ak->chi2 = m2/ak->totalmass;
593  ak->totalmass *= LAL_G_SI / pow(LAL_C_SI, 3.0); /* convert m from kilograms to seconds */
594 
595  ak->f0 = f_min;
596  ak->samplinginterval = deltaT;
597  ak->fn = 1. / (2. * ak->samplinginterval);
598  ak->vn = cbrt(LAL_PI * ak->totalmass * ak->fn);
599  ak->v0 = cbrt(LAL_PI * ak->totalmass * f_min);
600 
609 
618 
619  /* Tidal co-efficients for t(v) and phi(v) */
620  ak->tva10 = 0.;
621  ak->tva12 = 0.;
622  ak->pva10 = 0.;
623  ak->pva12 = 0.;
624  switch( tideO )
625  {
632 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
633  __attribute__ ((fallthrough));
634 #endif
640 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
641  __attribute__ ((fallthrough));
642 #endif
644  break;
645  default:
646  XLALPrintError("XLAL Error - %s: Invalid tidal PN order %d\nSee LALSimInspiralTidalOrder enum in LALSimInspiralWaveformFlags.h for valid tidal orders.\n",
647  __func__, tideO );
649  }
650 
651  lso = sqrt(oneby6);
652 
653  /* Location of the 0PN and 1PN T- and P-approximant last stable orbit: */
654  ak->vlsoT0 = lso;
655 
656 /*
657  vlsoT2 = 6./(9.+eta);
658  This correct value makes vlso too large for vlsoT2 hence use 1/sqrt(6)
659 */
660  ak->vlsoT2 = lso;
661 
662  switch (O)
663  {
664  case 0:
665  ak->vlso = ak->vlsoT0;
668  break;
669  case 1:
670  XLALPrintError("XLAL Error - %s: PN approximant not supported for requested PN order\n", __func__);
672  break;
673  case 2:
674  ak->vlso = ak->vlsoT2;
677  break;
678  case 3:
679  ak->vlso = ak->vlsoT2;
682  break;
683  case 4:
684 /*
685  The value vlsoT4 is too large and doesn't work sometimes;
686  so we use vlsoT2.
687 */
688  ak->vlso = ak->vlsoT2;
691  break;
692  case 5:
693 /*
694  The value vlsoT4 is too large and doesn't work with 2.5 PN
695  Taylor approximant; so we use vlsoT2.
696 */
697  ak->vlso = ak->vlsoT2;
700  break;
701  case 6:
702 /*
703  vlsoT6 is as yet undetermined and vlsoT4 is too large in
704  certain cases (TaylorT2 crashes for (1.4,10)); using vlsoT2;
705 */
706  ak->vlso = ak->vlsoT2;
709  break;
710  case 7:
711  case -1: // Use the highest PN order available, move if higher terms added
712  ak->vlso = ak->vlsoT2;
715  break;
716  case 8:
717  XLALPrintError("XLAL Error - %s: PN approximant not supported for requested PN order\n", __func__);
719  break;
720  default:
721  XLALPrintError("XLAL Error - %s: Unknown PN order in switch\n", __func__);
723  }
724 
725  ak->flso = pow(ak->vlso, 3.0) / (LAL_PI * ak->totalmass);
726 
727  return XLAL_SUCCESS;
728 }
729 
730 /**
731  * @addtogroup LALSimInspiralTaylorXX_c
732  * @{
733  * @name Routines for TaylorT2 Waveforms
734  * @sa
735  * Section IIIC of Alessandra Buonanno, Bala R Iyer, Evan
736  * Ochsner, Yi Pan, and B S Sathyaprakash, "Comparison of post-Newtonian
737  * templates for compact binary inspiral signals in gravitational-wave
738  * detectors", Phys. Rev. D 80, 084043 (2009), arXiv:0907.0700v1
739  * @{
740  */
741 
742 /**
743  * Computes a post-Newtonian orbit using the Taylor T2 method.
744  */
746  REAL8TimeSeries **V, /**< post-Newtonian parameter [returned] */
747  REAL8TimeSeries **phi, /**< orbital phase [returned] */
748  REAL8 phiRef, /**< reference orbital phase (rad) */
749  REAL8 deltaT, /**< sampling interval (s) */
750  REAL8 m1, /**< mass of companion 1 (kg) */
751  REAL8 m2, /**< mass of companion 2 (kg) */
752  REAL8 f_min, /**< starting GW frequency (Hz) */
753  REAL8 fRef, /**< reference GW frequency (Hz) */
754  REAL8 lambda1, /**< (tidal deformability of body 1)/(mass of body 1)^5 */
755  REAL8 lambda2, /**< (tidal deformability of body 2)/(mass of body 2)^5 */
756  LALSimInspiralTidalOrder tideO, /**< twice PN order of tidal effects */
757  int O /**< twice post-Newtonian order */
758  )
759 {
760  const UINT4 blocklen = 1024;
761  REAL8 tC, xmin, xmax, xacc, v, phase;
762  REAL8 (*timing2)(REAL8, void *);
763  UINT4 j, len, idxRef = 0;
765  REAL8 f, fLso, VRef = 0.;
766  SimInspiralToffInput toffIn;
767  void *funcParams;
768  int UNUSED errnum;
769 
770  expnFuncTaylorT2 expnfunc;
772 
773  /* allocate memory */
774 
775  *V = XLALCreateREAL8TimeSeries("ORBITAL_FREQUENCY_PARAMETER", &tc, 0.0, deltaT, &lalDimensionlessUnit,
776  blocklen);
777  *phi = XLALCreateREAL8TimeSeries("ORBITAL_PHASE", &tc, 0.0, deltaT, &lalDimensionlessUnit, blocklen);
778  if (!V || !phi)
780 
781  /* initialize expnCoeffsTaylorT2 and expnFuncTaylorT2 structures */
782  if (XLALSimInspiralTaylorT2Setup(&ak, &expnfunc, deltaT, m1, m2, lambda1,
783  lambda2, tideO, f_min, O))
785 
786  timing2 = expnfunc.timing2; /* function to solve for v, given t:*/
787 
788  toffIn.tN = ak.tvaN;
789  toffIn.t2 = ak.tva2;
790  toffIn.t3 = ak.tva3;
791  toffIn.t4 = ak.tva4;
792  toffIn.t5 = ak.tva5;
793  toffIn.t6 = ak.tva6;
794  toffIn.t7 = ak.tva7;
795  toffIn.tl6 = ak.tvl6;
796  toffIn.t10 = ak.tva10;
797  toffIn.t12 = ak.tva12;
798  toffIn.piM = ak.totalmass * LAL_PI;
799 
800  /* Determine the total chirp-time tC: the total chirp time is
801  * timing2(v0;tC,t) with t=tc=0*/
802 
803  toffIn.t = 0.;
804  toffIn.tc = 0.;
805  funcParams = (void *) &toffIn;
806  tC = timing2(f_min, funcParams);
807  if (XLAL_IS_REAL8_FAIL_NAN(tC))
809  /* Reset chirp time in toffIn structure */
810  toffIn.tc = -tC;
811 
812  /* If flso is less than the user inputted upper frequency cutoff fu */
813 
814  fLso = (ak.flso < ak.fn) ? ak.flso : ak.fn;
815 
816  /* Is the sampling rate large enough? */
817 
818  if (fLso > 0.5/deltaT)
820  if (fLso <= f_min)
822 
823  xmax = 1.5*fLso;
824  xacc = 1.0e-8;
825  xmin = 0.999999*f_min;
826 
827  /* start waveform generation */
828 
829 
830  /* Now cast the input structure to argument 4 of BisectionFindRoot so
831  * that it of type void * rather than SimInspiralToffInput */
832 
833  funcParams = (void *) &toffIn;
834 
835  toffIn.t = 0.0;
836  f = f_min;
837  j = 0;
838  do {
839  /* make sure we don't write past end of vectors */
840 
841  if ( j >= (*V)->data->length ) {
842  if ( ! XLALResizeREAL8TimeSeries(*V, 0, (*V)->data->length + blocklen) )
844  if ( ! XLALResizeREAL8TimeSeries(*phi, 0, (*phi)->data->length + blocklen) )
846  }
847 
848  /* compute values at this step */
849 
850  v = cbrt(f*toffIn.piM);
851  phase = expnfunc.phasing2(v, &ak); /* phase at given v */
852  if (XLAL_IS_REAL8_FAIL_NAN(phase))
854 
855  (*V)->data->data[j] = v;
856  (*phi)->data->data[j] = phase;
857 
858  /* make next step */
859 
860  ++j;
861  toffIn.t=j*deltaT;
862 
863  /* Determine the frequency at the current time by solving
864  * timing2(v;tC,t)=0 */
865 
866  xmin = 0.8*f;
867  XLAL_TRY(f = XLALDBisectionFindRoot(timing2, xmin, xmax, xacc, funcParams), errnum);
868  if (XLAL_IS_REAL8_FAIL_NAN(f)) {
869  /* It is possible for t(f) to become non-monotonic before reaching
870  * the ISCO (notably when including tidal effects).
871  * This causes the Bisector to fail to find a root.
872  * We throw a warning with freq. of previous step and exit loop */
873  XLALPrintWarning("XLAL Warning - %s: Waveform does not reach ISCO frequency %f (Hz)... generation stopping at frequency %f (Hz)\n",
874  __func__, fLso, v*v*v/toffIn.piM);
875  break;
876  }
877  } while (f < fLso && toffIn.t < -tC);
878 
879  /* check termination conditions */
880 
881  if (toffIn.t >= -tC) {
882  XLALPrintInfo("XLAL Info - %s: PN inspiral terminated at coalesence time\n", __func__);
883  }
884  if (f >= fLso) {
885  XLALPrintInfo("XLAL Info - %s: PN inspiral terminated at ISCO\n", __func__);
886  }
887 
888  /* make the correct length */
889 
890  if ( ! XLALResizeREAL8TimeSeries(*V, 0, j) )
892  if ( ! XLALResizeREAL8TimeSeries(*phi, 0, j) )
894 
895  /* adjust to correct time */
896 
897  XLALGPSAdd(&(*phi)->epoch, -1.0*j*deltaT);
898  XLALGPSAdd(&(*V)->epoch, -1.0*j*deltaT);
899 
900  /* Do a constant phase shift to get desired value of phiRef */
901  len = (*phi)->data->length;
902  /* For fRef==0, phiRef is phase of last sample */
903  if( fRef == 0. )
904  phiRef -= (*phi)->data->data[len-1];
905  /* For fRef==fmin, phiRef is phase of first sample */
906  else if( fRef == f_min )
907  phiRef -= (*phi)->data->data[0];
908  /* phiRef is phase when f==fRef */
909  else
910  {
911  VRef = pow(LAL_PI * LAL_G_SI*(m1+m2) * fRef, 1./3.) / LAL_C_SI;
912  j = 0;
913  do {
914  idxRef = j;
915  j++;
916  } while ((*V)->data->data[j] <= VRef);
917  phiRef -= (*phi)->data->data[idxRef];
918  }
919  for (j = 0; j < len; ++j)
920  (*phi)->data->data[j] += phiRef;
921 
922  return (int)(*V)->data->length;
923 }
924 
925 
926 /**
927  * Driver routine to compute the post-Newtonian inspiral waveform.
928  *
929  * This routine allows the user to specify different pN orders
930  * for phasing calcuation vs. amplitude calculations.
931  */
933  REAL8TimeSeries **hplus, /**< +-polarization waveform */
934  REAL8TimeSeries **hcross, /**< x-polarization waveform */
935  REAL8 phiRef, /**< reference orbital phase (rad) */
936  UNUSED REAL8 v0, /**< tail-term gauge choice (default = 1) */
937  REAL8 deltaT, /**< sampling interval (s) */
938  REAL8 m1, /**< mass of companion 1 (kg) */
939  REAL8 m2, /**< mass of companion 2 (kg) */
940  REAL8 f_min, /**< starting GW frequency (Hz) */
941  REAL8 fRef, /**< reference GW frequency (Hz) */
942  REAL8 r, /**< distance of source (m) */
943  REAL8 i, /**< inclination of source (rad) */
944  REAL8 lambda1, /**< (tidal deformability of body 1)/(mass of body 1)^5 */
945  REAL8 lambda2, /**< (tidal deformability of body 2)/(mass of body 2)^5 */
946  LALSimInspiralTidalOrder tideO, /**< twice PN order of tidal effects */
947  int amplitudeO, /**< twice post-Newtonian amplitude order */
948  int phaseO /**< twice post-Newtonian phase order */
949  )
950 {
951  /* The Schwarzschild ISCO frequency - for sanity checking fRef */
952  REAL8 fISCO = pow(LAL_C_SI,3) / (pow(6.,3./2.)*LAL_PI*(m1+m2)*LAL_G_SI);
953 
954  /* Sanity check fRef value */
955  if( fRef < 0. )
956  {
957  XLALPrintError("XLAL Error - %s: fRef = %f must be >= 0\n",
958  __func__, fRef);
960  }
961  if( fRef != 0. && fRef < f_min )
962  {
963  XLALPrintError("XLAL Error - %s: fRef = %f must be > fStart = %f\n",
964  __func__, fRef, f_min);
966  }
967  if( fRef >= fISCO )
968  {
969  XLALPrintError("XLAL Error - %s: fRef = %f must be < Schwar. ISCO=%f\n",
970  __func__, fRef, fISCO);
972  }
973 
974 
976  REAL8TimeSeries *phi;
977  int status;
978  int n;
979  n = XLALSimInspiralTaylorT2PNEvolveOrbit(&V, &phi, phiRef, deltaT,
980  m1, m2, f_min, fRef, lambda1, lambda2, tideO, phaseO);
981  if ( n < 0 )
983  status = XLALSimInspiralPNPolarizationWaveforms(hplus, hcross, V, phi,
984  v0, m1, m2, r, i, amplitudeO);
987  if ( status < 0 )
989  return n;
990 }
991 
992 /**
993  * Driver routine to compute the -2 spin-weighted spherical harmonic modes
994  * using TaylorT2 phasing.
995  */
997  UNUSED REAL8 v0, /**< tail-term gauge choice (default = 1) */
998  REAL8 deltaT, /**< sampling interval (s) */
999  REAL8 m1, /**< mass of companion 1 (kg) */
1000  REAL8 m2, /**< mass of companion 2 (kg) */
1001  REAL8 f_min, /**< starting GW frequency (Hz) */
1002  REAL8 fRef, /**< reference GW frequency (Hz) */
1003  REAL8 r, /**< distance of source (m) */
1004  REAL8 lambda1, /**< (tidal deformability of body 1)/(mass of body 1)^5 */
1005  REAL8 lambda2, /**< (tidal deformability of body 2)/(mass of body 2)^5 */
1006  LALSimInspiralTidalOrder tideO, /**< twice PN order of tidal effects */
1007  int amplitudeO, /**< twice post-Newtonian amplitude order */
1008  int phaseO, /**< twice post-Newtonian phase order */
1009  int lmax /**< generate all modes with l <= lmax */
1010  )
1011 {
1012  SphHarmTimeSeries *hlm = NULL;
1013  /* The Schwarzschild ISCO frequency - for sanity checking fRef */
1014  REAL8 fISCO = pow(LAL_C_SI,3) / (pow(6.,3./2.)*LAL_PI*(m1+m2)*LAL_G_SI);
1015 
1016  /* Sanity check fRef value */
1017  if( fRef < 0. )
1018  {
1019  XLALPrintError("XLAL Error - %s: fRef = %f must be >= 0\n",
1020  __func__, fRef);
1022  }
1023  if( fRef != 0. && fRef < f_min )
1024  {
1025  XLALPrintError("XLAL Error - %s: fRef = %f must be > fStart = %f\n",
1026  __func__, fRef, f_min);
1028  }
1029  if( fRef >= fISCO )
1030  {
1031  XLALPrintError("XLAL Error - %s: fRef = %f must be < Schwar. ISCO=%f\n",
1032  __func__, fRef, fISCO);
1034  }
1035 
1036  REAL8TimeSeries *V;
1037  REAL8TimeSeries *phi;
1038  int n;
1040  m1, m2, f_min, fRef, lambda1, lambda2, tideO, phaseO);
1041  if ( n < 0 )
1043  int m, l;
1044  COMPLEX16TimeSeries *hxx;
1045  for(l=2; l<=lmax; l++){
1046  for(m=-l; m<=l; m++){
1048  m1, m2, r, amplitudeO, l, m);
1049  if ( !hxx ){
1051  }
1052  hlm = XLALSphHarmTimeSeriesAddMode(hlm, hxx, l, m);
1054  }
1055  }
1058  return hlm;
1059 }
1060 
1061 /**
1062  * Driver routine to compute the -2 spin-weighted spherical harmonic mode
1063  * using TaylorT2 phasing.
1064  */
1066  UNUSED REAL8 v0, /**< tail-term gauge choice (default = 1) */
1067  REAL8 deltaT, /**< sampling interval (s) */
1068  REAL8 m1, /**< mass of companion 1 (kg) */
1069  REAL8 m2, /**< mass of companion 2 (kg) */
1070  REAL8 f_min, /**< starting GW frequency (Hz) */
1071  REAL8 fRef, /**< reference GW frequency (Hz) */
1072  REAL8 r, /**< distance of source (m) */
1073  REAL8 lambda1, /**< (tidal deformability of body 1)/(mass of body 1)^5 */
1074  REAL8 lambda2, /**< (tidal deformability of body 2)/(mass of body 2)^5 */
1075  LALSimInspiralTidalOrder tideO, /**< twice PN order of tidal effects */
1076  int amplitudeO, /**< twice post-Newtonian amplitude order */
1077  int phaseO, /**< twice post-Newtonian phase order */
1078  int l, /**< l index of mode */
1079  int m /**< m index of mode */
1080  )
1081 {
1082  COMPLEX16TimeSeries *hlm;
1083  /* The Schwarzschild ISCO frequency - for sanity checking fRef */
1084  REAL8 fISCO = pow(LAL_C_SI,3) / (pow(6.,3./2.)*LAL_PI*(m1+m2)*LAL_G_SI);
1085 
1086  /* Sanity check fRef value */
1087  if( fRef < 0. )
1088  {
1089  XLALPrintError("XLAL Error - %s: fRef = %f must be >= 0\n",
1090  __func__, fRef);
1092  }
1093  if( fRef != 0. && fRef < f_min )
1094  {
1095  XLALPrintError("XLAL Error - %s: fRef = %f must be > fStart = %f\n",
1096  __func__, fRef, f_min);
1098  }
1099  if( fRef >= fISCO )
1100  {
1101  XLALPrintError("XLAL Error - %s: fRef = %f must be < Schwar. ISCO=%f\n",
1102  __func__, fRef, fISCO);
1104  }
1105 
1106  REAL8TimeSeries *V;
1107  REAL8TimeSeries *phi;
1108  int n;
1110  m1, m2, f_min, fRef, lambda1, lambda2, tideO, phaseO);
1111  if ( n < 0 )
1114  m1, m2, r, amplitudeO, l, m);
1117  return hlm;
1118 }
1119 
1120 /**
1121  * Driver routine to compute the post-Newtonian inspiral waveform.
1122  *
1123  * This routine uses the same pN order for phasing and amplitude
1124  * (unless the order is -1 in which case the highest available
1125  * order is used for both of these -- which might not be the same).
1126  *
1127  * Constant log term in amplitude set to 1. This is a gauge choice.
1128  */
1130  REAL8TimeSeries **hplus, /**< +-polarization waveform */
1131  REAL8TimeSeries **hcross, /**< x-polarization waveform */
1132  REAL8 phiRef, /**< reference orbital phase (rad) */
1133  REAL8 deltaT, /**< sampling interval (s) */
1134  REAL8 m1, /**< mass of companion 1 (kg) */
1135  REAL8 m2, /**< mass of companion 2 (kg) */
1136  REAL8 f_min, /**< starting GW frequency (Hz)*/
1137  REAL8 fRef, /**< reference GW frequency (Hz)*/
1138  REAL8 r, /**< distance of source (m) */
1139  REAL8 i, /**< inclination of source (rad) */
1140  REAL8 lambda1, /**< (tidal deformability of body 1)/(mass of body 1)^5 */
1141  REAL8 lambda2, /**< (tidal deformability of body 2)/(mass of body 2)^5 */
1142  LALSimInspiralTidalOrder tideO, /**< twice PN order of tidal effects */
1143  int O /**< twice post-Newtonian order */
1144  )
1145 {
1146  /* set v0 to default value 1 */
1147  return XLALSimInspiralTaylorT2PNGenerator(hplus, hcross, phiRef, 1.0,
1148  deltaT, m1, m2, f_min, fRef, r, i, lambda1, lambda2, tideO, O, O);
1149 }
1150 
1151 
1152 /**
1153  * Driver routine to compute the restricted post-Newtonian inspiral waveform.
1154  *
1155  * This routine computes the phasing to the specified order, but
1156  * only computes the amplitudes to the Newtonian (quadrupole) order.
1157  *
1158  * Constant log term in amplitude set to 1. This is a gauge choice.
1159  */
1161  REAL8TimeSeries **hplus, /**< +-polarization waveform */
1162  REAL8TimeSeries **hcross, /**< x-polarization waveform */
1163  REAL8 phiRef, /**< reference orbital phase (rad) */
1164  REAL8 deltaT, /**< sampling interval (s) */
1165  REAL8 m1, /**< mass of companion 1 (kg) */
1166  REAL8 m2, /**< mass of companion 2 (kg) */
1167  REAL8 f_min, /**< starting GW frequency (Hz) */
1168  REAL8 fRef, /**< reference GW frequency (Hz) */
1169  REAL8 r, /**< distance of source (m) */
1170  REAL8 i, /**< inclination of source (rad) */
1171  REAL8 lambda1, /**< (tidal deformability of body 1)/(mass of body 1)^5 */
1172  REAL8 lambda2, /**< (tidal deformability of body 2)/(mass of body 2)^5 */
1173  LALSimInspiralTidalOrder tideO, /**< twice PN order of tidal effects */
1174  int O /**< twice post-Newtonian phase order */
1175  )
1176 {
1177  /* use Newtonian order for amplitude */
1178  /* set v0 to default value 1 */
1179  return XLALSimInspiralTaylorT2PNGenerator(hplus, hcross, phiRef, 1.0,
1180  deltaT, m1, m2, f_min, fRef, r, i, lambda1, lambda2, tideO, 0, O);
1181 }
1182 
1183 /** @} */
1184 /** @} */
static REAL8 UNUSED XLALSimInspiralTaylorT2Timing_12PNTidalCoeff(REAL8 eta, REAL8 chi, REAL8 lambda)
static REAL8 UNUSED XLALSimInspiralTaylorT2Timing_6PNCoeff(REAL8 eta)
static REAL8 UNUSED XLALSimInspiralTaylorT2Phasing_12PNTidalCoeff(REAL8 eta, REAL8 chi, REAL8 lambda)
static REAL8 UNUSED XLALSimInspiralTaylorT2Phasing_3PNCoeff(REAL8 UNUSED eta)
static REAL8 UNUSED XLALSimInspiralTaylorT2Timing_2PNCoeff(REAL8 eta)
static REAL8 UNUSED XLALSimInspiralTaylorT2Phasing_0PNCoeff(REAL8 eta)
Computes the PN Coefficients for using in the TaylorT2 phasing equation.
static REAL8 UNUSED XLALSimInspiralTaylorT2Timing_5PNCoeff(REAL8 eta)
static REAL8 UNUSED XLALSimInspiralTaylorT2Timing_4PNCoeff(REAL8 eta)
static REAL8 UNUSED XLALSimInspiralTaylorT2Timing_3PNCoeff(REAL8 UNUSED eta)
static REAL8 UNUSED XLALSimInspiralTaylorT2Phasing_4PNCoeff(REAL8 eta)
static REAL8 UNUSED XLALSimInspiralTaylorT2Phasing_5PNCoeff(REAL8 eta)
static REAL8 UNUSED XLALSimInspiralTaylorT2Timing_7PNCoeff(REAL8 eta)
static REAL8 UNUSED XLALSimInspiralTaylorT2Phasing_6PNLogCoeff(REAL8 UNUSED eta)
static REAL8 UNUSED XLALSimInspiralTaylorT2Timing_10PNTidalCoeff(REAL8 chi, REAL8 lambda)
static REAL8 UNUSED XLALSimInspiralTaylorT2Timing_0PNCoeff(REAL8 totalmass, REAL8 eta)
Computes the PN Coefficients for using in the TaylorT2 timing equation.
static REAL8 UNUSED XLALSimInspiralTaylorT2Phasing_2PNCoeff(REAL8 eta)
static REAL8 UNUSED XLALSimInspiralTaylorT2Phasing_10PNTidalCoeff(REAL8 chi, REAL8 lambda)
static REAL8 UNUSED XLALSimInspiralTaylorT2Phasing_6PNCoeff(REAL8 eta)
static REAL8 UNUSED XLALSimInspiralTaylorT2Timing_6PNLogCoeff(REAL8 UNUSED eta)
static REAL8 UNUSED XLALSimInspiralTaylorT2Phasing_7PNCoeff(REAL8 eta)
static REAL8 XLALSimInspiralPhasing2_5PN(REAL8 v, expnCoeffsTaylorT2 *ak)
static REAL8 XLALSimInspiralTiming2_5PN(REAL8 f, void *params)
static REAL8 XLALSimInspiralPhasing2_2PN(REAL8 v, expnCoeffsTaylorT2 *ak)
static REAL8 XLALSimInspiralTiming2_6PN(REAL8 f, void *params)
REAL8() SimInspiralTiming2(REAL8 td, void *ak)
REAL8() SimInspiralPhasing2(REAL8 td, expnCoeffsTaylorT2 *ak)
static int XLALSimInspiralTaylorT2Setup(expnCoeffsTaylorT2 *ak, expnFuncTaylorT2 *f, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 lambda1, REAL8 lambda2, LALSimInspiralTidalOrder tideO, REAL8 f_min, int O)
static REAL8 XLALSimInspiralPhasing2_7PN(REAL8 v, expnCoeffsTaylorT2 *ak)
static REAL8 XLALSimInspiralPhasing2_4PN(REAL8 v, expnCoeffsTaylorT2 *ak)
static REAL8 XLALSimInspiralTiming2_3PN(REAL8 f, void *params)
static REAL8 XLALSimInspiralPhasing2_3PN(REAL8 v, expnCoeffsTaylorT2 *ak)
static REAL8 XLALSimInspiralTiming2_4PN(REAL8 f, void *params)
static REAL8 XLALSimInspiralTiming2_2PN(REAL8 f, void *params)
static REAL8 XLALSimInspiralPhasing2_0PN(REAL8 v, expnCoeffsTaylorT2 *ak)
static REAL8 XLALSimInspiralTiming2_7PN(REAL8 f, void *params)
static REAL8 XLALSimInspiralPhasing2_6PN(REAL8 v, expnCoeffsTaylorT2 *ak)
static REAL8 XLALSimInspiralTiming2_0PN(REAL8 f, void *params)
int l
Definition: bh_qnmode.c:135
double i
Definition: bh_ringdown.c:118
#define __attribute__(x)
REAL8 XLALDBisectionFindRoot(REAL8(*y)(REAL8, void *), REAL8 xmin, REAL8 xmax, REAL8 xacc, void *params)
#define LAL_C_SI
#define LAL_PI
#define LAL_G_SI
#define LIGOTIMEGPSZERO
double REAL8
uint32_t UINT4
int XLALSimInspiralPNPolarizationWaveforms(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 v0, REAL8 m1, REAL8 m2, REAL8 r, REAL8 i, int ampO)
Given time series for a binary's orbital dynamical variables, construct the waveform polarizations h+...
LALSimInspiralTidalOrder
Enumeration of allowed PN orders of tidal effects.
@ LAL_SIM_INSPIRAL_TIDAL_ORDER_5PN
@ LAL_SIM_INSPIRAL_TIDAL_ORDER_6PN
@ LAL_SIM_INSPIRAL_TIDAL_ORDER_ALL
@ LAL_SIM_INSPIRAL_TIDAL_ORDER_0PN
COMPLEX16TimeSeries * XLALCreateSimInspiralPNModeCOMPLEX16TimeSeriesLALConvention(REAL8TimeSeries *v, REAL8TimeSeries *phi, REAL8 m1, REAL8 m2, REAL8 r, int O, int l, int m)
Computes h(l,m) mode timeseries of spherical harmonic decomposition of the post-Newtonian inspiral wa...
int XLALSimInspiralTaylorT2PNEvolveOrbit(REAL8TimeSeries **V, REAL8TimeSeries **phi, REAL8 phiRef, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 fRef, REAL8 lambda1, REAL8 lambda2, LALSimInspiralTidalOrder tideO, int O)
Computes a post-Newtonian orbit using the Taylor T2 method.
int XLALSimInspiralTaylorT2PN(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 phiRef, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 fRef, REAL8 r, REAL8 i, REAL8 lambda1, REAL8 lambda2, LALSimInspiralTidalOrder tideO, int O)
Driver routine to compute the post-Newtonian inspiral waveform.
int XLALSimInspiralTaylorT2PNGenerator(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 phiRef, UNUSED REAL8 v0, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 fRef, REAL8 r, REAL8 i, REAL8 lambda1, REAL8 lambda2, LALSimInspiralTidalOrder tideO, int amplitudeO, int phaseO)
Driver routine to compute the post-Newtonian inspiral waveform.
int XLALSimInspiralTaylorT2PNRestricted(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 phiRef, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 fRef, REAL8 r, REAL8 i, REAL8 lambda1, REAL8 lambda2, LALSimInspiralTidalOrder tideO, int O)
Driver routine to compute the restricted post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralTaylorT2PNMode(UNUSED REAL8 v0, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 fRef, REAL8 r, REAL8 lambda1, REAL8 lambda2, LALSimInspiralTidalOrder tideO, int amplitudeO, int phaseO, int l, int m)
Driver routine to compute the -2 spin-weighted spherical harmonic mode using TaylorT2 phasing.
SphHarmTimeSeries * XLALSimInspiralTaylorT2PNModes(UNUSED REAL8 v0, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 fRef, REAL8 r, REAL8 lambda1, REAL8 lambda2, LALSimInspiralTidalOrder tideO, int amplitudeO, int phaseO, int lmax)
Driver routine to compute the -2 spin-weighted spherical harmonic modes using TaylorT2 phasing.
SphHarmTimeSeries * XLALSphHarmTimeSeriesAddMode(SphHarmTimeSeries *appended, const COMPLEX16TimeSeries *inmode, UINT4 l, INT4 m)
Prepend a node to a linked list of SphHarmTimeSeries, or create a new head.
static const INT4 r
static const INT4 m
REAL8TimeSeries * XLALResizeREAL8TimeSeries(REAL8TimeSeries *series, int first, size_t length)
REAL8TimeSeries * XLALCreateREAL8TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
void XLALDestroyCOMPLEX16TimeSeries(COMPLEX16TimeSeries *series)
void XLALDestroyREAL8TimeSeries(REAL8TimeSeries *series)
const LALUnit lalDimensionlessUnit
#define XLAL_ERROR_REAL8(...)
#define XLAL_ERROR_NULL(...)
int int int XLALPrintInfo(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_ERROR(...)
#define XLAL_TRY(statement, errnum)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
int int XLALPrintWarning(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_IS_REAL8_FAIL_NAN(val)
XLAL_SUCCESS
XLAL_EFAULT
XLAL_EFUNC
XLAL_EDOM
XLAL_EINVAL
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
string status
REAL8Sequence * data
Structure to carry a collection of spherical harmonic modes in COMPLEX16 time series.
SimInspiralPhasing2 * phasing2
SimInspiralTiming2 * timing2
Definition: burst.c:245
double V
Definition: unicorn.c:25
double f_min
Definition: unicorn.c:22
double deltaT
Definition: unicorn.c:24