LALPulsar  6.1.0.1-b72065a
GenerateSpinOrbitCW.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2007 Reinhard Prix, Teviet Creighton
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 #ifndef _GENERATESPINORBITCW_H
21 #define _GENERATESPINORBITCW_H
22 
23 #include <lal/LALStdlib.h>
24 #include <lal/PulsarSimulateCoherentGW.h>
25 #include <lal/SkyCoordinates.h>
26 
27 #if defined(__cplusplus)
28 extern "C" {
29 #elif 0
30 } /* so that editors will match preceding brace */
31 #endif
32 
33 /**
34  * \defgroup GenerateSpinOrbitCW_h Header GenerateSpinOrbitCW.h
35  * \ingroup lalpulsar_inject
36  * \author Creighton, T. D.
37  *
38  * \brief Provides routines to generate continuous waveforms with spindown and orbital modulation.
39  *
40  * ### Synopsis ###
41  *
42  * \code
43  * #include <lal/GenerateSpinOrbitCW.h>
44  * \endcode
45  *
46  * This header covers routines to generate continuous quasiperiodic
47  * waveforms with a smoothly-varying intrinsic frequency modulated by
48  * orbital motions around a binary companion. The intrinsic frequency is
49  * modeled by Taylor series coefficients as in \ref GenerateTaylorCW.h,
50  * and the orbital modulation is described by a reduced set of orbital
51  * parameters. Note that the routines do \e not account for spin
52  * precession, accretion processes, or other complicating factors; they
53  * simply Doppler-modulate a polynomial frequency function.
54  *
55  * The frequency and phase of the wave in the source's rest frame are
56  * given by \eqref{eq_taylorcw-freq} and \eqref{eq_taylorcw-phi} of
57  * \ref GenerateTaylorCW_h, where \f$ t \f$ is the proper time in this rest
58  * frame. The frequency and phase of the wave fronts crossing a
59  * reference point in an inertial frame (e.g.\ the Solar system
60  * barycentre) are simply \f$ f[t(t_r)] \f$ and \f$ \phi[t(t_r)] \f$ , where
61  * \f{equation}{
62  * \label{eq_spinorbit-tr}
63  * t_r = t + R(t)/c
64  * \f}
65  * is the (retarded) time measured at the inertial reference point a
66  * distance \f$ r \f$ from the source.
67  *
68  * The generation of the waveform thus consists of computing the radial
69  * component \f$ R(t) \f$ of the orbital motion of the source in the binary
70  * centre-of-mass frame, inverting \eqref{eq_spinorbit-tr} to find
71  * the "emission time" \f$ t \f$ for a given "detector time" \f$ t_r \f$ , and
72  * plugging this into the Taylor expansions to generate the instantaneous
73  * frequency and phase. The received frequency is also multiplied by the
74  * instantaneous Doppler shift \f$ [1+\dot{R}(t)/c]^{-1} \f$ at the time of
75  * emission.
76  *
77  * Since we do not include precession effects, the polarization state of
78  * the wave is constant: we simply specify the polarization amplitudes
79  * \f$ A_+ \f$ , \f$ A_\times \f$ and the polarization phase \f$ \psi \f$ based on the
80  * (constant) orientation of the source's \e rotation. The following
81  * discussion defines a set of parameters for the source's orbital
82  * \e revolution, which we regard as completely independent from its
83  * rotation.
84  *
85  * ### Orbital motion ###
86  *
87  * \anchor inject_binary
88  * \image html inject_binary.png "Binary orbit orientation parameters"
89  *
90  * \ref inject_binary "this figure" illustrates the notation conventions
91  * defining a binary orbit. We define a radial axis \f$ R \f$ directed
92  * \e from the observer (Earth) \e to the source, as shown. The
93  * horizontal plane is thus the plane of the sky, and the direction
94  * marked \f$ N \f$ is the direction along a meridian towards the North
95  * celestial pole. The tilted plane is the plane of the binary orbit,
96  * and the axis labeled \f$ z \f$ is the normal to this plane directed such
97  * that the orbit is right-handed about this axis. The <em>ascending
98  * node</em> of the orbit, denoted by ☊, is the direction
99  * defined by \f$ \hat{\mathbf{\mathit{R}}}\times\hat{\mathbf{\mathit{z}}} \f$ .
100  * The binary orbit itself is shown as an off-centred ellipse, with the
101  * barycentre at one of its foci; the wave-emitting source is also shown.
102  *
103  * The <em>inclination angle</em> \f$ i \f$ is the angle between the sky and
104  * orbital planes. The <em>longitude of the ascending node</em> \f$ \Omega \f$
105  * is the angle in the plane of the sky from the North direction to the
106  * ascending node, measured right-handed about
107  * \f$ \hat{\mathbf{\mathit{R}}} \f$ . The <em>argument of the periapsis</em>
108  * \f$ \omega \f$ is the angle in the orbital plane from the ascending node to
109  * the direction of periapsis (point where the source is closest to the
110  * system barycentre), and the <em>true anomaly</em> \f$ \upsilon(t) \f$ of the
111  * source is the angle from the periapsis to the current location of the
112  * source; both angles are measured right-handed about
113  * \f$ \hat{\mathbf{\mathit{z}}} \f$ (i.e.\ prograde). The <em>periapsis
114  * separation</em> \f$ r_p \f$ is the distance from the periapsis to the
115  * barycentre, and we denote the \e eccentricity of the orbital
116  * ellipse as \f$ e \f$ , so that the separation between the source and the
117  * barycentre at any time is \f$ r=r_p(1+e)/(1+e\cos\upsilon) \f$ .
118  *
119  * In this convention, \f$ i\in[0,\pi] \f$ and \f$ \Omega\in[0,2\pi) \f$ . Another
120  * convention common in astronomy is to restrict \f$ \Omega \f$ to the range
121  * \f$ [0,\pi) \f$ , refering to whichever node (ascending or descending) lies
122  * in this range. The argument of the periapsis \f$ \omega \f$ is then also
123  * measured from this node. In this case the range of \f$ i \f$ must be
124  * extended to \f$ (-\pi,\pi] \f$ ; it is negative if the reference node is
125  * descending, and positive if it is ascending. The formulae that follow
126  * are the same in either convention, though, since one can verify that
127  * adding \f$ \pi \f$ to \f$ \Omega \f$ and \f$ \omega \f$ is equivalent to reversing the
128  * sign on \f$ i \f$ .
129  *
130  * Some spherical trigonometry gives us \f$ R=r\sin(\omega+\upsilon)\sin i \f$ .
131  * We can differentiate \f$ R \f$ with respect to \f$ t \f$ , and apply Keplers
132  * second law
133  * \f$ r^2\dot{\upsilon}=r_p^2\dot{\upsilon}_p=\mathrm{constant} \f$ , where
134  * \f$ \dot{\upsilon}_p \f$ is the angular speed at periapsis, to get:
135  * \f{eqnarray}{
136  * \label{eq_orbit-r}
137  * R & = & R_0 + \frac{(1+e) r_p\sin i}{1+e\cos\upsilon}
138  * \sin(\omega+\upsilon) \;,\\
139  * \label{eq_orbit-rdot}
140  * \dot{R} & = & \dot{R}_0 + \frac{\dot{\upsilon}_p r_p\sin i}{1+e}
141  * \left[ \cos(\omega+\upsilon) + e\cos\omega \right] \;.
142  * \f}
143  * Without loss of generality, we will henceforth drop the offsets \f$ R_0 \f$
144  * and (constant) \f$ \dot{R}_0 \f$ from these equations. This means that we
145  * ignore the overall propagation delay between the \f$ R=R_0 \f$ plane and the
146  * observer, and incorporate any (constant) Doppler shifts due to net
147  * centre-of-mass motions into the values of \f$ f \f$ and \f$ \dot{\upsilon}_p \f$ .
148  * The resulting times and parameter values are referred to as being in
149  * the \e barycentric frame. The only time delays and Doppler shifts
150  * that we explicitly treat are those arising from the motion of the
151  * source relative to the \f$ R=R_0 \f$ sky plane passing through the system
152  * barycentre.
153  *
154  * All we need now to determine the orbital motion is an equation for
155  * \f$ \upsilon(t) \f$ . Many basic astronomy textbooks give exact but
156  * transcendental expressions relating \f$ \upsilon \f$ and \f$ t \f$ for elliptical
157  * orbits with \f$ 0\leq e<1 \f$ , and/or series expansions of \f$ \upsilon(t) \f$ for
158  * \f$ e\ll1 \f$ . However, for a generic binary system we cannot guarantee
159  * that \f$ e\ll1 \f$ , and for now we would like to retain the possibility of
160  * modeling open orbits with \f$ e\geq1 \f$ . For now we will simply present
161  * the exact formulae, and discuss the numerical solution methods in the
162  * modules under this header.
163  *
164  * Let \f$ t_p \f$ be the time of a periapsis passage (preferably a recent one
165  * in the case of closed orbits). We express both \f$ t \f$ and \f$ \upsilon \f$ in
166  * terms of an intermediate variable \f$ E \f$ (called the <em>eccentric
167  * anomaly</em> for elliptic orbits, unnamed for open orbits). The formulae
168  * are:
169  * \f{equation}{
170  * \label{eq_spinorbit-t}
171  * t - t_p = \left\{ \begin{array}{l@{\qquad}c}
172  * \frac{1}{\dot{\upsilon}_p} \sqrt{\frac{1+e}{(1-e)^3}}
173  * \left( E - e\sin E \right) & 0 \leq e < 1 \\ & \\
174  * \frac{1}{\dot{\upsilon}_p} E
175  * \left( 1 + \frac{E^2}{12} \right) & e = 1 \\ & \\
176  * \frac{1}{\dot{\upsilon}_p} \sqrt{\frac{e+1}{(e-1)^3}}
177  * \left( e\sinh E - E \right) & e > 1
178  * \end{array} \right.
179  * \f}
180  * \f{equation}{
181  * \label{eq_spinorbit-upsilon}
182  * \begin{array}{c} \tan\left(\frac{\upsilon}{2}\right) \end{array}
183  * = \left\{ \begin{array}{l@{\qquad}c}
184  * \sqrt{\frac{1+e}{1-e}}\tan\left(\frac{E}{2}\right)
185  * & 0 \leq e < 1 \\ & \\
186  * \frac{E}{2} & e = 1 \\ & \\
187  * \sqrt{\frac{e+1}{e-1}}\tanh\left(\frac{E}{2}\right) & e > 1
188  * \end{array} \right.
189  * \f}
190  *
191  * Thus to solve for \f$ \upsilon(t) \f$ one typically inverts the equation for
192  * \f$ t-t_p \f$ numerically or by series expansion, finds the corresponding
193  * \f$ E \f$ , and then plugs this into the expression for \f$ \upsilon \f$ . However,
194  * in our case we would then need to do another numerical inversion to
195  * find the retarded time \f$ t_r \f$ from \eqref{eq_spinorbit-tr}. A more
196  * efficient approach is thus to take an initial guess for \f$ E \f$ , compute
197  * both \f$ t \f$ , \f$ \upsilon \f$ , and hence \f$ t_r \f$ , and then refine directly on
198  * \f$ E \f$ .
199  *
200  * ### Other notation conventions ###
201  *
202  * Since we may deal with highly eccentric or open orbits, we will
203  * specify these orbits with parameters that are definable for all
204  * classes of orbit. Thus we specify the size of the orbit with the
205  * periapsis separation \f$ r_p \f$ rather than the semimajor axis \f$ a \f$ , and the
206  * speed of the orbit with the angular speed at periapsis
207  * \f$ \dot{\upsilon}_p \f$ rather than with the period \f$ P \f$ . These parameters
208  * are related by:
209  * \f{eqnarray}{
210  * \label{eq_spinorbit-a}
211  * a & = & \frac{r_p}{1-e} \;,\\
212  * \label{eq_spinorbit-p}
213  * P & = & \frac{2\pi}{\dot{\upsilon}_p} \sqrt{\frac{1+e}{(1-e)^3}} \;.
214  * \f}
215  * Furthermore, for improved numerical precision when dealing with
216  * near-parabolic orbits, we specify the value of \f$ 1-e \f$ rather than the
217  * value of \f$ e \f$ . We note that \f$ 1-e \f$ has a maximum value of \f$ 1 \f$ for a
218  * circular orbit, positive for closed elliptical orbits, zero for
219  * parabolic orbits, and negative (unbounded) for hyperbolic orbits.
220  */
221 /** @{ */
222 
223 /** \name Error Codes */
224 /** @{ */
225 #define GENERATESPINORBITCWH_ENUL 1 /**< Unexpected null pointer in arguments */
226 #define GENERATESPINORBITCWH_EOUT 2 /**< Output field a, f, phi, or shift already exists */
227 #define GENERATESPINORBITCWH_EMEM 3 /**< Out of memory */
228 #define GENERATESPINORBITCWH_EECC 4 /**< Eccentricity out of range */
229 #define GENERATESPINORBITCWH_EFTL 5 /**< Periapsis motion is faster than light */
230 #define GENERATESPINORBITCWH_ESGN 6 /**< Sign error: positive parameter expected */
231 /** @} */
232 
233 /** \cond DONT_DOXYGEN */
234 #define GENERATESPINORBITCWH_MSGENUL "Unexpected null pointer in arguments"
235 #define GENERATESPINORBITCWH_MSGEOUT "Output field a, f, phi, or shift already exists"
236 #define GENERATESPINORBITCWH_MSGEMEM "Out of memory"
237 #define GENERATESPINORBITCWH_MSGEECC "Eccentricity out of range"
238 #define GENERATESPINORBITCWH_MSGEFTL "Periapsis motion is faster than light"
239 #define GENERATESPINORBITCWH_MSGESGN "Sign error: positive parameter expected"
240 /** \endcond */
241 
242 /**
243  * This structure stores the parameters for constructing a gravitational
244  * waveform with both a Taylor-polynomial intrinsic frequency and phase,
245  * and a binary-orbit modulation. As with the \c PPNParamStruc type
246  * in \c GeneratePPNInspiral_h, we divide the fields into passed
247  * fields (which are supplied to the final PulsarCoherentGW structure
248  * but not used in any calculations), input fields (that are used by the
249  * waveform generator), and output fields (that are set by the waveform
250  * generator).
251  */
252 typedef struct tagSpinOrbitCWParamStruc {
253  /** \name Passed parameters. */
254  /** @{ */
255  SkyPosition position; /**< The location of the source on the sky, normally in equatorial coordinates */
256  REAL4 psi; /**< The polarization angle of the source, in radians */
257  /** @} */
258 
259  /** \name Input parameters. */
260  /** @{ */
261  LIGOTimeGPS epoch; /**< The start time of the output series */
262  LIGOTimeGPS spinEpoch; /**< A reference time \f$ t_\mathrm{ref} \f$ (in the barycentric frame) at which the rotational properties of the source are specified */
263  LIGOTimeGPS orbitEpoch; /**< A time \f$ t_\mathrm{peri} \f$ (in the barycentric frame) at which the source passes through periapsis.
264  * Note that this is the proper or "true" time of passage; the \e observed periapsis passage occurs at
265  * time \f$ t_\mathrm{peri}+r(t_\mathrm{peri})/c \f$ */
266  REAL8 deltaT; /**< The requested sampling interval of the waveform, in s */
267  UINT4 length; /**< The number of samples in the generated waveform */
268  REAL4 aPlus, aCross; /**< The polarization amplitudes \f$ A_+ \f$ , \f$ A_\times \f$ , in dimensionless strain units */
269  REAL8 phi0; /**< The phase of the wave emitted at time \f$ t_\mathrm{ref} \f$ , in radians */
270  REAL8 f0; /**< The frequency of the wave emitted at time \f$ t_\mathrm{ref} \f$ (and incorporating any Doppler shift due to \f$ \dot{R}_0 \f$ ), in Hz */
271  REAL8Vector *f; /**< The spin-normalized Taylor parameters \f$ f_k \f$ , as defined in \eqref{eq_taylorcw-freq} of \ref GenerateTaylorCW_h.
272  * If \c f=\c NULL, the (proper) spin of the source is assumed to be constant */
273  REAL8 omega; /**< The argument of the periapsis, \f$ \omega \f$ , in radians */
274  REAL8 rPeriNorm; /**< The projected, speed-of-light-normalized periapsis separation of the orbit, \f$ (r_p/c)\sin i \f$ , in s */
275  REAL8 oneMinusEcc; /**< The value of \f$ 1-e \f$ */
276  REAL8 angularSpeed; /**< The angular speed at periapsis, \f$ \dot{\upsilon}_p \f$ , in Hz */
277  /** @} */
278 
279  /** \name Output parameters. */
280  /** @{ */
281  REAL4 dfdt; /**< The maximum value of \f$ \Delta f\Delta t \f$ encountered over any timestep \f$ \Delta t \f$ used in generating the waveform */
282  /** @} */
284 
285 
286 /* ---------- Function prototypes. ---------- */
287 int XLALGenerateSpinOrbitCW( PulsarCoherentGW *sourceSignal, SpinOrbitCWParamStruc *sourceParams );
288 
289 void
293 
294 void
298 
299 void
303 
304 void
308 
309 /** @} */
310 
311 #if 0
312 {
313  /* so that editors will match succeeding brace */
314 #elif defined(__cplusplus)
315 }
316 #endif
317 
318 #endif /* _GENERATESPINORBITCW_H */
void LALGenerateHyperbolicSpinOrbitCW(LALStatus *, PulsarCoherentGW *output, SpinOrbitCWParamStruc *params)
Computes a continuous waveform with frequency drift and Doppler modulation from a hyperbolic orbital ...
void LALGenerateEllipticSpinOrbitCW(LALStatus *, PulsarCoherentGW *output, SpinOrbitCWParamStruc *params)
Computes a continuous waveform with frequency drift and Doppler modulation from an elliptical orbital...
void LALGenerateSpinOrbitCW(LALStatus *, PulsarCoherentGW *output, SpinOrbitCWParamStruc *params)
Computes a spindown- and Doppler-modulated continuous waveform.
void LALGenerateParabolicSpinOrbitCW(LALStatus *, PulsarCoherentGW *output, SpinOrbitCWParamStruc *params)
Computes a continuous waveform with frequency drift and Doppler modulation from a parabolic orbital t...
int XLALGenerateSpinOrbitCW(PulsarCoherentGW *sourceSignal, SpinOrbitCWParamStruc *sourceParams)
FIXME: Temporary XLAL-wapper to LAL-function LALGenerateSpinOrbitCW()
double REAL8
uint32_t UINT4
float REAL4
This structure stores a representation of a plane gravitational wave propagating from a particular po...
This structure stores the parameters for constructing a gravitational waveform with both a Taylor-pol...
LIGOTimeGPS spinEpoch
A reference time (in the barycentric frame) at which the rotational properties of the source are spe...
UINT4 length
The number of samples in the generated waveform.
LIGOTimeGPS orbitEpoch
A time (in the barycentric frame) at which the source passes through periapsis.
REAL8 oneMinusEcc
The value of .
REAL8 deltaT
The requested sampling interval of the waveform, in s.
REAL8 phi0
The phase of the wave emitted at time , in radians.
REAL8Vector * f
The spin-normalized Taylor parameters , as defined in Eq.
SkyPosition position
The location of the source on the sky, normally in equatorial coordinates.
REAL8 angularSpeed
The angular speed at periapsis, , in Hz.
REAL8 omega
The argument of the periapsis, , in radians.
REAL8 rPeriNorm
The projected, speed-of-light-normalized periapsis separation of the orbit, , in s.
REAL4 dfdt
The maximum value of encountered over any timestep used in generating the waveform.
REAL4 aCross
The polarization amplitudes , , in dimensionless strain units.
REAL4 psi
The polarization angle of the source, in radians.
REAL8 f0
The frequency of the wave emitted at time (and incorporating any Doppler shift due to ),...
LIGOTimeGPS epoch
The start time of the output series.