LALSimulation  5.4.0.1-fe68b98
LALSimIMRSpinEOBFactorizedFluxOptimized.c
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2010 Craig Robinson, Yi Pan, Prayush Kumar (minor changes)
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, Yi Pan
23  *
24  * \brief Function to compute the factorized flux as uses in the SEOBNRv1
25  * model. Flux function given in
26  * Taracchini et al. ( PRD 86, 024011 (2012), arXiv 1202.0790 ).
27  * All equation numbers in this file refer to equations of this paper,
28  * unless otherwise specified.
29  */
30 
31 #ifndef _OPTIMIZEDLALSIMIMRSPINEOBFACTORIZEDFLUX_C
32 #define _OPTIMIZEDLALSIMIMRSPINEOBFACTORIZEDFLUX_C
33 
34 #include <complex.h>
35 #include <lal/LALSimInspiral.h>
36 #include <lal/LALSimIMR.h>
37 
38 #include "LALSimIMREOBNRv2.h"
39 #include "LALSimIMRSpinEOB.h"
40 
44 
45 /* OPTIMIZATION NOTE: UsePrec is declared global in LALSimIMRSpinEOBFactorizedFlux.c. Better to use ifndef like this: */
46 #ifndef USEPREC
47 #define USEPREC 0
48 #endif
49 
50 /*------------------------------------------------------------------------------------------
51  *
52  * Prototypes of functions defined in this code.
53  *
54  *------------------------------------------------------------------------------------------
55  */
56 
59  nqcCoeffs,
60  const REAL8 omega,
61  SpinEOBParams * ak,
62  const REAL8 H,
63  const INT4 lMax,
64  const UINT4
65  SpinAlignedEOBversion);
66 
67 /*------------------------------------------------------------------------------------------
68  *
69  * Defintions of functions.
70  *
71  *------------------------------------------------------------------------------------------
72  */
73 
74 /**
75  * This function calculates the spin factorized-resummed GW energy flux
76  * for given dynamical variables.
77  */
78 
79 static REAL8
81  /**< dynamical variables */
82  EOBNonQCCoeffs * nqcCoeffs,
83  /**< pre-computed NQC coefficients */
84  const REAL8 omega,
85  /**< orbital frequency */
86  SpinEOBParams * ak,
87  /**< physical parameters */
88  const REAL8 H, /**< real Hamiltonian */
89  const INT4 lMax,
90  /**< upper limit of the summation over l */
91  const UINT4 SpinAlignedEOBversion
92  /**< 1 for SEOBNRv1, 2 for SEOBNRv2 */
93  )
94 {
95 
96  REAL8 flux = 0.0;
97  REAL8 v;
98  REAL8 omegaSq;
99  COMPLEX16 hLM;
100  INT4 l, m;
101 
102  //EOBNonQCCoeffs nqcCoeffs;
103 
104  if (!values || !ak)
105  {
107  }
108 
109  if (lMax < 2)
110  {
112  }
113 
114  /* Omegs is the derivative of phi */
115  omegaSq = omega * omega;
116 
117  v = cbrt (omega);
118 
119  /* Update the factorized multipole coefficients, w.r.t. new spins */
120  if (USEPREC)
121  {
122  /* Assume that initial conditions are available at this point, to
123  * compute the chiS and chiA parameters.
124  * Calculate the values of chiS and chiA, as given in Eq.16 of
125  * Precessing EOB paper. Assuming \vec{L} to be pointing in the
126  * direction of \vec{r}\times\vec{p} */
127  /* TODO: Check the mass scaling of spins */
128  REAL8 rcrossp[3], rcrosspMag, s1dotL, s2dotL;
129  REAL8 chiS, chiA, tplspin;
130 
131  rcrossp[0] =
132  values->data[1] * values->data[5] - values->data[2] * values->data[4];
133  rcrossp[1] =
134  values->data[2] * values->data[3] - values->data[0] * values->data[5];
135  rcrossp[2] =
136  values->data[0] * values->data[4] - values->data[1] * values->data[3];
137  rcrosspMag =
138  sqrt (rcrossp[0] * rcrossp[0] + rcrossp[1] * rcrossp[1] +
139  rcrossp[2] * rcrossp[2]);
140 
141  rcrossp[0] /= rcrosspMag;
142  rcrossp[1] /= rcrosspMag;
143  rcrossp[2] /= rcrosspMag;
144 
145  s1dotL = values->data[6] * rcrossp[0] + values->data[7] * rcrossp[1]
146  + values->data[8] * rcrossp[2];
147  s2dotL = values->data[9] * rcrossp[0] + values->data[10] * rcrossp[1]
148  + values->data[11] * rcrossp[2];
149 
150  chiS = 0.5 * (s1dotL + s2dotL);
151  chiA = 0.5 * (s1dotL - s2dotL);
152 
153  /* Compute the test-particle limit spin of the deformed-Kerr background */
154  /* TODO: Check this is actually the way it works in LAL */
155  switch (SpinAlignedEOBversion)
156  {
157  case 1:
158  tplspin = 0.0;
159  break;
160  case 2:
161  tplspin = (1. - 2. * ak->eobParams->eta) * chiS + (ak->eobParams->m1
162  -
163  ak->eobParams->
164  m2) /
165  (ak->eobParams->m1 + ak->eobParams->m2) * chiA;
166  break;
167  case 4:
168  tplspin = (1. - 2. * ak->eobParams->eta) * chiS + (ak->eobParams->m1
169  -
170  ak->eobParams->
171  m2) /
172  (ak->eobParams->m1 + ak->eobParams->m2) * chiA;
173  break;
174  default:
176  ("XLAL Error - %s: Unknown SEOBNR version!\nAt present only v1 and v2 are available.\n",
177  __func__);
179  break;
180  }
181 
182  /* ************************************************* */
183  /* Re-Populate the Waveform structures */
184  /* ************************************************* */
185 
186  /* Re-compute the spinning coefficients for hLM */
188  (ak->eobParams->hCoeffs, ak , ak->eobParams->m1, ak->eobParams->m2,
189  ak->eobParams->eta, tplspin, chiS, chiA,
190  SpinAlignedEOBversion) == XLAL_FAILURE)
191  {
192  XLALDestroyREAL8Vector (values);
194  }
195  }
196 
197  /* BEGIN OPTIMIZED */
198  /* OPTIMIZATION NOTE: Pre-compute vPhi, since
199  * 1) It's expensive (calls deriv of Hamiltonian)
200  * 2) It doesn't depend on l or m!
201  */
202  REAL8 vPhi =
204  /* END OPTIMIZED */
205 
206 // printf( "v = %.16e\n", v );
207  for (l = 2; l <= lMax; l++)
208  {
209  for (m = 1; m <= l; m++)
210  {
211  INT4 use_optimized_v2 = 1;
213  (&hLM, values, v, H, l, m, ak, use_optimized_v2,
214  &vPhi) == XLAL_FAILURE)
215  {
217  }
218  /* For the 2,2 mode, we apply NQC correction to the flux */
219  if (l == 2 && m == 2)
220  {
221  COMPLEX16 hNQC;
222  /*switch ( SpinAlignedEOBversion )
223  {
224  case 1:
225  XLALSimIMRGetEOBCalibratedSpinNQC( &nqcCoeffs, l, m, ak->eobParams->eta, ak->a );
226  break;
227  case 2:
228  // XLALSimIMRGetEOBCalibratedSpinNQCv2( &nqcCoeffs, l, m, ak->eobParams->eta, ak->a );
229  XLALSimIMRGetEOBCalibratedSpinNQC3D( &nqcCoeffs, l, m, ak->eobParams->eta, ak->a, (ak->chi1 - ak->chi2)/2. );
230  break;
231  default:
232  XLALPrintError( "XLAL Error - %s: Unknown SEOBNR version!\nAt present only v1 and v2 are available.\n", __func__);
233  XLAL_ERROR( XLAL_EINVAL );
234  break;
235  } */
236  XLALSimIMREOBNonQCCorrection (&hNQC, values, omega, nqcCoeffs);
237  /* Eq. 16 */
238  hLM *= hNQC;
239  }
240  //printf( "l = %d, m = %d, mag(hLM) = %.17e, omega = %.16e\n", l, m, sqrt(creal(hLM)*creal(hLM)+cimag(hLM)*cimag(hLM)), omega );
241  /* Eq. 13 */
242  flux +=
243  (REAL8) (m * m) * omegaSq * (creal (hLM) * creal (hLM) +
244  cimag (hLM) * cimag (hLM));
245  }
246  }
247  return flux * LAL_1_PI / 8.0;
248 }
249 
250 #endif /* _OPTIMIZEDLALSIMIMRSPINEOBFACTORIZEDFLUX_C */
static UNUSED int XLALSimIMREOBNonQCCorrection(COMPLEX16 *restrict nqc, REAL8Vector *restrict values, const REAL8 omega, EOBNonQCCoeffs *restrict coeffs)
This function calculates the non-quasicircular correction to apply to the waveform.
static REAL8 XLALInspiralSpinFactorizedFluxOptimized(REAL8Vector *values, EOBNonQCCoeffs *nqcCoeffs, const REAL8 omega, SpinEOBParams *ak, const REAL8 H, const INT4 lMax, const UINT4 SpinAlignedEOBversion)
This function calculates the spin factorized-resummed GW energy flux for given dynamical variables.
static INT4 XLALSimIMRSpinEOBFluxGetSpinFactorizedWaveform(COMPLEX16 *restrict hlm, REAL8Vector *restrict values, const REAL8 v, const REAL8 Hreal, const INT4 l, const INT4 m, SpinEOBParams *restrict params, INT4 use_optimized_v2, REAL8 *vPhil2m2)
This function calculates hlm mode factorized-resummed waveform for given dynamical variables.
static int XLALSimIMREOBCalcSpinFacWaveformCoefficients(FacWaveformCoeffs *const coeffs, SpinEOBParams *restrict params, const REAL8 m1, const REAL8 m2, const REAL8 eta, const REAL8 a, const REAL8 chiS, const REAL8 chiA, const UINT4 SpinAlignedEOBversion)
Spin Factors.
static REAL8 XLALSimIMRSpinAlignedEOBNonKeplerCoeffOptimized(const REAL8 values[], SpinEOBParams *funcParams)
Function to calculate the non-Keplerian coefficient for the spin-aligned EOB model.
int l
Definition: bh_qnmode.c:135
const double H
#define LAL_1_PI
double complex COMPLEX16
double REAL8
uint32_t UINT4
int32_t INT4
static const INT4 m
void XLALDestroyREAL8Vector(REAL8Vector *vector)
#define XLAL_ERROR_REAL8(...)
#define XLAL_ERROR(...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
XLAL_EFAULT
XLAL_EFUNC
XLAL_EINVAL
XLAL_FAILURE
The coefficients which are used in calculating the non-quasicircular correction to the EOBNRv2 model.
FacWaveformCoeffs * hCoeffs
REAL8 * data
Parameters for the spinning EOB model.
EOBParams * eobParams