Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALSimulation 6.2.0.1-b246709
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
NSBHPropertiesTest.c
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2019 Edward Jacob Fauchon-Jones, Jonathan E. Thompson, Sebastian Khan
3 * Test code for LALSimIMRPhenomNSBH
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with with program; see the file COPYING. If not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301 USA
19 */
20
21#include <stdio.h>
22#include <stdlib.h>
23#include <math.h>
24#include <float.h>
25
26#include <lal/Units.h>
27#include <lal/LALAdaptiveRungeKuttaIntegrator.h>
28#include <lal/LALConstants.h>
29#include <lal/FindRoot.h>
30#include <lal/SeqFactories.h>
31#include <lal/LALSimInspiral.h>
32#include <lal/LALSimIMR.h>
33
34#include <lal/LALSimNoise.h>
35#include <lal/ComplexFFT.h>
36
37#include <lal/ComplexFFT.h>
38#include <gsl/gsl_errno.h>
39#include <gsl/gsl_spline.h>
40#include <gsl/gsl_math.h>
41
42#define MYUNUSED(expr) do { (void)(expr); } while (0)
43
44bool approximatelyEqual(REAL8 a, REAL8 b, REAL8 epsilon);
46 if (a == 0)
47 return fabs(b) < epsilon;
48 else if (b == 0)
49 return fabs(a) < epsilon;
50 else
51 return !gsl_fcmp(a, b, epsilon);
52}
53
54void print_difference(const char *name, REAL8 u, REAL8 u_expected);
55void print_difference(const char *name, REAL8 u, REAL8 u_expected) {
56 printf("%s: %-20.17g\t%-20.17g\t%-20.17g\n", name, u, u_expected, u - u_expected);
57}
58
59#define COUNT_FGWINKERR 9
60#define TOLERANCE_FGWINKERR 1e-8
62 {8.7173522796064891, 1.0, -0.900}, {13.0760284194097345, 1.0, -0.900},
63 {17.4347045592129781, 1.0, -0.900}, {6.0000000000000000, 1.0, 0.000},
64 {9.0000000000000000, 1.0, 0.000}, {12.0000000000000000, 1.0, 0.000},
65 {2.3208830417618871, 1.0, 0.900}, {3.4813245626428309, 1.0, 0.900},
66 {4.6417660835237742, 1.0, 0.900}};
68 0.01281537532531727, 0.00686250007959751, 0.00442721737694587,
69 0.02165824447871323, 0.0117892550438441, 0.007657345769747112,
70 0.07176032468044616, 0.04304065885628561, 0.0292012072733511};
71static void Test_fGWinKerr(void);
72static void Test_fGWinKerr(void) {
73 printf("\n## Test_fGWinKerr\n\n");
74 for (int i=0; i<COUNT_FGWINKERR; i++) {
78 input_fGWinKerr[i][2]);
79 print_difference("XLALSimNSBH_fGWinKerr", output, expected_fGWinKerr[i]);
81 }
82}
83
84#define COUNT_RKERRISCO 7
85#define TOLERANCE_RKERRISCO 1e-8
87 {-0.90}, {-0.60}, {-0.30}, {-0.00}, {0.30}, {0.60}, {0.90}};
89 8.717352279606489, 7.850686185306578, 6.949272527004718, 6, 4.97861683057595,
90 3.829069418813151, 2.320883041761887};
91static void Test_rKerrISCO(void);
92static void Test_rKerrISCO(void) {
93 printf("\n## Test_rKerrISCO\n\n");
94 for (int i=0; i<COUNT_RKERRISCO; i++) {
96 input_rKerrISCO[i][0]);
97 print_difference("XLALSimNSBH_rKerrISCO", output, expected_rKerrISCO[i]);
99 }
100}
101
102#define COUNT_XI_TIDE 36
103#define TOLERANCE_XI_TIDE 1e-8
105 {2.00, -0.90, 0.28}, {2.00, -0.90, 0.34}, {2.00, -0.90, 0.4}, {2.00, 0.00, 0.28},
106 {2.00, 0.00, 0.34}, {2.00, 0.00, 0.4}, {2.00, 0.90, 0.28}, {2.00, 0.90, 0.34}, {2.00, 0.90, 0.4},
107 {3.00, -0.90, 0.42}, {3.00, -0.90, 0.51}, {3.00, -0.90, 0.6}, {3.00, 0.00, 0.42},
108 {3.00, 0.00, 0.51}, {3.00, 0.00, 0.6}, {3.00, 0.90, 0.42}, {3.00, 0.90, 0.51}, {3.00, 0.90, 0.6},
109 {4.00, -0.90, 0.56}, {4.00, -0.90, 0.68}, {4.00, -0.90, 0.8}, {4.00, 0.00, 0.56},
110 {4.00, 0.00, 0.68}, {4.00, 0.00, 0.8}, {4.00, 0.90, 0.56}, {4.00, 0.90, 0.68}, {4.00, 0.90, 0.8},
111 {5.00, -0.90, 0.7}, {5.00, -0.90, 0.85}, {5.00, -0.90, 1}, {5.00, 0.00, 0.7}, {5.00, 0.00, 0.85},
112 {5.00, 0.00, 1}, {5.00, 0.90, 0.7}, {5.00, 0.90, 0.85}, {5.00, 0.90, 1}};
114 2.06871189988092, 2.165647459230484, 2.279729557247444, 1.957702074572125,
115 2.005770585734644, 2.063058314326985, 1.874012683952472, 1.884478196440186,
116 1.894984431945135, 2.535178557740413, 2.72161470061767, 2.939474255173244,
117 2.324039062239011, 2.419350068761182, 2.5369293431522, 2.162563923478413,
118 2.178495207637674, 2.19511940553916, 2.992537647891789, 3.286528350419773,
119 3.623185704395681, 2.661277126455292, 2.820959995701167, 3.018859346483027,
120 2.397505338613715, 2.419802208282962, 2.444234246009384, 3.455945198308276,
121 3.868295212767634, 4.330079575392291, 2.991668576796354, 3.230879137923294,
122 3.522510111613574, 2.600443557587901, 2.630444772711848, 2.665283137995229};
123static void Test_xi_tide(void);
124static void Test_xi_tide(void) {
125 printf("\n## Test_xi_tide\n\n");
126 for (int i=0; i<COUNT_XI_TIDE; i++) {
128 input_xi_tide[i][0],
129 input_xi_tide[i][1],
130 input_xi_tide[i][2]);
131 print_difference("XLALSimNSBH_xi_tide", output, expected_xi_tide[i]);
133 }
134}
135
136#define COUNT_COMPACTNESS_FROM_LAMBDA 21
137#define TOLERANCE_COMPACTNESS_FROM_LAMBDA 1e-8
139 {0.0}, {200.0}, {400.0}, {600.0}, {800.0}, {1000.0}, {1200.0}, {1400.0}, {1600.0}, {1800.0},
140 {2000.0}, {2200.0}, {2400.0}, {2600.0}, {2800.0}, {3000.0}, {3200.0}, {3400.0}, {3600.0}, {3800.0},
141 {4000.0}};
143 0.5, 0.1917006111637932, 0.1726108500082392, 0.1617580970945444,
144 0.1541985276023099, 0.1484152311071196, 0.1437420509536809,
145 0.1398274999660475, 0.1364636439460052, 0.1335173810600413,
146 0.1308984340168845, 0.1285427920411775, 0.1264034435624421,
147 0.1244448606165661, 0.1226395498186449, 0.1209658060963831,
148 0.1194061990393252, 0.1179465229202867, 0.1165750499338684,
149 0.1152819874103816, 0.114059075676274};
150static void Test_compactness_from_lambda(void);
152 printf("\n## Test_compactness_from_lambda\n\n");
153 for (int i=0; i<COUNT_COMPACTNESS_FROM_LAMBDA; i++) {
156 print_difference("XLALSimNSBH_compactness_from_lambda", output, expected_compactness_from_lambda[i]);
158 }
159}
160
161#define COUNT_TORUS_MASS_FIT 36
162#define TOLERANCE_TORUS_MASS_FIT 1e-8
164 {2.00, -0.90, 0.14}, {2.00, -0.90, 0.17}, {2.00, -0.90, 0.20}, {2.00, 0.00, 0.14},
165 {2.00, 0.00, 0.17}, {2.00, 0.00, 0.20}, {2.00, 0.90, 0.14}, {2.00, 0.90, 0.17}, {2.00, 0.90, 0.20},
166 {3.00, -0.90, 0.14}, {3.00, -0.90, 0.17}, {3.00, -0.90, 0.20}, {3.00, 0.00, 0.14},
167 {3.00, 0.00, 0.17}, {3.00, 0.00, 0.20}, {3.00, 0.90, 0.14}, {3.00, 0.90, 0.17}, {3.00, 0.90, 0.20},
168 {4.00, -0.90, 0.14}, {4.00, -0.90, 0.17}, {4.00, -0.90, 0.20}, {4.00, 0.00, 0.14},
169 {4.00, 0.00, 0.17}, {4.00, 0.00, 0.20}, {4.00, 0.90, 0.14}, {4.00, 0.90, 0.17}, {4.00, 0.90, 0.20},
170 {5.00, -0.90, 0.14}, {5.00, -0.90, 0.17}, {5.00, -0.90, 0.20}, {5.00, 0.00, 0.14},
171 {5.00, 0.00, 0.17}, {5.00, 0.00, 0.20}, {5.00, 0.90, 0.14}, {5.00, 0.90, 0.17}, {5.00, 0.90, 0.20}};
173 0.02349705295506288, 0, 0, 0.1299454661328111, 0.0430073416291199, 0,
174 0.2882657031643916, 0.2332155204085186, 0.1778008350569429, 0, 0, 0,
175 0.06437920494437788, 0, 0, 0.2941998033123807, 0.2231866136920418,
176 0.1517306063389851, 0, 0, 0, 0, 0, 0, 0.2887085776862365, 0.2028602793140871,
177 0.1165992019782404, 0, 0, 0, 0, 0, 0, 0.2763968308942356, 0.1765433406768961,
178 0.07648328516666991};
179static void Test_torus_mass_fit(void);
180static void Test_torus_mass_fit(void) {
181 printf("\n## Test_torus_mass_fit\n\n");
182 for (int i=0; i<COUNT_TORUS_MASS_FIT; i++) {
187 print_difference("XLALSimNSBH_torus_mass_fit", output, expected_torus_mass_fit[i]);
189 }
190}
191
192int main(int argc, char *argv[]) {
193 MYUNUSED(argc);
194 MYUNUSED(argv);
195
198
199 Test_xi_tide();
202
203 return 0;
204}
const char * name
double input_rKerrISCO[COUNT_RKERRISCO][1]
#define TOLERANCE_FGWINKERR
bool approximatelyEqual(REAL8 a, REAL8 b, REAL8 epsilon)
#define COUNT_COMPACTNESS_FROM_LAMBDA
int main(int argc, char *argv[])
#define COUNT_TORUS_MASS_FIT
static void Test_rKerrISCO(void)
double expected_compactness_from_lambda[COUNT_COMPACTNESS_FROM_LAMBDA]
#define MYUNUSED(expr)
static void Test_xi_tide(void)
double input_compactness_from_lambda[COUNT_COMPACTNESS_FROM_LAMBDA][1]
double input_fGWinKerr[COUNT_FGWINKERR][3]
#define COUNT_XI_TIDE
double expected_xi_tide[COUNT_XI_TIDE]
double input_torus_mass_fit[COUNT_TORUS_MASS_FIT][3]
#define TOLERANCE_XI_TIDE
#define TOLERANCE_TORUS_MASS_FIT
void print_difference(const char *name, REAL8 u, REAL8 u_expected)
double input_xi_tide[COUNT_XI_TIDE][3]
static void Test_torus_mass_fit(void)
#define COUNT_RKERRISCO
double expected_rKerrISCO[COUNT_RKERRISCO]
double expected_torus_mass_fit[COUNT_TORUS_MASS_FIT]
static void Test_compactness_from_lambda(void)
#define TOLERANCE_COMPACTNESS_FROM_LAMBDA
double expected_fGWinKerr[COUNT_FGWINKERR]
#define COUNT_FGWINKERR
static void Test_fGWinKerr(void)
#define TOLERANCE_RKERRISCO
double i
Definition: bh_ringdown.c:118
const double u
double REAL8
double XLALSimNSBH_compactness_from_lambda(const REAL8 Lambda)
Compactness as a function of tidal deformability.
double XLALSimNSBH_torus_mass_fit(const REAL8 q, const REAL8 a, const REAL8 C)
Baryonic mass of the torus remnant of a BH-NS merger.
double XLALSimNSBH_fGWinKerr(const REAL8 r, const REAL8 M, const REAL8 a)
GW frequency for a particle on Kerr.
double XLALSimNSBH_xi_tide(const REAL8 q, const REAL8 a, const REAL8 mu)
Relativistic correction to orbital radius at mass-shedding.
double XLALSimNSBH_rKerrISCO(const REAL8 a)
Kerr BH ISCO radius.
static const INT4 a
#define XLAL_CHECK_EXIT(assertion)
char output[FILENAME_MAX]
Definition: unicorn.c:26