gstlal-inspiral  1.9.3
 All Classes Namespaces Files Functions
chirptime.py
Go to the documentation of this file.
1 # Copyright (C) 2015 Jolien Creighton
2 #
3 # This program is free software; you can redistribute it and/or modify it
4 # under the terms of the GNU General Public License as published by the
5 # Free Software Foundation; either version 2 of the License, or (at your
6 # option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11 # Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License along
14 # with this program; if not, write to the Free Software Foundation, Inc.,
15 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 
17 ## @file
18 
19 ## @package chirptime
20 
21 import sys
22 from math import pi
23 import numpy
24 import lalsimulation as lalsim
25 import warnings
26 
27 def tmplttime(f0, m1, m2, j1, j2, approx):
28  dt = 1.0 / 16384.0
29  approximant = lalsim.GetApproximantFromString(approx)
30  hp, hc = lalsim.SimInspiralChooseTDWaveform(
31  phiRef=0,
32  deltaT=dt,
33  m1=m1,
34  m2=m2,
35  s1x=0,
36  s1y=0,
37  s1z=j1,
38  s2x=0,
39  s2y=0,
40  s2z=j2,
41  f_min=f0,
42  f_ref=0,
43  r=1,
44  i=0,
45  lambda1=0,
46  lambda2=0,
47  waveFlags=None,
48  nonGRparams=None,
49  amplitudeO=0,
50  phaseO=0,
51  approximant=approximant)
52  h = numpy.array(hp.data.data, dtype=complex)
53  h += 1j * numpy.array(hc.data.data, dtype=complex)
54  try:
55  n = list(abs(h)).index(0)
56  except ValueError:
57  n = len(h)
58  return n * hp.deltaT
59 
60 
61 GMsun = 1.32712442099e20 # heliocentric gravitational constant, m^2 s^-2
62 G = 6.67384e-11 # Newtonian constant of gravitation, m^3 kg^-1 s^-2
63 c = 299792458 # speed of light in vacuum (exact), m s^-1
64 Msun = GMsun / G # solar mass, kg
65 
66 def velocity(f, M):
67  """
68  Finds the orbital "velocity" corresponding to a gravitational
69  wave frequency.
70  """
71  return (pi * G * M * f)**(1.0/3.0) / c
72 
73 def chirptime(f, M, nu, chi):
74  """
75  Over-estimates the chirp time in seconds from a certain frequency.
76  Uses 2 pN chirp time from some starting frequency f in Hz
77  where all negative contributions are dropped.
78  """
79  v = velocity(f, M)
80  tchirp = 1.0
81  tchirp += ((743.0/252.0) + (11.0/3.0)*nu) * v**2
82  tchirp += (226.0/15.0) * chi * v**3
83  tchirp += ((3058673.0/508032.0) + (5429.0/504.0)*nu + (617.0/72.0)*nu**2) * v**4
84  tchirp *= (5.0/(256.0*nu)) * (G*M/c**3) / v**8
85  return tchirp
86 
87 def ringf(M, j):
88  """
89  Computes the approximate ringdown frequency in Hz.
90  Here j is the reduced Kerr spin parameter, j = c^2 a / G M.
91  """
92  return (1.5251 - 1.1568 * (1 - j)**0.1292) * (c**3 / (2.0 * pi * G * M))
93 
94 def ringtime(M, j):
95  """
96  Computes the black hole ringdown time in seconds.
97  Here j is the reduced Kerr spin parameter, j = c^2 a / G M.
98  """
99  efolds = 11
100  # these are approximate expressions...
101  f = ringf(M, j)
102  Q = 0.700 + 1.4187 * (1 - j)**-0.4990
103  T = Q / (pi * f)
104  return efolds * T
105 
106 def mergetime(M):
107  """
108  Over-estimates the time from ISCO to merger in seconds.
109  Assumes one last orbit at the maximum ISCO radius.
110  """
111  # The maximum ISCO is for orbits about a Kerr hole with
112  # maximal counter rotation. This corresponds to a radius
113  # of 9GM/c^2 and a orbital speed of ~ c/3. Assume the plunge
114  # and merger takes one orbit from this point.
115  norbits = 1.0
116  v = c / 3.0
117  r = 9.0 * G * M / c**2
118  return norbits * (2.0 * pi * r / v)
119 
120 def overestimate_j_from_chi(chi):
121  """
122  Overestimate final black hole spin
123  """
124  return min(max(lalsim.SimIMREOBFinalMassSpin(1, 1, [0, 0, chi], [0, 0, chi], lalsim.GetApproximantFromString('SEOBNRv2'))[2], abs(chi)), 0.998)
125 
126 def imr_time(f, m1, m2, j1, j2, f_max = None):
127  """
128  Returns an overestimate of the inspiral time and the
129  merger-ringdown time, both in seconds. Here, m1 and m2
130  are the component masses in kg, j1 and j2 are the dimensionless
131  spin parameters of the components.
132  """
133 
134  if f_max is not None and f_max < f:
135  raise ValueError("f_max must either be None or greater than f")
136 
137  # compute total mass and symmetric mass ratio
138  M = m1 + m2
139  nu = m1 * m2 / M**2
140 
141  # compute spin parameters
142  #chi_s = 0.5 * (j1 + j2)
143  #chi_a = 0.5 * (j1 - j2)
144  #chi = (1.0 - (76.0/113.0)) * chi_s + ((m1 - m2) / M) * chi_a
145  # overestimate chi:
146  chi = max(j1, j2)
147 
148  j = overestimate_j_from_chi(chi)
149 
150  if f > ringf(M, j):
151  warnings.warn("f is greater than the ringdown frequency. This might not be what you intend to compute")
152 
153  if f_max is None or f_max > ringf(M, j):
154  return chirptime(f, M, nu, chi) + mergetime(M) + ringtime(M, j)
155  else:
156  # Always be conservative and allow a merger time to be added to
157  # the end in case your frequency is above the last stable orbit
158  # but below the ringdown.
159  return imr_time(f, m1, m2, j1, j2) - imr_time(f_max, m1, m2, j1, j2)