Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALSimulation 6.2.0.1-da3b9d3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
LALSimInspiralEOS.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 Walter Del Pozzo, Tjonnie Li, Michalis Agathos
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 #include <stdlib.h>
20 #include <stdio.h>
21 #include <string.h>
22 #include <lal/LALSimInspiralEOS.h>
23 #include <lal/LALSimInspiral.h>
24
26 {
28 if (!strcmp("MS1",eos_name)) eos = LAL_SIM_INSPIRAL_EOS_MS1;
29 else if (!strcmp("H4",eos_name)) eos = LAL_SIM_INSPIRAL_EOS_H4;
30 else if (!strcmp("SQM3",eos_name)) eos = LAL_SIM_INSPIRAL_EOS_SQM3;
31 else if (!strcmp("MPA1",eos_name)) eos = LAL_SIM_INSPIRAL_EOS_MPA1;
32 else if (!strcmp("GNH3",eos_name)) eos = LAL_SIM_INSPIRAL_EOS_GNH3;
33 else if (!strcmp("A",eos_name)) eos = LAL_SIM_INSPIRAL_EOS_A;
34 else if (!strcmp("AU",eos_name)) eos = LAL_SIM_INSPIRAL_EOS_AU;
35 else if (!strcmp("FPS",eos_name)) eos = LAL_SIM_INSPIRAL_EOS_FPS;
36 else if (!strcmp("APR",eos_name)) eos = LAL_SIM_INSPIRAL_EOS_APR;
37 else if (!strcmp("UU",eos_name)) eos = LAL_SIM_INSPIRAL_EOS_UU;
38 else if (!strcmp("L",eos_name)) eos = LAL_SIM_INSPIRAL_EOS_L;
39 else if (!strcmp("PP",eos_name)) eos = LAL_SIM_INSPIRAL_EOS_NONE;
40 else
41 {
42 XLALPrintError( "XLAL Error - %s: Equation of state %s not recognized.", __func__, eos_name);
44 }
45 return eos;
46 }
47
48REAL8 XLALSimInspiralEOSLambda(LALEquationOfState eos_type, REAL8 m_intr_msun){/** this must be fed the INTRINSIC mass */
49
50 /* this is fed the intrinsic masses and then computes the value of \Lambda(m) See Hinderer et al ( http://arxiv.org/abs/0911.3535 ) for details of the EOSes*/
51 /* \Lambda(m) is in units of s^5 */
52 REAL8 lambda=0.;
53// printf("EOS number: %d\n", eos_type);
54// printf("mass: %e\n", m_intr_msun);
55 switch (eos_type)
56 {
58 lambda = 0.0;
59 break;
60 // MS1
62 // printf("Using EOS MS1\n");
63 lambda = 2.755956E-24*(2.19296 + 20.0273*m_intr_msun - 17.9443*m_intr_msun*m_intr_msun
64 + 5.75129*m_intr_msun*m_intr_msun*m_intr_msun - 0.699095*m_intr_msun*m_intr_msun*m_intr_msun*m_intr_msun);
65 break;
66 // H4
68 lambda = 2.755956E-24*(0.743351 + 15.8917*m_intr_msun - 14.7348*m_intr_msun*m_intr_msun
69 + 5.32863*m_intr_msun*m_intr_msun*m_intr_msun - 0.942625*m_intr_msun*m_intr_msun*m_intr_msun*m_intr_msun);
70 break;
71 // SQM3
73 lambda = 2.755956E-24*(-5.55858 + 20.8977*m_intr_msun - 20.5583*m_intr_msun*m_intr_msun
74 + 9.55465*m_intr_msun*m_intr_msun*m_intr_msun - 1.84933*m_intr_msun*m_intr_msun*m_intr_msun*m_intr_msun);
75 break;
76 // MPA1
78 lambda = 2.755956E-24*(0.276761 + 7.26925*m_intr_msun - 5.72102*m_intr_msun*m_intr_msun
79 + 1.51347*m_intr_msun*m_intr_msun*m_intr_msun - 0.152181*m_intr_msun*m_intr_msun*m_intr_msun*m_intr_msun);
80 break;
81 // GNH3
83 lambda = 2.755956E-24*(7.80715 + 0.683549*m_intr_msun + 1.21351*m_intr_msun*m_intr_msun
84 - 3.50234*m_intr_msun*m_intr_msun*m_intr_msun + 0.894662*m_intr_msun*m_intr_msun*m_intr_msun*m_intr_msun);
85 break;
86 default:
87 lambda = 0.0;
88 break;
89 }
90// printf("calculated love number: %e\n", lambda);
91 if (lambda<0.0) return 0.0;
92 else return lambda;
93}
94
96 mass = mass*LAL_MTSUN_SI;
97 // [LAMBDA0] = SEC^5; [LAMBDA1] = SEC^4; [LAMBDA2] = SEC^3
98 REAL8 lambda = 1.0E-23*c0 + 1.0E-18*(mass-1.4*LAL_MTSUN_SI)*c1 + 1.0E-13*(mass-1.4*LAL_MTSUN_SI)*(mass-1.4*LAL_MTSUN_SI)*c2;
99 lambda = (lambda > 0.0) ? lambda : 0.0;
100 return lambda;
101}
102
103
105 /* Quadrupole-monopole parameter calculated from love number;
106 see http://arxiv.org/abs/1303.1528 */
107 REAL8 q, loglam;
108 REAL8 tolerance = 5E-1;
109 if(lambda<tolerance) { //printf("Love number is (nearly) zero; cannot compute QM parameter. Setting to 1.0 (BH value).\n");
110 q = 1.0; }
111 else {
112 loglam = log(lambda);
113 q = 0.194 + 0.0936*loglam + 0.0474*loglam*loglam;
114 q -= 0.00421*loglam*loglam*loglam;
115 q += 0.000123*loglam*loglam*loglam*loglam;
116 q = exp(q);
117 }
118
119// printf("%e %e\n", l, q); // Testing numerical results from these functions.
120
121 return q;
122
123}
124
126
127 REAL8 q = 0.0 ;
128 REAL8 m = m_intr_msun ;
129 REAL8 m2 = m*m ;
130 REAL8 m3 = m2*m ;
131
132 switch (eos_type) {
133 /* */
135 q = -6.41414141*m3 + 30.70779221*m2 - 53.37417027*m + 35.62253247 ;
136 break;
137 /* */
139 q = -6.18686869*m3 + 30.15909091*m2 - 52.87806638*m + 35.86616883 ;
140 break;
141 /* */
143 q = -3.86363636*m3 + 21.03030303*m2 - 42.19448052*m + 32.83722944 ;
144 break;
145 /* */
147 q = -10.55555556*m3 + 49.52380952*m2 - 82.77063492*m + 53.02428571 ;
148 break;
149 /* */
151 q = -8.03030303*m3 + 37.61363636*m2 - 63.48733766*m + 41.75080087 ;
152 break;
153 /* */
155 q = -6.59090909*m3 + 33.67424242*m2 - 63.77034632*m + 48.98073593 ;
156 break;
158 q = 1.0 ;
159 break;
160
161 default:
162 q = 1.0 ;
163 break ;
164 }
165
166 if (q < 1.0) {
167 q = 1.0;
168 }
169
170 return q ;
171}
172
173/**
174 * This function estimates the radius of a NS of a given mass and
175 * tidal deformability parameter, based on the "I-Love-Q forever" relation
176 * of Maselli et al, arXiv:1304.2052v1.
177 * To be used for masses within [1.2,2]M_sun, and preferably not for strange
178 * quark stars (since the relation is calibrated for this mass range and for
179 * the EoS APR4, MS1, H4).
180 * For a BH, (lambda=0) it returns the Schwarzschild radius.
181 * The arguments are:
182 * m_intr_msun the intrinsic mass in solar masses
183 * barlambda the dimensionless tidal deformability (lambda/m^5)
184 * The return value is the radius in meters.
185 */
186
188
189 REAL8 loglambda;
190 REAL8 compactness, radius ;
191 REAL8 tolerance = 1E-15;
192
193 /* Check for sign of lambda */
194 if ( barlambda <= tolerance && barlambda >= 0.0 ) {
195 /* This is a black hole */
196 compactness = 0.5;
197 }
198 else if ( barlambda > tolerance ) {
199 loglambda = log(barlambda);
200 /* Calculate compactness according to arXiv:1304.2052v1 */
201 compactness = 0.371 - 0.0391*loglambda + 0.001056*loglambda*loglambda;
202 }
203 else {
204 XLALPrintError( "XLAL Error - %s: Tidal deformability is negative. Only positive values are acceptable.", __func__);
206 }
207
208 /* Check that radius is larger than Schwarzschild radius */
209 if ( compactness > 0.5 ) {
210 XLALPrintWarning( "XLAL Warning - %s: Neutron Star is calculated to have compactness larger than a black hole (C = %f, lambda = %f, m = %f).\n Setting C=0.5 ...", __func__, compactness, barlambda, m_intr_msun);
211 compactness = 0.5;
212 }
213
214 if ( compactness < 0.0 ) {
215 XLALPrintError( "XLAL Error - %s: Neutron Star is calculated to have negative compactness (C = %f, lambda = %f, m = %f).", __func__, compactness, barlambda, m_intr_msun);
217 }
218
219 radius = LAL_MRSUN_SI * m_intr_msun / compactness;
220
221 return radius;
222
223}
224
225
226/**
227 * This function estimates the radius for a binary of given masses and
228 * tidal deformability parameters.
229 * It uses XLALSimInspiralNSRadiusOfLambdaM() to calculate radii (see above).
230 * The arguments are:
231 * m1_intr, m2_intr the intrinsic masses in solar masses
232 * barlambda1, barlambda2 the dimensionless tidal deformabilities (lambda_i/m_i^5)
233 * The return value is the GW contact frequency in Hz.
234 */
235
236REAL8 XLALSimInspiralContactFrequency(REAL8 m1_intr, REAL8 barlambda1, REAL8 m2_intr, REAL8 barlambda2){
237
238 REAL8 r1, r2, rtot, mtot, f_gw_contact;
239
240 /* Calculate radii for the two components */
241 r1 = XLALSimInspiralNSRadiusOfLambdaM(m1_intr, barlambda1);
242 r2 = XLALSimInspiralNSRadiusOfLambdaM(m2_intr, barlambda2);
243
244 rtot = (r1 + r2)/LAL_C_SI; // Orbital distance in seconds
245 mtot = (m1_intr + m2_intr)*LAL_MTSUN_SI; // Total mass in seconds
246
247 /* Calculate the GW contact frequency */
248 f_gw_contact = sqrt(mtot/(rtot*rtot*rtot))/LAL_PI;
249 if ( f_gw_contact < 0.0 ) {
250 XLALPrintError( "XLAL Error - %s: Contact frequency is calculated to be negative (fcontact = %f)", __func__, f_gw_contact);
252 }
253
254 return f_gw_contact;
255
256}
const double c1
const double c2
const double c0
REAL8 XLALSimInspiralNSRadiusOfLambdaM(REAL8 m_intr_msun, REAL8 barlambda)
This function estimates the radius of a NS of a given mass and tidal deformability parameter,...
REAL8 XLALSimInspiralEOSLambda(LALEquationOfState eos_type, REAL8 m_intr_msun)
LALEquationOfState XLALSimEOSfromString(char eos_name[])
REAL8 XLALSimInspiralContactFrequency(REAL8 m1_intr, REAL8 barlambda1, REAL8 m2_intr, REAL8 barlambda2)
This function estimates the radius for a binary of given masses and tidal deformability parameters.
REAL8 XLALSimInspiralEOSQfromLambda(REAL8 lambda)
REAL8 XLALLambdaQuadratic(REAL8 c0, REAL8 c1, REAL8 c2, REAL8 mass)
REAL8 XLALSimInspiralEOSqmparameter(LALEquationOfState eos_type, REAL8 m_intr_msun)
LALEquationOfState
The first enum types are available for both lambda and q From EOS_Lambda_q_Specific,...
@ LAL_SIM_INSPIRAL_EOS_FPS
EOS available for q.
@ LAL_SIM_INSPIRAL_EOS_MPA1
EOS available for lambda.
@ LAL_SIM_INSPIRAL_EOS_UU
EOS available for q.
@ LAL_SIM_INSPIRAL_EOS_MS1
EOS available for lambda.
@ LAL_SIM_INSPIRAL_EOS_A
EOS available for q.
@ LAL_SIM_INSPIRAL_EOS_L
EOS available for q.
@ LAL_SIM_INSPIRAL_EOS_NONE
A black hole.
@ LAL_SIM_INSPIRAL_EOS_GNH3
EOS available for lambda.
@ LAL_SIM_INSPIRAL_EOS_SQM3
EOS available for lambda.
@ LAL_SIM_INSPIRAL_EOS_H4
EOS available for lambda.
@ LAL_SIM_INSPIRAL_EOS_APR
EOS available for q.
@ LAL_SIM_INSPIRAL_EOS_AU
EOS available for q.
const double r2
#define LAL_C_SI
#define LAL_PI
#define LAL_MTSUN_SI
#define LAL_MRSUN_SI
double REAL8
static const INT4 m
static const INT4 q
#define XLAL_ERROR_REAL8(...)
#define XLAL_ERROR(...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
int int XLALPrintWarning(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
XLAL_ERANGE
XLAL_EDOM
XLAL_EINVAL