25#include <lal/LALStdio.h>
26#include <lal/LALStdlib.h>
27#include <lal/LALConstants.h>
29#include <lal/FindRoot.h>
30#include <lal/AVFactories.h>
31#include <lal/SeqFactories.h>
32#include <lal/SimulateCoherentGW.h>
33#include <lal/GeneratePPNInspiral.h>
38#define ACCURACY (1.0e-6)
39#define TWOTHIRDS (0.6666666667)
40#define ONEMINUSEPS (0.99999)
77typedef struct tagFreqDiffParamStruc {
94 ASSERT(
p, stat, 1,
"Null pointer" );
118typedef struct tagPPNInspiralBuffer {
122 struct tagPPNInspiralBuffer *next;
127#define FREELIST( node ) \
129 PPNInspiralBuffer *herePtr = (node); \
130 while ( herePtr ) { \
131 PPNInspiralBuffer *lastPtr = herePtr; \
132 herePtr = herePtr->next; \
133 LALFree( lastPtr ); \
352 REAL4 d0, d1, d2, d3, d4, d5;
353 REAL4 e0, e1, e2, e3, e4, e5;
369 REAL4 tStop = 0.0625;
373 REAL4 x2, x3, x4, x5;
387 b0 =
b1 =
b2 = b3 = b4 = b5 = 0;
388 c0 =
c1 =
c2 = c3 = c4 = c5 = d0 = d1 = d2 = d3 = d4 = d5 = 0.0;
392 GENERATEPPNINSPIRALH_MSGENUL );
394 GENERATEPPNINSPIRALH_MSGENUL );
398 GENERATEPPNINSPIRALH_MSGEOUT );
400 GENERATEPPNINSPIRALH_MSGEOUT );
402 GENERATEPPNINSPIRALH_MSGEOUT );
404 GENERATEPPNINSPIRALH_MSGEOUT );
410 GENERATEPPNINSPIRALH_MSGENUL );
414 for (
i = 0;
i < j;
i++ )
435 GENERATEPPNINSPIRALH_MSGEMBAD );
438 GENERATEPPNINSPIRALH_MSGEMBAD );
441 cosI = cos(
params->inc );
448 GENERATEPPNINSPIRALH_MSGETBAD );
451 GENERATEPPNINSPIRALH_MSGEDBAD );
453 apFac *= 1.0 + cosI*cosI;
459 c2 =
c[2] =
p[2]*( 743.0/2688.0 + eta*11.0/32.0 );
460 c3 =
c[3] = -
p[3]*( 3.0*
LAL_PI/10.0 );
461 c4 =
c[4] =
p[4]*( 1855099.0/14450688.0 + eta*56975.0/258048.0 +
462 eta*eta*371.0/2048.0 );
463 c5 =
c[5] = -
p[5]*( 7729.0/21504.0 + eta*3.0/256.0 )*
LAL_PI;
480 b0 = b[0] = (
c0 == 0.0 ? 0 : 1 );
481 b1 = b[1] = (
c1 == 0.0 ? 0 : 1 );
482 b2 = b[2] = (
c2 == 0.0 ? 0 : 1 );
483 b3 = b[3] = ( c3 == 0.0 ? 0 : 1 );
484 b4 = b[4] = ( c4 == 0.0 ? 0 : 1 );
485 b5 = b[5] = ( c5 == 0.0 ? 0 : 1 );
488 for ( j = 0; ( j <
MAXORDER ) && ( b[j] == 0 ); j++ )
492 GENERATEPPNINSPIRALH_MSGEPBAD );
502 yStart =
params->fStartIn / fFac;
503 if (
params->fStopIn == 0.0 )
508 yMax = fabs(
params->fStopIn ) / fFac;
510 if ( (
c[j]*fFac < 0.0 ) || ( yStart < 0.0 ) || ( yMax < 0.0 ) ) {
512 GENERATEPPNINSPIRALH_MSGEPBAD );
514 xStart = pow( yStart/
c[j], 1.0/( j + 3.0 ) );
519 for (
i = j + 1; (
i <
MAXORDER ) && ( b[
i] == 0 );
i++ )
532 x = pow( fabs(
c[j]/
c[
i] ), 1.0/(
REAL4)(
i - j ) );
536 if ( xStart > 0.39*xMax )
541 if (
params->fStopIn < 0.0 ) {
548 xLow = xHigh = xStart;
549 FREQ( yHigh, xStart );
551 while ( yLow > yStart ) {
557 while ( yHigh < yStart ) {
561 FREQ( yHigh, xHigh );
563 if ( ( yHigh < yLow ) || ( xHigh > xMax ) ) {
565 GENERATEPPNINSPIRALH_MSGEFBAD );
571 if ( yLow == yStart )
573 else if ( yHigh == yStart )
586 (
void *)( &par ) ), stat );
592 else if (
params->fStopIn < 0.0 ) {
600 t0 = pow( xStart, -8.0 );
601 FREQ( yStart, xStart );
602 if ( yStart >= yMax ) {
604 GENERATEPPNINSPIRALH_MSGEFBAD );
606 params->fStart = yStart*fFac;
618 GENERATEPPNINSPIRALH_MSGEMEM );
624 nMax = (
UINT4)( -1 );
625 if (
params->lengthIn > 0 )
642 while (
n < nNext ) {
650 params->termDescription = GENERATEPPNINSPIRALH_MSGEPNFAIL;
659 params->termDescription = GENERATEPPNINSPIRALH_MSGEFSTOP;
678 params->termDescription = GENERATEPPNINSPIRALH_MSGEFNOTMON;
681 if (
y - yOld > dyMax )
702 phase += d5*log(t)*x5;
703 phase *= t*x3*etaInv;
704 *(phi++) = phiC - phase;
712 params->termDescription = GENERATEPPNINSPIRALH_MSGERTOOSMALL;
715 x = pow( t, -0.125 );
722 params->termDescription = GENERATEPPNINSPIRALH_MSGELENGTH;
733 GENERATEPPNINSPIRALH_MSGEMEM );
755 params->fStop = yOld*fFac;
763 GENERATEPPNINSPIRALH_MSGEMEM );
771 GENERATEPPNINSPIRALH_MSGEMEM );
780 GENERATEPPNINSPIRALH_MSGEMEM );
833 f =
output->f->data->data;
834 phi =
output->phi->data->data;
836 while ( here && (
n > 0 ) ) {
841 memcpy(
a, here->
a, 2*nCopy*
sizeof(
REAL4) );
842 memcpy( f, here->
f, nCopy*
sizeof(
REAL4) );
843 memcpy( phi, here->
phi, nCopy*
sizeof(
REAL8) );
static void FreqDiff(LALStatus *stat, REAL4 *y, REAL4 x, void *p)
#define ABORT(statusptr, code, mesg)
#define ENDFAIL(statusptr)
#define TRY(func, statusptr)
#define ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
#define BEGINFAIL(statusptr)
void LALSDestroyVectorSequence(LALStatus *status, REAL4VectorSequence **vectorSequence)
void LALSCreateVectorSequence(LALStatus *status, REAL4VectorSequence **vectorSequence, CreateVectorSequenceIn *vSeqParams)
void LALSBisectionFindRoot(LALStatus *status, REAL4 *root, SFindRootIn *input, void *params)
#define GENERATEPPNINSPIRALH_EMEM
Out of memory.
#define GENERATEPPNINSPIRALH_EFNOTMON
Frequency no longer increasing monotonically.
#define GENERATEPPNINSPIRALH_EDBAD
Bad distance.
#define GENERATEPPNINSPIRALH_EOUT
output field a, f, phi, or shift already exists
void LALGeneratePPNInspiral(LALStatus *stat, CoherentGW *output, PPNParamStruc *params)
Computes a parametrized post-Newtonian inspiral waveform.
#define GENERATEPPNINSPIRALH_ERTOOSMALL
Orbital radius too small for PN approximation.
#define GENERATEPPNINSPIRALH_EMBAD
Bad masses.
#define GENERATEPPNINSPIRALH_EFSTOP
Reached requested termination frequency.
#define GENERATEPPNINSPIRALH_EPNFAIL
Evolution dominated by higher-order PN terms.
#define GENERATEPPNINSPIRALH_ENUL
Unexpected null pointer in arguments.
#define GENERATEPPNINSPIRALH_EPBAD
Bad post-Newtonian parameters.
#define GENERATEPPNINSPIRALH_EFBAD
Bad starting frequency; could not get valid start time.
#define GENERATEPPNINSPIRALH_ELENGTH
Reached maximum length, or end of provided time series vector.
#define GENERATEPPNINSPIRALH_ETBAD
Bad sampling interval.
const LALUnit lalStrainUnit
const LALUnit lalHertzUnit
const LALUnit lalDimensionlessUnit
void LALDCreateVector(LALStatus *, REAL8Vector **, UINT4)
void LALSDestroyVector(LALStatus *, REAL4Vector **)
void LALSCreateVector(LALStatus *, REAL4Vector **, UINT4)
struct tagLALStatus * statusPtr
struct tagPPNInspiralBuffer * next
This structure stores the parameters for constructing a restricted post-Newtonian waveform.
void(* function)(LALStatus *s, REAL4 *y, REAL4 x, void *p)
char output[FILENAME_MAX]