LALSimulation  5.4.0.1-fe68b98
LALSimIMRSpinEOBHamiltonianOptimized.c
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2011 Craig Robinson, Enrico Barausse, Yi Pan
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  * \author Craig Robinson, Yi Pan, Zachariah Etienne, Caleb Devine,
22  * David Buch
23  *
24  * Functions for calculating the effective one-body Hamiltonian for
25  * spinning binaries, as described 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  * This code borrows hugely from a C implementation originally written
30  * by Enrico Barausse, following Barausse and Buonanno
31  * PRD 81, 084024 (2010) and PRD 84, 104027 (2011), henceforth BB1 and BB2,
32  * and additionally from the original un-optimized version
33  * LALSimIMRSpinEOBHamiltonian.c
34  */
35 
36 #ifndef _LALSIMIMRSPINEOBHAMILTONIANOPTIMIZED_C
37 #define _LALSIMIMRSPINEOBHAMILTONIANOPTIMIZED_C
38 
39 #include <stdio.h>
40 #include <math.h>
41 
42 #include <lal/LALSimInspiral.h>
43 #include <lal/LALSimIMR.h>
44 
45 #include "LALSimIMRSpinEOB.h"
46 
48 
49 /*------------------------------------------------------------------------------------------
50  *
51  * Prototypes of functions defined in this code.
52  *
53  *------------------------------------------------------------------------------------------
54  */
55 
56 
58  const REAL8 eta,
59  REAL8Vector * restrict x,
60  REAL8Vector * restrict p,
61  REAL8Vector * restrict s1Vec,
62  REAL8Vector * restrict s2Vec,
63  REAL8Vector * restrict sigmaKerr,
64  REAL8Vector * restrict sigmaStar,
65  int tortoise,
66  SpinEOBHCoeffs *coeffs);
67 
69  const REAL8 values[],
70  SpinEOBParams *funcParams
71  );
72 
74  const REAL8 values[],
75  SpinEOBParams *funcParams
76  );
77 
78 /*------------------------------------------------------------------------------------------
79  *
80  * Defintions of functions.
81  *
82  *------------------------------------------------------------------------------------------
83  */
84 
85 /**
86  *
87  * Function to calculate the value of the spinning Hamiltonian for given values
88  * of the dynamical variables (in a Cartesian co-ordinate system). The inputs are
89  * as follows:
90  *
91  * x - the separation vector r expressed in Cartesian co-ordinates
92  * p - the momentum vector (with the radial component tortoise pr*)
93  * sigmaKerr - spin of the effective Kerr background (a combination of the individual spin vectors)
94  * sigmaStar - spin of the effective particle (a different combination of the individual spins).
95  * coeffs - coefficients which crop up in the Hamiltonian. These can be calculated using the
96  * XLALCalculateSpinEOBParams() function.
97  *
98  * The function returns a REAL8, which will be the value of the Hamiltonian if all goes well;
99  * otherwise, it will return the XLAL REAL8 failure NaN.
100  */
102  const REAL8 eta, /**<< Symmetric mass ratio */
103  REAL8Vector * restrict x, /**<< Position vector */
104  REAL8Vector * restrict p, /**<< Momentum vector (tortoise radial component pr*) */
105  REAL8Vector * restrict s1Vec, /**<< Spin vector 1 */
106  REAL8Vector * restrict s2Vec, /**<< Spin vector 2 */
107  REAL8Vector * restrict sigmaKerr, /**<< Spin vector sigma_kerr */
108  REAL8Vector * restrict sigmaStar, /**<< Spin vector sigma_star */
109  INT4 tortoise, /**<< flag to state whether the momentum is the tortoise co-ord */
110  SpinEOBHCoeffs *coeffs /**<< Structure containing various coefficients */
111  )
112 {
113  /* This is a modified sign function: e3z = 1 if sigmaKerr->data[2]>=0, -1 otherwise */
114  REAL8 e3z = (0.0 <= sigmaKerr->data[2]) - (sigmaKerr->data[2] < 0.0);
115 
116  if(tortoise==1) {
117  {
119  return Hreal;
120  }
121  } else if(tortoise==0) {
122  {
124  return Hreal;
125  }
126  } else {
127  XLALPrintError( "XLAL Error - %s: SEOBNRv2 Optimized Hamiltonian called with unknown tortoise value = %d.\n", __func__,tortoise);
129  }
130 }
131 
132 /**
133  * Function to calculate the value of omega for the spin-aligned EOB waveform.
134  * Can NOT be used in precessing cases. This omega is defined as \f$\dot{y}/r\f$ by setting \f$y=0\f$.
135  * The function calculates omega = v/r, by first converting (r,phi,pr,pphi) to Cartesian coordinates
136  * in which rVec={r,0,0} and pVec={0,pphi/r,0}, i.e. the effective-test-particle is positioned at x=r,
137  * and its velocity along y-axis. Then it computes omega, which is now given by dydt/r = (dH/dp_y)/r.
138  */
139 static REAL8
141  const REAL8 values[], /**<< Dynamical variables */
142  SpinEOBParams *funcParams /**<< EOB parameters */
143  )
144 {
146 
147  /* Cartesian values for calculating the Hamiltonian */
148  REAL8 cartValues[6];
149 
150  REAL8 omega;
151  REAL8 r;
152 
153  /* Populate the Cartesian values vector */
154  /* We can assume phi is zero wlog */
155  memset( cartValues, 0, sizeof( cartValues ) );
156  cartValues[0] = r = values[0];
157  cartValues[3] = values[2];
158  cartValues[4] = values[3] / values[0];
159 
160  /* Set up input parameters for exact derivative calculation */
161  params.values = cartValues;
162  params.params = funcParams;
163 
164  /* Now calculate omega. In the chosen co-ordinate system, */
165  /* we need dH/dpy to calculate this, i.e. varyParam = 4 */
166  params.varyParam = 4;
167  omega = GSLSpinAlignedHamiltonianWrapper_ExactDeriv( cartValues[4], &params );
168 
169  omega = omega / r;
170 
171  return omega;
172 }
173 
174 /**
175  * Function to calculate the non-Keplerian coefficient for the spin-aligned EOB model.
176  * radius \f$r\f$ times the cuberoot of the returned number is \f$r_\Omega\f$ defined in Eq. A2.
177  * i.e. the function returns \f$(r_{\Omega} / r)^3\f$.
178  */
180  const REAL8 values[], /**<< Dynamical variables */
181  SpinEOBParams *funcParams /**<< EOB parameters */
182  )
183 {
184 
185  REAL8 omegaCirc;
186 
187  REAL8 tmpValues[4];
188 
189  REAL8 r3;
190 
191  /* We need to find the values of omega assuming pr = 0 */
192  memcpy( tmpValues, values, sizeof(tmpValues) );
193  tmpValues[2] = 0.0;
194 
195  omegaCirc = XLALSimIMRSpinAlignedEOBCalcOmegaOptimized( tmpValues, funcParams );
196  if ( XLAL_IS_REAL8_FAIL_NAN( omegaCirc ) )
197  {
199  }
200 
201  r3 = values[0]*values[0]*values[0];
202 
203  return 1.0/(omegaCirc*omegaCirc*r3);
204 }
205 
206 #endif /*_LALSIMIMRSPINEOBHAMILTONIANOPTIMIZED_C*/
static REAL8 XLALSimIMRSpinAlignedEOBNonKeplerCoeffOptimized(const REAL8 values[], SpinEOBParams *funcParams)
Function to calculate the non-Keplerian coefficient for the spin-aligned EOB model.
static REAL8 XLALSimIMRSpinEOBHamiltonianOptimized(const REAL8 eta, REAL8Vector *restrict x, REAL8Vector *restrict p, REAL8Vector *restrict s1Vec, REAL8Vector *restrict s2Vec, REAL8Vector *restrict sigmaKerr, REAL8Vector *restrict sigmaStar, int tortoise, SpinEOBHCoeffs *coeffs)
static REAL8 XLALSimIMRSpinAlignedEOBCalcOmegaOptimized(const REAL8 values[], SpinEOBParams *funcParams)
Function to calculate the value of omega for the spin-aligned EOB waveform.
static double GSLSpinAlignedHamiltonianWrapper_ExactDeriv(double x, void *params)
REAL8 Hreal
double REAL8
int32_t INT4
static const INT4 r
#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_EFUNC
XLAL_EINVAL
Parameters for the spinning EOB model, used in calculating the Hamiltonian.
Parameters for the spinning EOB model.
Definition: burst.c:245
LALDict * params
Definition: inspiral.c:248