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
LALInspiralSpinningBHBinariesTest.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2007 Bernd Machenschalk, B.S. Sathyaprakash, Thomas Cokelaer
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.
22 * \file
23 * \ingroup LALInspiral_h
24 *
25 * \brief Test routine for spin-modulted inspiral waveform generation code.
26 *
27 * First set the \c InspiralTemplate structure (example given below). Then call the function
28 * <tt>LALInspiralWaveLength (\&status, \&n, params)</tt>
29 * to measure the length \c n of the array required. Then call the function
30 * <tt>LALInspiralWave(\&status, signal1, params);</tt>
31 * to generate the wave, which will be returned in \c signal.
32 * Example values of the parameters that can be set (with options in
33 * brackets):
34 *
35 * \code
36 * params.OmegaS = 0.; (Unknown 3PN parameter in energy shown to be zero by DJS)
37 * params.ieta=1; (1 for comparable masses model, 0 for test mass model)
38 * params.mass1=1.4; (masses of the component stars in solar masses)
39 * params.mass2=1.4;
40 * params.startTime=0.0; (in sec. Defined so that the instantaneous GW frequency
41 * is params.fLower at params.startTime)
42 * params.startPhase=0.0; (0 to LAL_PI_2)
43 * params.fLower=40.0; (in Hz)
44 * params.fCutoff=1000.0; (in Hz)
45 * params.tSampling=4000.; (in Hz; should be larger than 2*fCutoff or 2*flso,
46 * whichever is smaller)
47 * params.signalAmplitude=1.0;
48 * params.nStartPad=0; (number of leading zero bins)
49 * params.nEndPad=0; (number of trailing zero bins)
50 * params.approximant=SpinTaylorT3;
51 * params.order=twoPN; (also newtonian, onePN, oneAndHalfPN, twoPN,
52 * twoAndHalfPN, threePN, threeAndHalfPN)
53 * params.massChoice=m1Andm2; (also t0t2, t0t3, t0t4, totalMassAndEta,totalMassAndMu)
54 * params.Theta = 0.;
55 * params.distance = 1.e8 * LAL_PC_SI/LAL_C_SI; (distance in sec)
56 * params.sourceTheta = LAL_PI/6.L; (Source co-latitute)
57 * params.sourcePhi = LAL_PI/6.L; (Source azimuth)
58 *
59 * mass1Sq = pow(params.mass1*LAL_MTSUN_SI,2.L); (mass of the 1st body in sec.)
60 * mass2Sq = pow(params.mass2*LAL_MTSUN_SI,2.L); (mass of the 2nd body in sec.)
61 * spin1Frac = 0.9; (spin of body 1 in units of its mass)
62 * spin2Frac = 0.3; (spin of body 2 in units of its mass)
63 *
64 * params.orbitTheta0 = LAL_PI_2/3.; (initial co-latitute orientation of the orbit)
65 * params.orbitPhi0 = LAL_PI/6.; (initial azimuth orientation of the orbit)
66 *
67 * (spin of body 1)
68 * params.spin1[0] = mass1Sq * spin1Frac * sin(spin1Theta) * cos(spin1Phi);
69 * params.spin1[1] = mass1Sq * spin1Frac * sin(spin1Theta) * sin(spin1Phi);
70 * params.spin1[2] = mass1Sq * spin1Frac * cos(spin1Theta);
71 *
72 * (spin of body 2)
73 * params.spin2[0] = mass2Sq * spin2Frac * sin(spin2Theta) * cos(spin2Phi);
74 * params.spin2[1] = mass2Sq * spin2Frac * sin(spin2Theta) * sin(spin2Phi);
75 * params.spin2[2] = mass2Sq * spin2Frac * cos(spin2Theta);
76 * \endcode
77 *
78 */
79
80#include <math.h>
81#include <stdio.h>
82#include <lal/LALInspiral.h>
83#include <lal/RealFFT.h>
84#include <lal/AVFactories.h>
85
86
87void printf_timeseries (int n, float *sig, double delta, double t0) ;
88void printf_timeseries (int n, float *sig, double delta, double t0)
89{
90 int i=0;
91 FILE *outfile1;
92
93 outfile1=fopen("wave1.dat","a");
94
95 do
96 fprintf (outfile1,"%e %e\n", i*delta+t0, *(sig+i));
97 while (n-++i);
98
99 fprintf(outfile1,"&\n");
100 fclose(outfile1);
101}
102
103
104int main (void) {
105 static REAL4Vector *signal1;
106 static LALStatus status;
108 static REAL8 dt, mass1Sq, mass2Sq, spin1Frac, spin2Frac, spin1Theta, spin1Phi, spin2Theta, spin2Phi;
109 static REAL8 dTheta, dPhi;
110 UINT4 n, count=0;
111
112 dTheta = LAL_PI_2/1.9;
113 dPhi = LAL_TWOPI/1.9;
114 params.OmegaS = 0.;
115 params.Theta = 0.;
116 params.ieta=1;
117 params.mass1=10.0;
118 params.mass2=1.0;
119 params.startTime=0.0;
120 params.startPhase=0.0;
121 params.fLower=40.0;
122 params.fCutoff=2000.00;
123 params.tSampling=4096.0;
124 params.order=4;
125 params.approximant=TaylorT3;
126 params.signalAmplitude=1.0;
127 params.nStartPad=0;
128 params.nEndPad=1000;
129 params.massChoice=m1Andm2;
131 params.sourceTheta = LAL_PI/6.L;
132 params.sourcePhi = LAL_PI/6.L;
133 dt = 1./params.tSampling;
134 spin1Frac = 0.9;
135 spin2Frac = 0.9;
136
137 mass1Sq = pow(params.mass1*LAL_MTSUN_SI,2.L);
138 mass2Sq = pow(params.mass2*LAL_MTSUN_SI,2.L);
139
142 fprintf(stderr, "#signal length=%d\n", n);
143 LALCreateVector(&status, &signal1, n);
144 params.orbitTheta0 = LAL_PI_2/3.;
145 params.orbitPhi0 = LAL_PI/6.;
146 params.orbitTheta0 = 0.;
147 params.orbitPhi0 = 0.;
148
149 /*
150 for (params.orbitTheta0=0; params.orbitTheta0<LAL_PI_2; params.orbitTheta0+=dTheta)
151 for (params.orbitPhi0=0; params.orbitPhi0<LAL_TWOPI; params.orbitPhi0+=dPhi)
152 */
153 for (spin1Theta=0.; spin1Theta<LAL_PI_2; spin1Theta+=dTheta)
154 for (spin1Phi=0.; spin1Phi<LAL_TWOPI; spin1Phi+=dPhi)
155 for (spin2Theta=0.; spin2Theta<LAL_PI_2; spin2Theta+=dTheta)
156 for (spin2Phi=0.; spin2Phi<LAL_TWOPI; spin2Phi+=dPhi)
157 {
158 fprintf(stderr, "%d %e %e %e %e %e %e\n",
159 count++, params.orbitTheta0, params.orbitPhi0, spin1Theta, spin1Phi, spin2Theta, spin2Phi);
160 params.spin1[0] = mass1Sq * spin1Frac * sin(spin1Theta) * cos(spin1Phi);
161 params.spin1[1] = mass1Sq * spin1Frac * sin(spin1Theta) * sin(spin1Phi);
162 params.spin1[2] = mass1Sq * spin1Frac * cos(spin1Theta);
163 params.spin2[0] = mass2Sq * spin2Frac * sin(spin2Theta) * cos(spin2Phi);
164 params.spin2[1] = mass2Sq * spin2Frac * sin(spin2Theta) * sin(spin2Phi);
165 params.spin2[2] = mass2Sq * spin2Frac * cos(spin2Theta);
166
168 printf_timeseries(signal1->length, signal1->data, dt, params.startTime);
169
170 /*
171 */
172 }
173
174 LALDestroyVector(&status, &signal1);
176
177 return 0;
178}
void LALInspiralWaveLength(LALStatus *status, UINT4 *n, InspiralTemplate params)
void LALInspiralSpinModulatedWave(LALStatus *status, REAL4Vector *signalvec, InspiralTemplate *in)
void LALInspiralParameterCalc(LALStatus *status, InspiralTemplate *params)
void printf_timeseries(int n, float *sig, double delta, double t0)
void LALCheckMemoryLeaks(void)
static double double delta
#define fprintf
double i
#define LAL_PI_2
#define LAL_C_SI
#define LAL_PI
#define LAL_TWOPI
#define LAL_MTSUN_SI
#define LAL_PC_SI
double REAL8
uint32_t UINT4
@ m1Andm2
component masses
Definition: LALInspiral.h:179
TaylorT3
void LALDestroyVector(LALStatus *, REAL4Vector **)
void LALCreateVector(LALStatus *, REAL4Vector **, UINT4)
int n
double t0
The inspiral waveform parameter structure containing information about the waveform to be generated.
Definition: LALInspiral.h:205
REAL4 * data
double distance