LALSimulation  5.4.0.1-fe68b98
LALSimIMRPhenomX_internals.h
Go to the documentation of this file.
1 #ifndef _LALSIM_IMR_PHENOMX_INTERNALS_H
2 #define _LALSIM_IMR_PHENOMX_INTERNALS_H
3 
4 /*
5  * Copyright (C) 2018 Geraint Pratten
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with with program; see the file COPYING. If not, write to the
19  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20  * MA 02110-1301 USA
21  */
22 
23 
24 /*
25  * \author Geraint Pratten
26  *
27  */
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #ifdef __GNUC__
34 #define UNUSED __attribute__ ((unused))
35 #else
36 #define UNUSED
37 #endif
38 
39 /* Inherited from IMRPhenomD */
40 #define N_MAX_COLLOCATION_POINTS_PHASE_RD 5
41 #define N_MAX_COLLOCATION_POINTS_PHASE_INT 5
42 #define N_MAX_COLLOCATION_POINTS_PHASE_INS 6
43 
44 #define N_MAX_COLLOCATION_POINTS_AMP_RD 5
45 #define N_MAX_COLLOCATION_POINTS_AMP_INT 5
46 #define N_MAX_COLLOCATION_POINTS_AMP_INS 5
47 
48 /* Standard libraries */
49 #include <stdlib.h>
50 #include <stdio.h>
51 #include <math.h>
52 
53 /* LAL */
54 #include <lal/LALStdlib.h>
55 #include <lal/LALConstants.h>
56 #include <lal/Date.h>
57 #include <lal/FrequencySeries.h>
58 #include <lal/Units.h>
59 
60 /* IMRPhenomX */
61 #include <lal/LALSimInspiral.h>
62 
63 /* ********************** CACHED VARIABLES ********************* */
64 /*
65  Cached, recurring coefficients that occur in IMRPhenomX.
66  Must be frequency independent.
67 */
68 typedef struct tagIMRPhenomXWaveformStruct
69 {
70  /* Debug flag */
72 
73  /* Model Version Parameters */
77 
81 
82  /* Implemented for PhenomPNR coprecessing model. When used, this value will be determined by the corresponding value in precStruct */
85 
86  /* Toggle to return coprecessing model without any twisting up */
88  /* Toggle for only returning waveform (i.e. mode) phase */
90 
91  /* Parameters that define deviation of the tuned coprecessing mode PhenomXCP from PhenomX (500) */
92  REAL8 MU1; // MR Amplitude
93  REAL8 MU2; // MR Amplitude: modifies gamma2
94  REAL8 MU3; // MR Amplitude: modifies gamma3
95  REAL8 MU4; // MR Amplitude: would modify appearance of fRing in MR amplitude
96  REAL8 NU0; // MR Phase
97  REAL8 NU4; // MR Phase
98  REAL8 NU5; // MR Phase
99  REAL8 NU6; // MR Phase
100  REAL8 ZETA1; // INT Phase
101  REAL8 ZETA2; // INT Phase
102  REAL8 PNR_DEV_PARAMETER; // Is zero when no precession, and non-zero otherwise
105 
106  /* Mass Parameters */
107  REAL8 m1_SI; // Mass in SI units
108  REAL8 m2_SI; // Mass in SI units
109  REAL8 Mtot_SI; // Total mass in SI units
110  REAL8 m1; // Mass in solar masses
111  REAL8 m2; // Mass in solar masses
112  REAL8 Mtot; // Total mass in solar masses
113  REAL8 Mc; // Chirp mass in solar masses
114  REAL8 q; // Mass ratio >= 1
115  REAL8 eta; // Symmetric mass ratio
116  REAL8 delta; // PN symmetry parameter: sqrt(1-4*eta)
117 
118  /* Spin Parameters */
130  REAL8 theta_LS; // PNR Specific
131  REAL8 a1; // PNR Specific
132 
136 
137  /* Matter parameters */
144 
145 
146  /* Useful Powers (?) */
154  REAL8 chi1L2L; // chi1 * chi2;
155 
156  /* Amplitude and Phase Normalisation */
160 
161  /* Frequencies */
164 
165  /* Ringdown value of precession angle beta */
168  /* Quantity needed to calculate effective RD frequencies (500) */
170  /* Coprecessing frame ringdown frequencies for 22 Mode (500) */
172 
173  /* Ringdown and Damping Frequencies for 22 Mode */
176 
177  /* Ringdown and Damping Frequencies for 21 Mode */
180 
181  /* Ringdown and Damping Frequencies for 33 Mode */
184 
185  /* Ringdown and Damping Frequencies for 32 Mode */
188 
189  /* Ringdown and Damping Frequencies for 44 Mode */
192 
200 
201  // Dimensionless frequency (Mf) defining the end of the waveform
203 
212 
213  /* Final mass and spin */
217 
218  /* (500) Final mass and spin: It will at times be useful to use both separately. */
221 
225 
226  LALDict *LALparams;
227 
228  /* PhenomXO4 variables */
230 
231  /* Frequency at which to force XAS/XHM phase and phase derivative value */
235  /* Strategy: valies e.g. XHM_dphase_at_f_inspiral_align are updated within
236  loop over ell and emm within IMRPhenomXPHM_hplushcross. Within same loop,
237  e.g. IMRPhenomXHMGenerateFDOneMode is called to generate a coprecessing
238  moment. At that time, the values of e.g. XHM_dphase_at_f_inspiral_align
239  defined in IMRPhenomXHM_PNR_SetPhaseAlignmentParams.*/
242 
244 
246 
247 
248 typedef struct tagIMRPhenomX_UsefulPowers
249 {
279 
281 
283 
284 /*
285  * useful powers of LAL_PI, calculated once and kept constant - to be initied with a call to
286  */
288 
289 typedef struct tagIMRPhenomXPhaseCoefficients
290 {
291  /* PHASE */
292  /* Phase Transition Frequencies */
299 
302 
303  REAL8 C1Int, C2Int;
304  REAL8 C1MRD, C2MRD;
305 
306  /* These are the RD phenomenological coefficients */
307  REAL8 c0, c1, c2, c3, c4, cL, cRD, cLGR;
308 
309  /* These are the intermediate phenomenological coefficients */
310  REAL8 b0, b1, b2, b3, b4;
311 
312  /* These are the inspiral phenomenological coefficients */
313  REAL8 a0, a1, a2, a3, a4;
314 
315  /* Coefficients enterting tidal phase */
316  REAL8 c2PN_tidal, c3PN_tidal, c3p5PN_tidal;
317 
318  /* Pre-cached variables */
319  REAL8 c4ov3, cLovfda, nonGR_dcl;
320 
321  /* TaylorF2 PN Coefficients */
322  REAL8 phi_minus2, phi_minus1, phi0, phi1, phi2, phi3, phi4, phi5, phi6, phi7, phi8, phi9, phi10, phi11, phi12, phi13, phi5L, phi6L, phi8L, phi9L;
323  REAL8 phi_initial, phiNorm;
324  REAL8 dphi_minus2, dphi_minus1, dphi0, dphi1, dphi2, dphi3, dphi4, dphi5, dphi6, dphi7, dphi8, dphi9, dphi10, dphi11, dphi12, dphi13, dphi5L, dphi6L, dphi8L, dphi9L;
325 
326  /* Pseudo-PN Coefficients */
327  REAL8 sigma0, sigma1, sigma2, sigma3, sigma4, sigma5;
328 
329  /* Flag to set how many collocation points the RD region uses */
331 
332  /* Flag to set how many collocation points the INT region uses */
334 
335  /* Integer to tell us how many pseudo PN terms are used */
338 
339  /* The canonical ringdown phase is constructed from 5 collocation points */
340  REAL8 CollocationPointsPhaseRD[N_MAX_COLLOCATION_POINTS_PHASE_RD];
341  REAL8 CollocationValuesPhaseRD[N_MAX_COLLOCATION_POINTS_PHASE_RD];
343 
344 
345  /* The canonical intermediate phase is constructed from 4/5 collocation points */
346  REAL8 CollocationPointsPhaseInt[N_MAX_COLLOCATION_POINTS_PHASE_INT];
347  REAL8 CollocationValuesPhaseInt[N_MAX_COLLOCATION_POINTS_PHASE_INT];
349 
350  /*
351  For N pseudo-PN terms we need N+1 collocation points:
352  We have set N_MAX_COLLOCATION_POINTS_INS = 5 to allow
353  either 3 or 4 pseudo-PN coefficients to be used.
354  */
355  REAL8 CollocationPointsPhaseIns[N_MAX_COLLOCATION_POINTS_PHASE_INS];
356  REAL8 CollocationValuesPhaseIns[N_MAX_COLLOCATION_POINTS_PHASE_INS];
358 
360 
361 typedef struct tagIMRPhenomXAmpCoefficients
362 {
369 
372 
373  /* These are the RD phenomenological coefficients */
374  REAL8 c0, c1, c2, c3, c4, cL;
375 
376  /* These are the intermediate phenomenological coefficients */
377  REAL8 b0, b1, b2, b3, b4, b5;
378 
379  /* These are the inspiral phenomenological coefficients */
380  REAL8 a0, a1, a2, a3, a4, a5;
381 
382  REAL8 v1RD, sigmaRD;
383 
384  REAL8 rho1, rho2, rho3; /* Inspiral pseudo-PN coefficients */
385  REAL8 delta0, delta1, delta2, delta3, delta4, delta5; /* Intermediate phenomenological coefficients */
386  REAL8 gamma1, gamma2, gamma3; /* Ringdown phenomenological coefficients */
387  REAL8 gammaR, gammaD13, gammaD2;
388 
389  /* PN Amplitude Prefactors */
390  REAL8 pnInitial, pnOneThird, pnTwoThirds, pnThreeThirds, pnFourThirds, pnFiveThirds, pnSixThirds, pnSevenThirds, pnEightThirds, pnNineThirds;
391 
392  /* Flags to set the ringdown amplitude version */
395 
396  /* Flags to set the intermediate amplitude version */
399 
400  /* Flags to set the inspiral amplitude version */
403 
404  /* The ringdown is constructed from 5 collocation points */
405  REAL8 CollocationPointsAmpRD[N_MAX_COLLOCATION_POINTS_AMP_RD];
406  REAL8 CollocationValuesAmpRD[N_MAX_COLLOCATION_POINTS_AMP_RD];
407 
408  REAL8 CollocationPointsAmpInt[N_MAX_COLLOCATION_POINTS_AMP_INT];
409  REAL8 CollocationValuesAmpInt[N_MAX_COLLOCATION_POINTS_AMP_INT];
410 
411  /* For 3 pseudo-PN parameters we need 4 collocation points */
412  /* For 4 pseudo-PN parameters we need 5 collocation points, etc... */
413  REAL8 CollocationPointsAmpIns[N_MAX_COLLOCATION_POINTS_AMP_INS];
414  REAL8 CollocationValuesAmpIns[N_MAX_COLLOCATION_POINTS_AMP_INS];
415 
417 
418 
419 
420 ///////////////////////////// Useful Numerical Routines /////////////////////////////
423 
426  const REAL8 m1_SI,
427  const REAL8 m2_SI,
428  const REAL8 chi1L_In,
429  const REAL8 chi2L_In,
430  const REAL8 deltaF,
431  const REAL8 fRef,
432  const REAL8 phiRef,
433  const REAL8 f_min,
434  const REAL8 f_max,
435  const REAL8 distance,
436  const REAL8 inclination,
437  LALDict *lalParams,
438  const UINT4 debug
439 );
440 
444 
447 
449 
451 
452 /* Function to check if the input mode array contains supported modes */
453 INT4 check_input_mode_array(LALDict *lalParams);
454 
455 /* Function to compute full model phase */
456 INT4 IMRPhenomX_FullPhase_22(double *phase, double *dphase, double Mf, IMRPhenomXPhaseCoefficients *pPhase, IMRPhenomXWaveformStruct *pWF);
457 
459 
463 
464 #ifdef __cplusplus
465 }
466 #endif
467 
468 #endif // of #ifndef _LALSIM_IMR_PHENOMX_INTERNALS_H
const double b1
const double c1
const double b2
const double c2
#define N_MAX_COLLOCATION_POINTS_AMP_INS
#define N_MAX_COLLOCATION_POINTS_PHASE_RD
IMRPhenomX_UsefulPowers powers_of_lalpi
double IMRPhenomX_TimeShift_22(IMRPhenomXPhaseCoefficients *pPhase, IMRPhenomXWaveformStruct *pWF)
REAL8 IMRPhenomX_TidalPhaseDerivative(IMRPhenomX_UsefulPowers *powers_of_Mf, IMRPhenomXWaveformStruct *pWF, IMRPhenomXPhaseCoefficients *pPhase, NRTidal_version_type NRTidal_version)
double IMRPhenomX_Amplitude_22(double f, IMRPhenomX_UsefulPowers *powers_of_f, IMRPhenomXAmpCoefficients *pAmp, IMRPhenomXWaveformStruct *pWF)
void IMRPhenomX_Phase_22_ConnectionCoefficients(IMRPhenomXWaveformStruct *pWF, IMRPhenomXPhaseCoefficients *pPhase)
int IMRPhenomXGetAmplitudeCoefficients(IMRPhenomXWaveformStruct *pWF, IMRPhenomXAmpCoefficients *pAmp)
int IMRPhenomX_Initialize_Powers(IMRPhenomX_UsefulPowers *p, REAL8 number)
#define N_MAX_COLLOCATION_POINTS_PHASE_INT
NRTidal_version_type IMRPhenomX_SetTidalVersion(LALDict *LALParams)
#define N_MAX_COLLOCATION_POINTS_PHASE_INS
void IMRPhenomXGetTidalPhaseCoefficients(IMRPhenomXWaveformStruct *pWF, IMRPhenomXPhaseCoefficients *pPhase, NRTidal_version_type NRTidal_version)
REAL8 IMRPhenomX_TidalPhase(IMRPhenomX_UsefulPowers *powers_of_Mf, IMRPhenomXWaveformStruct *pWF, IMRPhenomXPhaseCoefficients *pPhase, NRTidal_version_type NRTidal_version)
int IMRPhenomX_Initialize_Powers_Light(IMRPhenomX_UsefulPowers *p, REAL8 number)
int IMRPhenomXGetPhaseCoefficients(IMRPhenomXWaveformStruct *pWF, IMRPhenomXPhaseCoefficients *pPhase)
double IMRPhenomX_Phase_22(double f, IMRPhenomX_UsefulPowers *powers_of_f, IMRPhenomXPhaseCoefficients *Phase, IMRPhenomXWaveformStruct *pWF)
#define N_MAX_COLLOCATION_POINTS_AMP_INT
int IMRPhenomXSetWaveformVariables(IMRPhenomXWaveformStruct *pWF, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 chi1L_In, const REAL8 chi2L_In, const REAL8 deltaF, const REAL8 fRef, const REAL8 phiRef, const REAL8 f_min, const REAL8 f_max, const REAL8 distance, const REAL8 inclination, LALDict *lalParams, const UINT4 debug)
#define N_MAX_COLLOCATION_POINTS_AMP_RD
double IMRPhenomX_dPhase_22(double ff, IMRPhenomX_UsefulPowers *powers_of_f, IMRPhenomXPhaseCoefficients *pPhase, IMRPhenomXWaveformStruct *pWF)
INT4 check_input_mode_array(LALDict *lalParams)
INT4 IMRPhenomX_FullPhase_22(double *phase, double *dphase, double Mf, IMRPhenomXPhaseCoefficients *pPhase, IMRPhenomXWaveformStruct *pWF)
const double a4
const double a2
const double rho2
double REAL8
uint32_t UINT4
int32_t INT4
NRTidal_version_type
Definition: LALSimIMR.h:80
double f_min
Definition: unicorn.c:22
double f_max
Definition: unicorn.c:23