LALSimulation  5.4.0.1-fe68b98
LALSimIMRSpinEOBFactorizedFluxPrec.c
Go to the documentation of this file.
1 /**
2  * \author Craig Robinson, Yi Pan, Prayush Kumar, Stas Babak, Andrea Taracchini
3  */
4 
5 #ifndef _LALSIMIMRSPINPRECEOBFACTORIZEDFLUX_C
6 #define _LALSIMIMRSPINPRECEOBFACTORIZEDFLUX_C
7 
8 #include <complex.h>
9 #include <lal/LALSimInspiral.h>
10 #include <lal/LALSimIMR.h>
11 
12 #include "LALSimIMREOBNRv2.h"
13 #include "LALSimIMRSpinEOB.h"
14 
17 //#include "LALSimIMRSpinEOBFactorizedWaveform.c"
19 
20 
21 
22 /*------------------------------------------------------------------------------------------
23  *
24  * Prototypes of functions defined in this code.
25  *
26  *------------------------------------------------------------------------------------------
27  */
28 
29 static REAL8
31  REAL8Vector * polvalues, /**< \f$(r,\phi,p_r,p_\phi)\f$ */
32  REAL8Vector * values, /**< dynamical variables */
33  EOBNonQCCoeffs * nqcCoeffs, /**< pre-computed NQC coefficients */
34  const REAL8 omega, /**< orbital frequency */
35  SpinEOBParams * ak, /**< physical parameters */
36  const REAL8 H, /**< real Hamiltonian */
37  const INT4 lMax, /**< upper limit of the summation over l */
38  const UINT4 SpinAlignedEOBversion /**< 1 for SEOBNRv1, 2 for SEOBNRv2 */
39 );
40 /*------------------------------------------------------------------------------------------
41  *
42  * Defintions of functions.
43  *
44  *------------------------------------------------------------------------------------------
45  */
46 /**
47  * This function calculates the spin factorized-resummed GW energy flux
48  * for given dynamical variables.
49  * Eq. 12 of PRD 86, 024011 (2012)
50  */
51 
52 static REAL8
54  REAL8Vector * polvalues, /**< \f$(r,\phi,p_r,p_\phi)\f$ */
55  REAL8Vector * values, /**< dynamical variables */
56  EOBNonQCCoeffs * nqcCoeffs, /**< pre-computed NQC coefficients */
57  const REAL8 omega, /**< orbital frequency */
58  SpinEOBParams * ak, /**< physical parameters */
59  const REAL8 H, /**< real Hamiltonian */
60  const INT4 lMax, /**< upper limit of the summation over l */
61  const UINT4 SpinAlignedEOBversion /**< 1 for SEOBNRv1, 2 for SEOBNRv2 */
62 )
63 {
64  int debugPK = 0;
65  int i = 0;
66  double radius = sqrt(values->data[0]*values->data[0] + values->data[1] *values->data[1] + values->data[2] *values->data[2] );
67  if (radius < 1.) {
68  return 0.;
69  }
70  if (1){
71  for( i =0; i < 4; i++)
72  if( isnan(polvalues->data[i]) ) {
73  XLAL_PRINT_INFO("XLALInspiralPrecSpinFactorizedFlux (from input)::polvalues %3.10f %3.10f %3.10f %3.10f\n", polvalues->data[0], polvalues->data[1], polvalues->data[2], polvalues->data[3]);
74  XLALPrintError( "XLAL Error - %s: nan polvalues: %3.10f %3.10f %3.10f %3.10f \n", __func__, polvalues->data[0], polvalues->data[1], polvalues->data[2], polvalues->data[3] );
76  }
77 
78  for( i =0; i < 12; i++)
79  if( isnan(values->data[i]) ) {
80  XLAL_PRINT_INFO("XLALInspiralPrecSpinFactorizedFlux (from input)::values %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f\n", values->data[0], values->data[1], values->data[2], values->data[3], values->data[4], values->data[5], values->data[6], values->data[7], values->data[8], values->data[9], values->data[10], values->data[11]);
81  XLALPrintError( "XLAL Error - %s: nan in input values: %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f \n", __func__, values->data[0], values->data[1], values->data[2], values->data[3], values->data[4], values->data[5], values->data[6], values->data[7], values->data[8], values->data[9], values->data[10], values->data[11] );
83  }
84  }
85 
86  REAL8 flux = 0.0;
87  REAL8 v;
88  REAL8 omegaSq;
89  COMPLEX16 hLM;
90  INT4 l , m;
91 
92  //EOBNonQCCoeffs nqcCoeffs;
93 
94  if (!values || !ak) {
96  }
97 
98  if (lMax < 2) {
100  }
101  /* Omega is the derivative of phi */
102  omegaSq = omega * omega;
103 
104  v = cbrt(omega);
105 
106  /* Update the factorized multipole coefficients, w.r.t. new spins */
107  if (0) { /* {{{ */
108  XLAL_PRINT_INFO("\nValues inside Flux:\n");
109  for (i = 0; i < 11; i++)
110  XLAL_PRINT_INFO("values[%d] = %.12e\n", i, values->data[i]);
111  /*
112  * Assume that initial conditions are available at this
113  * point, to compute the chiS and chiA parameters. Calculate
114  * the values of chiS and chiA, as given in Eq.16 of
115  * Precessing EOB paper Pan et.al. arXiv:1307.6232 (or PRD 89, 084006 (2014)). Assuming \vec{L} to be pointing in
116  * the direction of \vec{r}\times\vec{p}
117  */
118  REAL8 rcrossp [3], rcrosspMag, s1dotL, s2dotL;
119  REAL8 chiS , chiA, tplspin;
120 
121  rcrossp[0] = values->data[1] * values->data[5] - values->data[2] * values->data[4];
122  rcrossp[1] = values->data[2] * values->data[3] - values->data[0] * values->data[5];
123  rcrossp[2] = values->data[0] * values->data[4] - values->data[1] * values->data[3];
124  rcrosspMag = sqrt(rcrossp[0] * rcrossp[0] + rcrossp[1] * rcrossp[1] +
125  rcrossp[2] * rcrossp[2]);
126 
127  rcrossp[0] /= rcrosspMag;
128  rcrossp[1] /= rcrosspMag;
129  rcrossp[2] /= rcrosspMag;
130 
131  s1dotL = values->data[6] * rcrossp[0] + values->data[7] * rcrossp[1]
132  + values->data[8] * rcrossp[2];
133  s2dotL = values->data[9] * rcrossp[0] + values->data[10] * rcrossp[1]
134  + values->data[11] * rcrossp[2];
135 
136  chiS = 0.5 * (s1dotL + s2dotL);
137  chiA = 0.5 * (s1dotL - s2dotL);
138 
139  /*
140  * Compute the test-particle limit spin of the deformed-Kerr
141  * background
142  */
143  switch (SpinAlignedEOBversion) {
144  case 1:
145  tplspin = 0.0;
146  break;
147  case 2:
148  tplspin = (1. - 2. * ak->eobParams->eta) * chiS + (ak->eobParams->m1
149  - ak->eobParams->m2) / (ak->eobParams->m1 + ak->eobParams->m2) * chiA;
150  break;
151  default:
152  XLALPrintError("XLAL Error - %s: Unknown SEOBNR version!\nAt present only v1 and v2 are available.\n", __func__);
154  break;
155  }
156 
157  /* ************************************************* */
158  /* Re-Populate the Waveform structures */
159  /* ************************************************* */
160 
161  /* Re-compute the spinning coefficients for hLM */
162  //debugPK
163  XLAL_PRINT_INFO("Re-calculating waveform coefficients in the Flux function with chiS, chiA = %e, %e!\n", chiS, chiA);
164  chiS = 0.3039435650957116;
165  chiA = -0.2959424290852973;
166  XLAL_PRINT_INFO("Changed them to the correct values = %e, %e!\n", chiS, chiA);
167 
168  if (ak->alignedSpins==1) {
170  ak->eobParams->m1, ak->eobParams->m2, ak->eobParams->eta,
171  tplspin, chiS, chiA, SpinAlignedEOBversion) == XLAL_FAILURE) {
172  XLALDestroyREAL8Vector(values);
174  }
175  }
176  else {
178  ak->eobParams->m1, ak->eobParams->m2, ak->eobParams->eta,
179  tplspin, chiS, chiA, 3) == XLAL_FAILURE) {
180  XLALDestroyREAL8Vector(values);
182  }
183  }
184  } /* }}} */
185  //XLAL_PRINT_INFO("v = %.16e\n", v);
186  COMPLEX16 hLMTab[lMax+1][lMax+1];
187  if (XLALSimIMRSpinEOBFluxGetPrecSpinFactorizedWaveform(&hLMTab[0][0], polvalues, values, v, H,
188  lMax, ak) == XLAL_FAILURE) {
190  }
191  for (l = 2; l <= lMax; l++) {
192 
193  for (m = 1; m <= l; m++) {
194 
195  if (debugPK)
196  XLAL_PRINT_INFO("\nGetting (%d, %d) mode for flux!\n", l, m);
197  //XLAL_PRINT_INFO("Stas, computing the waveform l = %d, m =%d\n", l, m);
198  hLM = hLMTab[l][m];
199  //XLAL_PRINT_INFO("Stas: done\n");
200  /*
201  * For the 2,2 mode, we apply NQC correction to the
202  * flux
203  */
204  if (l == 2 && m == 2) {
205  COMPLEX16 hNQC;
206  /*
207  * switch ( SpinAlignedEOBversion ) { case 1:
208  * XLALSimIMRGetEOBCalibratedSpinNQC(
209  * &nqcCoeffs, l, m, ak->eobParams->eta,
210  * ak->a ); break; case 2: //
211  * XLALSimIMRGetEOBCalibratedSpinNQCv2(
212  * &nqcCoeffs, l, m, ak->eobParams->eta,
213  * ak->a );
214  * XLALSimIMRGetEOBCalibratedSpinNQC3D(
215  * &nqcCoeffs, l, m, ak->eobParams->eta,
216  * ak->a, (ak->chi1 - ak->chi2)/2. ); break;
217  * default: XLALPrintError( "XLAL Error - %s:
218  * Unknown SEOBNR version!\nAt present only
219  * v1 and v2 are available.\n", __func__);
220  * XLAL_ERROR( XLAL_EINVAL ); break; }
221  */
222  if (debugPK)
223  XLAL_PRINT_INFO("\tl = %d, m = %d, NQC: a1 = %.16e, a2 = %.16e, a3 = %.16e, a3S = %.16e, a4 = %.16e, a5 = %.16e\n\tb1 = %.16e, b2 = %.16e, b3 = %.16e, b4 = %.16e\n",
224  2, 2, nqcCoeffs->a1, nqcCoeffs->a2, nqcCoeffs->a3, nqcCoeffs->a3S, nqcCoeffs->a4, nqcCoeffs->a5,
225  nqcCoeffs->b1, nqcCoeffs->b2, nqcCoeffs->b3, nqcCoeffs->b4);
226  XLALSimIMREOBNonQCCorrection(&hNQC, polvalues, omega, nqcCoeffs);
227  if (debugPK)
228  XLAL_PRINT_INFO("\tl = %d, m = %d, hNQC = %.16e + i%.16e, |hNQC| = %.16e\n", l, m,
229  creal(hNQC), cimag(hNQC), sqrt(creal(hNQC) * creal(hNQC) + cimag(hLM) * cimag(hLM)));
230 
231  if((m * m) * omegaSq * (creal(hLM) * creal(hLM) + cimag(hLM) * cimag(hLM)) > 5.) {
232 
233  XLAL_PRINT_INFO("\tl = %d, m = %d, mag(hLM) = %.17e, mag(hNQC) = %.17e, omega = %.16e\n",
234  l, m, sqrt(creal(hLM) * creal(hLM) + cimag(hLM) * cimag(hLM)),
235  sqrt(creal(hNQC) * creal(hNQC) + cimag(hNQC) * cimag(hNQC)), omega);
236 
237  XLAL_PRINT_INFO("XLALInspiralPrecSpinFactorizedFlux (from input)::values %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f\n", values->data[0], values->data[1], values->data[2], values->data[3], values->data[4], values->data[5], values->data[6], values->data[7], values->data[8], values->data[9], values->data[10], values->data[11]);
238  }
239 
240  /* Eq. 16 */
241  //FIXME
242  hLM *= hNQC;
243  }
244  if (debugPK)
245  XLAL_PRINT_INFO("\tl = %d, m = %d, mag(hLM) = %.17e, omega = %.16e\n", l, m, sqrt(creal(hLM) * creal(hLM) + cimag(hLM) * cimag(hLM)), omega);
246 
247  /* Eq. 13 */
248  flux += (REAL8) (m * m) * omegaSq * (creal(hLM) * creal(hLM) + cimag(hLM) * cimag(hLM));
249  }
250  }
251  if( (omegaSq > 1 || flux > 5) ) {
252  if(debugPK) {
253  XLAL_PRINT_INFO("In XLALInspiralPrecSpinFactorizedFlux: omegaSq = %3.12f, FLUX = %3.12f, r = %3.12f\n",
254  omegaSq, flux,radius);
255  }
256  flux = 0.;
257  }
258 
259  if (debugPK)
260  XLAL_PRINT_INFO("\tStas, FLUX = %.16e\n", flux * LAL_1_PI / 8.0);
261  return flux * LAL_1_PI / 8.0;
262 }
263 #endif /* _LALSIMIMRSPINPRECEOBFACTORIZEDFLUX_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 XLALInspiralPrecSpinFactorizedFlux(REAL8Vector *polvalues, 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 int XLALSimIMREOBCalcSpinPrecFacWaveformCoefficients(FacWaveformCoeffs *const coeffs, const REAL8 m1, const REAL8 m2, const REAL8 eta, const REAL8 a, const REAL8 chiS, const REAL8 chiA, const UINT4 SpinAlignedEOBversion)
Waveform expressions are given by Taracchini et al.
static INT4 XLALSimIMRSpinEOBFluxGetPrecSpinFactorizedWaveform(COMPLEX16 *restrict hlmTab, REAL8Vector *restrict values, REAL8Vector *restrict cartvalues, const REAL8 v, const REAL8 Hreal, const INT4 lMax, SpinEOBParams *restrict params)
FOR PRECESSING EOB This function calculates hlm mode factorized-resummed waveform for given dynamical...
int l
Definition: bh_qnmode.c:135
double i
Definition: bh_ringdown.c:118
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_PRINT_INFO(...)
#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