LALInspiral 5.0.3.1-eeff03c
LALSTPNWaveformFrameless.c
Go to the documentation of this file.
1#include <lal/LALSTPNWaveformFrameless.h>
2#include <lal/LALSTPNWaveformErrors.h>
3#include <lal/LALAdaptiveRungeKuttaIntegrator.h>
4#include <stdio.h>
5
6#define UNUSED(expr) do { (void)(expr); } while (0)
7
8typedef struct LALSTPNstructparams {
9 REAL8 eta, m1m2, m2m1;
10 REAL8 wdotnew, wdotorb[9], wspin15, wspin20;
11 REAL8 LNhdot15, LNhdot20;
12 REAL8 S1dot15, S2dot15, Sdot20;
13 REAL8 epnorb[9];
15
18{
19 // Check the relevant pointers
20 if( !params || !mparams || !paramsInit )
22
23 /* Check the PN order is sane */
24 /* LAL_PNORDER_NUM_ORDER is 1 more than the maximum PN order implemented */
25 if( params->order > LAL_PNORDER_NUM_ORDER )
27
28 REAL8 m1, m2;
29 m1 = params->mass1;
30 m2 = params->mass2;
31 mparams->m2m1 = m2 / m1;
32 mparams->m1m2 = m1 / m2;
33
34 mparams->eta = (m1 * m2) / (m1 + m2) / (m1 + m2);
35
36 mparams->wdotnew = (96.0/5.0) * params->eta;
37
38 for(int j = LAL_PNORDER_NEWTONIAN; j <= 8; j++)
39 {
40 mparams->wdotorb[j] = mparams->epnorb[j] = 0.0;
41 }
42
43 mparams->epnorb[0] = 1.0;
44
45 for(unsigned int j = LAL_PNORDER_NEWTONIAN; j <= params->order; j++)
46 {
47 mparams->wdotorb[j] = paramsInit->ak.ST[j];
48 }
49
50 /* note: in the original code epnorb[2] is set even for */
51 /* PNORDER_NEWTONIAN or PNORDER_HALF */
52 if (params->order >= LAL_PNORDER_ONE)
53 {
54 mparams->epnorb[2] = -(1.0/12.0) * (9.0 + params->eta);
55 }
56
57 for(int j = params->order + 1; j <= 8; j++)
58 {
59 mparams->wdotorb[j] = 0;
60 }
61
63 {
64 mparams->wspin15 = -(1.0/12.0);
65 mparams->LNhdot15 = 0.5;
66 mparams->S1dot15 = (4.0 + 3.0 * mparams->m2m1) / 2.0 ;
67 mparams->S2dot15 = (4.0 + 3.0 * mparams->m1m2) / 2.0 ;
68 }
69 else
70 {
71 mparams->wspin15 = 0.0;
72 mparams->LNhdot15 = 0.0;
73 mparams->S1dot15 = 0.0;
74 mparams->S2dot15 = 0.0;
75 }
76
77 if (params->order >= LAL_PNORDER_TWO)
78 {
79 mparams->wspin20 = -(1.0/48.0) / params->eta;
80 mparams->LNhdot20 = -1.5 / params->eta;
81 mparams->Sdot20 = 0.5;
82 mparams->epnorb[4] = (1.0/24.0)
83 * (-81.0 + 57.0*params->eta - params->eta*params->eta);
84 }
85 else
86 {
87 mparams->wspin20 = 0.0;
88 mparams->LNhdot20 = 0.0;
89 mparams->Sdot20 = 0.0;
90 }
91
92 if (params->order >= LAL_PNORDER_THREE)
93 {
94 mparams->epnorb[6] = ( - (675.0/64.0) + ( (209323.0/4032.0)
95 -(205.0/96.0)*LAL_PI*LAL_PI - (110.0/9.0) * (-1987.0/3080.0) ) * params
96 ->eta - (155.0/96.0)*(params->eta*params->eta)
97 - (35.0/5184.0)*(params->eta*params->eta*params->eta) );
98 }
99
100 if (params->order == LAL_PNORDER_THREE)
101 {
102 mparams->wdotorb[(int)(LAL_PNORDER_THREE+1)]
103 = paramsInit->ak.ST[(int)(LAL_PNORDER_THREE+1)];
104 }
105
107 {
108 mparams->wdotorb[8] = paramsInit->ak.ST[8];
109 }
110
111 return XLAL_SUCCESS;
112}
113
114static int XLALSTPNAdaptiveTest(double t, const double values[],
115 double dvalues[],void *mparams)
116{
117 REAL8 omega, v, test;
119
120 UNUSED(t);
121
122 omega = values[1];
123 v = pow(omega,(1./3.));
124
125 test = -0.5 * params->eta * ( (2.0/3.0) * (1.0/v) * params->epnorb[0]
126 + params->epnorb[1] + (4.0/3.0) * v * (params->epnorb[2]
127 + (5.0/4.0) * v * (params->epnorb[3] + (6.0/5.0) * v * (params->epnorb[4]
128 + (7.0/6.0) * v * (params->epnorb[5] + (8.0/7.0) * v * (params->epnorb[6]
129 + (9.0/8.0) * v * (params->epnorb[7]
130 + (10.0/9.0)* v * params->epnorb[8] )))))) );
131
132 if (params->wspin15 != 0.0)
133 {
134 REAL8 LNhx, LNhy, LNhz, S1x, S1y, S1z, S2x, S2y, S2z;
135 REAL8 v2, dotLNS1, dotLNS2;
136
137 LNhx = values[2]; LNhy = values[3]; LNhz = values[4] ;
138 S1x = values[5]; S1y = values[6]; S1z = values[7] ;
139 S2x = values[8]; S2y = values[9]; S2z = values[10];
140
141 v2 = v * v;
142
143 dotLNS1 = (LNhx*S1x + LNhy*S1y + LNhz*S1z);
144 dotLNS2 = (LNhx*S2x + LNhy*S2y + LNhz*S2z);
145
146 test += -0.5 * params->eta * (5.0/3.0) * v2
147 * ( (8.0/3.0 + 2.0*params->m2m1)*dotLNS1
148 + (8.0/3.0 + 2.0*params->m1m2)*dotLNS2 );
149
150 if (params->wspin20 != 0.0)
151 {
152 REAL8 dotS1S2;
153
154 dotS1S2 = (S1x*S2x + S1y*S2y + S1z*S2z);
155 test += -(v*v2) * (dotS1S2 - 3.0 * dotLNS1 * dotLNS2);
156 }
157 }
158
159 if (test > 0.0) /* energy test fails! */
160 {
161 return LALSTPN_TEST_ENERGY;
162 }
163 else if (dvalues[1] < 0.0) /* omegadot < 0! */
164 {
166 }
167 else if (isnan(omega)) /* omega is nan! */
168 {
170 }
171 else /* Step is valid, continue the integration */
172 {
173 return GSL_SUCCESS;
174 }
175}
176
178 const double values[], double dvalues[], void *mparams)
179{
180 /* coordinates and derivatives */
181 REAL8 omega, LNhx, LNhy, LNhz, S1x, S1y, S1z, S2x, S2y, S2z, E1x, E1y, E1z;
182 REAL8 ds, domega, dLNhx, dLNhy, dLNhz, dS1x, dS1y, dS1z, dS2x, dS2y, dS2z;
183 REAL8 dE1x, dE1y, dE1z;
184
185 /* auxiliary variables */
186 REAL8 v, v2, v3, v4, v7, v11;
187 REAL8 dotLNS1, dotLNS2, dotS1S2;
188 REAL8 omega2, tmpx, tmpy, tmpz, tmp1;
189 REAL8 LNmag, crossx, crossy, crossz;
190
192
193 UNUSED(t);
194
195 /* copy variables */
196 // UNUSED!!: s = values[0];
197 omega = values[1];
198 LNhx = values[2]; LNhy = values[3]; LNhz = values[4] ;
199 S1x = values[5]; S1y = values[6]; S1z = values[7] ;
200 S2x = values[8]; S2y = values[9]; S2z = values[10];
201 E1x = values[11]; E1y = values[12]; E1z = values[13];
202
203 if (omega <= 0.0)
204 {
206 }
207
208 v = pow(omega,(1./3.));
209 v2 = v * v; v3 = v2 * v; v4 = v3 * v; v7 = v4 * v3; v11 = v7 * v4;
210
211 dotLNS1 = (LNhx*S1x + LNhy*S1y + LNhz*S1z);
212 dotLNS2 = (LNhx*S2x + LNhy*S2y + LNhz*S2z);
213 dotS1S2 = (S1x*S2x + S1y*S2y + S1z*S2z );
214
215 /* domega - non-spinning PN corrections... */
216 domega = params->wdotorb[0] + v * (params->wdotorb[1] +
217 v * (params->wdotorb[2] + v * (params->wdotorb[3] +
218 v * (params->wdotorb[4] + v * (params->wdotorb[5] +
219 v * (params->wdotorb[6] + params->wdotorb[7] * log(omega) +
220 v * params->wdotorb[8] ))))));
221
222 /* ...now add in spin-dependent corrections... */
223 domega += params->wspin15 * omega * ( LNhx * (113.0 * S1x + 113.0 * S2x
224 + 75.0 * params->m2m1 * S1x + 75.0 * params->m1m2 * S2x)
225 + LNhy * (113.0 * S1y + 113.0 * S2y + 75.0 * params->m2m1 * S1y
226 + 75.0 * params->m1m2 * S2y) + LNhz * (113.0 * S1z + 113.0 * S2z
227 + 75.0 * params->m2m1 * S1z + 75.0 * params->m1m2 * S2z) );
228
229 domega += params->wspin20 * v4 *(247.0 * dotS1S2 - 721.0 * dotLNS1 * dotLNS2);
230
231 domega *= params->wdotnew * v11; /* ... now multiply by Newtonian term */
232
233 /* dLN */
234 omega2 = omega * omega;
235
236 tmpx = params->LNhdot15 * omega2 * ((4.0 + 3.0*params->m2m1) * S1x
237 + (4.0 + 3.0*params->m1m2) * S2x);
238 tmpy = params->LNhdot15 * omega2 * ((4.0 + 3.0*params->m2m1) * S1y
239 + (4.0 + 3.0*params->m1m2) * S2y);
240 tmpz = params->LNhdot15 * omega2 * ((4.0 + 3.0*params->m2m1) * S1z
241 + (4.0 + 3.0*params->m1m2) * S2z);
242
243 tmpx += params->LNhdot20 * v7 * (dotLNS2 * S1x + dotLNS1 * S2x);
244 tmpy += params->LNhdot20 * v7 * (dotLNS2 * S1y + dotLNS1 * S2y);
245 tmpz += params->LNhdot20 * v7 * (dotLNS2 * S1z + dotLNS1 * S2z);
246
247 dLNhx = (-tmpz*LNhy + tmpy*LNhz);
248 dLNhy = (-tmpx*LNhz + tmpz*LNhx);
249 dLNhz = (-tmpy*LNhx + tmpx*LNhy);
250
251 /* dE1; reuses tmpxyz above, which is PBCV's Omega_L */
252
253 tmp1 = tmpx * LNhx + tmpy * LNhy + tmpz * LNhz;
254 tmpx -= tmp1 * LNhx;
255 tmpy -= tmp1 * LNhy;
256 tmpz -= tmp1 * LNhz; /* Now tmpxyz is PBCV's Omega_e */
257
258 dE1x = (-tmpz*E1y + tmpy*E1z);
259 dE1y = (-tmpx*E1z + tmpz*E1x);
260 dE1z = (-tmpy*E1x + tmpx*E1y);
261
262 /* dS1 */
263 LNmag = params->eta / v;
264
265 crossx = (LNhy*S1z - LNhz*S1y);
266 crossy = (LNhz*S1x - LNhx*S1z);
267 crossz = (LNhx*S1y - LNhy*S1x);
268
269 dS1x = params->S1dot15 * omega2 * LNmag * crossx;
270 dS1y = params->S1dot15 * omega2 * LNmag * crossy;
271 dS1z = params->S1dot15 * omega2 * LNmag * crossz;
272
273 tmpx = S1z*S2y - S1y*S2z;
274 tmpy = S1x*S2z - S1z*S2x;
275 tmpz = S1y*S2x - S1x*S2y;
276
277 dS1x += params->Sdot20 * omega2 * (tmpx - 3.0 * dotLNS2 * crossx);
278 dS1y += params->Sdot20 * omega2 * (tmpy - 3.0 * dotLNS2 * crossy);
279 dS1z += params->Sdot20 * omega2 * (tmpz - 3.0 * dotLNS2 * crossz);
280
281 /* dS2 */
282 crossx = (LNhy*S2z - LNhz*S2y);
283 crossy = (LNhz*S2x - LNhx*S2z);
284 crossz = (LNhx*S2y - LNhy*S2x);
285
286 dS2x = params->S2dot15 * omega2 * LNmag * crossx;
287 dS2y = params->S2dot15 * omega2 * LNmag * crossy;
288 dS2z = params->S2dot15 * omega2 * LNmag * crossz;
289
290 dS2x += params->Sdot20 * omega2 * (-tmpx - 3.0 * dotLNS1 * crossx);
291 dS2y += params->Sdot20 * omega2 * (-tmpy - 3.0 * dotLNS1 * crossy);
292 dS2z += params->Sdot20 * omega2 * (-tmpz - 3.0 * dotLNS1 * crossz);
293
294 /* dphi */
295 /* No coordinate singularity; instead, frame is evolving */
296 ds = omega;
297
298 dvalues[0] = ds ; dvalues[1] = domega;
299 dvalues[2] = dLNhx; dvalues[3] = dLNhy ; dvalues[4] = dLNhz;
300 dvalues[5] = dS1x ; dvalues[6] = dS1y ; dvalues[7] = dS1z ;
301 dvalues[8] = dS2x ; dvalues[9] = dS2y ; dvalues[10] = dS2z ;
302 dvalues[11] = dE1x ; dvalues[12] = dE1y ; dvalues[13] = dE1z ;
303
304 return GSL_SUCCESS;
305}
306
309{
310 XLAL_PRINT_DEPRECATION_WARNING("XLALSTPNFramelessWaveform");
313
314 if( XLALSTPNFramelessWaveform(signalvec, params) )
316
318 RETURN(status);
319}
320
322{
323 // Check the relevant pointers
324 if( !signalvec || !signalvec->data || !params )
326
327 // Check the parameters are sane
328 if( params->nStartPad < 0 || params->nEndPad < 0 || params->fLower <= 0
329 || params->tSampling <= 0 || params->totalMass <= 0.)
331
332 UINT4 count;
333 InspiralInit paramsInit;
334
335 if( XLALInspiralSetup(&(paramsInit.ak), params) )
337 if( XLALInspiralChooseModel(&(paramsInit.func), &(paramsInit.ak), params) )
339
340 memset(signalvec->data, 0, signalvec->length * sizeof( REAL4 ));
341 /* Call the engine function */
342 if( XLALSTPNFramelessAdaptiveWaveformEngine(signalvec, NULL, &count, params,
343 &paramsInit) )
345
346 return XLAL_SUCCESS;
347}
348
350 REAL4Vector *signalvec1, REAL4Vector *signalvec2, InspiralTemplate *params)
351{
352 XLAL_PRINT_DEPRECATION_WARNING("XLALSTPNFramelessWaveformTemplates");
355
356 if( XLALSTPNFramelessWaveformTemplates(signalvec1, signalvec2, params) )
358
360 RETURN(status);
361}
362
363
364
366 REAL4Vector *signalvec2, InspiralTemplate *params)
367{
368 // Check the relevant pointers
369 if( !signalvec1 || !signalvec1->data || !signalvec2
370 || !signalvec2->data || !params )
372
373 // Check the parameters are sane
374 if( params->nStartPad < 0 || params->nEndPad < 0 || params->fLower <= 0
375 || params->tSampling <= 0 || params->totalMass <= 0.)
377
378
379 UINT4 count;
380 InspiralInit paramsInit;
381
382 if( XLALInspiralInit(params, &paramsInit) )
384
385 memset(signalvec1->data, 0, signalvec1->length * sizeof( REAL4 ));
386 memset(signalvec2->data, 0, signalvec2->length * sizeof( REAL4 ));
387 /* Call the engine function */
388 if( XLALSTPNFramelessAdaptiveWaveformEngine(signalvec1, signalvec2,
389 &count, params, &paramsInit) )
391
392 return XLAL_SUCCESS;
393}
394
396 CoherentGW *waveform, InspiralTemplate *params, PPNParamStruc *ppnParams)
397{
398 XLAL_PRINT_DEPRECATION_WARNING("XLALSTPNFramelessWaveformForInjection");
401
402 if( XLALSTPNFramelessWaveformForInjection(waveform, params, ppnParams) )
404
406 RETURN(status);
407}
408
411{
412 // Check the relevant pointers exist
413 if( !waveform || !params )
415
416 // CoherentGW waveform->h shouldn't exist yet
417 if( waveform->h )
419
420 UINT4 count, i;
421
422 REAL4Vector *hplus = NULL;
423 REAL4Vector *hcross = NULL;
424
425 InspiralInit paramsInit;
426
427 /* Compute some parameters*/
428
429 /* The start phase is passed via coa_phase in the SimInspiralTable, */
430 /* then ppnParams->phi due to convention in GenerateInspiral.c */
431 params->startPhase = ppnParams->phi;
432 if( XLALInspiralInit(params, &paramsInit) )
434 if (paramsInit.nbins==0)
435 {
436 XLALPrintWarning("Warning! Waveform of zero length requested in %s. Returning empty waveform.\n ", __func__);
437 return XLAL_SUCCESS;
438 }
439
440 /* Now we can allocate memory and vector for coherentGW structure*/
441 hplus = XLALCreateREAL4Vector(paramsInit.nbins);
442 hcross = XLALCreateREAL4Vector(paramsInit.nbins);
443
444 /* By default the waveform is empty */
445 memset(hplus->data, 0, paramsInit.nbins * sizeof(REAL4));
446 memset(hcross->data, 0, paramsInit.nbins * sizeof(REAL4));
447
448
449 /* Call the engine function */
450 if( XLALSTPNFramelessAdaptiveWaveformEngine(hplus, hcross, &count,
451 params, &paramsInit) )
453
454 /* Check an empty waveform hasn't been returned
455 Is this something that we should actually check for?
456 If so, uncomment and switch to checking hplus
457 for (i = 0; i < a->length; i++)
458 {
459 if (a->data[i] != 0.0) break;
460 if (i == a->length - 1)
461 {
462 XLALDestroyREAL4Vector(ff);
463 XLALDestroyREAL4Vector(a);
464 XLALDestroyREAL4Vector(phi);
465 XLALDestroyREAL4Vector(shift);
466 }
467 } */
468
469
470 /* Allocate the waveform structures. */
471 if ( ( waveform->h = (REAL4TimeVectorSeries *)
472 XLALMalloc( sizeof(REAL4TimeVectorSeries) ) ) == NULL )
473 {
475 }
476 memset( waveform->h, 0, sizeof(REAL4TimeVectorSeries) );
477
478 // UNUSED!! CreateVectorSequenceIn in;
479 // in.length = (UINT4)count;
480 // in.vectorLength = 2;
481 // '2' is the number of vectors - 1 for each of h+ and hx
482 waveform->h->data = XLALCreateREAL4VectorSequence( (UINT4) count, 2);
483
484 /* We alternate hplus and hcross. LALInjectStrainGW actually wants */
485 /* a continuous block of hplus followed by a continuous block of hcross */
486 /* But, LALFindChirpInjectSignals reorders h assuming it is passed */
487 /* into the function as alternating hplus and hcross */
488 for( i = 0; i < count; i++)
489 {
490 waveform->h->data->data[2*i] = hplus->data[i];
491 waveform->h->data->data[2*i+1] = hcross->data[i];
492 }
493
494 waveform->h->deltaT = 1./params->tSampling;
495 waveform->h->sampleUnits = lalStrainUnit;
496
497 waveform->position = ppnParams->position;
498 waveform->psi = ppnParams->psi;
499
500
501 snprintf(waveform->h->name, LALNameLength, "STPN inspiral strain");
502
503
504 /* --- fill some output ---*/
505 ppnParams->tc = (double)(count-1) / params->tSampling ;
506 ppnParams->length = count;
507 /*ppnParams->dfdt = ((REAL4)(waveform->f->data->data[count-1]
508 - waveform->f->data->data[count-2])) * ppnParams->deltaT; */
509 ppnParams->fStop = params->fFinal;
511 ppnParams->termDescription = GENERATEPPNINSPIRALH_MSGEFSTOP;
512
513 ppnParams->fStart = ppnParams->fStartIn;
514
515 /* --- free memory --- */
518
519 return XLAL_SUCCESS;
520}
521
523 REAL4Vector *signalvec1, REAL4Vector *signalvec2, UINT4 *countback,
525{
526 XLAL_PRINT_DEPRECATION_WARNING("XLALSTPNFramelessAdaptiveWaveformEngine");
527
530
531 if( XLALSTPNFramelessAdaptiveWaveformEngine(signalvec1, signalvec2,
532 countback, params, paramsInit) )
534
536 RETURN(status);
537}
538
539
541 REAL4Vector *signalvec2, UINT4 *countback, InspiralTemplate *params,
542 InspiralInit *paramsInit)
543{
544 /* PN parameters */
545 LALSTPNparams mparams;
546
547 /* needed for integration */
549 unsigned int len;
550 int intreturn;
551 REAL8 yinit[14];
552 REAL8Array *yout;
553
554 /* other computed values */
555 REAL8 unitHz, dt, m, lengths, norm;
556 REAL8 E2x, E2y;
557 REAL8 hpluscos, hplussin, hcrosscos, hcrosssin;
558
559 /* units */
560 unitHz = params->totalMass * LAL_MTSUN_SI * (REAL8)LAL_PI;
561 dt = 1.0/params->tSampling; /* tSampling is in Hz, so dt is in seconds */
562 m = params->totalMass * LAL_MTSUN_SI;
563
564 /* length estimation (Newtonian) */
565 /* since integration is adaptive, we could use a better estimate */
566 lengths = (5.0/256.0) * pow(LAL_PI,-8.0/3.0) * pow(params->chirpMass
567 * LAL_MTSUN_SI * params->fLower,-5.0/3.0) / params->fLower;
568
569 /* setup coefficients for PN equations */
570 XLALSTPNAdaptiveSetParams(&mparams, params, paramsInit);
571
572 /* initialize the coordinates */
573 yinit[0] = params->startPhase / 2.0; /* initial vphi sets start phase */
574 yinit[1] = params->fLower * unitHz; /* omega (really pi M f) */
575
576 yinit[2] = sin(params->inclination); /* LNh(x,y,z) */
577 yinit[3] = 0.0;
578 yinit[4] = cos(params->inclination);
579
580 norm = pow(params->mass1/params->totalMass,2.0);
581 yinit[5] = norm * params->spin1[0]; /* S1(x,y,z) */
582 yinit[6] = norm * params->spin1[1];
583 yinit[7] = norm * params->spin1[2];
584
585 norm = pow(params->mass2/params->totalMass,2.0);
586 yinit[8] = norm * params->spin2[0]; /* S2(x,y,z) */
587 yinit[9] = norm * params->spin2[1];
588 yinit[10]= norm * params->spin2[2];
589
590 yinit[11] = cos(params->inclination); /* E1(x,y,z) */
591 yinit[12] = 0.0;
592 yinit[13] = -1.0 * sin(params->inclination);
593
594 xlalErrno = 0;
595
596 /* allocate the integrator */
597 integrator = XLALAdaptiveRungeKutta4Init(14,
599 1.0e-6, 1.0e-6);
600 if (!integrator)
601 {
602 XLALPrintError("LALSTPNFramelessAdaptiveWaveformEngine: Cannot allocate integrator.\n");
604 }
605
606 /* stop the integration only when the test is true */
607 integrator->stopontestonly = 1;
608
609 /* run the integration; note: time is measured in units of total mass */
610 len = XLALAdaptiveRungeKutta4(integrator, (void *) &mparams, yinit, 0.0,
611 lengths/m, dt/m, &yout);
612
613 intreturn = integrator->returncode;
614 XLALAdaptiveRungeKuttaFree(integrator);
615
616 if (!len)
617 {
618 XLALPrintError("LALSTPNFramelessAdaptiveWaveformEngine: integration failed with errorcode %d.\n",intreturn);
620 }
621
622 /* report on abnormal termination (TO DO: throw some kind of LAL error?) */
623 if (intreturn != 0 && intreturn != LALSTPN_TEST_ENERGY
624 && intreturn != LALSTPN_TEST_OMEGADOT)
625 {
626 XLALPrintWarning("LALSTPNFramelessAdaptiveWaveformEngine WARNING: integration terminated with code %d.\n",intreturn);
627 XLALPrintWarning("Waveform parameters were m1 = %e, m2 = %e, s1 = (%e,%e,%e), s2 = (%e,%e,%e), inc = %e.\n",
628 params->mass1, params->mass2, params->spin1[0], params->spin1[1],
629 params->spin1[2], params->spin2[0], params->spin2[1],
630 params->spin2[2], params->inclination);
631 }
632
633 /* check that we're not above Nyquist. Need to find a way to pass
634 * this information along without creating GB worth of warnings.
635 * a --no-warning flag?
636 * if (yinit[1]/unitHz > 0.5 * params->tSampling) {
637 * fprintf(stderr,"LALSTPNWaveform2 WARNING: final frequency above Nyquist.\n");
638 * }
639 */
640 /* if we have enough space, compute the waveform components; otherwise abort*/
641 if (signalvec1 && len >= signalvec1->length)
642 {
643 XLALPrintError("LALSTPNFramelessAdaptiveWaveformEngine: no space to write in signalvec1: %d vs. %d\n", len, signalvec1->length);
645 }
646 if (signalvec2 && len >= signalvec2->length)
647 {
648 XLALPrintError("LALSTPNFramelessAdaptiveWaveformEngine: no space to write in signalvec2: %d vs. %d\n", len, signalvec2->length);
650 }
651
652 /* set up some aliases for the returned arrays; note vector 0 is time */
653 REAL8 *vphi = &yout->data[1*len]; REAL8 *omega = &yout->data[2*len];
654 REAL8 *LNhx = &yout->data[3*len]; REAL8 *LNhy = &yout->data[4*len];
655 REAL8 *LNhz = &yout->data[5*len];
656
657 /*-- these are not needed for the waveforms, but uncomment for debugging: --*/
658 /*REAL8 *S1x = &yout->data[6*len]; REAL8 *S1y = &yout->data[7*len];
659 REAL8 *S1z = &yout->data[8*len]; REAL8 *S2x = &yout->data[9*len];
660 REAL8 *S2y = &yout->data[10*len]; REAL8 *S2z = &yout->data[11*len];
661 REAL8 *that = &yout->data[0];*/
662 /*--------------------------------------------------------------------------*/
663
664 REAL8 *E1x = &yout->data[12*len]; REAL8 *E1y = &yout->data[13*len];
665 REAL8 *E1z = &yout->data[14*len];
666
667 *countback = len;
668
669 REAL8 amp, f2a;
670 amp = -4.0 * params->mu * LAL_MRSUN_SI / (params->distance);
671 /*---- Uncomment the next 2 lines for debugging ----*/
672 /*FILE *outFile=NULL;
673 outFile = fopen("frameless-dynamics.dat", "w");*/
674 /*--------------------------------------------------*/
675 for(unsigned int i=0;i<len;i++)
676 {
677 f2a = pow(omega[i],2.0/3.0);
678
679 E2x = LNhy[i]*E1z[i] - LNhz[i]*E1y[i]; /* E2 = LNhat x E1 */
680 E2y = LNhz[i]*E1x[i] - LNhx[i]*E1z[i];
681
682 /*---- Uncomment the next line for debugging ----*/
683 /* E2z = LNhx[i]*E1y[i] - LNhy[i]*E1x[i];
684 fprintf(outFile,"%f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f\n",
685 that[i] * m, vphi[i], omega[i], LNhx[i], LNhy[i], LNhz[i],
686 S1x[i], S1y[i], S1z[i], S2x[i], S2y[i], S2z[i],
687 E1x[i], E1y[i], E1z[i], E2x, E2y, E2z);*/
688 /* ----------------------------------------------*/
689
690 if (signalvec1)
691 {
692 /* Polarization tensors projected into viewer's frame */
693 hpluscos = 0.5 * (E1x[i]*E1x[i] - E1y[i]*E1y[i] - E2x*E2x + E2y*E2y);
694 hplussin = E1x[i]*E2x - E1y[i]*E2y;
695
696 signalvec1->data[i] = (REAL4) ( amp * f2a * \
697 ( hpluscos * cos(2*vphi[i]) + hplussin * sin(2*vphi[i]) ) );
698 }
699
700 if (signalvec2)
701 {
702 /* Polarization tensors projected into viewer's frame */
703 hcrosscos = E1x[i]*E1y[i] - E2x*E2y;
704 hcrosssin = E1y[i]*E2x + E1x[i]*E2y;
705
706 signalvec2->data[i] = (REAL4) ( amp * f2a * \
707 ( hcrosscos * cos(2*vphi[i]) + hcrosssin * sin(2*vphi[i]) ) );
708 }
709 }
710 /*---- Uncomment next line for debugging ----*/
711 /*fclose(outFile);*/
712 /*-------------------------------------------*/
713
714 params->fFinal = (REAL4)(omega[len-1]/unitHz);
715 params->tC = yout->data[len-1] * m; /* m converts from t/m to t in seconds */
716
717 if (yout) XLALDestroyREAL8Array(yout);
718
719 return XLAL_SUCCESS;
720}
static INT4 test(REAL4, REAL4, REAL4, REAL4, REAL4, REAL4, REAL4, REAL4)
int XLALInspiralSetup(expnCoeffs *ak, InspiralTemplate *params)
int XLALInspiralInit(InspiralTemplate *params, InspiralInit *paramsInit)
int XLALInspiralChooseModel(expnFunc *func, expnCoeffs *ak, InspiralTemplate *params)
#define LALSTPN_TEST_OMEGADOT
#define LALSTPN_TEST_OMEGANAN
#define LALSTPN_TEST_ENERGY
#define LALSTPN_DERIVATIVE_OMEGANONPOS
static int XLALSTPNAdaptiveTest(double t, const double values[], double dvalues[], void *mparams)
static int XLALSTPNAdaptiveSetParams(LALSTPNparams *mparams, InspiralTemplate *params, InspiralInit *paramsInit)
int XLALSTPNFramelessWaveform(REAL4Vector *signalvec, InspiralTemplate *params)
static int XLALSTPNFramelessAdaptiveDerivatives(double t, const double values[], double dvalues[], void *mparams)
void LALSTPNFramelessWaveformForInjection(LALStatus *status, CoherentGW *waveform, InspiralTemplate *params, PPNParamStruc *ppnParams)
int XLALSTPNFramelessAdaptiveWaveformEngine(REAL4Vector *signalvec1, REAL4Vector *signalvec2, UINT4 *countback, InspiralTemplate *params, InspiralInit *paramsInit)
int XLALSTPNFramelessWaveformForInjection(CoherentGW *waveform, InspiralTemplate *params, PPNParamStruc *ppnParams)
void LALSTPNFramelessAdaptiveWaveformEngine(LALStatus *status, REAL4Vector *signalvec1, REAL4Vector *signalvec2, UINT4 *countback, InspiralTemplate *params, InspiralInit *paramsInit)
void LALSTPNFramelessWaveformTemplates(LALStatus *status, REAL4Vector *signalvec1, REAL4Vector *signalvec2, InspiralTemplate *params)
int XLALSTPNFramelessWaveformTemplates(REAL4Vector *signalvec1, REAL4Vector *signalvec2, InspiralTemplate *params)
void LALSTPNFramelessWaveform(LALStatus *status, REAL4Vector *signalvec, InspiralTemplate *params)
#define ATTATCHSTATUSPTR(statusptr)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
#define ABORTXLAL(sp)
REAL8 tmp1
double i
void XLALDestroyREAL8Array(REAL8Array *)
REAL4VectorSequence * XLALCreateREAL4VectorSequence(UINT4 length, UINT4 veclen)
#define GENERATEPPNINSPIRALH_EFSTOP
Reached requested termination frequency.
int XLALAdaptiveRungeKutta4(LALAdaptiveRungeKuttaIntegrator *integrator, void *params, REAL8 *yinit, REAL8 tinit, REAL8 tend, REAL8 deltat, REAL8Array **yout)
void XLALAdaptiveRungeKuttaFree(LALAdaptiveRungeKuttaIntegrator *integrator)
LALAdaptiveRungeKuttaIntegrator * XLALAdaptiveRungeKutta4Init(int dim, int(*dydt)(double t, const double y[], double dydt[], void *params), int(*stop)(double t, const double y[], double dydt[], void *params), double eps_abs, double eps_rel)
#define LAL_PI
#define LAL_MTSUN_SI
#define LAL_MRSUN_SI
double REAL8
uint32_t UINT4
float REAL4
LALNameLength
void * XLALMalloc(size_t n)
LAL_PNORDER_NUM_ORDER
LAL_PNORDER_THREE
LAL_PNORDER_TWO
LAL_PNORDER_ONE
LAL_PNORDER_THREE_POINT_FIVE
LAL_PNORDER_ONE_POINT_FIVE
LAL_PNORDER_NEWTONIAN
static const INT4 m
const LALUnit lalStrainUnit
REAL4Vector * XLALCreateREAL4Vector(UINT4 length)
void XLALDestroyREAL4Vector(REAL4Vector *vector)
#define xlalErrno
#define XLAL_ERROR(...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
int int XLALPrintWarning(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_PRINT_DEPRECATION_WARNING(replacement)
XLAL_EBADLEN
XLAL_ENOMEM
XLAL_SUCCESS
XLAL_EFAULT
XLAL_EFUNC
XLAL_EINVAL
SkyPosition position
REAL4TimeVectorSeries * h
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
REAL8 wdotorb[9]
This structure stores the parameters for constructing a restricted post-Newtonian waveform.
const CHAR * termDescription
The termination code description (above)
INT4 termCode
The termination condition (above) that stopped computation of the waveform.
REAL4 phi
The phase at coalescence (or arbitrary reference phase for a post -Newtonian approximation),...
REAL4 psi
polarization angle (radians)
REAL4 fStart
The actual starting frequency of the waveform, in Hz (normally close but not identical to fStartIn)
SkyPosition position
location of source on sky
UINT4 length
The length of the generated waveform.
REAL4 fStop
The frequency at the termination of the waveform, in Hz.
REAL8 tc
The time from the start of the waveform to coalescence (in the point-mass approximation),...
REAL4 fStartIn
The requested starting frequency of the waveform, in Hz.
CHAR name[LALNameLength]
REAL4VectorSequence * data
REAL4 * data
REAL8 * data
REAL8 ST[9]
Definition: LALInspiral.h:464
double inclination
double distance