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
LALInspiralTaylorNWaveform.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2008 B.S. Sathyaprakash, Bala R. Iyer, Drew Keppel
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 Sathyaprakash, B. S., Cokelaer T.
22 * \file
23 * \ingroup LALInspiral_h
24 *
25 * \brief NONE
26 *
27 */
28/*-------------------------------------------------------------------*/
29#include <math.h>
30#include <lal/LALInspiral.h>
31#include <lal/SeqFactories.h>
32#include <lal/FindRoot.h>
33#include <lal/LALConstants.h>
34
35#ifdef __GNUC__
36#define UNUSED __attribute__ ((unused))
37#else
38#define UNUSED
39#endif
40
41typedef struct tagxiInitIn {
42 REAL8 eta, omega, e0;
43} xiInitIn;
44
45static REAL8 XLALxiInit4PN(
46 REAL8 xi,
47 void *params);
48
49
50static REAL8 XLALxiInit5PN(
51 REAL8 xi,
52 void *params);
53
54
55static REAL8 XLALxiInit6PN(
56 REAL8 xi,
57 void *params);
58
59
60static REAL8 XLALxiInit7PN(
61 REAL8 xi,
62 void *params);
63
64
66 REAL8Vector *values,
67 REAL8Vector *dvalues,
68 void *funcParams
69);
70
72 REAL8Vector *values,
73 REAL8Vector *dvalues,
74 void *funcParams
75);
76
78 REAL8Vector *values,
79 REAL8Vector *dvalues,
80 void *funcParams
81);
82
84 REAL8Vector *values,
85 REAL8Vector *dvalues,
86 void *funcParams
87);
88
89int
91 REAL4Vector *output1,
92 REAL4Vector *output2,
94 InspiralInit *paramsInit
95);
96
98 REAL8 xi,
99 void *params)
100{
101 /* The variable xi=GMn/c^3, where omega = n (1 + k) */
102 xiInitIn *in;
103 REAL8 xi43, xi23, eta, x;
104
105 in = (xiInitIn *) params;
106 eta = in->eta;
107 xi23 = pow(xi, 2./3.);
108 xi43 = pow(xi, 4./3.);
109
110 x = xi * ( 1. + 3. * xi23 + (39./2. - 7*eta) * xi43 );
111 x -= in->omega;
112
113 return x;
114}
115
117 REAL8 xi,
118 void *params)
119{
120 /* The variable xi=GMn/c^3, where omega = n (1 + k) */
121 xiInitIn *in;
122 REAL8 xi43, xi23, eta, x;
123
124 in = (xiInitIn *) params;
125 eta = in->eta;
126 xi23 = pow(xi, 2./3.);
127 xi43 = pow(xi, 4./3.);
128
129 x = xi * ( 1. + 3. * xi23 + (39./2. - 7*eta) * xi43 );
130 x -= in->omega;
131
132 return x;
133}
134
136 REAL8 xi,
137 void *params)
138{
139 /* The variable xi=GMn/c^3, where omega = n (1 + k) */
140 xiInitIn *in;
141 REAL8 xi2, xi43, xi23, eta, eta2, pisq, x;
142
143 in = (xiInitIn *) params;
144 eta = in->eta;
145 eta2 = eta*eta;
146 xi2 = xi*xi;
147 xi23 = pow(xi, 2./3.);
148 xi43 = pow(xi, 4./3.);
149 pisq = LAL_PI*LAL_PI;
150
151 x = xi * ( 1. + 3. * xi23 + (39./2. - 7*eta) * xi43
152 + (315./2. + (-817./4. + 123./32.*pisq) * eta + 7*eta2) * xi2);
153 x -= in->omega;
154
155 return x;
156}
157
159 REAL8 xi,
160 void *params)
161{
162 /* The variable xi=GMn/c^3, where omega = n (1 + k) */
163 xiInitIn *in;
164 REAL8 xi2, xi43, xi23, eta, eta2, pisq, x;
165
166 in = (xiInitIn *) params;
167 eta = in->eta;
168 eta2 = eta*eta;
169 xi2 = xi*xi;
170 xi23 = pow(xi, 2./3.);
171 xi43 = pow(xi, 4./3.);
172 pisq = LAL_PI*LAL_PI;
173
174 x = xi * ( 1. + 3. * xi23 + (39./2. - 7*eta) * xi43
175 + (315./2. + (-817./4. + 123./32.*pisq) * eta + 7*eta2) * xi2);
176 x -= in->omega;
177
178 return x;
179}
180
181
183 REAL8Vector *values,
184 REAL8Vector *dvalues,
185 void *funcParams
186)
187{
188 /* The variable xi=GMn/c^3, where omega = n (1 + k) */
190 REAL8 xi, xi23, xi43, xi113, eta, eta2;
191
192 ak = (InspiralDerivativesIn *) funcParams;
193 eta = ak->coeffs->eta;
194
195 xi = values->data[1];
196 eta2 = eta * eta;
197 xi23 = pow(xi, 2./3.);
198 xi43 = pow(xi, 4./3.);
199 xi113 = pow(xi, 11./3.);
200
201 dvalues->data[0] = xi * ( 1. + 3. * xi23 + (39./2. - 7*eta) * xi43);
202
203 dvalues->data[1] = 96./5.*eta*xi113*(1. + (1273./336. - 11./4.*eta) * xi23
204 + 4.*LAL_PI*xi + (438887./18144. - 49507./2016.*eta + 59./18.*eta2)*xi43);
205}
206
208 REAL8Vector *values,
209 REAL8Vector *dvalues,
210 void *funcParams
211)
212{
213 /* The variable xi=GMn/c^3, where omega = n (1 + k) */
215 REAL8 xi, xi23, xi43, xi53, xi113, eta, eta2;
216
217 ak = (InspiralDerivativesIn *) funcParams;
218 eta = ak->coeffs->eta;
219
220 xi = values->data[1];
221 eta2 = eta * eta;
222 xi23 = pow(xi, 2./3.);
223 xi43 = pow(xi, 4./3.);
224 xi53 = pow(xi, 5./3.);
225 xi113 = pow(xi, 11./3.);
226
227 dvalues->data[0] = xi * ( 1. + 3. * xi23 + (39./2. - 7*eta) * xi43);
228 dvalues->data[1] = 96./5.*eta*xi113*(1. + (1273./336. - 11./4.*eta) * xi23
229 + 4.*LAL_PI*xi + (438887./18144. - 49507./2016.*eta + 59./18.*eta2)*xi43
230 + (20033./672. - 189./8.*eta) * LAL_PI * xi53);
231}
232
234 REAL8Vector *values,
235 REAL8Vector *dvalues,
236 void *funcParams
237)
238{
239 /* The variable xi=GMn/c^3, where omega = n (1 + k) */
241 REAL8 xi, xi2, xi13, xi23, xi43, xi53, xi113, eta, eta2, eta3, pisq;
242
243 ak = (InspiralDerivativesIn *) funcParams;
244 eta = ak->coeffs->eta;
245
246 xi = values->data[1];
247 eta2 = eta * eta;
248 eta3 = eta2 * eta;
249 xi2 = xi*xi;
250 xi13 = pow(xi, 1./3.);
251 xi23 = pow(xi, 2./3.);
252 xi43 = pow(xi, 4./3.);
253 xi53 = pow(xi, 5./3.);
254 xi113 = pow(xi, 11./3.);
255 pisq = LAL_PI*LAL_PI;
256
257 dvalues->data[0] = xi * ( 1. + 3. * xi23 + (39./2. - 7*eta) * xi43
258 + (315./2. + (-817./4. + 123./32.*pisq) * eta + 7*eta2) * xi2);
259
260 dvalues->data[1] = 96./5.*eta*xi113*(1. + (1273./336. - 11./4.*eta) * xi23
261 + 4.*LAL_PI*xi + (438887./18144. - 49507./2016.*eta + 59./18.*eta2)*xi43
262 + (20033./672. - 189./8.*eta) * LAL_PI * xi53 + (38047038863./139708800.
263 + (16./3. + 287./24. * eta)*pisq - 16554367./31104.*eta
264 + 617285./8064.*eta2 - 5605./2592.*eta3 - 1712./105.*(LAL_GAMMA + log(4*xi13)))*xi2);
265}
266
268 REAL8Vector *values,
269 REAL8Vector *dvalues,
270 void *funcParams
271)
272{
273 /* The variable xi=GMn/c^3, where omega = n (1 + k) */
275 REAL8 xi, xi2, xi13, xi23, xi43, xi53, xi73, xi113, eta, eta2, eta3, pisq;
276
277 ak = (InspiralDerivativesIn *) funcParams;
278 eta = ak->coeffs->eta;
279
280 xi = values->data[1];
281 eta2 = eta * eta;
282 eta3 = eta2 * eta;
283 xi2 = xi*xi;
284 xi13 = pow(xi, 1./3.);
285 xi23 = pow(xi, 2./3.);
286 xi43 = pow(xi, 4./3.);
287 xi53 = pow(xi, 5./3.);
288 xi73 = pow(xi, 7./3.);
289 xi113 = pow(xi, 11./3.);
290 pisq = LAL_PI*LAL_PI;
291
292 dvalues->data[0] = xi * ( 1. + 3. * xi23 + (39./2. - 7*eta) * xi43
293 + (315./2. + (-817./4. + 123./32.*pisq) * eta + 7*eta2) * xi2);
294
295 dvalues->data[1] = 96./5.*eta*xi113*(1. + (1273./336. - 11./4.*eta) * xi23
296 + 4.*LAL_PI*xi + (438887./18144. - 49507./2016.*eta + 59./18.*eta2)*xi43
297 + (20033./672. - 189./8.*eta) * LAL_PI * xi53 + (38047038863./139708800.
298 + (16./3. + 287./24. * eta)*pisq - 16554367./31104.*eta
299 + 617285./8064.*eta2 - 5605./2592.*eta3 - 1712./105.*(LAL_GAMMA + log(4*xi13)))*xi2
300 + (971011./4032. - 1608185./6048.*eta + 91495./1512.*eta2)*LAL_PI*xi73);
301}
302
305 REAL4Vector *signalvec,
307 )
308{
309 XLAL_PRINT_DEPRECATION_WARNING("XLALTaylorNWaveform");
312
313 if (XLALTaylorNWaveform(signalvec, params))
315
317 RETURN(status);
318}
319
321 REAL4Vector *output,
323 )
324{
325 INT4 count;
326 InspiralInit paramsInit;
327
328 if (output == NULL)
330 if (output->data == NULL)
332 if (params == NULL)
334 if (params->nStartPad < 0)
336 if (params->fLower <= 0)
338 if (params->tSampling <= 0)
340
341 if (XLALInspiralInit(params, &paramsInit))
343
344 if (params->totalMass <= 0.)
346 if (params->eta < 0.)
348
349 memset( output->data, 0, output->length * sizeof(REAL4) );
350
351 /* Call the engine function */
352 count = XLALTaylorNWaveformEngine(output, NULL, params, &paramsInit);
353 if (count < 0)
355
356 return XLAL_SUCCESS;
357}
358
359/*---------------------------------------------------------*/
360int
362 REAL4Vector *output1,
363 REAL4Vector *output2,
365 InspiralInit *paramsInit
366 )
367{
368
369 void *funcParams;
370 UINT4 length=0, count, ndx;
371 INT4 nn=2;
372 /* The variable xi=GMn/c^3, where omega = n (1 + k) */
373 REAL8 h, omega, omegaMax, t, dt, m, eta, phi, xi, v, xmax, xmin, xacc;
374 REAL8Vector dummy, values, dvalues, newvalues, yt, dym, dyt;
375 rk4GSLIntegrator *integrator = NULL;
377 xiInitIn in3;
378 rk4In in4;
379 expnCoeffs ak;
380 expnFunc func;
381 REAL8 (*rootfunction)(REAL8, void *);
382 CHAR message[256];
383
384
385/* Allocate all the memory required to dummy and then point the various
386 arrays to dummy - this makes it easier to handle memory failures */
387
388 dummy.length = nn * 6;
389
390 if (!(dummy.data = (REAL8 * ) XLALMalloc(sizeof(REAL8) * nn * 6)))
392
393 values.length = nn;
394 dvalues.length = nn;
395 newvalues.length = nn;
396 yt.length = nn;
397 dym.length = nn;
398 dyt.length = nn;
399
400 values.data = &dummy.data[0];
401 dvalues.data = &dummy.data[nn];
402 newvalues.data = &dummy.data[2*nn];
403 yt.data = &dummy.data[3*nn];
404 dym.data = &dummy.data[4*nn];
405 dyt.data = &dummy.data[5*nn];
406
407
408 /* Set dt to sampling interval specified by user */
409
410 dt = 1./params->tSampling;
411 ak = paramsInit->ak;
412 func = paramsInit->func;
413 length = output1->length;
414 eta = ak.eta;
415 m = ak.totalmass;
416
417 /* Begin initial conditions */
418 /* Given omega compute xi by solving Eq.(18b) of TG08 */
419 omega = LAL_PI * params->fLower * m;
420 xacc = 1.0e-16;
421 xmax = 2.*omega;
422 xmin = omega/2.;
423 switch (params->order)
424 {
425 case LAL_PNORDER_TWO:
426 rootfunction = &XLALxiInit4PN;
427 break;
429 rootfunction = &XLALxiInit5PN;
430 break;
432 rootfunction = &XLALxiInit6PN;
433 break;
435 rootfunction = &XLALxiInit7PN;
436 break;
437 default:
438 snprintf(message, 256, "There are no Et waveforms at order %d\n", params->order);
439 XLALPrintError( "%s", message );
440 XLALFree(dummy.data);
442 break;
443 }
444 in3.eta = ak.eta;
445 in3.omega = omega;
446 funcParams = (void *) &in3;
447
448
449 xi = XLALDBisectionFindRoot(rootfunction, xmin, xmax, xacc, funcParams);
452
453 /* End of initial conditions */
454
455 values.data[0] = phi = params->startPhase;
456 values.data[1] = xi;
457
458 /* fprintf(stdout, "Initial phi=%e, xi=%e\n", values.data[0], values.data[1]); */
459 t = 0.0;
460
461 /* Initialize the GSL integrator */
462 switch (params->order)
463 {
464 case LAL_PNORDER_TWO:
466 break;
469 break;
472 break;
475 break;
476 default:
477 snprintf(message, 256, "There are no Et waveforms at order %d\n", params->order);
478 XLALPrintError( "%s", message );
479 XLALFree(dummy.data);
481 break;
482 }
483 in4.y = &values;
484 in4.h = dt/m;
485 in4.n = nn;
486 in4.yt = &yt;
487 in4.dym = &dym;
488 in4.dyt = &dyt;
489 in4.x = 0.;
490
491 if (!(integrator = XLALRungeKutta4Init(nn, &in4)))
492 {
493 XLALFree(dummy.data);
495 }
496
497 in2.totalmass = ak.totalmass;
498 in2.dEnergy = func.dEnergy;
499 in2.flux = func.flux;
500 in2.coeffs = &ak;
501 funcParams = (void *) &in2;
502 /* Calculate the initial value of omega */
503 in4.function(&values, &dvalues, funcParams);
504
505 /* Begin integration loop here */
506
507 omegaMax = 1./pow(6.,1.5);
508 t = 0.0;
509 ndx = 0;
510 count = 0;
511
512 /* fprintf(stdout, "fMin=%e, fMax=%e, f=%e, dxi/dt=%e\n", */
513 /* omega/(m*LAL_PI), omegaMax/(m*LAL_PI), */
514 /* dvalues.data[0]/(m*LAL_PI), dvalues.data[1]); */
515
516 while (omega<omegaMax)
517 {
518 if (count > length)
519 {
520 XLALRungeKutta4Free( integrator );
521 XLALFree(dummy.data);
523 }
524
525 h = 4 * m * eta * xi * sin(2.*phi)/1.e14;
526 output1->data[ndx] = h;
527 if (output2)
528 {
529 h = 4 * m * eta * xi * cos(2.*phi)/1.e14;
530 output2->data[ndx] = h;
531 }
532 /* fprintf(stdout, "%e %e %e\n", t, h, omega/(m*LAL_PI)); */
533
534 /* Integrate one step forward */
535 in4.dydx = &dvalues;
536 in4.x = t/m;
537 if (XLALRungeKutta4(&newvalues, integrator, funcParams))
538 {
539 XLALRungeKutta4Free( integrator );
540 XLALFree(dummy.data);
542 }
543
544 /* Update the values of the dynamical variables */
545 phi = values.data[0] = newvalues.data[0];
546 xi = values.data[1] = newvalues.data[1];
547 /* fprintf(stdout, "phi=%e, xi=%e, omega=%e, dxi/dt=%e\n", */
548 /* phi, xi, omega/(m*LAL_PI), dvalues.data[1]); */
549
550 /* Compute the derivaties at the new location */
551 in4.function(&values, &dvalues, funcParams);
552 omega = dvalues.data[0];
553
554 t = (++count-params->nStartPad) * dt;
555 ndx++;
556 }
557
558 /*----------------------------------------------------------------------*/
559 /* Record the final cutoff frequency of BD Waveforms for record keeping */
560 /* ---------------------------------------------------------------------*/
561 v = pow(omega, 1./3.);
562 params->vFinal = v;
563 params->tC = t;
564 params->fFinal = omega/(LAL_PI*m);
565 /* fprintf(stdout, "Final velocity=%e, time=%e, frequency=%e\n", v, t, params->fFinal); */
566
567 XLALRungeKutta4Free( integrator );
568 XLALFree(dummy.data);
569
570 return count;
571}
572/*---------------------------------------------------------*/
void XLALRungeKutta4Free(rk4GSLIntegrator *integrator)
int XLALInspiralInit(InspiralTemplate *params, InspiralInit *paramsInit)
rk4GSLIntegrator * XLALRungeKutta4Init(INT4 n, rk4In *input)
int XLALRungeKutta4(REAL8Vector *yout, rk4GSLIntegrator *integrator, void *params)
void XLALTaylorNDerivatives7PN(REAL8Vector *values, REAL8Vector *dvalues, void *funcParams)
static REAL8 XLALxiInit4PN(REAL8 xi, void *params)
static REAL8 XLALxiInit6PN(REAL8 xi, void *params)
int XLALTaylorNWaveform(REAL4Vector *output, InspiralTemplate *params)
static REAL8 XLALxiInit7PN(REAL8 xi, void *params)
void LALTaylorNWaveform(LALStatus *status, REAL4Vector *signalvec, InspiralTemplate *params)
void XLALTaylorNDerivatives5PN(REAL8Vector *values, REAL8Vector *dvalues, void *funcParams)
void XLALTaylorNDerivatives6PN(REAL8Vector *values, REAL8Vector *dvalues, void *funcParams)
static REAL8 XLALxiInit5PN(REAL8 xi, void *params)
void XLALTaylorNDerivatives4PN(REAL8Vector *values, REAL8Vector *dvalues, void *funcParams)
int XLALTaylorNWaveformEngine(REAL4Vector *output1, REAL4Vector *output2, InspiralTemplate *params, InspiralInit *paramsInit)
#define ATTATCHSTATUSPTR(statusptr)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
#define ABORTXLAL(sp)
const double xi2
REAL8 XLALDBisectionFindRoot(REAL8(*y)(REAL8, void *), REAL8 xmin, REAL8 xmax, REAL8 xacc, void *params)
#define LAL_PI
#define LAL_GAMMA
double REAL8
char CHAR
uint32_t UINT4
int32_t INT4
float REAL4
void * XLALMalloc(size_t n)
void XLALFree(void *p)
LAL_PNORDER_TWO_POINT_FIVE
LAL_PNORDER_THREE
LAL_PNORDER_TWO
LAL_PNORDER_THREE_POINT_FIVE
static const INT4 m
#define XLAL_ERROR(...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_PRINT_DEPRECATION_WARNING(replacement)
#define XLAL_IS_REAL8_FAIL_NAN(val)
XLAL_EBADLEN
XLAL_ENOMEM
XLAL_SUCCESS
XLAL_EFAULT
XLAL_EFUNC
XLAL_EDOM
XLAL_EINVAL
x
Structure used as an input to compute the derivatives needed in solving the phasing formula when the ...
Definition: LALInspiral.h:607
EnergyFunction * dEnergy
Definition: LALInspiral.h:609
FluxFunction * flux
Definition: LALInspiral.h:610
expnCoeffs * coeffs
Definition: LALInspiral.h:611
expnFunc func
Definition: LALInspiral.h:680
expnCoeffs ak
Definition: LALInspiral.h:679
The inspiral waveform parameter structure containing information about the waveform to be generated.
Definition: LALInspiral.h:205
REAL4 * data
REAL8 * data
This structure contains various post-Newtonian and P-approximant expansion coefficients; the meanings...
Definition: LALInspiral.h:399
REAL8 totalmass
Definition: LALInspiral.h:474
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
Structure containing steps and controls for the GSL Runge-Kutta solver.
Definition: LALInspiral.h:637
Structure used as an input to Runge-Kutta solver.
Definition: LALInspiral.h:620
REAL8Vector * dym
Definition: LALInspiral.h:626
REAL8 x
Definition: LALInspiral.h:622
REAL8Vector * yt
Definition: LALInspiral.h:625
REAL8Vector * dydx
Definition: LALInspiral.h:624
REAL8 h
Definition: LALInspiral.h:628
REAL8Vector * dyt
Definition: LALInspiral.h:627
INT4 n
Definition: LALInspiral.h:629
REAL8Vector * y
Definition: LALInspiral.h:623
TestFunction * function
Definition: LALInspiral.h:621
char output[FILENAME_MAX]