Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALInspiral 5.0.3.1-ea7c608
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
LALInspiralStationaryPhaseApprox1.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2007 B.S. Sathyaprakash, Thomas Cokelaer, Alexander Dietz
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 B.S. Sathyaprakash
22 * \file
23 * \ingroup LALInspiral_h
24 *
25 * \brief This module computes the stationary phase approximation to the
26 * Fourier transform of a chirp waveform by integrating \eqref{eq_InspiralFourierPhase}.
27 *
28 * ### Prototypes ###
29 *
30 * <tt>XLALInspiralStationaryPhaseApprox1()</tt>
31 * <ul>
32 * <li> \c signalvec: Output containing the inspiral waveform.
33 * </li><li> \c params: Input containing binary chirp parameters.
34 * </li></ul>
35 *
36 * ### Description ###
37 *
38 * This module generates the Fourier domain waveform that is analogous of
39 * the time-domain approximant <tt>TaylorT1.</tt> Instead of re-expanding the
40 * the energy and flux functions they are kept in tact and the integral
41 * in \eqref{eq_InspiralFourierPhase} is solved numerically.
42 * The code returns the Fourier transform packed in the same way as fftw
43 * would for the Fourier transform of a real vector. For a signal vector
44 * of length <tt>n=signalvec->length</tt> (\c n even):
45 * <ul>
46 * <li> <tt>signalvec->data[0]</tt> is the \e real 0th frequency component of the Fourier transform.
47 * </li><li> <tt>signalvec->data[n/2]</tt> is the \e real Nyquist frequency component of the Fourier transform.
48 * </li><li> <tt>signalvec->data[k]</tt> and <tt>signalvec->data[n-k],</tt> for <tt>k=1,..., n/2-1,</tt> are
49 * the real and imaginary parts of the Fourier transform at a frequency \f$k\Delta f=k/T,\f$ \f$T\f$ being
50 * the duration of the signal and \f$\Delta f=1/T\f$ is the frequency resolution.
51 * </li></ul>
52 *
53 * ### Algorithm ###
54 *
55 * The lal code \c XLALREAL8RombergIntegrate() is used to solve the
56 * integral in \eqref{eq_InspiralFourierPhase}.
57 * The reference points are chosen so that on inverse Fourier transforming
58 * the time-domain waveform will
59 * <ul>
60 * <li> be padded with zeroes in the first <tt>params->nStartPad</tt> bins,
61 * </li><li> begin with a phase shift of <tt>params->nStartPhase</tt> radians,
62 * </li><li> have an amplitude of \f$n v^2.\f$
63 * </li></ul>
64 *
65 * ### Uses ###
66 *
67 * \code
68 * XLALInspiralSetup()
69 * XLALInspiralChooseModel()
70 * XLALREAL8RombergIntegrate()
71 * \endcode
72 *
73 * ### Notes ###
74 *
75 * If it is required to compare the output of this module with a time domain
76 * signal one should use an inverse Fourier transform routine that packs data
77 * in the same way as fftw. Moreover, one should divide the resulting inverse
78 * Fourier transform by a factor \f$n/2\f$ to be consistent with the
79 * amplitude used in time-domain signal models.
80 *
81 */
82
83#include <math.h>
84#include <lal/LALInspiral.h>
85#include <lal/Integrate.h>
86
87#ifdef __GNUC__
88#define UNUSED __attribute__ ((unused))
89#else
90#define UNUSED
91#endif
92
93/* a local function to compute the phase of the Fourier transform */
96 REAL8 v,
97 void *param
98 );
99
100/* This is the main function to compute the stationary phase approximation */
101
102int
104 REAL4Vector *signalvec,
106 )
107{
108 REAL8 t, pimmc, f0, fn, f, v, df, shft, phi, amp0, amp, psif, psi, sign;
109 REAL8 xmin, xmax;
110 INT4 n, i, nby2;
111 void *funcParams;
112 REAL8 (*integratedfunction)(REAL8, void *);
113 IntegralType integrationtype;
114 TofVIntegrandIn psiIn;
115 TofVIn tofvin;
116 expnCoeffs ak;
117 expnFunc func;
118
119 /* Perform some initial checks */
120 if (signalvec == NULL)
122 if (signalvec->data == NULL)
124 if (params == NULL)
126
127 /* Set up the coefficients in post-Newtonian expansion, vlso, etc. */
130
131 /* Set up the functions required for the chosen signal
132 approximation scheme */
133 if ( XLALInspiralChooseModel(&func, &ak, params)
134 == XLAL_FAILURE )
136
137 /* Cast the struct required for the phase function */
138 psiIn.dEnergy = func.dEnergy;
139 psiIn.flux = func.flux;
140 psiIn.coeffs = &ak;
141
142 /* Cast the struct required for computing initial conditions */
143 n = signalvec->length;
144 nby2 = n/2;
145 df = params->tSampling/signalvec->length;
146 pimmc = LAL_PI * ak.totalmass;
147 t = 0.0;
148 tofvin.t = t;
149 tofvin.v0 = ak.v0;
150 tofvin.t0 = ak.t0;
151 tofvin.vlso = ak.vlsoT2;
152 tofvin.totalmass = ak.totalmass;
153 tofvin.dEnergy = func.dEnergy;
154 tofvin.flux = func.flux;
155 tofvin.coeffs = &ak;
156
157 /* Compute the initial velocity frequency */
158 v = XLALInspiralVelocity(&tofvin);
159 f0 = pow(v,3.L)/pimmc;
160 fn = (params->fCutoff < ak.fn) ? params->fCutoff : ak.fn;
161
162 /* If we want to pad with zeroes in the beginning then the instant of
163 * coalescence will be the chirp time + the duration for which padding
164 * is needed. Thus, in the equation below nStartPad occurs with a +ve sign.
165 */
166 shft = LAL_PI*2.L * (ak.tn + params->nStartPad/params->tSampling +
167 params->startTime);
168 phi = params->startPhase + LAL_PI/4.L;
169 amp0 = params->signalAmplitude * ak.totalmass * pow(LAL_PI/12.L, 0.5L) * df;
170
171 signalvec->data[0] = 0.;
172 signalvec->data[nby2] = 0.;
173
174 /*
175 Compute the standard stationary phase approximation.
176 */
177 funcParams = (void *) &psiIn;
178 integratedfunction = XLALPsiOfT;
179 integrationtype = ClosedInterval;
180 for (i=1; i<nby2; i++)
181 {
182 f = i * df;
183 if (f<f0 || f>fn)
184 {
185
186 /*
187 All frequency components below f0 and above fn are set to zero
188 */
189 signalvec->data[i] = 0.;
190 signalvec->data[n-i] = 0.;
191 }
192 else
193 {
194 ak.vf = v = pow(pimmc * f, (1./3.));
195 if (v==ak.v0)
196 {
197 psif = 0.;
198
199 }
200 else
201 {
202 if (ak.v0 > ak.vf)
203 {
204 xmin = ak.vf;
205 xmax = ak.v0;
206 sign = -1.0;
207 }
208 else
209 {
210 xmin = ak.v0;
211 xmax = ak.vf;
212 sign = 1.0;
213 }
214
215 psif = XLALREAL8RombergIntegrate(integratedfunction, funcParams, \
216 xmin, xmax, integrationtype);
217 if (XLAL_IS_REAL8_FAIL_NAN(psif))
219
220 psif *= sign;
221 }
222 psi = shft * f + phi + psif;
223
224 /*
225 dEnergybyFlux computes 1/(dv/dt) while what we need is 1/(dF/dt):
226 dF/dt=(dF/dv)(dv/dt)=-dEnergybyFlux/(dF/dv)=-dEnergybyFlux 3v^2/(LAL_PI m^2)
227 */
228 amp = amp0 * pow(-func.dEnergy(v,&ak)/func.flux(v,&ak),0.5) * v;
229 signalvec->data[i] = (REAL4) (amp * cos(psi));
230 signalvec->data[n-i] = -(REAL4) (amp * sin(psi));
231 }
232 }
233 params->fFinal = fn;
234
235 return XLAL_SUCCESS;
236}
237
238
239
240REAL8
242 REAL8 v,
243 void *param
244 )
245{
246 REAL8 vf, dE, F;
247 TofVIntegrandIn *par;
248
249 par = (TofVIntegrandIn *) param;
250
251 /* The integrand below has an overall -ve sign as compared to
252 * Eq. (3.5) of DIS3; this is because as oppsed to Eq. (3.5) of
253 * DIS3 here we integrate from v0 to vf instead of from vf to v0.
254 */
255 dE = par->dEnergy(v, par->coeffs);
256 F = par->flux(v, par->coeffs);
257 vf = par->coeffs->vf;
258 return 2. * (v*v*v - vf*vf*vf) * dE/F;
259}
int XLALInspiralSetup(expnCoeffs *ak, InspiralTemplate *params)
REAL8 XLALInspiralVelocity(TofVIn *params)
int XLALInspiralChooseModel(expnFunc *func, expnCoeffs *ak, InspiralTemplate *params)
int XLALInspiralStationaryPhaseApprox1(REAL4Vector *signalvec, InspiralTemplate *params)
REAL8 XLALPsiOfT(REAL8 v, void *param)
double i
IntegralType
REAL8 XLALREAL8RombergIntegrate(REAL8(*f)(REAL8 x, void *params), void *params, REAL8 xmin, REAL8 xmax, IntegralType type)
ClosedInterval
#define LAL_PI
double REAL8
int32_t INT4
float REAL4
#define XLAL_ERROR_REAL8(...)
#define XLAL_ERROR(...)
#define XLAL_IS_REAL8_FAIL_NAN(val)
XLAL_SUCCESS
XLAL_EFAULT
XLAL_EFUNC
XLAL_FAILURE
int n
The inspiral waveform parameter structure containing information about the waveform to be generated.
Definition: LALInspiral.h:205
REAL4 * data
REAL8 t0
Definition: LALInspiral.h:567
REAL8 v0
Definition: LALInspiral.h:566
REAL8 totalmass
Definition: LALInspiral.h:569
EnergyFunction dEnergy
expnCoeffsdEnergyFlux * coeffs
REAL8 t
Definition: LALInspiral.h:565
FluxFunction flux
REAL8 vlso
Definition: LALInspiral.h:568
EnergyFunction dEnergy
expnCoeffsdEnergyFlux * coeffs
FluxFunction flux
This structure contains various post-Newtonian and P-approximant expansion coefficients; the meanings...
Definition: LALInspiral.h:399
REAL8 totalmass
Definition: LALInspiral.h:474
REAL8 vlsoT2
Definition: LALInspiral.h:492
Structure to hold the pointers to the generic functions defined above.
Definition: LALInspiral.h:546
EnergyFunction * dEnergy
Definition: LALInspiral.h:547
FluxFunction * flux
Definition: LALInspiral.h:548
double df