LALSimulation  5.4.0.1-fe68b98
LALSimIMRCalculateSpinPrecEOBHCoeffs.c
Go to the documentation of this file.
1 #ifndef _LALSimIMRCalculateSpinPrecEOBHCoeffs_C
2 #define _LALSimIMRCalculateSpinPrecEOBHCoeffs_C
4 
5 /**
6  * \author Craig Robinson, Yi Pan, Stas Babak, Prayush Kumar, Andrea Taracchini
7  *
8  * This function was originally part of LALSimIMRSpinEOBHamiltonianPrec.c,
9  * and moved here during the development of v3_opt. Function relocation
10  * implemented by R. Devine, Z. Etienne, D. Buch, and T. Knowles. In comments,
11  * R.H. refers to Roland Hass.
12  */
13 
14 #include <stdio.h>
15 #include <math.h>
16 #include <LALSimIMRSpinEOB.h>
17 
18 /*------------------------------------------------------------------------------------------
19  *
20  * Prototypes of functions defined in this code.
21  *
22  *------------------------------------------------------------------------------------------
23  */
24 
26  SpinEOBHCoeffs *coeffs,
27  const REAL8 eta,
28  const REAL8 a,
29  const UINT4 SpinAlignedEOBversion
30  );
31 
32 
33 /*------------------------------------------------------------------------------------------
34  *
35  * Defintions of functions.
36  *
37  *------------------------------------------------------------------------------------------
38  */
39 
40 /**
41  *
42  * This function is used to calculate some coefficients which will be used in the
43  * spinning EOB Hamiltonian. It takes the following inputs:
44  *
45  * coeffs - a (non-null) pointer to a SpinEOBParams structure. This will be populated
46  * with the output.
47  * eta - the symmetric mass ratio.
48  * sigmaKerr - the spin of the effective Kerr background (a combination of the individual spins).
49  *
50  * If all goes well, the function will return XLAL_SUCCESS. Otherwise, XLAL_FAILURE is returned.
51  */
53  SpinEOBHCoeffs *coeffs, /**<< OUTPUT, EOB parameters including pre-computed coefficients */
54  const REAL8 eta, /**<< symmetric mass ratio */
55  const REAL8 a, /**<< Normalized deformed Kerr spin */
56  const UINT4 SpinAlignedEOBversion /**<< 1 for SEOBNRv1; 2 for SEOBNRv2 */
57  )
58 {
59 
60  REAL8 KK, k0, k1, k2, k3, k4, k5, k5l, k1p2, k1p3;
61  REAL8 m1PlusEtaKK;
62 
63  if ( !coeffs )
64  {
66  }
67 
68  coeffs->SpinAlignedEOBversion = SpinAlignedEOBversion;
69  const int debugPK = 0;
70  if( debugPK )
71  {
72  XLAL_PRINT_INFO("In XLALSimIMRCalculateSpinPrecEOBHCoeffs: SpinAlignedEOBversion = %d,%d\n",
73  (int) SpinAlignedEOBversion, (int) coeffs->SpinAlignedEOBversion );
74  fflush( NULL );
75  }
76  /* Constants are fits taken from PRD 86, 024011 (2012) Eq. 37 */
77  static const REAL8 c0 = 1.4467; /* needed to get the correct self-force results */
78  static const REAL8 c1 = -1.7152360250654402;
79  static const REAL8 c2 = -3.246255899738242;
80 
81  static const REAL8 c20 = 1.712;
82  static const REAL8 c21 = -1.803949138004582;
83  static const REAL8 c22 = -39.77229225266885;
84  static const REAL8 c23 = 103.16588921239249;
85 
86  static const REAL8 third = 1./3.;
87  static const REAL8 fifth = 1./5.;
88  static const REAL8 ln2 = 0.6931471805599453094172321214581765680755; // log(2.)
89 
90  // RH: this assumes that SpinAlignedEOBversion is either 1 or 2
91  // RH: the ifthenelse macros return their ifvalue if cond>=0 (specifically
92  // the positive sign is set) and elsevalue otherwise. So:
93  // RH: 1.5-SpinAlignedEOBversion is positive for SpinAlignedEOBversion==1 and
94  // RH: negative for SpinAlignedEOBversion==2
95  // RH: SpinAlignedEOBversion-1.5 is reversed
96 
97  // RH: TODO check if b3 can ever be non-zero. If not remove all terms using b3.
98  coeffs->b3 = 0.;
99  coeffs->bb3 = 0.;
100 #define ifthenelse(cond, ifvalue, elsevalue) ((elsevalue) + (0.5 + copysign(0.5, cond)) * ((ifvalue)-(elsevalue)))
101  coeffs->KK = KK = ifthenelse(1.5-SpinAlignedEOBversion,
102  c0 + c1*eta + c2*eta*eta,
103  c20 + c21*eta + c22*(eta*eta) + c23*(eta*eta)*eta);
104  REAL8 chi = a / (1. - 2. * eta);
105  REAL8 eta2 = eta * eta, eta3 = eta2 * eta;
106  REAL8 chi2 = chi * chi, chi3 = chi2 * chi;
107  if (SpinAlignedEOBversion == 4)
108  {
109  coeffs->KK = KK =
110  coeff00K + coeff01K * chi + coeff02K * chi2 + coeff03K * chi3 +
111  coeff10K * eta + coeff11K * eta * chi + coeff12K * eta * chi2 +
112  coeff13K * eta * chi3 + coeff20K * eta2 + coeff21K * eta2 * chi +
113  coeff22K * eta2 * chi2 + coeff23K * eta2 * chi3 + coeff30K * eta3 +
114  coeff31K * eta3 * chi + coeff32K * eta3 * chi2 + coeff33K * eta3 * chi3;
115  // printf("KK %.16e\n", KK);
116  }
117  m1PlusEtaKK = -1. + eta*KK;
118  const REAL8 invm1PlusEtaKK = 1./m1PlusEtaKK;
119  /* Eqs. 5.77 - 5.81 of PRD 81, 084024 (2010) */
120  coeffs->k0 = k0 = KK*(m1PlusEtaKK - 1.);
121  coeffs->k1 = k1 = - 2.*(k0 + KK)*m1PlusEtaKK;
122  k1p2= k1*k1;
123  k1p3= k1*k1p2;
124  coeffs->k2 = k2 = (k1 * (k1 - 4.*m1PlusEtaKK)) * 0.5 - a*a*k0*m1PlusEtaKK*m1PlusEtaKK;
125  coeffs->k3 = k3 = -(k1*k1)*k1 * third + k1*k2 + (k1*k1)*m1PlusEtaKK - 2.*(k2 - m1PlusEtaKK)*m1PlusEtaKK - a*a*k1*(m1PlusEtaKK*m1PlusEtaKK);
126  coeffs->k4 = k4 = ((24./96.)*(k1*k1)*(k1*k1) - (96./96.)*(k1*k1)*k2 + (48./96.)*k2*k2 - (64./96.)*(k1*k1)*k1*m1PlusEtaKK
127  + (48./96.)*(a*a)*(k1*k1 - 2.*k2)*(m1PlusEtaKK*m1PlusEtaKK) +
128  (96./96.)*k1*(k3 + 2.*k2*m1PlusEtaKK) - m1PlusEtaKK*((192./96.)*k3 + m1PlusEtaKK*(-(3008./96.) + (123./96.)*LAL_PI*LAL_PI)));
129 #define ifthenelsezero(cond, ifvalue) ((0.5 + copysign(0.5, cond)) * (ifvalue))
130  coeffs->k5 = k5 = ifthenelsezero(SpinAlignedEOBversion-1.5,
131  m1PlusEtaKK*m1PlusEtaKK
132  * (-4237./60.+128./5.*LAL_GAMMA+2275.*LAL_PI*LAL_PI/512.
133  - third*(a*a)*(k1p3-3.*(k1*k2)+3.*k3)
134  - ((k1p3*k1p2)-5.*(k1p3*k2)+5.*k1*k2*k2+5.*k1p2*k3-5.*k2*k3-5.*k1*k4)*fifth*invm1PlusEtaKK*invm1PlusEtaKK
135  + ((k1p2*k1p2)-4.*(k1p2*k2)+2.*k2*k2+4.*k1*k3-4.*k4)*0.5*invm1PlusEtaKK+(256./5.)*ln2)
136  );
137  coeffs->k5l= k5l= ifthenelsezero(SpinAlignedEOBversion-1.5, (m1PlusEtaKK*m1PlusEtaKK) * (64./5.));
138  if ( SpinAlignedEOBversion == 4 ) {
139  coeffs->k5 = k5 = m1PlusEtaKK*m1PlusEtaKK
140  * (-4237./60.+128./5.*LAL_GAMMA+2275.*LAL_PI*LAL_PI/512.
141  - third*(a*a)*(k1p3-3.*(k1*k2)+3.*k3)
142  - ((k1p3*k1p2)-5.*(k1p3*k2)+5.*k1*k2*k2+5.*k1p2*k3-5.*k2*k3-5.*k1*k4)*fifth*invm1PlusEtaKK*invm1PlusEtaKK
143  + ((k1p2*k1p2)-4.*(k1p2*k2)+2.*k2*k2+4.*k1*k3-4.*k4)*0.5*invm1PlusEtaKK+(256./5.)*ln2 + (41. * LAL_PI * LAL_PI / 32. -
144  221. / 6.) * eta );
145  coeffs->k5l= k5l= (m1PlusEtaKK*m1PlusEtaKK) * (64./5.);
146  }
147 
148 
149  /* Now calibrated parameters for spin models */
150  coeffs->d1 = ifthenelsezero(1.5-SpinAlignedEOBversion, -69.5);
151  coeffs->d1v2 = ifthenelsezero(SpinAlignedEOBversion-1.5, -74.71 - 156.*eta + 627.5*eta*eta);
152  coeffs->dheffSS = ifthenelsezero(1.5-SpinAlignedEOBversion, 2.75);
153  coeffs->dheffSSv2 = ifthenelsezero(SpinAlignedEOBversion-1.5, 8.127 - 154.2*eta + 830.8*eta*eta);
154  if (SpinAlignedEOBversion==4) {
155  coeffs->d1 = 0.;
156  coeffs->dheffSS = 0.;
157  // dSO
158  coeffs->d1v2 =
159  coeff00dSO + coeff01dSO * chi + coeff02dSO * chi2 + coeff03dSO * chi3 +
160  coeff10dSO * eta + coeff11dSO * eta * chi + coeff12dSO * eta * chi2 +
161  coeff13dSO * eta * chi3 + coeff20dSO * eta2 + coeff21dSO * eta2 * chi +
162  coeff22dSO * eta2 * chi2 + coeff23dSO * eta2 * chi3 + coeff30dSO * eta3 +
163  coeff31dSO * eta3 * chi + coeff32dSO * eta3 * chi2 + coeff33dSO * eta3 * chi3;
164 
165  // dSS
166  coeffs->dheffSSv2 =
167  coeff00dSS + coeff01dSS * chi + coeff02dSS * chi2 + coeff03dSS * chi3 +
168  coeff10dSS * eta + coeff11dSS * eta * chi + coeff12dSS * eta * chi2 +
169  coeff13dSS * eta * chi3 + coeff20dSS * eta2 + coeff21dSS * eta2 * chi +
170  coeff22dSS * eta2 * chi2 + coeff23dSS * eta2 * chi3 + coeff30dSS * eta3 +
171  coeff31dSS * eta3 * chi + coeff32dSS * eta3 * chi2 + coeff33dSS * eta3 * chi3;
172  // printf("dSO %.16e, dSS %.16e\n", coeffs->d1v2,coeffs->dheffSSv2);
173  }
174  return XLAL_SUCCESS;
175 }
176 
177 /**
178  *
179  * This function is used to calculate some coefficients which will be used in the
180  * spinning EOB Hamiltonian. It was specifically designed for precessing binaries,
181  * such that it allows the spin parameter chi that enters the NR-calibrated terms (like KK) to be different
182  * from a that enters derived coefficients like k0,k1,...
183  * If all goes well, the function will return XLAL_SUCCESS. Otherwise, XLAL_FAILURE is returned.
184  * The paper references are:
185  * 1. Barausse and Buonanno - PRD 81, 084024 (2010) [arXiv:0912.3517]
186  * 2. Bohe et al - Phys. Rev. D 95, 044028 – (2017) [arXiv:1611.03703]
187  * 3. Steinhoff et al - Phys. Rev. D 94, 104028 (2016) [arXiv:1608.01907]
188 */
190  SpinEOBHCoeffs *coeffs, /**<< OUTPUT, EOB parameters including pre-computed coefficients */
191  const REAL8 eta, /**<< symmetric mass ratio */
192  REAL8 a, /**<< Normalized deformed Kerr spin */
193  REAL8 chi, /**<< The augmented spin, with correct aligned-spin limit */
194  const UINT4 SpinAlignedEOBversion /**<< 4 for SEOBNRv4P; Possible to extend this later later */
195 )
196 {
197 
198  REAL8 KK, k0, k1, k2, k3, k4, k5, k5l, k1p2, k1p3;
199  REAL8 m1PlusEtaKK;
200 
201  if (!coeffs)
202  {
204  }
205 
206  coeffs->SpinAlignedEOBversion = SpinAlignedEOBversion;
207  const int debugPK = 0;
208  if (debugPK)
209  {
210  XLAL_PRINT_INFO("In XLALSimIMRCalculateSpinPrecEOBHCoeffs: SpinAlignedEOBversion = %d,%d\n",
211  (int)SpinAlignedEOBversion, (int)coeffs->SpinAlignedEOBversion);
212  fflush(NULL);
213  }
214 
215  static const REAL8 third = 1. / 3.;
216  static const REAL8 fifth = 1. / 5.;
217  static const REAL8 ln2 = 0.6931471805599453094172321214581765680755; // log(2.)
218  coeffs->b3 = 0.;
219  coeffs->bb3 = 0.;
220  REAL8 eta2 = eta * eta, eta3 = eta2 * eta;
221  REAL8 chi2 = chi * chi, chi3 = chi2 * chi;
222  coeffs->KK = KK = 0;
223  if (SpinAlignedEOBversion == 4)
224  {
225  // See Eq.(4.8) and Eq.(4.12) in Bohe et al
226  coeffs->KK = KK =
227  coeff00K + coeff01K * chi + coeff02K * chi2 + coeff03K * chi3 +
228  coeff10K * eta + coeff11K * eta * chi + coeff12K * eta * chi2 +
229  coeff13K * eta * chi3 + coeff20K * eta2 + coeff21K * eta2 * chi +
230  coeff22K * eta2 * chi2 + coeff23K * eta2 * chi3 + coeff30K * eta3 +
231  coeff31K * eta3 * chi + coeff32K * eta3 * chi2 + coeff33K * eta3 * chi3;
232  }
233  m1PlusEtaKK = -1. + eta * KK;
234  const REAL8 invm1PlusEtaKK = 1. / m1PlusEtaKK;
235  /* Eqs.(5.77 - 5.81) of Baruasse and Buonnano PRD 81, 084024 (2010) */
236  coeffs->k0 = k0 = KK * (m1PlusEtaKK - 1.);
237  coeffs->k1 = k1 = -2. * (k0 + KK) * m1PlusEtaKK;
238  k1p2 = k1 * k1;
239  k1p3 = k1 * k1p2;
240  coeffs->k2 = k2 = (k1 * (k1 - 4. * m1PlusEtaKK)) * 0.5 - a * a * k0 * m1PlusEtaKK * m1PlusEtaKK;
241  coeffs->k3 = k3 = -(k1 * k1) * k1 * third + k1 * k2 + (k1 * k1) * m1PlusEtaKK - 2. * (k2 - m1PlusEtaKK) * m1PlusEtaKK - a * a * k1 * (m1PlusEtaKK * m1PlusEtaKK);
242  coeffs->k4 = k4 = ((24. / 96.) * (k1 * k1) * (k1 * k1) - (96. / 96.) * (k1 * k1) * k2 + (48. / 96.) * k2 * k2 - (64. / 96.) * (k1 * k1) * k1 * m1PlusEtaKK + (48. / 96.) * (a * a) * (k1 * k1 - 2. * k2) * (m1PlusEtaKK * m1PlusEtaKK) +
243  (96. / 96.) * k1 * (k3 + 2. * k2 * m1PlusEtaKK) - m1PlusEtaKK * ((192. / 96.) * k3 + m1PlusEtaKK * (-(3008. / 96.) + (123. / 96.) * LAL_PI * LAL_PI)));
244  if (SpinAlignedEOBversion == 4)
245  {
246  // Look at Eq.(A2C) in Steinhoff et al. The last term from Eq.(2.3) in Bohe et al.
247  coeffs->k5 = k5 = m1PlusEtaKK * m1PlusEtaKK * (-4237. / 60. + 128. / 5. * LAL_GAMMA + 2275. * LAL_PI * LAL_PI / 512. - third * (a * a) * (k1p3 - 3. * (k1 * k2) + 3. * k3) - ((k1p3 * k1p2) - 5. * (k1p3 * k2) + 5. * k1 * k2 * k2 + 5. * k1p2 * k3 - 5. * k2 * k3 - 5. * k1 * k4) * fifth * invm1PlusEtaKK * invm1PlusEtaKK + ((k1p2 * k1p2) - 4. * (k1p2 * k2) + 2. * k2 * k2 + 4. * k1 * k3 - 4. * k4) * 0.5 * invm1PlusEtaKK + (256. / 5.) * ln2 + (41. * LAL_PI * LAL_PI / 32. - 221. / 6.) * eta);
248  // This is the first term in the brackets in Eq.(A2C) in Steinhoff et al.
249  coeffs->k5l = k5l = (m1PlusEtaKK * m1PlusEtaKK) * (64. / 5.);
250  }
251 
252  /* Now calibrated parameters for spin models */
253  if (SpinAlignedEOBversion == 4)
254  {
255 
256  coeffs->d1 = 0.;
257  coeffs->dheffSS = 0.;
258  // dSO: Eq.(4.13) in Bohe et al
259  coeffs->d1v2 =
260  coeff00dSO + coeff01dSO * chi + coeff02dSO * chi2 + coeff03dSO * chi3 +
261  coeff10dSO * eta + coeff11dSO * eta * chi + coeff12dSO * eta * chi2 +
262  coeff13dSO * eta * chi3 + coeff20dSO * eta2 + coeff21dSO * eta2 * chi +
263  coeff22dSO * eta2 * chi2 + coeff23dSO * eta2 * chi3 + coeff30dSO * eta3 +
264  coeff31dSO * eta3 * chi + coeff32dSO * eta3 * chi2 + coeff33dSO * eta3 * chi3;
265 
266  // dSS: Eq.(4.14) in Bohe et al
267  coeffs->dheffSSv2 =
268  coeff00dSS + coeff01dSS * chi + coeff02dSS * chi2 + coeff03dSS * chi3 +
269  coeff10dSS * eta + coeff11dSS * eta * chi + coeff12dSS * eta * chi2 +
270  coeff13dSS * eta * chi3 + coeff20dSS * eta2 + coeff21dSS * eta2 * chi +
271  coeff22dSS * eta2 * chi2 + coeff23dSS * eta2 * chi3 + coeff30dSS * eta3 +
272  coeff31dSS * eta3 * chi + coeff32dSS * eta3 * chi2 + coeff33dSS * eta3 * chi3;
273  // printf("dSO %.16e, dSS %.16e\n", coeffs->d1v2,coeffs->dheffSSv2);
274  }
275  return XLAL_SUCCESS;
276 }
277 
278 #endif // _LALSimIMRCalculateSpinPrecEOBHCoeffs_C
#define ifthenelse(cond, ifvalue, elsevalue)
static int XLALSimIMRCalculateSpinPrecEOBHCoeffs_v2(SpinEOBHCoeffs *coeffs, const REAL8 eta, REAL8 a, REAL8 chi, const UINT4 SpinAlignedEOBversion)
This function is used to calculate some coefficients which will be used in the spinning EOB Hamiltoni...
static int XLALSimIMRCalculateSpinPrecEOBHCoeffs(SpinEOBHCoeffs *coeffs, const REAL8 eta, const REAL8 a, const UINT4 SpinAlignedEOBversion)
This function is used to calculate some coefficients which will be used in the spinning EOB Hamiltoni...
#define ifthenelsezero(cond, ifvalue)
const double c1
const double c2
const double c0
static const REAL8 coeff12dSO
static const REAL8 coeff00dSO
static const REAL8 coeff02K
static const REAL8 coeff21dSO
static const REAL8 coeff12dSS
static const REAL8 coeff31dSS
static const REAL8 coeff20K
static const REAL8 coeff31dSO
static const REAL8 coeff32dSS
static const REAL8 coeff23K
static const REAL8 coeff33K
static const REAL8 coeff32K
static const REAL8 coeff11dSS
static const REAL8 coeff11dSO
static const REAL8 coeff21K
static const REAL8 coeff10dSO
static const REAL8 coeff31K
static const REAL8 coeff23dSO
static const REAL8 coeff10dSS
static const REAL8 coeff01K
static const REAL8 coeff02dSS
static const REAL8 coeff13dSS
static const REAL8 coeff10K
static const REAL8 coeff20dSS
static const REAL8 coeff30dSS
static const REAL8 coeff11K
static const REAL8 coeff03K
static const REAL8 coeff22K
static const REAL8 coeff23dSS
static const REAL8 coeff20dSO
static const REAL8 coeff03dSS
static const REAL8 coeff22dSO
static const REAL8 coeff32dSO
static const REAL8 coeff33dSS
static const REAL8 coeff33dSO
static const REAL8 coeff01dSS
static const REAL8 coeff02dSO
static const REAL8 coeff03dSO
static const REAL8 coeff21dSS
static const REAL8 coeff13K
static const REAL8 coeff22dSS
static const REAL8 coeff00K
static const REAL8 coeff00dSS
static const REAL8 coeff01dSO
static const REAL8 coeff12K
static const REAL8 coeff30K
static const REAL8 coeff30dSO
static const REAL8 coeff13dSO
#define LAL_PI
#define LAL_GAMMA
double REAL8
uint32_t UINT4
static const INT4 a
#define XLAL_PRINT_INFO(...)
#define XLAL_ERROR(...)
XLAL_SUCCESS
XLAL_EINVAL
Parameters for the spinning EOB model, used in calculating the Hamiltonian.
UINT4 SpinAlignedEOBversion