28 #include <lal/LALSimIMR.h>
29 #include <lal/LALConstants.h>
31 #include <lal/Units.h>
34 #include <gsl/gsl_linalg.h>
35 #include <gsl/gsl_complex.h>
36 #include <gsl/gsl_complex_math.h>
37 #include <gsl/gsl_roots.h>
39 #include <lal/XLALGSL.h>
40 #include <gsl/gsl_errno.h>
41 #include <gsl/gsl_spline.h>
42 #include <lal/LALAdaptiveRungeKuttaIntegrator.h>
44 #include <gsl/gsl_sf_legendre.h>
45 #include <gsl/gsl_sf_gamma.h>
47 #include <lal/LALSimInspiralPrecess.h>
51 #define MIN(a,b) (((a)<(b))?(a):(b))
64 #define LAL_ST4_ABSOLUTE_TOLERANCE 1.e-12
65 #define LAL_ST4_RELATIVE_TOLERANCE 1.e-12
71 double nospin, eqspin, uneqspin;
73 nospin = (-236.05916243036953 - 831.5431113584278*eta)/(1 + 20.613030474069898*eta);
75 eqspin = (48.728774732041 + 8.161848266333303*eta + 146.22536542867712*eta*eta)*S + (-13.633462771084439 + 97.744032521123*eta - 333.74293640880865*eta*eta)*S*S +
76 (-76.67450724471107 + 1030.4869060625915*eta - 3160.810490374918*eta*eta)*S*S*S + (-20.941621754455277 - 26.348664719217858*eta + 778.3469028250508*eta*eta)*S*S*S*S +
77 (86.59936006891306 - 1115.1092303071634*eta + 3348.2374777841*eta*eta)*S*S*S*S*S + (13.413110005766034 + 46.573063129481895*eta - 631.7603046833175*eta*eta)*S*S*S*S*S*S;
79 uneqspin = -1385.6109494038105*dchi*
delta*(1 - 2.465600020183968*eta)*eta*eta + 10.837064426546098*dchi*dchi*eta*eta*eta + 355.1229694251773*dchi*
delta*(1 - 4.1057183984004695*eta)*eta*eta*S;
81 return (nospin + eqspin + uneqspin);
85 typedef struct taggammaIntegration
101 return -1. * alphadot * cosbeta;
115 REAL8 tmp1 = tmpx*cosangle - tmpy*sinangle;
116 REAL8 tmp2 = tmpx*sinangle + tmpy*cosangle;
129 REAL8 tmp1 = + tmpx*cosangle + tmpz*sinangle;
130 REAL8 tmp2 = - tmpx*sinangle + tmpz*cosangle;
141 for (
int i = 1;
i < len;
i++) {
142 double d = in[
i] - in[
i-1];
143 d =
d > M_PI ?
d - 2 * M_PI : (
d < -M_PI ?
d + 2 * M_PI :
d);
144 out[
i] = out[
i-1] +
d;
149 typedef struct tagPhenomTPHMEvolution
208 if(pPhase->
tmin>=tMECO - 10*pPhase->
dtM && EulerRDVersion == 2)
211 XLAL_PRINT_WARNING(
"Waveform is too short for EulerRDVersion=2. Defaulting to EulerRDVersion=1.\n");
213 if(pPhase->
tmin>= - 10*pPhase->
dtM && GammaVersion == 1)
216 XLAL_PRINT_WARNING(
"Waveform is too short for GammaVersion=1. Defaulting to GammaVersion=0.\n");
225 XLAL_PRINT_WARNING(
"System is almost aligned spin. Defaulting to EulerRDVersion=0.\n");
230 if(EulerRDVersion == 0)
234 else if(EulerRDVersion == 1)
241 length = floor((0.0 - pPhase->
tmin)/pWF->
dtM);
244 else if(EulerRDVersion == 2)
247 length = floor((t0 - pPhase->
tmin)/pWF->
dtM);
264 REAL8 s, s2, cos_beta, omega, omega_cbrt2, omega_cbrt, logomega, v, L;
269 omega_cbrt = sqrt(omega_cbrt2);
270 omega = omega_cbrt2*omega_cbrt;
271 logomega = log(omega);
277 for(
UINT4 jdx = 0; jdx < length; jdx++)
279 omega_cbrt2 = xorb->
data[jdx];
280 omega_cbrt = sqrt(omega_cbrt2);
282 omega = omega_cbrt2*omega_cbrt;
283 logomega = log(omega);
288 L =
XLALSimIMRPhenomXLPNAnsatz(v, pWFX->
eta/v, pPrec->
L0, pPrec->
L1, pPrec->
L2, pPrec->
L3, pPrec->
L4, pPrec->
L5, pPrec->
L6, pPrec->
L7, pPrec->
L8, pPrec->
L8L);
292 cos_beta = copysign(1.0, L + pPrec->
SL) / sqrt(1.0 + s2);
294 (*cosbetaTS)->data->data[jdx] = cos_beta;
305 vector vangles = {0.,0.,0.};
309 for(
UINT4 jdx = 0; jdx < length; jdx++)
311 v = sqrt(xorb->
data[jdx]);
315 (*alphaTS)->data->data[jdx] = vangles.
x + alphaOff;
316 (*gammaTS)->data->data[jdx] = -vangles.
y - alphaOff;
317 cos_beta = vangles.
z;
318 (*cosbetaTS)->data->data[jdx] = cos_beta;
325 XLAL_ERROR(
XLAL_EINVAL,
"Error: IMRPhenomXPrecessionVersion not recognized. Recommended default is 223.\n");
333 if(GammaVersion == 1 && length>0)
345 gsl_interp_accel *accel_alpha;
346 gsl_spline *spline_alpha;
348 accel_alpha = gsl_interp_accel_alloc();
349 spline_alpha = gsl_spline_alloc(gsl_interp_cspline, length);
350 gsl_spline_init(spline_alpha, timesPN->
data, (*alphaTS)->data->data, length);
353 gsl_interp_accel *accel_cosb;
354 gsl_spline *spline_cosb;
356 accel_cosb = gsl_interp_accel_alloc();
357 spline_cosb = gsl_spline_alloc(gsl_interp_cspline, length);
358 gsl_spline_init(spline_cosb, timesPN->
data, (*cosbetaTS)->data->data, length);
370 double t1 = timesPN->
data[
i-1];
371 double t2 = timesPN->
data[
i];
372 (*gammaTS)->data->data[
i] = (*gammaTS)->data->data[
i-1] + (1.0/90.0)*(t2 - t1)*(7.0*
f_alphadotcosi(t1,&gammaStruct)
381 gsl_spline_free(spline_alpha);
382 gsl_spline_free(spline_cosb);
383 gsl_interp_accel_free(accel_alpha);
384 gsl_interp_accel_free(accel_cosb);
397 if(EulerRDVersion == 1)
402 REAL8 alphaRD0 = 0.0;
403 REAL8 cosbetaRD0 = 0.0;
404 REAL8 gammaRD0 = 0.0;
411 gammaRD0 = -alphaOff;
416 alphaRD0 = (*alphaTS)->data->data[length-1];
417 cosbetaRD0 = (*cosbetaTS)->data->data[length-1];
418 gammaRD0 = (*gammaTS)->data->data[length-1];
424 tt = (jdx - length)*pWF->
dtM;
425 (*alphaTS)->data->data[jdx] = alphaRD0 + pPhase->
EulerRDslope*tt;
426 (*cosbetaTS)->data->data[jdx] = cosbetaRD0;
427 (*gammaTS)->data->data[jdx] = gammaRD0 - (*alphaTS)->data->data[jdx]*(*cosbetaTS)->data->data[jdx] + alphaRD0*cosbetaRD0;
434 else if(EulerRDVersion == 2)
438 size_t lengthInt = floor((t0 - pPhase->
tmin)/pWF->
dtM);
439 length = floor((0.0 - pPhase->
tmin)/pWF->
dtM);
442 REAL8 beta1 = acos((*cosbetaTS)->data->data[lengthInt-1]);
443 REAL8 beta2 = acos((*cosbetaTS)->data->data[lengthInt-2]);
444 REAL8 beta3 = acos((*cosbetaTS)->data->data[lengthInt-3]);
447 REAL8 alphader = (3.0*(*alphaTS)->data->data[lengthInt-1] - 4.0*(*alphaTS)->data->data[lengthInt-2] + (*alphaTS)->data->data[lengthInt-3])/(2*pWF->
dtM);
448 REAL8 betader = (3.0*beta1 - 4.0*beta2 + beta3)/(2*pWF->
dtM);
453 REAL8 alphaInt0 = (*alphaTS)->data->data[lengthInt-1];
454 REAL8 betaInt0 = beta1;
455 REAL8 gammaInt0 = (*gammaTS)->data->data[lengthInt-1];
462 if(fabs(betader)>1E-15)
464 for(
UINT4 jdx = lengthInt; jdx < length; jdx++)
466 (*alphaTS)->data->data[jdx] = alphaInt0 + alphader*kk*pWF->
dtM;
467 betalin = betaInt0 + betader*kk*pWF->
dtM;
469 if(betalin < 0.0){betalin=0.0;
XLAL_PRINT_INFO(
"Warning: beta<0º reached, correcting to 0º.");}
470 (*cosbetaTS)->data->data[jdx] = cos(betalin);
471 (*gammaTS)->data->data[jdx] = gammaInt0 - (alphader/betader)*sin(betaInt0 + betader*kk*pWF->
dtM) + (alphader/betader)*sin(betaInt0);
476 for(
UINT4 jdx = lengthInt; jdx < length; jdx++)
478 tt = (jdx - lengthInt)*pWF->
dtM;
479 (*alphaTS)->data->data[jdx] = alphaInt0 + alphader*kk*pWF->
dtM;
480 betalin = betaInt0 + betader*kk*pWF->
dtM;
482 if(betalin < 0.0){betalin=0.0;
XLAL_PRINT_INFO(
"Warning: beta<0 reached, correcting to 0.");}
483 (*cosbetaTS)->data->data[jdx] = cos(betalin);
484 (*gammaTS)->data->data[jdx] = gammaInt0 - alphader*tt*cos(betaInt0);
492 tt = (jdx - length)*pWF->
dtM;
493 (*alphaTS)->data->data[jdx] = (*alphaTS)->data->data[length-1] + pPhase->
EulerRDslope*tt;
494 (*cosbetaTS)->data->data[jdx] = (*cosbetaTS)->data->data[length-1];
495 (*gammaTS)->data->data[jdx] = (*gammaTS)->data->data[length-1] - (*alphaTS)->data->data[jdx]*(*cosbetaTS)->data->data[jdx] + (*alphaTS)->data->data[length-1]*(*cosbetaTS)->data->data[length-1];
513 int StoppingTest(
double UNUSED t,
const double UNUSED values[],
double UNUSED dvalues[],
void UNUSED *mparams);
515 int StoppingTest(
double UNUSED t,
const double UNUSED values[],
double UNUSED dvalues[],
void UNUSED *mparams)
524 const REAL8 values[],
531 const REAL8 values[],
539 REAL8 LNhx, LNhy, LNhz, S1x, S1y, S1z, S2x, S2y, S2z, E1x, E1y, E1z;
540 REAL8 dLNhx, dLNhy, dLNhz, dS1x, dS1y, dS1z, dS2x, dS2y, dS2z, dE1x, dE1y, dE1z;
544 REAL8 LNhdotS1, LNhdotS2;
551 LNhx = values[0] ; LNhy = values[1] ; LNhz = values[2] ;
552 S1x = values[3] ; S1y = values[4] ; S1z = values[5] ;
553 S2x = values[6] ; S2y = values[7] ; S2z = values[8];
554 E1x = values[9]; E1y = values[10]; E1z = values[11];
561 v = gsl_spline_eval(
params->v_spline, toff + sign*t,
params->v_acc );
564 LNhdotS1 = (LNhx*S1x + LNhy*S1y + LNhz*S1z);
565 LNhdotS2 = (LNhx*S2x + LNhy*S2y + LNhz*S2z);
567 status =
XLALSimInspiralSpinDerivativesAvg(&dLNhx,&dLNhy,&dLNhz,&dE1x,&dE1y,&dE1z,&dS1x,&dS1y,&dS1z,&dS2x,&dS2y,&dS2z,v,LNhx,LNhy,LNhz,E1x,E1y,E1z,S1x,S1y,S1z,S2x,S2y,S2z,LNhdotS1,LNhdotS2,Tparams);
570 dvalues[0] = sign*dLNhx; dvalues[1] = sign*dLNhy ; dvalues[2] = sign*dLNhz;
571 dvalues[3] = sign*dS1x ; dvalues[4] = sign*dS1y ; dvalues[5] = sign*dS1z ;
572 dvalues[6] = sign*dS2x ; dvalues[7] = sign*dS2y ; dvalues[8] = sign*dS2z ;
573 dvalues[9] = sign*dE1x ; dvalues[10] = sign*dE1y ; dvalues[11] = sign*dE1z ;
660 if(fRef < 0.0) {
XLAL_ERROR(
XLAL_EDOM,
"fRef_In must be positive or set to 0 to ignore.\n"); }
665 if(fRef > 0.0 && fRef < fmin){
XLAL_ERROR(
XLAL_EDOM,
"fRef must be >= f_min or =0 to use f_min.\n"); }
689 REAL8 mass_ratio = m1_SI / m2_SI;
701 if(mass_ratio > 20.0 && chi1L < 0.9 && m2_SI/LAL_MSUN_SI >= 0.5 ) {
XLAL_PRINT_INFO(
"Warning: Extrapolating outside of Numerical Relativity calibration domain."); }
702 if(mass_ratio > 20.0 && (chi1L >= 0.9 || m2_SI/
LAL_MSUN_SI < 0.5) ) {
XLAL_PRINT_INFO(
"Warning: Model can be pathological at these parameters"); }
703 if(mass_ratio > 200. && fabs(mass_ratio - 200) > 1
e-12) {
XLAL_ERROR(
XLAL_EDOM,
"ERROR: Model not valid at mass ratios beyond 200."); }
704 if(fabs(chi1L) > 0.99 || fabs(chi2L) > 0.99) {
XLAL_PRINT_INFO(
"Warning: Extrapolating to extremal spins, model is not trusted."); }
709 status =
IMRPhenomTSetWaveformVariables(pWF, m1_SI, m2_SI, chi1z, chi2z, 1.0,
deltaT, fmin, fRef, phiRef, lalParams);
721 size_t length_insp = length_insp_early + length_insp_late;
725 REAL8 factheta = pow(5.0,1./8);
736 for(
UINT4 jdx = 0; jdx < length_insp_early; jdx++)
738 t = pPhase->
tmin + jdx*pWF->
dtM;
740 thetabar = pow(pWF->
eta*(pPhase->
tt0-t),-1./8);
742 theta = factheta*thetabar;
745 xorb->
data[jdx] = pow(0.5*w22,2./3);
748 for(
UINT4 jdx = length_insp_early; jdx < length_insp; jdx++)
750 t = pPhase->
tmin + jdx*pWF->
dtM;
752 thetabar = pow(-pWF->
eta*t,-1./8);
754 theta = factheta*thetabar;
757 xorb->
data[jdx] = pow(0.5*w22,2./3);
764 for(
UINT4 jdx = 0; jdx < length_insp; jdx++)
766 t = pPhase->
tmin + jdx*pWF->
dtM;
768 thetabar = pow(-pWF->
eta*t,-1./8);
770 theta = factheta*thetabar;
773 xorb->
data[jdx] = pow(0.5*w22,2./3);
780 for(
UINT4 jdx = length_insp; jdx < length; jdx++)
782 t = pPhase->
tmin + jdx*pWF->
dtM;
785 xorb->
data[jdx] = pow(0.5*w22,2./3);
789 status =
IMRPhenomTPHM_EvolveOrbit(
V,S1x,S1y,S1z,S2x,S2y,S2z,LNhatx,LNhaty,LNhatz,E1x,E1y,E1z,xorb,m1_SI,m2_SI,chi1x,chi1y,chi1z,chi2x,chi2y,chi2z,pWF,pPhase);
838 REAL8 norm1, norm2, m1sec, m2sec, Msec;
841 if ( !
V || !S1x || !S1y || !S1z || !S2x || !S2y || !S2z
842 || !LNhatx || !LNhaty || !LNhatz || !E1x || !E1y || !E1z )
851 size_t lengthAll2 = xorb->
length;
859 for(
UINT4 idx=0; idx<lengthAll2; idx++)
861 timesPN->
data[idx] = idx*pWF->
dtM;
862 vorb->
data[idx] = sqrt(xorb->
data[idx]);
866 gsl_interp_accel *accel_v;
867 gsl_spline *spline_v;
868 accel_v = gsl_interp_accel_alloc();
869 spline_v = gsl_spline_alloc(gsl_interp_cspline, vorb->
length);
872 gsl_spline_init(spline_v, timesPN->
data, vorb->
data, vorb->
length);
891 XLALSimInspiralSpinTaylorT4Setup(&Tparams, m1_SI, m2_SI, pWF->
fRef, 0.0, lambda1, lambda2, quadparam1, quadparam2, spinO, tideO, phaseO, lscorr, 1);
893 params.v_spline = spline_v;
903 Msec = m1sec + m2sec;
912 norm1 = m1sec * m1sec / Msec / Msec;
913 yinit[3] = norm1 * s1x;
914 yinit[4] = norm1 * s1y;
915 yinit[5] = norm1 * s1z;
917 norm2 = m2sec * m2sec / Msec / Msec;
918 yinit[6] = norm2 * s2x;
919 yinit[7] = norm2 * s2y;
920 yinit[8]= norm2 * s2z;
948 size_t length1 = floor(tint1/pWF->
dtM);
953 tint1, tend - pWF->
dtM, pWF->
dtM, &yout);
958 XLALPrintError(
"XLAL Error - %s: integration failed (yout == NULL)\n",
966 XLALPrintError(
"XLAL Error - %s: integration failed with errorcode %d.\n", __func__, intreturn);
975 size_t lengthAll = len + length1;
1004 if ( !*
V || !*S1x || !*S1y || !*S1z || !*S2x || !*S2y || !*S2z
1005 || !*LNhatx || !*LNhaty || !*LNhatz || !*E1x || !*E1y || !*E1z )
1016 for(
i = 0;
i < len;
i++ )
1018 int j =
i + length1;
1019 (*V)->data->data[j] = vorb->
data[j];
1020 (*LNhatx)->data->data[j] = yout->
data[len+
i];
1021 (*LNhaty)->data->data[j] = yout->
data[2*len+
i];
1022 (*LNhatz)->data->data[j] = yout->
data[3*len+
i];
1023 (*S1x)->data->data[j] = yout->
data[4*len+
i]/norm1;
1024 (*S1y)->data->data[j] = yout->
data[5*len+
i]/norm1;
1025 (*S1z)->data->data[j] = yout->
data[6*len+
i]/norm1;
1026 (*S2x)->data->data[j] = yout->
data[7*len+
i]/norm2;
1027 (*S2y)->data->data[j] = yout->
data[8*len+
i]/norm2;
1028 (*S2z)->data->data[j] = yout->
data[9*len+
i]/norm2;
1029 (*E1x)->data->data[j] = yout->
data[10*len+
i];
1030 (*E1y)->data->data[j] = yout->
data[11*len+
i];
1031 (*E1z)->data->data[j] = yout->
data[12*len+
i];
1059 norm1 = m1sec * m1sec / Msec / Msec;
1060 yinit2[3] = norm1 * s1x;
1061 yinit2[4] = norm1 * s1y;
1062 yinit2[5] = norm1 * s1z;
1064 norm2 = m2sec * m2sec / Msec / Msec;
1065 yinit2[6] = norm2 * s2x;
1066 yinit2[7] = norm2 * s2y;
1067 yinit2[8]= norm2 * s2z;
1075 XLALSimInspiralSpinTaylorT4Setup(&Tparams, m1_SI, m2_SI, pWF->
fmin, 0.0, lambda1, lambda2, quadparam1, quadparam2, spinO, tideO, phaseO, lscorr, 1);
1076 params.Tparams = Tparams;
1078 params.ToffSign = -tint1;
1091 pWF->
dtM, tint1, pWF->
dtM, &yout2);
1096 XLALPrintError(
"XLAL Error - %s: integration failed (yout == NULL)\n",
1103 XLALPrintError(
"XLAL Error - %s: integration failed with errorcode %d.\n", __func__, intreturn);
1109 for(
i = 0;
i < len2;
i++ )
1111 int j = len2 - 1 -
i;
1112 (*V)->data->data[j] = vorb->
data[j];
1113 (*LNhatx)->data->data[j] = yout2->
data[len2+
i];
1114 (*LNhaty)->data->data[j] = yout2->
data[2*len2+
i];
1115 (*LNhatz)->data->data[j] = yout2->
data[3*len2+
i];
1116 (*S1x)->data->data[j] = yout2->
data[4*len2+
i]/norm1;
1117 (*S1y)->data->data[j] = yout2->
data[5*len2+
i]/norm1;
1118 (*S1z)->data->data[j] = yout2->
data[6*len2+
i]/norm1;
1119 (*S2x)->data->data[j] = yout2->
data[7*len2+
i]/norm2;
1120 (*S2y)->data->data[j] = yout2->
data[8*len2+
i]/norm2;
1121 (*S2z)->data->data[j] = yout2->
data[9*len2+
i]/norm2;
1122 (*E1x)->data->data[j] = yout2->
data[10*len2+
i];
1123 (*E1y)->data->data[j] = yout2->
data[11*len2+
i];
1124 (*E1z)->data->data[j] = yout2->
data[12*len2+
i];
1134 gsl_spline_free(spline_v);
1135 gsl_interp_accel_free(accel_v);
1211 status =
IMRPhenomTPHM_EvolveOrbit(&
V, &S1x, &S1y, &S1z, &S2x, &S2y, &S2z, &LNhatx, &LNhaty, &LNhatz, &E1x, &E1y, &E1z,\
1212 xorb, m1_SI, m2_SI, s1x, s1y, s1z, s2x, s2y, s2z, pWF, pPhase);
1223 REAL8 Msec = m1sec + m2sec;
1224 REAL8 norm1 = m1sec * m1sec / Msec / Msec;
1225 REAL8 norm2 = m2sec * m2sec / Msec / Msec;
1227 REAL8 lnxpeak, lnypeak, lnzpeak;
1228 REAL8 s1xpeak,s1ypeak,s1zpeak,s2xpeak,s2ypeak,s2zpeak;
1232 s1xpeak = norm1*(S1x)->
data->data[lenPN-1];
1233 s1ypeak = norm1*(S1y)->data->data[lenPN-1];
1234 s1zpeak = norm1*(S1z)->
data->data[lenPN-1];
1236 s2xpeak = norm2*(S2x)->data->data[lenPN-1];
1237 s2ypeak = norm2*(S2y)->
data->data[lenPN-1];
1238 s2zpeak = norm2*(S2z)->data->data[lenPN-1];
1240 lnxpeak = (LNhatx)->
data->data[lenPN-1];
1241 lnypeak = (LNhaty)->data->data[lenPN-1];
1242 lnzpeak = (LNhatz)->
data->data[lenPN-1];
1246 REAL8 s1Lpeak = s1xpeak*lnxpeak + s1ypeak*lnypeak + s1zpeak*lnzpeak;
1247 REAL8 s2Lpeak = s2xpeak*lnxpeak + s2ypeak*lnypeak + s2zpeak*lnzpeak;
1249 REAL8 s1xparallel = s1Lpeak*lnxpeak;
1250 REAL8 s1yparallel = s1Lpeak*lnypeak;
1251 REAL8 s1zparallel = s1Lpeak*lnzpeak;
1253 REAL8 s1xperp = s1xpeak - s1xparallel;
1254 REAL8 s1yperp = s1ypeak - s1yparallel;
1255 REAL8 s1zperp = s1zpeak - s1zparallel;
1257 REAL8 s2xparallel = s2Lpeak*lnxpeak;
1258 REAL8 s2yparallel = s2Lpeak*lnypeak;
1259 REAL8 s2zparallel = s2Lpeak*lnzpeak;
1261 REAL8 s2xperp = s2xpeak - s2xparallel;
1262 REAL8 s2yperp = s2ypeak - s2yparallel;
1263 REAL8 s2zperp = s2zpeak - s2zparallel;
1267 REAL8 Sperp = sqrt( pow(s1xperp + s2xperp, 2) + pow(s1yperp + s2yperp, 2) + pow(s1zperp + s2zperp, 2) );
1271 REAL8 Sf = copysign(1.0,af_nonprec)*sqrt(Sperp*Sperp + pow(af_nonprec,2));
1273 if(Sf>1.0){Sf = 1.0;};
1274 if(Sf<-1.0){Sf = -1.0;};
1287 REAL8 alphaOff = atan2(pPrec->S1y + pPrec->S2y, pPrec->S1x + pPrec->S2x) -
LAL_PI;
1290 size_t lengthAll = pPhase->
wflength;
1292 REAL8 tint1 = fabs(tend + pPhase->
tRef);
1293 size_t length1 = floor(tint1/pWF->
dtM);
1307 REAL8 cosPhiJ = cos(-pPrec->phiJ_Sf);
1308 REAL8 sinPhiJ = sin(-pPrec->phiJ_Sf);
1310 REAL8 cosThetaJ = cos(-pPrec->thetaJ_Sf);
1311 REAL8 sinThetaJ = sin(-pPrec->thetaJ_Sf);
1313 REAL8 cosKappa = cos(-pPrec->kappa);
1314 REAL8 sinKappa = sin(-pPrec->kappa);
1330 alphaOff -= atan2(LNhaty->
data->
data[length1], LNhatx->
data->
data[length1]);
1333 alphaaux->
data[
i] += alphaOff;
1342 for(
UINT8 jdx = lenPN-1; jdx < lengthAll; jdx++)
1345 alpha->data[jdx] =
alpha->data[lenPN-2] + EulerRDslope*times->
data[jdx];
1346 cosbeta->
data[jdx] = cosbeta->
data[lenPN-2];
1354 gsl_interp_accel *accel_alpha;
1355 gsl_spline *spline_alpha;
1357 accel_alpha = gsl_interp_accel_alloc();
1358 spline_alpha = gsl_spline_alloc(gsl_interp_cspline, lengthAll);
1360 gsl_spline_init(spline_alpha, times->
data,
alpha->data, lengthAll);
1363 gsl_interp_accel *accel_cosb;
1364 gsl_spline *spline_cosb;
1366 accel_cosb = gsl_interp_accel_alloc();
1367 spline_cosb = gsl_spline_alloc(gsl_interp_cspline, lengthAll);
1369 gsl_spline_init(spline_cosb, times->
data, cosbeta->
data, lengthAll);
1381 (*gammaTS)->data->data[0] =
gamma->data[0];
1382 (*alphaTS)->data->data[0] =
alpha->data[0];
1383 (*cosbetaTS)->data->data[0] = cosbeta->
data[0];
1386 for(
UINT4 i = 1;
i < lengthAll;
i++ ){
1387 double t1 = times->
data[
i-1];
1388 double t2 = times->
data[
i];
1396 (*gammaTS)->data->data[
i] =
gamma->data[
i];
1397 (*alphaTS)->data->data[
i] =
alpha->data[
i];
1398 (*cosbetaTS)->data->data[
i] = cosbeta->
data[
i];
1402 for(
UINT4 i = 1;
i < lengthAll;
i++ ){
1403 (*gammaTS)->data->data[
i] += -
gamma->data[length1] -
alpha->data[length1];
1429 gsl_spline_free(spline_alpha);
1430 gsl_spline_free(spline_cosb);
1431 gsl_interp_accel_free(accel_alpha);
1432 gsl_interp_accel_free(accel_cosb);
static double double delta
double IMRPhenomTomega22(REAL8 t, REAL8 theta, IMRPhenomTWaveformStruct *pWF, IMRPhenomTPhase22Struct *pPhase)
REAL8 GetEulerSlope(REAL8 af, REAL8 mf)
int IMRPhenomTSetPhase22Coefficients(IMRPhenomTPhase22Struct *pPhase, IMRPhenomTWaveformStruct *wf)
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)
#define LAL_ST4_RELATIVE_TOLERANCE
void IMRPhenomT_rotate_z(REAL8 cosangle, REAL8 sinangle, REAL8 *vx, REAL8 *vy, REAL8 *vz)
int PNAnalyticalInspiralEulerAngles(REAL8TimeSeries **alphaTS, REAL8TimeSeries **cosbetaTS, REAL8TimeSeries **gammaTS, REAL8Sequence *xorb, IMRPhenomTWaveformStruct *pWF, IMRPhenomTPhase22Struct *pPhase, IMRPhenomXWaveformStruct *pWFX, IMRPhenomXPrecessionStruct *pPrec, INT4 EulerRDVersion, INT4 GammaVersion)
This function provides a wrapper to the analytical PN angle descriptions computed by the IMRPhenomXP(...
int IMRPhenomTPHM_EvolveOrbit(REAL8TimeSeries **V, REAL8TimeSeries **S1x, REAL8TimeSeries **S1y, REAL8TimeSeries **S1z, REAL8TimeSeries **S2x, REAL8TimeSeries **S2y, REAL8TimeSeries **S2z, REAL8TimeSeries **LNhatx, REAL8TimeSeries **LNhaty, REAL8TimeSeries **LNhatz, REAL8TimeSeries **E1x, REAL8TimeSeries **E1y, REAL8TimeSeries **E1z, REAL8Sequence *xorb, REAL8 m1_SI, REAL8 m2_SI, REAL8 s1x, REAL8 s1y, REAL8 s1z, REAL8 s2x, REAL8 s2y, REAL8 s2z, IMRPhenomTWaveformStruct *pWF, IMRPhenomTPhase22Struct *pPhase)
static double f_alphadotcosi(double x, void *inparams)
void IMRPhenomT_rotate_y(REAL8 cosangle, REAL8 sinangle, REAL8 *vx, REAL8 *vy, REAL8 *vz)
int IMRPhenomTPHM_NumericalEulerAngles(REAL8TimeSeries **alphaInt, REAL8TimeSeries **cosbetaInt, REAL8TimeSeries **gammaInt, REAL8 *af_evolved, REAL8Sequence *xorb, REAL8 deltaT, REAL8 m1_SI, REAL8 m2_SI, REAL8 s1x, REAL8 s1y, REAL8 s1z, REAL8 s2x, REAL8 s2y, REAL8 s2z, REAL8 epochT, IMRPhenomTWaveformStruct *pWF, IMRPhenomTPhase22Struct *pPhase, UNUSED IMRPhenomXPrecessionStruct *pPrec)
void unwrap_array(double *in, double *out, int len)
INT4 XLALSimIMRPhenomTPHMSpinDerivatives(REAL8 UNUSED t, const REAL8 values[], REAL8 dvalues[], void *mparams)
#define LAL_ST4_ABSOLUTE_TOLERANCE
static double IMRPhenomT_MECOTime(double eta, double S, double dchi, double delta)
int StoppingTest(double UNUSED t, const double UNUSED values[], double UNUSED dvalues[], void UNUSED *mparams)
double IMRPhenomX_PN_Euler_epsilon_NNLO(IMRPhenomXPrecessionStruct *pPrec, const double omega, const double omega_cbrt2, const double omega_cbrt, const double logomega)
Internal function to calculate epsilon using pre-cached NNLO PN expressions.
REAL8 XLALSimIMRPhenomXLPNAnsatz(REAL8 v, REAL8 LNorm, REAL8 L0, REAL8 L1, REAL8 L2, REAL8 L3, REAL8 L4, REAL8 L5, REAL8 L6, REAL8 L7, REAL8 L8, REAL8 L8L)
This is a convenient wrapper function for PN orbital angular momentum.
double IMRPhenomX_PN_Euler_alpha_NNLO(IMRPhenomXPrecessionStruct *pPrec, const double omega, const double omega_cbrt2, const double omega_cbrt, const double logomega)
Internal function to calculate alpha using pre-cached NNLO PN expressions.
vector IMRPhenomX_Return_phi_zeta_costhetaL_MSA(const double v, IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec)
Wrapper to generate , and at a given frequency.
REAL8 XLALSimIMRPhenomXFinalSpin2017(REAL8 eta, REAL8 chi1L, REAL8 chi2L)
Final Dimensionless Spin, X Jimenez-Forteza et al, PRD, 95, 064024, (2017), arXiv:1611....
INT4 XLALSimInspiralSpinTaylorT4Setup(XLALSimInspiralSpinTaylorTxCoeffs **params, REAL8 m1, REAL8 m2, REAL8 fStart, REAL8 fEnd, REAL8 lambda1, REAL8 lambda2, REAL8 quadparam1, REAL8 quadparam2, LALSimInspiralSpinOrder spinO, LALSimInspiralTidalOrder tideO, INT4 phaseO, INT4 lscorr, INT4 phenomtp)
See arXiv:0907.0700 for TaylorT4 definition.
INT4 XLALSimInspiralSpinDerivativesAvg(REAL8 *dLNhx, REAL8 *dLNhy, REAL8 *dLNhz, REAL8 *dE1x, REAL8 *dE1y, REAL8 *dE1z, REAL8 *dS1x, REAL8 *dS1y, REAL8 *dS1z, REAL8 *dS2x, REAL8 *dS2y, REAL8 *dS2z, const REAL8 v, const REAL8 LNhx, const REAL8 LNhy, const REAL8 LNhz, const REAL8 E1x, const REAL8 E1y, const REAL8 E1z, const REAL8 S1x, const REAL8 S1y, const REAL8 S1z, const REAL8 S2x, const REAL8 S2y, const REAL8 S2z, const REAL8 LNhdotS1, const REAL8 LNhdotS2, XLALSimInspiralSpinTaylorTxCoeffs *params)
Function computing spin precession equations, common to all member of the SpinTaylor family.
static vector d(const double L_norm, const double J_norm, const vector roots)
Internal function that returns the coefficients "d_0", "d_2" and "d_4" from 1703.03967 corresponding ...
void XLALDestroyREAL8Array(REAL8Array *)
void XLALAdaptiveRungeKuttaFree(LALAdaptiveRungeKuttaIntegrator *integrator)
int XLALAdaptiveRungeKutta4Hermite(LALAdaptiveRungeKuttaIntegrator *integrator, void *params, REAL8 *yinit, REAL8 tinit, REAL8 tend_in, REAL8 deltat, REAL8Array **yout)
LALAdaptiveRungeKuttaIntegrator * XLALAdaptiveRungeKutta4Init(int dim, int(*dydt)(double t, const double y[], double dydt[], void *params), int(*stop)(double t, const double y[], double dydt[], void *params), double eps_abs, double eps_rel)
void * XLALMalloc(size_t n)
int XLALSimIMRPhenomTPHM_EvolveOrbit(REAL8TimeSeries **V, REAL8TimeSeries **S1x, REAL8TimeSeries **S1y, REAL8TimeSeries **S1z, REAL8TimeSeries **S2x, REAL8TimeSeries **S2y, REAL8TimeSeries **S2z, REAL8TimeSeries **LNhatx, REAL8TimeSeries **LNhaty, REAL8TimeSeries **LNhatz, REAL8TimeSeries **E1x, REAL8TimeSeries **E1y, REAL8TimeSeries **E1z, REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1x, REAL8 chi1y, REAL8 chi1z, REAL8 chi2x, REAL8 chi2y, REAL8 chi2z, REAL8 deltaT, REAL8 fmin, REAL8 fRef, REAL8 phiRef, LALDict *lalParams)
Function to return the time series for the evolution of the individual spins, the Newtonian angular m...
LALSimInspiralSpinOrder
Enumeration of allowed PN orders of spin effects.
LALSimInspiralTidalOrder
Enumeration of allowed PN orders of tidal effects.
void XLALDestroyREAL8Sequence(REAL8Sequence *sequence)
REAL8Sequence * XLALCreateREAL8Sequence(size_t length)
REAL8TimeSeries * XLALCreateREAL8TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
void XLALDestroyREAL8TimeSeries(REAL8TimeSeries *series)
const LALUnit lalDimensionlessUnit
#define XLAL_PRINT_INFO(...)
#define XLAL_CHECK(assertion,...)
#define XLAL_PRINT_WARNING(...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
size_t wflength_insp_early
size_t wflength_insp_late
REAL8 thetaJ_Sf
Angle between and (z-direction)
INT4 IMRPhenomXPrecVersion
Flag to set version of Euler angles used.
XLALSimInspiralSpinTaylorTxCoeffs * Tparams
gsl_spline * cosbeta_spline
gsl_spline * alpha_spline
gsl_interp_accel * alpha_acc
gsl_interp_accel * cosbeta_acc