Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALSimulation 6.2.0.1-5e288d3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
LALSimInspiralFDPrecAngles.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Katerina Chatziioannou, Sebastian Khan
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
21#include "LALSimIMR.h"
22
23/* *********************************************************************************/
24/* XLAL function that does everything. */
25/* *********************************************************************************/
26
28 REAL8Sequence *phiz_of_f, /**< [out] azimuthal angle of L around J */
29 REAL8Sequence *zeta_of_f, /**< [out] Third euler angle to describe L w.r.t. J */
30 REAL8Sequence *costhetaL_of_f, /**< [out] Cosine of polar angle between L and J */
31 const REAL8Sequence *f, /**< list of input Orbtial frequencies (Hz) */
32 const double m1, /**< Primary mass in SI (kg) */
33 const double m2, /**< Secondary mass in SI (kg) */
34 const double mul, /**< Cosine of Polar angle of orbital angular momentum */
35 const double phl, /**< Azimuthal angle of orbital angular momentum */
36 const double mu1, /**< Cosine of Polar angle of primary spin w.r.t. orbital angular momentum */
37 const double ph1, /**< Azimuthal angle of primary spin */
38 const double ch1, /**< Dimensionless spin magnitude of primary spin */
39 const double mu2, /**< Cosine of Polar angle of secondary spin w.r.t. orbital angular momentum */
40 const double ph2, /**< Azimuthal angle of secondary spin */
41 const double ch2, /**< Dimensionless spin magnitude of secondary spin */
42 const double f_0, /**< Reference Gravitational Wave frequency (Hz) */
43 const int ExpansionOrder /**< Keep terms upto ExpansionOrder in precession angles phi_z and zeta (1,2,3,4,5 or -1 for all orders) */
44){
45 /* Struct that stores the precession angle variables */
46 sysq *system;
47 system = (sysq *)XLALMalloc(sizeof(sysq));
48 int errcode;
49
50 errcode = InitializeSystem(system, m1, m2, mul, phl, mu1, ph1, ch1, mu2, ph2, ch2, f_0, ExpansionOrder);
51 XLAL_CHECK(errcode == XLAL_SUCCESS, XLAL_EFUNC, "InitializeSystem failed");
52
53 double xi;
54 const double twopiGM_over_cthree = LAL_TWOPI*LAL_G_SI*(m1+m2)/LAL_C_SI/LAL_C_SI/LAL_C_SI;
55 /* twopiGM_over_cthree is the same as -> LAL_TWOPI * LAL_MTSUN_SI * (m1+m2) / LAL_MSUN_SI */
56
57 vector angles;
58
59 for(UINT4 i = 0; i < (*f).length; i++){
60 xi = pow(((*f).data[i])*twopiGM_over_cthree, system->onethird);
61 angles = compute_phiz_zeta_costhetaL(xi,system);
62 (*phiz_of_f).data[i] = angles.x;
63 (*zeta_of_f).data[i] = angles.y;
64 (*costhetaL_of_f).data[i] = angles.z;
65 }
66
67 LALFree(system);
68 return XLAL_SUCCESS;
69}
70
71/* *********************************************************************************/
72/* XLAL function that does everything at 2PN non-spinning */
73/* *********************************************************************************/
74
76 REAL8Sequence *phiz_of_f, /**< [out] azimuthal angle of L around J */
77 REAL8Sequence *zeta_of_f, /**< [out] Third euler angle to describe L w.r.t. J */
78 REAL8Sequence *costhetaL_of_f, /**< [out] Cosine of polar angle between L and J */
79 const REAL8Sequence *f, /**< list of input Orbtial frequencies (Hz) */
80 const double m1, /**< Primary mass in SI (kg) */
81 const double m2, /**< Secondary mass in SI (kg) */
82 const double mul, /**< Cosine of Polar angle of orbital angular momentum */
83 const double phl, /**< Azimuthal angle of orbital angular momentum */
84 const double mu1, /**< Cosine of Polar angle of primary spin w.r.t. orbital angular momentum */
85 const double ph1, /**< Azimuthal angle of primary spin */
86 const double ch1, /**< Dimensionless spin magnitude of primary spin */
87 const double mu2, /**< Cosine of Polar angle of secondary spin w.r.t. orbital angular momentum */
88 const double ph2, /**< Azimuthal angle of secondary spin */
89 const double ch2, /**< Dimensionless spin magnitude of secondary spin */
90 const double f_0, /**< Reference Gravitational Wave frequency (Hz) */
91 const int ExpansionOrder /**< Keep terms upto ExpansionOrder in precession angles phi_z and zeta (1,2,3,4,5 or -1 for all orders) */
92)
93{
94
95 /* Struct that stores the precession angle variables */
96 sysq *system;
97 system = (sysq *)XLALMalloc(sizeof(sysq));
98 int errcode;
99
100 errcode = InitializeSystem(system, m1, m2, mul, phl, mu1, ph1, ch1, mu2, ph2, ch2, f_0, ExpansionOrder);
101 XLAL_CHECK(errcode == XLAL_SUCCESS, XLAL_EFUNC, "InitializeSystem failed");
102
103 double xi;
104 const double twopiGM_over_cthree = LAL_TWOPI * LAL_G_SI * (m1 + m2) / LAL_C_SI / LAL_C_SI / LAL_C_SI;
105 /* twopiGM_over_cthree is the same as -> LAL_TWOPI * LAL_MTSUN_SI * (m1+m2) / LAL_MSUN_SI */
106
107 vector angles;
108
109 for (UINT4 i = 0; i < (*f).length; i++)
110 {
111 xi = pow(((*f).data[i]) * twopiGM_over_cthree, system->onethird);
113 (*phiz_of_f).data[i] = angles.x;
114 (*zeta_of_f).data[i] = angles.y;
115 (*costhetaL_of_f).data[i] = angles.z;
116 }
117
118 LALFree(system);
119 return XLAL_SUCCESS;
120}
121
122/* *********************************************************************************/
123/* XLAL function that does everything at 3PN. */
124/* *********************************************************************************/
125
127 REAL8Sequence *phiz_of_f, /**< [out] azimuthal angle of L around J */
128 REAL8Sequence *zeta_of_f, /**< [out] Third euler angle to describe L w.r.t. J */
129 REAL8Sequence *costhetaL_of_f, /**< [out] Cosine of polar angle between L and J */
130 const REAL8Sequence *f, /**< list of input Orbtial frequencies (Hz) */
131 const double m1, /**< Primary mass in SI (kg) */
132 const double m2, /**< Secondary mass in SI (kg) */
133 const double mul, /**< Cosine of Polar angle of orbital angular momentum */
134 const double phl, /**< Azimuthal angle of orbital angular momentum */
135 const double mu1, /**< Cosine of Polar angle of primary spin w.r.t. orbital angular momentum */
136 const double ph1, /**< Azimuthal angle of primary spin */
137 const double ch1, /**< Dimensionless spin magnitude of primary spin */
138 const double mu2, /**< Cosine of Polar angle of secondary spin w.r.t. orbital angular momentum */
139 const double ph2, /**< Azimuthal angle of secondary spin */
140 const double ch2, /**< Dimensionless spin magnitude of secondary spin */
141 const double f_0, /**< Reference Gravitational Wave frequency (Hz) */
142 const int ExpansionOrder /**< Keep terms upto ExpansionOrder in precession angles phi_z and zeta (1,2,3,4,5 or -1 for all orders) */
143){
144
145 /* Struct that stores the precession angle variables */
146 sysq *system;
147 system = (sysq *)XLALMalloc(sizeof(sysq));
148 int errcode;
149
150 errcode = InitializeSystem(system, m1, m2, mul, phl, mu1, ph1, ch1, mu2, ph2, ch2, f_0, ExpansionOrder);
151 XLAL_CHECK(errcode == XLAL_SUCCESS, XLAL_EFUNC, "InitializeSystem failed");
152
153 double xi;
154 const double twopiGM_over_cthree = LAL_TWOPI*LAL_G_SI*(m1+m2)/LAL_C_SI/LAL_C_SI/LAL_C_SI;
155 /* twopiGM_over_cthree is the same as -> LAL_TWOPI * LAL_MTSUN_SI * (m1+m2) / LAL_MSUN_SI */
156
157 vector angles;
158
159 for(UINT4 i = 0; i < (*f).length; i++){
160 xi = pow(((*f).data[i])*twopiGM_over_cthree, system->onethird);
161 angles = compute_phiz_zeta_costhetaL3PN(xi,system);
162 (*phiz_of_f).data[i] = angles.x;
163 (*zeta_of_f).data[i] = angles.y;
164 (*costhetaL_of_f).data[i] = angles.z;
165 }
166
167 LALFree(system);
168 return XLAL_SUCCESS;
169}
170
171/**
172 * Standalone function to compute the magnitude of L divided by GMsquare_over_c to
173 * 3PN order with spin terms as a function of the orbital frequency in Hz
174 */
176 REAL8Sequence *L_norm_3PN, /**< [out] Normalised Orbital angular momentum accurate to 3PN with spin terms */
177 REAL8Sequence *f_orb_hz, /**< list of input Orbtial frequencies (Hz) */
178 const double m1, /**< Primary mass in SI (kg) */
179 const double m2, /**< Secondary mass in SI (kg) */
180 const double mul, /**< Cosine of Polar angle of orbital angular momentum */
181 const double phl, /**< Azimuthal angle of orbital angular momentum */
182 double mu1, /**< Cosine of Polar angle of primary spin w.r.t. orbital angular momentum */
183 double ph1, /**< Azimuthal angle of primary spin */
184 double ch1, /**< Dimensionless spin magnitude of primary spin */
185 double mu2, /**< Cosine of Polar angle of secondary spin w.r.t. orbital angular momentum */
186 double ph2, /**< Azimuthal angle of secondary spin */
187 double ch2, /**< Dimensionless spin magnitude of secondary spin */
188 const double f_0, /**< Reference Gravitational Wave frequency (Hz) */
189 const int ExpansionOrder /**< Keep terms upto ExpansionOrder in precession angles phi_z and zeta (1,2,3,4,5 or -1 for all orders) */
190)
191{
192 /* Struct that stores the precession angle variables */
193 sysq *system;
194 system = (sysq *)XLALMalloc(sizeof(sysq));
195 int errcode;
196
197 errcode = InitializeSystem(system, m1, m2, mul, phl, mu1, ph1, ch1, mu2, ph2, ch2, f_0, ExpansionOrder);
198 XLAL_CHECK(errcode == XLAL_SUCCESS, XLAL_EFUNC, "InitializeSystem failed");
199
200 double xi, xi_2, L_norm;
201 const double twopiGM_over_cthree = LAL_TWOPI * LAL_G_SI * (m1 + m2) / LAL_C_SI / LAL_C_SI / LAL_C_SI;
202
203 for (UINT4 i = 0; i < (*f_orb_hz).length; i++)
204 {
205 xi = pow(((*f_orb_hz).data[i]) * twopiGM_over_cthree, system->onethird);
206 xi_2 = xi * xi;
207 L_norm = (system->nu) / xi;
208 (*L_norm_3PN).data[i] = L_norm_3PN_of_xi(xi, xi_2, L_norm, system);
209 }
210
211 LALFree(system);
212 return XLAL_SUCCESS;
213
214}
#define LALFree(p)
int XLALOrbitalAngMom3PNSpinning(REAL8Sequence *L_norm_3PN, REAL8Sequence *f_orb_hz, const double m1, const double m2, const double mul, const double phl, double mu1, double ph1, double ch1, double mu2, double ph2, double ch2, const double f_0, const int ExpansionOrder)
Standalone function to compute the magnitude of L divided by GMsquare_over_c to 3PN order with spin t...
int XLALComputeAngles(REAL8Sequence *phiz_of_f, REAL8Sequence *zeta_of_f, REAL8Sequence *costhetaL_of_f, const REAL8Sequence *f, const double m1, const double m2, const double mul, const double phl, const double mu1, const double ph1, const double ch1, const double mu2, const double ph2, const double ch2, const double f_0, const int ExpansionOrder)
int XLALComputeAngles3PN(REAL8Sequence *phiz_of_f, REAL8Sequence *zeta_of_f, REAL8Sequence *costhetaL_of_f, const REAL8Sequence *f, const double m1, const double m2, const double mul, const double phl, const double mu1, const double ph1, const double ch1, const double mu2, const double ph2, const double ch2, const double f_0, const int ExpansionOrder)
int XLALComputeAngles2PNNonSpinning(REAL8Sequence *phiz_of_f, REAL8Sequence *zeta_of_f, REAL8Sequence *costhetaL_of_f, const REAL8Sequence *f, const double m1, const double m2, const double mul, const double phl, const double mu1, const double ph1, const double ch1, const double mu2, const double ph2, const double ch2, const double f_0, const int ExpansionOrder)
static UNUSED vector compute_phiz_zeta_costhetaL(const double xi, const sysq *system)
Internal function that computes phiz, zeta, and costhetaL at Newtonian order.
static double L_norm_3PN_of_xi(const double xi, const double xi_2, const double L_norm, const sysq *system)
Internal function that returns the magnitude of L divided by GMsquare_over_c to 3PN order from 060514...
static UNUSED int InitializeSystem(sysq *system, const double m1, const double m2, const double mul, const double phl, const double mu1, const double ph1, const double ch1, const double mu2, const double ph2, const double ch2, const double f_0, const int ExpansionOrder)
InitializeSystem computes all the prefactors needed to generate precession angles from Chatziioannou ...
static UNUSED vector compute_phiz_zeta_costhetaL2PNNonSpinning(const double xi, const sysq *system)
Internal function that computes phiz, zeta, and costhetaL at 2PN NonSpinning.
static UNUSED vector compute_phiz_zeta_costhetaL3PN(const double xi, const sysq *system)
Internal function that computes phiz, zeta, and costhetaL at 3PN.
double i
Definition: bh_ringdown.c:118
#define LAL_C_SI
#define LAL_TWOPI
#define LAL_G_SI
uint32_t UINT4
void * XLALMalloc(size_t n)
#define XLAL_CHECK(assertion,...)
XLAL_SUCCESS
XLAL_EFUNC