LALSimulation  5.4.0.1-fe68b98
LALSimIMREOBNewtonianMultipole.c
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2010 Craig Robinson, Prayush Kumar (minor additions)
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 /**
22  * \author Craig Robinson, Prayush Kumar
23  *
24  * Functions to construct the Newtonian multipolar waveform as given
25  * by Damour et al, Phys.Rev.D79:064004,2009.
26  * All equation numbers in this file refer to equations of this paper,
27  * unless otherwise specified.
28  *
29  * In addition to the function used to do this,
30  * XLALCalculateNewtonianMultipole(), this file also contains a function
31  * for calculating the standard scalar spherical harmonics Ylm.
32  *
33  * Also functions to return only the absolute value of the Newtonian multipolar
34  * waveform, ignoring the complex argument that dependens on the orbital phase.
35  * These functions are used in the flux calculation.
36  */
37 
38 #include <complex.h>
39 
40 #include <gsl/gsl_sf_gamma.h>
41 
42 #include "LALSimIMREOBNRv2.h"
43 
44 #ifndef _LALSIMIMRNEWTONIANMULTIPOLE_C
45 #define _LALSIMIMRNEWTONIANMULTIPOLE_C
46 
47 static REAL8
49  const int m
50  );
51 
52 static int
54  INT4 l,
55  INT4 m,
56  REAL8 phi);
57 
58 static int
60  INT4 l,
61  INT4 m);
62 
63 static int
65  COMPLEX16 *prefix,
66  const REAL8 m1,
67  const REAL8 m2,
68  const INT4 l,
69  const INT4 m );
70 
71 
72 /**
73  * Function which computes the various coefficients in the Newtonian
74  * multipole. The definition of this can be found in Pan et al,
75  * arXiv:1106.1021v1 [gr-qc]. Note that, although this function gets passed
76  * masses measured in Solar masses (which is fine since it is a static function),
77  * the units of mass won't matter so long as they are consistent. This is because
78  * all uses of the mass within the function are normalized by the total mass.
79  * The prefixes of all (l,m) modes are pre-computed and stored in a structure
80  */
82  NewtonMultipolePrefixes *prefix, /**<< OUTPUT Structure containing the coeffs */
83  const REAL8 m1, /**<< Mass of first component */
84  const REAL8 m2 /**<< Nass of second component */
85  )
86 {
87 
88  INT4 l, m;
89 
90  memset( prefix, 0, sizeof( NewtonMultipolePrefixes ) );
91 
92  for ( l = 2; l <= LALEOB_MAX_MULTIPOLE; l++ )
93  {
94  for ( m = 1; m <= l; m++ )
95  {
96  CalculateThisMultipolePrefix( &(prefix->values[l][m]), m1, m2, l, m );
97  }
98  }
99  return XLAL_SUCCESS;
100 }
101 
102 /**
103  * This function calculates the Newtonian multipole part of the
104  * factorized waveform for the EOBNRv2 model. This is defined in Eq. 4.
105  */
106 UNUSED static int
108  COMPLEX16 *multipole, /**<< OUTPUT, Newtonian multipole */
109  REAL8 x, /**<< Dimensionless parameter \f$\equiv v^2\f$ */
110  UNUSED REAL8 r, /**<< Orbital separation (units of total mass M) */
111  REAL8 phi, /**<< Orbital phase (in radians) */
112  UINT4 l, /**<< Mode l */
113  INT4 m, /**<< Mode m */
114  EOBParams *params /**<< Pre-computed coefficients, parameters, etc. */
115  )
116 {
117 
118  INT4 xlalStatus;
119 
120  COMPLEX16 y;
121 
122  INT4 epsilon = (l + m) % 2;
123 
124  y = 0.0;
125 
126  /* Calculate the necessary Ylm */
127  xlalStatus = XLALScalarSphHarmThetaPiBy2( &y, l - epsilon, - m, phi );
128  if (xlalStatus != XLAL_SUCCESS )
129  {
131  }
132 
133  /* Special treatment for (2,1) and (4,4) modes, defined in Eq. 17ab of PRD84:124052 2011 */
134  if ( (l == 4 && m == 4) || ( l == 2 && m == 1 ) )
135  {
136  *multipole = params->prefixes->values[l][m] * pow( x, (REAL8)(l+epsilon)/2.0 - 1.0)/r;
137  }
138  else
139  {
140  *multipole = params->prefixes->values[l][m] * pow( x, (REAL8)(l+epsilon)/2.0);
141  }
142  *multipole *= y;
143 
144  return XLAL_SUCCESS;
145 }
146 
147 
148 /**
149  * This function calculates the Newtonian multipole part of the
150  * factorized waveform for the SEOBNRv1 model. This is defined in Eq. 4.
151  */
152 UNUSED static int
154  COMPLEX16 *multipole, /**<< OUTPUT, Newtonian multipole */
155  REAL8 x, /**<< Dimensionless parameter \f$\equiv v^2\f$ */
156  UNUSED REAL8 r, /**<< Orbital separation (units of total mass M */
157  REAL8 phi, /**<< Orbital phase (in radians) */
158  UINT4 l, /**<< Mode l */
159  INT4 m, /**<< Mode m */
160  EOBParams *params /**<< Pre-computed coefficients, parameters, etc. */
161  )
162 {
163  INT4 xlalStatus;
164 
165  COMPLEX16 y;
166 
167  INT4 epsilon = (l + m) % 2;
168 
169  y = 0.0;
170 
171  /* Calculate the necessary Ylm */
172  xlalStatus = XLALScalarSphHarmThetaPiBy2( &y, l - epsilon, - m, phi );
173  if (xlalStatus != XLAL_SUCCESS )
174  {
176  }
177 
178  *multipole = params->prefixes->values[l][m] * pow( x, (REAL8)(l+epsilon)/2.0) ;
179  *multipole *= y;
180 
181  return XLAL_SUCCESS;
182 }
183 
184 /**
185  * This function calculates the Newtonian multipole part of the
186  * factorized waveform for the SEOBNRv1 model. This is defined in Eq. 4.
187  * It ignores the \f$exp(\ii * phi)\f$ part, and returns only the absolute
188  * value.
189  */
190 UNUSED static int
192  COMPLEX16 *multipole, /**<< OUTPUT, Newtonian multipole */
193  REAL8 x, /**<< Dimensionless parameter \f$\equiv v^2\f$ */
194  UNUSED REAL8 r, /**<< Orbital separation (units of total mass M */
195  UNUSED REAL8 phi, /**<< Orbital phase (in radians) */
196  UINT4 l, /**<< Mode l */
197  INT4 m, /**<< Mode m */
198  EOBParams *params /**<< Pre-computed coefficients, parameters, etc. */
199  )
200 {
201  INT4 xlalStatus;
202 
203  COMPLEX16 y;
204 
205  INT4 epsilon = (l + m) % 2;
206 
207  phi = y = 0.0;
208 
209  /* Calculate the necessary Ylm */
210  xlalStatus = XLALAbsScalarSphHarmThetaPiBy2( &y, l - epsilon, - m );
211  if (xlalStatus != XLAL_SUCCESS )
212  {
214  }
215 
216  *multipole = params->prefixes->values[l][m] * pow( x, (REAL8)(l+epsilon)/2.0) ;
217  *multipole *= y;
218 
219  return XLAL_SUCCESS;
220 }
221 
222 /* In the calculation of the Newtonian multipole, we only use
223  * the spherical harmonic with theta set to pi/2. Since this
224  * is always the case, we can use this information to use a
225  * faster version of the spherical harmonic code
226  */
227 
228 static int
230  COMPLEX16 *y, /**<< OUTPUT, Ylm(0,phi) */
231  INT4 l, /**<< Mode l */
232  INT4 m, /**<< Mode m */
233  REAL8 phi /**<< Orbital phase (in radians) */
234  )
235 {
236 
237  REAL8 legendre;
238  INT4 absM = abs( m );
239 
240  if ( l < 0 || absM > (INT4) l )
241  {
243  }
244 
245  /* For some reason GSL will not take negative m */
246  /* We will have to use the relation between sph harmonics of +ve and -ve m */
247  legendre = XLALAssociatedLegendreXIsZero( l, absM );
248  if ( XLAL_IS_REAL8_FAIL_NAN( legendre ))
249  {
251  }
252 
253  /* Compute the values for the spherical harmonic */
254  *y = legendre * cos(m * phi);
255  *y += I * legendre * sin(m * phi);
256 
257  /* If m is negative, perform some jiggery-pokery */
258  if ( m < 0 && absM % 2 == 1 )
259  {
260  *y *= -1.0;
261  }
262 
263  return XLAL_SUCCESS;
264 }
265 
266 /* In the calculation of the Newtonian multipole, we only use
267  * the spherical harmonic with theta set to pi/2. Since this
268  * is always the case, we can use this information to use a
269  * faster version of the spherical harmonic code
270  */
271 
272 static int
274  COMPLEX16 *y, /**<< OUTPUT, Ylm(0,phi) */
275  INT4 l, /**<< Mode l */
276  INT4 m /**<< Mode m */
277  )
278 {
279 
280  REAL8 legendre;
281  INT4 absM = abs( m );
282 
283  if ( l < 0 || absM > (INT4) l )
284  {
286  }
287 
288  /* For some reason GSL will not take negative m */
289  /* We will have to use the relation between sph harmonics of +ve and -ve m */
290  legendre = XLALAssociatedLegendreXIsZero( l, absM );
291  if ( XLAL_IS_REAL8_FAIL_NAN( legendre ))
292  {
294  }
295 
296  /* Compute the values for the spherical harmonic */
297  *y = legendre;// * cos(m * phi);
298  //*y += I * legendre * sin(m * phi);
299 
300  /* If m is negative, perform some jiggery-pokery */
301  if ( m < 0 && absM % 2 == 1 )
302  {
303  *y *= -1.0;
304  }
305 
306  return XLAL_SUCCESS;
307 }
308 
309 /**
310  * Function to calculate associated Legendre function used by the spherical harmonics function
311  */
312 static REAL8
314  const int m )
315 {
316 
317  REAL8 legendre;
318 
319  if ( l < 0 )
320  {
321  XLALPrintError( "l cannot be < 0\n" );
323  }
324 
325  if ( m < 0 || m > l )
326  {
327  XLALPrintError( "Invalid value of m!\n" );
329  }
330 
331  /* we will switch on the values of m and n */
332  switch ( l )
333  {
334  case 1:
335  switch ( m )
336  {
337  case 1:
338  legendre = - 1.;
339  break;
340  default:
342  }
343  break;
344  case 2:
345  switch ( m )
346  {
347  case 2:
348  legendre = 3.;
349  break;
350  case 1:
351  legendre = 0.;
352  break;
353  default:
355  }
356  break;
357  case 3:
358  switch ( m )
359  {
360  case 3:
361  legendre = -15.;
362  break;
363  case 2:
364  legendre = 0.;
365  break;
366  case 1:
367  legendre = 1.5;
368  break;
369  default:
371  }
372  break;
373  case 4:
374  switch ( m )
375  {
376  case 4:
377  legendre = 105.;
378  break;
379  case 3:
380  legendre = 0.;
381  break;
382  case 2:
383  legendre = - 7.5;
384  break;
385  case 1:
386  legendre = 0;
387  break;
388  default:
390  }
391  break;
392  case 5:
393  switch ( m )
394  {
395  case 5:
396  legendre = - 945.;
397  break;
398  case 4:
399  legendre = 0.;
400  break;
401  case 3:
402  legendre = 52.5;
403  break;
404  case 2:
405  legendre = 0;
406  break;
407  case 1:
408  legendre = - 1.875;
409  break;
410  default:
412  }
413  break;
414  case 6:
415  switch ( m )
416  {
417  case 6:
418  legendre = 10395.;
419  break;
420  case 5:
421  legendre = 0.;
422  break;
423  case 4:
424  legendre = - 472.5;
425  break;
426  case 3:
427  legendre = 0;
428  break;
429  case 2:
430  legendre = 13.125;
431  break;
432  case 1:
433  legendre = 0;
434  break;
435  default:
437  }
438  break;
439  case 7:
440  switch ( m )
441  {
442  case 7:
443  legendre = - 135135.;
444  break;
445  case 6:
446  legendre = 0.;
447  break;
448  case 5:
449  legendre = 5197.5;
450  break;
451  case 4:
452  legendre = 0.;
453  break;
454  case 3:
455  legendre = - 118.125;
456  break;
457  case 2:
458  legendre = 0.;
459  break;
460  case 1:
461  legendre = 2.1875;
462  break;
463  default:
465  }
466  break;
467  case 8:
468  switch ( m )
469  {
470  case 8:
471  legendre = 2027025.;
472  break;
473  case 7:
474  legendre = 0.;
475  break;
476  case 6:
477  legendre = - 67567.5;
478  break;
479  case 5:
480  legendre = 0.;
481  break;
482  case 4:
483  legendre = 1299.375;
484  break;
485  case 3:
486  legendre = 0.;
487  break;
488  case 2:
489  legendre = - 19.6875;
490  break;
491  case 1:
492  legendre = 0.;
493  break;
494  default:
496  }
497  break;
498  default:
499  XLALPrintError( "Unsupported (l, m): %d, %d\n", l, m );
501  }
502 
503  legendre *= sqrt( (REAL8)(2*l+1)*gsl_sf_fact( l-m ) / (4.*LAL_PI*gsl_sf_fact(l+m)));
504 
505  return legendre;
506 }
507 
508 /**
509  * Function to calculate the numerical prefix in the Newtonian amplitude. Eqs. 5 - 7.
510  */
511 static int
513  COMPLEX16 *prefix, /**<< OUTPUT, Prefix value */
514  const REAL8 m1, /**<< mass 1 */
515  const REAL8 m2, /**<< mass 2 */
516  const INT4 l, /**<< Mode l */
517  const INT4 m /**<< Mode m */
518  )
519 {
520  COMPLEX16 n;
521  REAL8 c;
522 
523  REAL8 x1, x2; /* Scaled versions of component masses */
524 
525  REAL8 mult1, mult2;
526 
527  REAL8 totalMass;
528  REAL8 eta;
529 
530  INT4 epsilon;
531  INT4 sign; /* To give the sign of some additive terms */
532 
533 
534  n = 0.0;
535 
536  totalMass = m1 + m2;
537 
538  epsilon = ( l + m ) % 2;
539 
540  x1 = m1 / totalMass;
541  x2 = m2 / totalMass;
542 
543  eta = m1*m2/(totalMass*totalMass);
544 
545  if ( abs( m % 2 ) == 0 )
546  {
547  sign = 1;
548  }
549  else
550  {
551  sign = -1;
552  }
553  /*
554  * Eq. 7 of Damour, Iyer and Nagar 2008.
555  * For odd m, c is proportional to dM = m1-m2. In the equal-mass case, c = dM = 0.
556  * In the equal-mass unequal-spin case, however, when spins are different, the odd m term is generally not zero.
557  * In this case, c can be written as c0 * dM, while spins terms in PN expansion may take the form chiA/dM.
558  * Although the dM's cancel analytically, we can not implement c and chiA/dM with the possibility of dM -> 0.
559  * Therefore, for this case, we give numerical values of c0 for relevant modes, and c0 is calculated as
560  * c / dM in the limit of dM -> 0. Consistently, for this case, we implement chiA instead of chiA/dM
561  * in LALSimIMRSpinEOBFactorizedWaveform.c.
562  */
563  if ( m1 != m2 || sign == 1 )
564  {
565  c = pow( x2, l + epsilon - 1 ) + sign * pow(x1, l + epsilon - 1 );
566  }
567  else
568  {
569  switch( l )
570  {
571  case 2:
572  c = -1.0;
573  break;
574  case 3:
575  c = -1.0;
576  break;
577  case 4:
578  c = -0.5;
579  break;
580  case 5:
581  c = -0.5;
582  break;
583  default:
584  c = 0.0;
585  break;
586  }
587  }
588 
589  /* Eqs 5 and 6. Dependent on the value of epsilon (parity), we get different n */
590  if ( epsilon == 0 )
591  {
592 
593  n = I * m;
594  n = cpow( n, (REAL8)l );
595 
596  mult1 = 8.0 * LAL_PI / gsl_sf_doublefact(2u*l + 1u);
597  mult2 = (REAL8)((l+1) * (l+2)) / (REAL8)(l * ((INT4)l - 1));
598  mult2 = sqrt(mult2);
599 
600  n *= mult1;
601  n *= mult2;
602  }
603  else if ( epsilon == 1 )
604  {
605 
606  n = I * m;
607  n = cpow( n, (REAL8)l );
608  n = -n;
609 
610  mult1 = 16.*LAL_PI / gsl_sf_doublefact( 2u*l + 1u );
611 
612  mult2 = (REAL8)( (2*l + 1) * (l+2) * (l*l - m*m) );
613  mult2 /= (REAL8)( (2*l - 1) * (l+1) * l * (l-1) );
614  mult2 = sqrt(mult2);
615 
616  n *= I * mult1;
617  n *= mult2;
618  }
619  else
620  {
621  XLALPrintError( "Epsilon must be 0 or 1.\n");
623  }
624 
625  *prefix = n * eta * c;
626 
627  return XLAL_SUCCESS;
628 }
629 
630 #endif /*_LALSIMIMRNEWTONIANMULTIPOLE_C*/
#define LALEOB_MAX_MULTIPOLE
File containing most of the structures and prototypes which are used in the generation of the EOBNRv2...
static int CalculateThisMultipolePrefix(COMPLEX16 *prefix, const REAL8 m1, const REAL8 m2, const INT4 l, const INT4 m)
Function to calculate the numerical prefix in the Newtonian amplitude.
static REAL8 XLALAssociatedLegendreXIsZero(const int l, const int m)
Function to calculate associated Legendre function used by the spherical harmonics function.
static UNUSED int XLALSimIMREOBComputeNewtonMultipolePrefixes(NewtonMultipolePrefixes *prefix, const REAL8 m1, const REAL8 m2)
Function which computes the various coefficients in the Newtonian multipole.
static UNUSED int XLALSimIMRSpinEOBCalculateNewtonianMultipole(COMPLEX16 *multipole, REAL8 x, UNUSED REAL8 r, REAL8 phi, UINT4 l, INT4 m, EOBParams *params)
This function calculates the Newtonian multipole part of the factorized waveform for the SEOBNRv1 mod...
static UNUSED int XLALSimIMREOBCalculateNewtonianMultipole(COMPLEX16 *multipole, REAL8 x, UNUSED REAL8 r, REAL8 phi, UINT4 l, INT4 m, EOBParams *params)
This function calculates the Newtonian multipole part of the factorized waveform for the EOBNRv2 mode...
static UNUSED int XLALSimIMRSpinEOBFluxCalculateNewtonianMultipole(COMPLEX16 *multipole, REAL8 x, UNUSED REAL8 r, UNUSED REAL8 phi, UINT4 l, INT4 m, EOBParams *params)
This function calculates the Newtonian multipole part of the factorized waveform for the SEOBNRv1 mod...
static int XLALAbsScalarSphHarmThetaPiBy2(COMPLEX16 *y, INT4 l, INT4 m)
static int XLALScalarSphHarmThetaPiBy2(COMPLEX16 *y, INT4 l, INT4 m, REAL8 phi)
#define c
int l
Definition: bh_qnmode.c:135
#define LAL_PI
double complex COMPLEX16
double REAL8
uint32_t UINT4
int32_t INT4
static const INT4 r
static const INT4 m
#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_SUCCESS
XLAL_EFUNC
XLAL_EINVAL
list x
list y
Structure containing all the parameters needed for the EOB waveform.
Structure containing all the terms of the Newtonian multipole which are constant over the course of t...
COMPLEX16 values[LALEOB_MAX_MULTIPOLE+1][LALEOB_MAX_MULTIPOLE+1]
Definition: burst.c:245