LALSimulation  5.4.0.1-fe68b98
LALSimIMRPhenomTHM_internals.h
Go to the documentation of this file.
1 #ifndef _LALSIM_IMR_PHENOMTHM_INTERNALS_H
2 #define _LALSIM_IMR_PHENOMTHM_INTERNALS_H
3 
4 /*
5  * Copyright (C) 2020 Hector Estelles
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with with program; see the file COPYING. If not, write to the
18  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301 USA
20  */
21 
22 
23 /*
24  * \author Hector Estelles
25  *
26  */
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /* Standard libraries */
33 #include <stdlib.h>
34 #include <stdio.h>
35 #include <math.h>
36 
37 /* LAL */
38 #include <lal/LALStdlib.h>
39 #include <lal/LALConstants.h>
40 #include <lal/Date.h>
41 #include <lal/Units.h>
42 
43 /* IMRPhenomT */
44 #include <lal/LALSimInspiral.h>
45 
46 /* Constant times employed during the code */
47 #define tCUT_Amp -150.0 // Ending time of inspiral region for the amplitude. Same for all modes.
48 #define tCUT_Freq -150.0 // Ending time of inspiral region for the frequency and phase.
49 #define tcpMerger -25.0 // Merger collocation point time, same for frequency and amplitude.
50 #define tEnd 500.0 // Maximum time for which the modes are computed. Enough to contain the non-negligible power of the ringdown radiation for all the modes.
51 
52 /**** STRUCTS DEFINITION ****/
53 
54 /* Waveform struct for storing binary parameters, final state parameters, and parameters needed for evaluating the calibrated fits. */
55 typedef struct tagIMRPhenomTWaveformStruct
56 {
57  REAL8 m1_SI; /* Mass of companion 1 (kg) */
58  REAL8 m2_SI; /* Mass of companion 2 (kg) */
59  REAL8 q; /* mass ratio q>1 */
60  REAL8 eta; /* Symmetric mass ratio */
61  REAL8 Mtot_SI; /* Total mass in SI units (kg) */
62  REAL8 Mtot; /* Total mass in solar masses */
63  REAL8 m1; /* Mass 1 (larger), dimensionless (i.e. m1 \in [0,1]) */
64  REAL8 m2; /* Mass 2 (smaller), dimensionless */
65  REAL8 M_sec; /* Conversion factor, total mass in seconds */
66  REAL8 delta; /* PN symmetry coefficient */
67 
68  REAL8 fRef; /* reference GW frequency (Hz) */
69  REAL8 fmin; /* starting GW frequency (Hz) */
70  REAL8 MfRef; /* Dimensionless reference GW frequency */
71  REAL8 Mfmin; /* Dimensionless minimum GW frequency */
72 
73  REAL8 chi1L; /* Dimensionless aligned spin of companion 1 */
74  REAL8 chi2L; /* Dimensionless aligned spin of companion 2 */
75  REAL8 Shat; /* Dimensionless effective spin parameterisation for the callibrated fits */
76  REAL8 dchi; /* Dimensionless spin difference parameterisation for the callibrated fits */
77 
78  REAL8 Mfinal; /* Final mass of the remnant black hole */
79  REAL8 afinal; /* Final spin of the remnant black hole */
81 
82  REAL8 distance; /* Luminosity distance (m) */
83 
84  REAL8 deltaT; /* sampling interval (s) */
85  REAL8 dtM; /* sampling interval (M) */
86  REAL8 dist_sec; /* Luminosity distance (seconds) */
87  REAL8 phiRef; /* reference orbital phase (rad) */
88 
89  REAL8 ampfac; // Amplitude conversion factor from NR to physical units
90  INT4 inspVersion; // 0 (default) 22 phase/frequency reconstruction with 3 regions. Any other value, 4 regions
92 
93 /* Struct for storing the coefficient values of the frequency and phase ansatz for the 22 mode.
94  It also contains information about the minimum and reference times and the length of the waveform. */
95 typedef struct tagIMRPhenomTPhase22Struct
96 {
97  REAL8 omegaPeak; // 22 frequency value at the peak amplitude time of the 22 mode (t=0)
98 
99  /* Ringdown ansatz phenomenological coefficients */
105 
106  /* PN coefficients of TaylorT3 */
113 
114  /* Phenomenological coefficients of inspiral ansatz */
121 
122  /* Phenomenological coefficients of merger ansatz */
126 
127  REAL8 alpha1RD; // Angular damping frequency of the nlm = 122 QNM
129  REAL8 domegaPeak; // Frequency derivative at the peak amplitude time
130  REAL8 omegaRING; // Angular ringdown frequency
132 
133  REAL8 MfRef; // Dimensionless reference frequency
134  REAL8 Mfmin; // Dimensionless minimum frequency
135 
136  REAL8 tRef; // Reference time
137  REAL8 tmin; // Minimum time
138  REAL8 tminSec; // Minimum time in seconds
139  size_t wflength; // Length of the waveform (in number of points)
140  size_t wflength_insp_early; // Length of the early inspiral waveform (in number of points) (needed if 4 regions are requested)
141  size_t wflength_insp_late; // Length of the late inspiral waveform (in number of points) (needed if 4 regions are requested)
142 
143  REAL8 phOffInsp; // phase offset of inspiral phase (needed if 4 regions are requested)
144  REAL8 phOffMerger; // phase offset of merger phase
145  REAL8 phOffRD; // phase offset of ringdown phase
146 
147  REAL8 tCut22; // Inspiral-merger boundary time for the 22 mode phase/frequency
148  REAL8 tEarly; // Early inspiral-late inspiral boundary time for the 22 mode phase/frequency (needed if 4 regions are requested)
149  REAL8 tt0; // Calibrated t0 parameter of TaylorT3, needed for theta=0.33 collocation point and for early inspiral region if requested.
150 
151  REAL8 dtM; // Dimensionless time step
152  REAL8 EulerRDslope; // Slope of the analytical ringdown approximation for the precessing alpha angle. FIXME: check if its needed.
153 
155 
156 /* Struct for storing the coefficient values of the frequency and phase merger-ringdown ansatz for the lm mode. */
157 typedef struct tagIMRPhenomTHMPhaseStruct
158 {
159  UINT4 emm; // mode number
160  REAL8 omegaPeak; // lm frequency value at the peak amplitude time of the lm mode
161 
162  /* Ringdown ansatz phenomenological coefficients */
168 
169  /* Phenomenological coefficients of merger ansatz */
173 
174  REAL8 alpha1RD; // Angular damping frequency of the nlm = 1lm QNM
176  REAL8 alpha2RD; // Angular damping frequency of the nlm = 2lm QNM
177  REAL8 alpha21RD; // Damping frequency difference between n=2 and n=1 QNM
178 
179  REAL8 domegaPeak; // Frequency derivative at the peak amplitude time
180  REAL8 omegaRING; // Angular ringdown frequency
182 
183  REAL8 phOffMerger; // phase offset of merger phase
184  REAL8 phOffRD; // phase offset of ringdown phase
185 
187 
188 /* Struct for storing the coefficient values of the amplitude ansatz for the lm mode. */
189 typedef struct tahIMRPhenomTHMAmpStruct
190 {
191  /* PN amplitude coefficients */
209 
210  REAL8 tshift; // Peak amplitude time of the lm mode
211 
212  /* Phenomenological coefficients of inspiral ansatz */
216 
217  /* Phenomenological coefficients of merger ansatz */
222 
223  /* Damping frequencies */
227 
231 
232  /* Phenomenological coefficients of ringdown ansatz */
237 
241 
242  /* Complex inspiral amplitude phase/frequenct contribution at the inspiral-merger boundary */
246 
247 /* Wrapper struct for GSL Root Finder */
249  double f0;
252 };
253 
254 /**** FUNCTIONS FOR POPULATING THE STRUCTS *****/
255 
256 double GetTimeOfFreq(double t, void *params); // Wrapper function for GSL Root Finder
257 
260  const REAL8 m1_SI,
261  const REAL8 m2_SI,
262  const REAL8 chi1L_In,
263  const REAL8 chi2L_In,
264  const REAL8 distance,
265  const REAL8 deltaT,
266  const REAL8 fmin,
267  const REAL8 fRef,
268  const REAL8 phiRef,
269  LALDict *lalParams
270 );
271 
272 /* Functions to populate phase and amplitude structs */
276 
277 /********************************* 22 Frequency ansatzs *********************************/
278 
283 
284 /********************************* 22 Phase ansatzs *********************************/
285 
290 
291 /********************************* HM Frequency ansatzs *********************************/
292 
295 
296 /********************************* HM Phase ansatzs *********************************/
297 
300 
301 /********************************* HM Amplitude ansatzs *********************************/
302 
306 
307 /* Wrapper for complex inspiral amplitude phase */
309 
310 /***************************** Piecewise functions for 22 phase and frequency ********/
311 
314 
315 /***************************** Piecewise functions for lm phase and amplitude ********/
316 
318  REAL8 t,
319  REAL8 phiInsp,
320  IMRPhenomTHMPhaseStruct *pPhaseHM,
321  IMRPhenomTHMAmpStruct *pAmpHM
322 );
323 
325 
327 
328 #ifdef __cplusplus
329 }
330 #endif
331 
332 #endif
double IMRPhenomTRDPhaseAnsatz22(REAL8 t, IMRPhenomTPhase22Struct *pPhase)
double IMRPhenomTMergerOmegaAnsatz22(REAL8 t, IMRPhenomTPhase22Struct *pPhase)
double IMRPhenomTInspiralOmegaAnsatz22(REAL8 theta, IMRPhenomTPhase22Struct *pPhase)
double IMRPhenomTomega22(REAL8 t, REAL8 theta, IMRPhenomTWaveformStruct *pWF, IMRPhenomTPhase22Struct *pPhase)
int IMRPhenomTSetHMPhaseCoefficients(int l, int m, IMRPhenomTHMPhaseStruct *pPhaseHM, IMRPhenomTPhase22Struct *pPhase, IMRPhenomTHMAmpStruct *pAmp, IMRPhenomTWaveformStruct *wf)
double IMRPhenomTRDOmegaAnsatzHM(REAL8 t, IMRPhenomTHMPhaseStruct *pPhase)
int IMRPhenomTSetHMAmplitudeCoefficients(int l, int m, IMRPhenomTHMAmpStruct *pAmp, IMRPhenomTPhase22Struct *pPhase, IMRPhenomTWaveformStruct *wf)
double IMRPhenomTHMPhase(REAL8 t, REAL8 phiInsp, IMRPhenomTHMPhaseStruct *pPhaseHM, IMRPhenomTHMAmpStruct *pAmpHM)
REAL8 GetEulerSlope(REAL8 af, REAL8 mf)
double GetTimeOfFreq(double t, void *params)
double IMRPhenomTMergerPhaseAnsatz22(REAL8 t, IMRPhenomTPhase22Struct *pPhase)
double IMRPhenomTMergerAmpAnsatzHM(REAL8 t, IMRPhenomTHMAmpStruct *pAmp)
double IMRPhenomTRDOmegaAnsatz22(REAL8 t, IMRPhenomTPhase22Struct *pPhase)
double ComplexAmpOrientation(REAL8 xref, IMRPhenomTHMAmpStruct *pAmp)
double IMRPhenomTMergerOmegaAnsatzHM(REAL8 t, IMRPhenomTHMPhaseStruct *pPhase)
double IMRPhenomTRDAmpAnsatzHM(REAL8 t, IMRPhenomTHMAmpStruct *pAmp)
int IMRPhenomTSetPhase22Coefficients(IMRPhenomTPhase22Struct *pPhase, IMRPhenomTWaveformStruct *wf)
COMPLEX16 IMRPhenomTHMAmp(REAL8 t, REAL8 w, IMRPhenomTHMAmpStruct *pAmpHM)
double IMRPhenomTInspiralPhaseAnsatz22(REAL8 t, REAL8 theta, IMRPhenomTWaveformStruct *wf, IMRPhenomTPhase22Struct *pPhase)
double IMRPhenomTTaylorT3(REAL8 theta, IMRPhenomTPhase22Struct *pPhase)
double IMRPhenomTMergerPhaseAnsatzHM(REAL8 t, IMRPhenomTHMPhaseStruct *pPhase)
int IMRPhenomTSetWaveformVariables(IMRPhenomTWaveformStruct *wf, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 chi1L_In, const REAL8 chi2L_In, const REAL8 distance, const REAL8 deltaT, const REAL8 fmin, const REAL8 fRef, const REAL8 phiRef, LALDict *lalParams)
COMPLEX16 IMRPhenomTInspiralAmpAnsatzHM(REAL8 t, IMRPhenomTHMAmpStruct *pAmp)
double IMRPhenomTPhase22(REAL8 t, REAL8 thetabar, IMRPhenomTWaveformStruct *pWF, IMRPhenomTPhase22Struct *pPhase)
double IMRPhenomTRDPhaseAnsatzHM(REAL8 t, IMRPhenomTHMPhaseStruct *pPhase)
double IMRPhenomTInspiralPhaseTaylorT3(REAL8 thetabar, IMRPhenomTWaveformStruct *wf, IMRPhenomTPhase22Struct *pPhase)
int l
Definition: bh_qnmode.c:135
double theta
Definition: bh_sphwf.c:118
const double w
double complex COMPLEX16
double REAL8
uint32_t UINT4
int32_t INT4
static const INT4 m
IMRPhenomTPhase22Struct * pPhase
IMRPhenomTWaveformStruct * wf
Definition: burst.c:245
double deltaT
Definition: unicorn.c:24