LALInspiral 5.0.3.1-eeff03c
LALSQTPNWaveformTest.c
Go to the documentation of this file.
1/**
2 * @file LALSQTPNWaveformTest.c
3 * The user interface for the SpinQuadTaylor program.
4 * This file is an example howto use the SpinQuadTaylor program.
5 * The input parameters are:<br/>
6 * <em>Waveform parameters:</em>(note:\f$i=1,2\f$ and \f$j=x,y,z\f$)
7 * <ul>
8 * <li>masses of the BHs (or NSs) \f$m_i\f$ in \f$M_\odot\f$</li>
9 * <li>the spin components \f$\chi_{ij}\f$, the values of \f$\sqrt{\sum_j\chi_{ij}}\f$, are between 0 and 1</li>
10 * <li>the quadrupole parameters \f$w_i\in(4,8)\f$ for NSs [1] and \f$w_i=1\f$ for BHs[2] are 1 (default 1)</li>
11 * <li>the inclination (angle between the line of sight and Newtonian orbital angular momentum) \f$\iota\f$ in \f$rad\f$</li>
12 * <li>the initial frequency \f$f_L\f$ in \f$Hz\f$</li>
13 * <li>the distance \f$d\f$ in \f$Mpc\f$</li>
14 * <li>the sampling time \f$t_s\f$ in \f$s\f$</li>
15 * </ul>
16 * <em>Program parameters:</em>
17 * <ul>
18 * <li>the name of the output file (default out.dat)</li>
19 * <li>the PN order (newtonian, oneHalfPN, onePN, onePointFivePN, twoPN, twoPointFivePN, threePN, threePointFivePN(default))</li>
20 * <li>level of accuracy in including spin and quadrupole contributions
21 * (NO, SO, SS, SELF, QM, ALL(default))</li>
22 * </ul>
23 * The output file contains three coloums: elapsed time, \f$h_+\f$, \f$h_\times\f$.
24 * \f{gather}{
25 * h_+=a_1\cos\left(2\alpha\right)\cos\left(2\Phi\right)-a_2\sin\left(2\alpha\right)\sin\left(2\Phi\right),\\
26 * h_\times=a_1\sin\left(2\alpha\right)\cos\left(2\Phi\right)+a_2\cos\left(2\alpha\right)\sin\left(2\Phi\right)
27 * \f}
28 * with \f$a_i\f$ amplitudes, \f$\alpha\f$ polarization shift, \f$\Phi\f$ phase (Eq. (4.28)-(4.30) of [3] up to leading order (The \f$\Phi\f$ is shifted by \f$\pi\f$ with respect to [3]). We note that \f$\Theta=0\f$ in leading order because we use radiation frame).<br />
29 * \f$a_1\f$, \f$a_2\f$ are defined in LALSQTPNGenerator() function, \f$\alpha\f$ and \f$\Phi\f$ phase is defined in XLALSQTPNDerivator() function.<br />
30 * <b>References</b><br />
31 * [1] E. Poisson, Phys.Rev. D57 5287 (1998)<br />
32 * [2] K. S. Thorne, Rev.Mod.Phys. 52 299 (1980)<br />
33 * [3] L. E. Kidder, Phys.Rev.D 52, 821 (1995)<br />
34 * @author László Veréb
35 * @date 2010.06.27.
36 */
37
38#include <lal/GenerateInspiral.h>
39#include <lal/LALStdlib.h>
40#include <lal/LALInspiral.h>
41#include <lal/GeneratePPNInspiral.h>
42#include <lal/LALSQTPNWaveformInterface.h>
43
44
45/**
46 * The main program.
47 */
48int main(int argc, char *argv[]) {
49
50 // variable declaration and initialization
51 static LALStatus mystatus;
52 CoherentGW thewaveform;
53 SimInspiralTable injParams;
54 PPNParamStruc ppnParams;
55 const char *filename;
56 FILE *outputfile;
57 INT4 i, length;
58 REAL8 dt;
59 char PNString[50];
60
61 if (argc == 17) {
62 sprintf(PNString, "SpinQuadTaylor%s%s", argv[15], argv[16]);
63 filename = argv[14];
64 } else if (argc == 16) {
65 sprintf(PNString, "SpinQuadTaylor%sALL", argv[15]);
66 filename = argv[14];
67 } else if (argc == 15) {
68 sprintf(PNString, "SpinQuadTaylorthreePointFivePNALL");
69 filename = argv[14];
70 } else if (argc == 14) {
71 sprintf(PNString, "SpinQuadTaylorthreePointFivePNALL");
72 filename = "out.dat";
73 } else if (argc != 14) {
74 printf(
75 " 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16\n");
76 printf(
77 "Correct parameter order: m1 m2 S1x S1y S1z S2x S2y S2z incl f_lower f_final distance dt output PNorder SpinInter\n");
78 return (1);
79 }
80
81 memset(&mystatus, 0, sizeof(LALStatus));
82 memset(&thewaveform, 0, sizeof(CoherentGW));
83 memset(&injParams, 0, sizeof(SimInspiralTable));
84 memset(&ppnParams, 0, sizeof(PPNParamStruc));
85
86 // setting the parameters
87 injParams.mass1 = atof(argv[1]);
88 injParams.mass2 = atof(argv[2]);
89 injParams.spin1x = atof(argv[3]);
90 injParams.spin1y = atof(argv[4]);
91 injParams.spin1z = atof(argv[5]);
92 injParams.spin2x = atof(argv[6]);
93 injParams.spin2y = atof(argv[7]);
94 injParams.spin2z = atof(argv[8]);
95 injParams.qmParameter1 = 1.;//atof(argv[9]);
96 injParams.qmParameter2 = 1.;//atof(argv[10]);
97 injParams.inclination = atof(argv[9]);
98 injParams.f_lower = atof(argv[10]);
99 injParams.f_final = atof(argv[11]);
100 injParams.distance = atof(argv[12]);
101 ppnParams.deltaT = atof(argv[13]);
102 injParams.polarization = 0;
103 LALSnprintf(injParams.waveform, LIGOMETA_WAVEFORM_MAX * sizeof(CHAR),
104 PNString);
105
106 //interface(&mystatus, &thewaveform, &injParams, &ppnParams);
107 LALGenerateInspiral(&mystatus, &thewaveform, &injParams, &ppnParams);
108 if (mystatus.statusCode) {
109 fprintf( stderr, "LALSQTPNWaveformTest: error generating waveform\n" );
110 return mystatus.statusCode;
111 }
112 // and finally save in a file
113 outputfile = fopen(filename, "w");
114
115 length = thewaveform.f->data->length;
116 dt = thewaveform.phi->deltaT;
117 REAL8 a1, a2, phi, shift;
118 for(i = 0; i < length; i++) {
119 a1 = thewaveform.a->data->data[2*i];
120 a2 = thewaveform.a->data->data[2*i+1];
121 phi = thewaveform.phi->data->data[i] - thewaveform.phi->data->data[0];
122 shift = thewaveform.shift->data->data[i];
123
124 fprintf(outputfile,"% 10.7e\t% 10.7e\t% 10.7e\n",
125 i*dt,
126 a1*cos(shift)*cos(phi) - a2*sin(shift)*sin(phi),
127 a1*sin(shift)*cos(phi) + a2*cos(shift)*sin(phi));
128 }
129 fclose(outputfile);
130 XLALSQTPNDestroyCoherentGW(&thewaveform);
131 puts("Done.");
133 return mystatus.statusCode;
134}
void LALCheckMemoryLeaks(void)
int main(int argc, char *argv[])
The main program.
#define LIGOMETA_WAVEFORM_MAX
#define fprintf
double i
const double a2
void LALGenerateInspiral(LALStatus *status, CoherentGW *waveform, SimInspiralTable *thisEvent, PPNParamStruc *ppnParams)
double REAL8
char CHAR
int32_t INT4
void XLALSQTPNDestroyCoherentGW(CoherentGW *wave)
The function deallocates memory of the waveform.
REAL4TimeSeries * shift
REAL4TimeVectorSeries * a
REAL8TimeSeries * phi
REAL4TimeSeries * f
INT4 statusCode
This structure stores the parameters for constructing a restricted post-Newtonian waveform.
REAL8 deltaT
The requested sampling interval of the waveform, in s.
REAL4Sequence * data
REAL4VectorSequence * data
REAL4 * data
REAL8Sequence * data
REAL8 * data
CHAR waveform[LIGOMETA_WAVEFORM_MAX]