20 #ifndef _LALSIMIMRSPINPRECEOB_C
21 #define _LALSIMIMRSPINPRECEOB_C
34 #include <lal/LALSimInspiral.h>
35 #include <lal/LALSimIMR.h>
37 #include <lal/TimeSeries.h>
38 #include <lal/Units.h>
39 #include <lal/LALAdaptiveRungeKuttaIntegrator.h>
40 #include <lal/SphericalHarmonics.h>
41 #include <gsl/gsl_sf_gamma.h>
42 #include <gsl/gsl_integration.h>
48 #include <lal/VectorOps.h>
76 #define UNUSED __attribute__ ((unused))
81 #define FREE_EVERYTHING \
82 if ( hlmPTS != NULL ) \
83 XLALDestroySphHarmTimeSeries(hlmPTS); \
84 if ( hIMRlmJTS != NULL ) \
85 XLALDestroySphHarmTimeSeries(hIMRlmJTS); \
86 if ( hIMRlmITS != NULL ) \
87 XLALDestroySphHarmTimeSeries(hIMRlmITS); \
89 if ( dynamics != NULL ) \
90 XLALDestroyREAL8Array( dynamics ); \
91 if ( dynamicsV2 != NULL ) \
92 XLALDestroyREAL8Array( dynamicsV2 ); \
93 if ( dynamicsV2Hi != NULL ) \
94 XLALDestroyREAL8Array( dynamicsV2Hi ); \
95 if ( dynamicsHi != NULL ) \
96 XLALDestroyREAL8Array( dynamicsHi ); \
98 XLALDestroyREAL8Vector( valuesV2 ); \
99 XLALDestroyREAL8Vector( values ); \
100 XLALDestroyREAL8Vector( dvalues ); \
102 XLALDestroyREAL8Vector( sigmaStar ); \
103 XLALDestroyREAL8Vector( sigmaKerr ); \
105 XLALDestroyREAL8Vector( rdMatchPoint ); \
107 XLALDestroyREAL8Vector( Alpha ); \
108 XLALDestroyREAL8Vector( Beta ); \
109 XLALDestroyREAL8Vector( Gamma ); \
110 XLALDestroyREAL8Vector( AlphaHi ); \
111 XLALDestroyREAL8Vector( BetaHi ); \
112 XLALDestroyREAL8Vector( GammaHi ); \
114 XLALDestroyREAL8Vector( sigReHi ); \
115 XLALDestroyREAL8Vector( sigImHi ); \
117 XLALDestroyREAL8TimeSeries(alphaI2PTS); \
118 XLALDestroyREAL8TimeSeries(betaI2PTS); \
119 XLALDestroyREAL8TimeSeries(gammaI2PTS); \
121 XLALDestroyREAL8TimeSeries(alphaI2PTSHi); \
122 XLALDestroyREAL8TimeSeries(betaI2PTSHi); \
123 XLALDestroyREAL8TimeSeries(gammaI2PTSHi); \
125 XLALDestroyREAL8TimeSeries(alphaP2JTS); \
126 XLALDestroyREAL8TimeSeries(betaP2JTS); \
127 XLALDestroyREAL8TimeSeries(gammaP2JTS); \
129 XLALDestroyREAL8TimeSeries(alphaP2JTSHi); \
130 XLALDestroyREAL8TimeSeries(betaP2JTSHi); \
131 XLALDestroyREAL8TimeSeries(gammaP2JTSHi); \
133 XLALDestroyREAL8TimeSeries(alpI); \
134 XLALDestroyREAL8TimeSeries(betI); \
135 XLALDestroyREAL8TimeSeries(gamI); \
137 XLALDestroyCOMPLEX16TimeSeries(h22TS); \
138 XLALDestroyCOMPLEX16TimeSeries(h21TS); \
139 XLALDestroyCOMPLEX16TimeSeries(h20TS); \
140 XLALDestroyCOMPLEX16TimeSeries(h2m1TS); \
141 XLALDestroyCOMPLEX16TimeSeries(h2m2TS); \
143 XLALDestroyCOMPLEX16TimeSeries(h22TSHi); \
144 XLALDestroyCOMPLEX16TimeSeries(h21TSHi); \
145 XLALDestroyCOMPLEX16TimeSeries(h20TSHi); \
146 XLALDestroyCOMPLEX16TimeSeries(h2m1TSHi); \
147 XLALDestroyCOMPLEX16TimeSeries(h2m2TSHi); \
149 XLALDestroyCOMPLEX16TimeSeries(hIMRJTS); \
150 XLALDestroyCOMPLEX16TimeSeries(hIMRJTSHi); \
152 XLALAdaptiveRungeKuttaFree(integrator); \
154 XLALDestroyREAL8TimeSeries(hPlusTS); \
155 XLALDestroyREAL8TimeSeries(hCrossTS);
158 #define FREE_SPHHARM \
159 XLALDestroyREAL8Vector( tlist ); \
160 XLALDestroyREAL8Vector( tlistHi ); \
161 XLALDestroyREAL8Vector( timeJFull ); \
162 XLALDestroyREAL8Vector( timeIFull ); \
163 XLALDestroyREAL8Vector( tlistRDPatch ); \
164 XLALDestroyREAL8Vector( tlistRDPatchHi );
166 #define PRINT_PARAMS do { \
167 XLALPrintError("--approximant SEOBNRv3 --f-min %.16e --m1 %.16e --m2 %.16e --spin1x %.16e --spin1y %.16e --spin1z %.16e --spin2x %.16e --spin2y %.16e --spin2z %.16e --inclination %.16e --distance %.16e --phiRef %.16e --sample-rate %.16e\n",\
168 fMin, m1SI/LAL_MSUN_SI, m2SI/LAL_MSUN_SI, INspin1x, INspin1y, INspin1z, INspin2x, INspin2y, INspin2z, inc, r/(1e6 * LAL_PC_SI), phiC, 1./deltaT);\
176 const double values[],
178 void UNUSED *funcParams
181 int debugPK = 0;
int debugPKverbose = 0;
186 REAL8 p[3],
r[3], pdotVec[3], rdotVec[3];
187 REAL8 omega, omega_xyz[3], L[3], dLdt1[3], dLdt2[3];
189 memcpy(
r, values, 3*
sizeof(
REAL8));
190 memcpy(
p, values+3, 3*
sizeof(
REAL8));
191 memcpy( rdotVec, dvalues, 3*
sizeof(
REAL8));
192 memcpy( pdotVec, dvalues+3, 3*
sizeof(
REAL8));
198 if (debugPK){
XLAL_PRINT_INFO(
"XLALEOBSpinPrecStopConditionBasedOnPR:: r = %e %e\n", sqrt(
r2), omega);}
199 if (debugPK){
XLAL_PRINT_INFO(
"XLALEOBSpinPrecStopConditionBasedOnPR:: values = %e %e %e %e %e %e\n", values[6], values[7], values[8], values[9], values[10], values[11]);}
200 if (debugPK){
XLAL_PRINT_INFO(
"XLALEOBSpinPrecStopConditionBasedOnPR:: dvalues = %e %e %e %e %e %e\n",dvalues[6], dvalues[7], dvalues[8], dvalues[9], dvalues[10], dvalues[11]);}
218 for(
i = 0;
i < 12;
i++ )
220 if( isnan(dvalues[
i]) || isnan(values[
i]) )
223 XLALPrintError(
"XLAL Error - %s: nan reached at r2 = %f \n", __func__,
r2);
234 if ( r2 < 16 && pDotr >= 0 )
237 XLAL_PRINT_INFO(
"\n Integration stopping, p_r pointing outwards -- out-spiraling!\n");
244 if ( r2 < 16 && rdot >= 0 )
247 XLAL_PRINT_INFO(
"\n Integration stopping, dr/dt>0 -- out-spiraling!\n");
254 if(r2 < 4. && prDot > 0. )
264 if(
r2 < 16. && ( sqrt(values[3]*values[3] + values[4]*values[4] + values[5]*values[5]) > 10. )) {
270 if(
r2 < 16. && ( sqrt(values[3]*values[3] + values[4]*values[4] + values[5]*values[5]) < 1.e-10 )) {
280 if (
r2 < 16. && omega < params->eobParams->omega )
281 params->eobParams->omegaPeaked = 1;
284 if ( r2 < 4. && params->eobParams->omegaPeaked == 1
285 && omega >
params->eobParams->omega )
288 XLAL_PRINT_INFO(
"\n Integration stopping, omega reached second extremum\n");
295 if((
r2 < 16. && omega < 0.04) || (
r2 < 4. && omega < 0.14 && params->eobParams->omegaPeaked == 1 ) )
298 XLAL_PRINT_INFO(
"\n Integration stopping for omega below threshold, omega=%f at r = %f\n", omega, sqrt(
r2));
304 if(r2 < 16. && omega > 1. )
312 params->eobParams->omega = omega;
319 if (
r2 < 25 && (fabs(dvalues[3]) > 10 || fabs(dvalues[4]) > 10 || fabs(dvalues[5]) > 10) )
328 if(
r2 < 16. && values[5] > 10 )
337 if ( r2 < 9. && rdot>
params->prev_dr ) {
352 if(debugPKverbose &&
r2 < 16.) {
354 t, values[0], values[1], values[2], values[3], values[4], values[5],
355 values[6], values[7], values[8], values[9], values[10], values[11],
356 values[12], values[13], omega);
372 const double values[],
383 if (debugPK){
XLAL_PRINT_INFO(
"XLALEOBSpinPrecAlignedStopCondition:: r = %e\n",
r);}
385 if (
r < 6. && omega < params->eobParams->omega )
390 params->eobParams->omega = omega;
404 const double UNUSED values[],
406 void UNUSED *funcParams
411 XLAL_PRINT_INFO(
"XLALSpinPrecAlignedHiSRStopCondition:: r = %e\n", values[0]);
412 XLAL_PRINT_INFO(
"values[0], values[1], values[2], values[3], dvalues[0], dvalues[1], dvalues[2], dvalues[3] = %e %e %e %e %e %e %e %e\n", values[0], values[1], values[2], values[3], dvalues[0], dvalues[1], dvalues[2], dvalues[3]);
415 if ( dvalues[0] >= 0. || dvalues[2] >= 0. || isnan( dvalues[3] ) || isnan (dvalues[2]) || isnan (dvalues[1]) || isnan (dvalues[0]) )
430 REAL8 c21 = -1.803949138004582;
431 REAL8 c22 = -39.77229225266885;
432 REAL8 c23 = 103.16588921239249;
439 REAL8 coeffsKK = c20 + c21*eta + c22*eta*eta + c23*eta*eta*eta;
440 REAL8 m1PlusEtaKK = -1. + eta*coeffsKK;
442 #include "seobnrv3_opt_exactderivs/SEOBNRv3_opt_coeffs-kC-parsedfinal.c.generated"
443 CoeffConsts.
a0k2 = kC0;
444 CoeffConsts.
a1k2 = kC1;
445 CoeffConsts.
a0k3 = kC2;
446 CoeffConsts.
a1k3 = kC3;
447 CoeffConsts.
a0k4 = kC4;
448 CoeffConsts.
a1k4 = kC5;
449 CoeffConsts.
a2k4 = kC6;
450 CoeffConsts.
a0k5 = kC7;
451 CoeffConsts.
a1k5 = kC8;
452 CoeffConsts.
a2k5 = kC9;
470 const REAL8 INspin1[],
471 const REAL8 INspin2[],
472 const UINT4 PrecEOBversion
488 REAL8 m1SI = m1SI_in;
489 REAL8 m2SI = m2SI_in;
492 bool generation_OK =
false;
496 while (!generation_OK && (
i < n_try)) {
498 phiC,
deltaT, m1SI, m2SI, fMin,
r, inc, INspin1[0], INspin1[1], INspin1[2], INspin2[0], INspin2[1], INspin2[2], PrecEOBversion);
500 if (*hplus == NULL || *hcross == NULL || (*hplus)->
data == NULL || (*hcross)->
data == NULL){
501 XLALPrintWarning(
"Houston-2/3, we've got a problem SOS, SOS, SOS, the waveform generator returns NULL!!!... m1 = %.18e, m2 = %.18e, fMin = %.18e, inclination = %.18e, spin1 = {%.18e, %.18e, %.18e}, spin2 = {%.18e, %.18e, %.18e} \n",
502 m1SI/
LAL_MSUN_SI, m2SI/
LAL_MSUN_SI, (
double)fMin, (
double)inc, INspin1[0], INspin1[1], INspin1[2], INspin2[0], INspin2[1], INspin2[2]);
503 XLALPrintWarning(
"We will perturb the masses by a small amount and retry in next iteration (%d of %d).\n",
i, n_try);
508 generation_OK =
true;
523 XLALPrintWarning(
"We have called XLALSimIMRSpinEOBWaveformAll %d times with perturbed masses, now we give up.\n", n_try);
599 const REAL8 INspin1x,
600 const REAL8 INspin1y,
601 const REAL8 INspin1z,
602 const REAL8 INspin2x,
603 const REAL8 INspin2y,
604 const REAL8 INspin2z,
605 const UINT4 PrecEOBversion
609 REAL8 INspin1[3], INspin2[3];
610 INspin1[0] = INspin1x;
611 INspin1[1] = INspin1y;
612 INspin1[2] = INspin1z;
613 INspin2[0] = INspin2x;
614 INspin2[1] = INspin2y;
615 INspin2[2] = INspin2z;
617 INT4 debugPK = 0, debugCustomIC = 0, debugNoNQC = 0;
630 INT4 use_optimized = 0;
631 if ( PrecEOBversion == 300 || PrecEOBversion == 304 ) { spinEOBApproximant =
SEOBNRv3_opt; use_optimized = 1; }
634 INT4 SpinAlignedEOBversion = 2;
638 REAL8 spin1[3] = {0,0,0}, spin2[3] = {0,0,0}, InitLhat[3] = {0.0,0.0,1.0};
640 memcpy( spin1, INspin1, 3*
sizeof(
REAL8));
641 memcpy( spin2, INspin2, 3*
sizeof(
REAL8));
646 REAL8 theta1Ini = 0, theta2Ini = 0;
647 REAL8 spin1Norm = -1, spin2Norm = -1;
648 spin1Norm = sqrt( INspin1[0]*INspin1[0] + INspin1[1]*INspin1[1] + INspin1[2]*INspin1[2] );
649 spin2Norm = sqrt( INspin2[0]*INspin2[0] + INspin2[1]*INspin2[1] + INspin2[2]*INspin2[2] );
650 if ( INspin1[0] == 0. && INspin1[1] == 0. && INspin1[2] == 0. ) {
653 if ( INspin2[0] == 0. && INspin2[1] == 0. && INspin2[2] == 0. ) {
658 if (spin1Norm <= 1.0e-5) {INspin1[0]=0.;INspin1[1]=0.;INspin1[2]=0.;}
659 if (spin2Norm <= 1.0e-5) {INspin2[0]=0.;INspin2[1]=0.;INspin2[2]=0.;}
660 REAL8 acosarg1 = 0, acosarg2 = 0;
661 if( spin1Norm > 1.0e-5){
662 acosarg1 = (InitLhat[0]*INspin1[0] + InitLhat[1]*INspin1[1] + InitLhat[2]*INspin1[2])/ spin1Norm ;
666 else if (acosarg1 < -1.) {
670 theta1Ini = acos( acosarg1 );
674 if( spin2Norm > 1.0e-5){
675 acosarg2 = (InitLhat[0]*INspin2[0] + InitLhat[1]*INspin2[1] + InitLhat[2]*INspin2[2])/ spin2Norm ;
679 else if (acosarg2 < -1.) {
683 theta2Ini = acos( acosarg2 );
689 REAL8 EPS_ALIGN = 1.0e-4, incA = inc;
690 bool SpinsAlmostAligned = ( fabs(theta1Ini) <= EPS_ALIGN || fabs(theta1Ini) >=
LAL_PI - EPS_ALIGN) && ( fabs(theta2Ini) <= EPS_ALIGN || fabs(theta2Ini) >=
LAL_PI - EPS_ALIGN);
691 if ( SpinsAlmostAligned ) {
692 XLAL_PRINT_INFO(
"Both spins are almost aligned/antialigned to initial LNhat: we use V2 dynamics\n");
698 spin1[2] = spin1Norm*copysign(1., cos(theta1Ini));
701 spin2[2] = spin2Norm*copysign(1., cos(theta2Ini));
709 InitLhat[0], InitLhat[1], InitLhat[2] );
711 XLAL_PRINT_INFO(
"theta1Ini, theta2Ini = %3.10f, %3.10f\n", theta1Ini, theta2Ini );
713 INspin1[0], INspin1[1], INspin1[2] );
715 INspin2[0], INspin2[1], INspin2[2] );
716 XLAL_PRINT_INFO(
"spin1 = {%3.10f, %3.10f, %3.10f}\n", spin1[0], spin1[1], spin1[2] );
717 XLAL_PRINT_INFO(
"spin2 = {%3.10f, %3.10f, %3.10f}\n", spin2[0], spin2[1], spin2[2] );
751 REAL8 rdotvec[3] = {0,0,0};
755 REAL8 chiS = 0, chiA = 0;
779 REAL8 mSpin1[3] = {0,0,0}, mSpin2[3] = {0,0,0};
786 REAL8 s1Data[3] = {0,0,0}, s2Data[3] = {0,0,0},
787 s1DataNorm[3] = {0,0,0}, s2DataNorm[3] = {0,0,0};
790 REAL8 m1 = 0, m2 = 0, mTotal = 0, eta = 0, mTScaled = 0;
795 REAL8Vector posVecx, posVecy, posVecz, momVecx, momVecy, momVecz;
796 REAL8Vector s1Vecx, s1Vecy, s1Vecz, s2Vecx, s2Vecy, s2Vecz;
797 REAL8 omega = 0, v = 0, ham = 0;
803 REAL8Vector posVecxEOMv, posVecyEOMv, posVeczEOMv, tVecEOMv;
804 REAL8Vector * posVecxEOM = &posVecxEOMv, * posVecyEOM = &posVecyEOMv,
805 * posVeczEOM = &posVeczEOMv, * tVecEOM = &tVecEOMv;
807 posVecxEOMv.
data = posVecyEOMv.
data = posVeczEOMv.
data = tVecEOMv.
data = NULL;
813 REAL8 cartPosData[3] = {0,0,0}, cartMomData[3] = {0,0,0};
814 REAL8 rcrossrdotNorm = 0, rvec[3] = {0,0,0}, rcrossrdot[3] = {0,0,0};
815 REAL8 pvec[3] = {0,0,0}, rcrossp[3] = {0,0,0};
816 REAL8 s1dotLN = 0, s2dotLN = 0;
820 REAL8 polData[4] = {0,0,0,0};
828 memset( &nqcCoeffs, 0,
sizeof( nqcCoeffs ) );
835 COMPLEX16 Y22 = 0.0 + 0.0j, Y2m2 = 0.0 + 0.0j, Y21 = 0.0 + 0.0j, Y2m1 = 0.0 + 0.0j;
840 REAL8 deltaTHigh = 0, resampEstimate = 0;
841 UINT4 resampFac = 0, resampPwr = 0;
844 REAL8 tStepBack = 0, HiSRstart = 0;
851 REAL8Vector posVecxHi, posVecyHi, posVeczHi, momVecxHi, momVecyHi, momVeczHi;
852 REAL8Vector s1VecxHi, s1VecyHi, s1VeczHi, s2VecxHi, s2VecyHi, s2VeczHi;
906 memset( &seobParams, 0,
sizeof(seobParams) );
907 memset( &seobCoeffs, 0,
sizeof(seobCoeffs) );
908 memset( &eobParams, 0,
sizeof(eobParams) );
909 memset( &hCoeffs, 0,
sizeof( hCoeffs ) );
910 memset( &prefixes, 0,
sizeof( prefixes ) );
912 REAL8TimeSeries *alphaI2PTS = NULL, *betaI2PTS = NULL, *gammaI2PTS = NULL, *alphaP2JTS = NULL, *betaP2JTS = NULL, *gammaP2JTS = NULL;
913 REAL8TimeSeries *alphaI2PTSHi = NULL, *betaI2PTSHi = NULL, *gammaI2PTSHi = NULL, *alphaP2JTSHi = NULL, *betaP2JTSHi = NULL, *gammaP2JTSHi = NULL;
914 COMPLEX16TimeSeries *h22TS = NULL, *h21TS = NULL, *h20TS = NULL, *h2m1TS = NULL, *h2m2TS = NULL;
915 COMPLEX16TimeSeries *h22TSHi = NULL, *h21TSHi = NULL, *h20TSHi = NULL, *h2m1TSHi = NULL, *h2m2TSHi = NULL;
970 REAL8 tPeakOmega = 0, tAttach = 0, combSize = 0, deltaNQC =0;
972 REAL8 magR = 0, Lx = 0, Ly = 0, Lz = 0, magL = 0, magJ = 0,
973 LNhx = 0, LNhy = 0, LNhz = 0, magLN =0, Jx = 0, Jy = 0, Jz = 0;
974 REAL8 aI2P = 0, bI2P = 0, gI2P = 0;
975 REAL8 aP2J = 0, bP2J = 0, gP2J = 0;
976 REAL8 chi1J= 0, chi2J= 0, chiJ = 0;
977 REAL8 chi1L= 0.0, chi2L = 0.0, chiL = 0.0;
980 REAL8 JframeEx[3] = {0,0,0}, JframeEy[3] = {0,0,0}, JframeEz[3] = {0,0,0};
990 INT4 retLenEOMLow = 0, retLenEOMHi = 0;
991 INT4 retLen = 0, retLenLow = 0, retLenHi = 0;
992 INT4 retLenRDPatchHi= 0, retLenRDPatchLow = 0;
996 gsl_spline *spline = NULL;
997 gsl_interp_accel *acc = NULL;
1002 REAL8 EPS_ABS = 1.0e-8;
1003 const REAL8 EPS_REL = 1.0e-8;
1006 if (sqrt((INspin1[0] + INspin2[0])*(INspin1[0] + INspin2[0]) + (INspin1[1] + INspin2[1])*(INspin1[1] + INspin2[1])) < 1.0e-10 && !SpinsAlmostAligned && !use_optimized)
1013 REAL8Vector *Alpha = NULL, *Beta = NULL, *Gamma = NULL;
1014 REAL8Vector *AlphaHi = NULL, *BetaHi = NULL, *GammaHi = NULL;
1033 if ( !rdMatchPoint )
1035 XLALPrintError(
"Failed to allocate REAL8Vector rdMatchPoint!\n");
1039 REAL8 alJtoI = 0, betJtoI = 0, gamJtoI = 0;
1052 eta = m1 * m2 / (mTotal*mTotal);
1071 XLAL_PRINT_INFO(
"Inputs: m1 = %.16e, m2 = %.16e, fMin = %.16e, inclination = %.16e\n",
1072 m1, m2, (
double) fMin, (
double) inc );
1075 spin1[0], spin1[1], spin1[2]);
1077 spin2[0], spin2[1], spin2[2]);
1082 tStepBack = 150. * mTScaled;
1083 nStepBack = ceil( tStepBack /
deltaT );
1089 resampEstimate = 50. *
deltaT / mTScaled;
1091 if ( resampEstimate > 1. ) {
1092 resampPwr = (
UINT4)ceil( log2( resampEstimate ) );
1093 while( resampPwr-- ) { resampFac *= 2u; }
1099 s1Vec.
data = s1Data;
1100 s2Vec.
data = s2Data;
1103 s1VecOverMtMt.
data = s1DataNorm;
1104 s2VecOverMtMt.
data = s2DataNorm;
1106 for(
i = 0;
i < 3;
i++ )
1108 s1Vec.
data[
i] = mSpin1[
i] = spin1[
i] * m1 * m1;
1109 s2Vec.
data[
i] = mSpin2[
i] = spin2[
i] * m2 * m2;
1110 s1VecOverMtMt.
data[
i] = s1Vec.
data[
i] / mTotal / mTotal;
1111 s2VecOverMtMt.
data[
i] = s2Vec.
data[
i] / mTotal / mTotal;
1116 XLAL_PRINT_INFO(
"Inputs: m1 = %.16e, m2 = %.16e, fMin = %.16e, inclination = %.16e\n",
1117 m1, m2, (
double) fMin, (
double) inc );
1119 spin1[0], spin1[1], spin1[2]);
1121 spin2[0], spin2[1], spin2[2]);
1163 if (use_optimized) {
1168 seobParams.
s1Vec = &s1VecOverMtMt;
1169 seobParams.
s2Vec = &s2VecOverMtMt;
1173 sigmaKerr->
data[0], sigmaKerr->
data[1], sigmaKerr->
data[2]);
1175 sigmaStar->
data[0], sigmaStar->
data[1], sigmaStar->
data[2]);
1187 XLALPrintError(
"Failed to allocate REAL8Vector AttachParams!\n");
1191 *AttachPars = AttachParams;
1194 if (!use_optimized) {
1196 cartPosVec.
data = cartPosData;
1197 cartMomVec.
data = cartMomData;
1198 memset( cartPosData, 0,
sizeof( cartPosData ) );
1199 memset( cartMomData, 0,
sizeof( cartMomData ) );
1221 eobParams.
eta = eta;
1224 tidal1.
mByM = m1SI / (m1SI + m2SI);
1230 tidal2.
mByM = m2SI / (m1SI + m2SI);
1236 seobCoeffs.
tidal1 = &tidal1;
1237 seobCoeffs.
tidal2 = &tidal2;
1239 hCoeffs.
tidal1 = &tidal1;
1240 hCoeffs.
tidal2 = &tidal2;
1250 XLALPrintError(
"XLALSimIMRCalculateSpinPrecEOBHCoeffs failed!\n");
1265 XLALPrintError(
"XLALSimIMREOBComputeNewtonMultipolePrefixes failed!\n");
1278 XLAL_PRINT_INFO(
"Calling the XLALSimIMRSpinEOBInitialConditionsPrec function!\n");
1280 "Inputs: m1 = %.16e, m2 = %.16e, fMin = %.16e, inclination = %.16e\n",
1281 m1, m2, (
double) fMin, (
double) inc );
1283 mSpin1[0], mSpin1[1], mSpin1[2]);
1285 mSpin2[0], mSpin2[1], mSpin2[2]);
1290 REAL8 incl_temp = 0.0;
1296 if ( SpinsAlmostAligned ) {
1298 seobParams.
chi1 = copysign( spin1Norm, cos(theta1Ini) );
1299 seobParams.
chi2 = copysign( spin2Norm, cos(theta2Ini) );
1300 chiS = 0.5*(seobParams.
chi1 + seobParams.
chi2);
1301 chiA = 0.5*(seobParams.
chi1 - seobParams.
chi2);
1302 tplspin = (1.-2.*eta) * chiS + (m1 - m2)/(m1 + m2) * chiA;
1306 XLALPrintError(
"XLALSimIMREOBCalcSpinFacWaveformCoefficients failed!\n");
1321 XLALPrintError(
"XLALSimIMRSpinEOBInitialConditionsPrec failed!\n");
1335 values->
data[12] = 0.;
1336 values->
data[13] = 0.;
1340 values->
data[0]= 15.4898001256;
1341 values->
data[1]= 0.;
1342 values->
data[2]= -4.272074867808132e-19;
1343 values->
data[3]= -0.0009339635043526475;
1344 values->
data[4]= 0.2802596444562164;
1345 values->
data[5]= -0.0001262371378125648;
1346 values->
data[6]= 0.03950299224160406;
1347 values->
data[7]= 0.1033495061350166;
1348 values->
data[8]= 0.02382287037711037;
1349 values->
data[9]= 0.07463668902857602;
1350 values->
data[10]= 0.001769731591445356;
1351 values->
data[11]= 0.04303525354405329;
1356 XLAL_PRINT_INFO(
"Setting up initial conditions, returned values are:\n");
1357 for( j=0; j < values->
length; j++)
1361 if(debugPK)
XLAL_PRINT_INFO(
"\nReached the point where LN is to be calculated\n");
1363 memset( dvalues->
data, 0, 14 *
sizeof(
REAL8) );
1382 memcpy( rdotvec, dvalues->
data, 3*
sizeof(
REAL8) );
1383 memcpy( rvec, values->
data, 3*
sizeof(
REAL8) );
1384 memcpy( pvec, values->
data+3,3*
sizeof(
REAL8) );
1387 rcrossrdotNorm = sqrt(
inner_product( rcrossrdot, rcrossrdot ));
1388 for(
i = 0;
i < 3;
i++ ) { rcrossrdot[
i] /= rcrossrdotNorm; }
1404 XLAL_PRINT_INFO(
"rXp = %3.10f %3.10f %3.10f\n", rcrossp[0], rcrossp[1], rcrossp[2]);
1405 XLAL_PRINT_INFO(
"rXrdot = %3.10f %3.10f %3.10f\n", rcrossrdot[0], rcrossrdot[1], rcrossrdot[2]);
1409 chiS = 0.5 * (s1dotLN + s2dotLN);
1410 chiA = 0.5 * (s1dotLN - s2dotLN);
1413 switch ( SpinAlignedEOBversion )
1421 tplspin = (1.-2.*eta) * chiS + (m1 - m2)/(m1 + m2) * chiA;
1424 XLALPrintError(
"XLAL Error - %s: Unknown SEOBNR version!\nAt present only v1 and v2 are available.\n", __func__);
1440 XLAL_PRINT_INFO(
"tplspin = %.12e, chiS = %.12e, chiA = %.12e\n", tplspin, chiS, chiA);
1452 XLALPrintError(
"XLALSimIMREOBCalcSpinPrecFacWaveformCoefficients failed!\n");
1461 spinNQC = (1.-2.*eta) * chiS + (m1 - m2)/(m1 + m2) * chiA;
1467 REAL8 freqMinRad = pow(10.0, -1.5)/(
LAL_PI*mTScaled);
1468 REAL8 signOfa = copysign(1., spinNQC);
1469 REAL8 spn2 = spinNQC*spinNQC;
1471 REAL8 Z1 = 1.0 + pow(1.0 - spn2, 1./3.)*(pow(1.0+spinNQC, 1./3.) + pow(1.0-spinNQC, 1./3.) );
1472 REAL8 Z2 = sqrt(3.0*spn2 + Z1*Z1);
1473 REAL8 rISCO = 3.0 + Z2 - signOfa*sqrt( (3.-Z1)*(3.+Z1 + 2.*Z2));
1479 XLAL_PRINT_INFO(
"Stas ---- check for fmin NRPeakOmega22 = %4.10f, freqMinRad = %4.10f \n", NRPeakOmega22, freqMinRad);
1480 XLAL_PRINT_INFO(
"Stas -- minf freq is min( %4.10f, %4.10f )\n", NRPeakOmega22*0.1, freqMinRad);
1483 XLAL_PRINT_INFO(
"Stas -- rISCO = %4.10f , freq_ISCO = %4.10f \n", rISCO, fISCO);
1490 if (pow(
LAL_PI*fMin*mTScaled,-2./3.) < 10.0)
1492 XLAL_PRINT_WARNING(
"Waveform generation may fail due to high starting frequency. The starting frequency corresponds to a small initial radius of %.2fM. We recommend a lower starting frequency that corresponds to an estimated starting radius > 10M.", pow(
LAL_PI*fMin*mTScaled,-2.0/3.0));
1494 if (fMin > freqMinRad){
1495 XLALPrintError(
"XLAL Error - %s: Intitial frequency is too high, the limit is %4.10f \n", __func__, freqMinRad);
1505 switch ( SpinAlignedEOBversion )
1512 if(debugPK)
XLAL_PRINT_INFO(
"\t NQC: spins used = %.12e, %.12e\n", spinNQC, chiA);
1516 XLALPrintError(
"XLAL Error - %s: Unknown SEOBNR version!\nAt present only v1 and v2 are available.\n", __func__);
1529 nqcCoeffs.
a1 = nqcCoeffs.
a2 = nqcCoeffs.
a3 = nqcCoeffs.
a3S = nqcCoeffs.
a4 =
1530 nqcCoeffs.
a5 = nqcCoeffs.
b1 = nqcCoeffs.
b2 = nqcCoeffs.
b3 = nqcCoeffs.
b4 =
1537 XLAL_PRINT_INFO(
" NQC: a1 = %.16e, a2 = %.16e,\n a3 = %.16e, a3S = %.16e,\n a4 = %.16e, a5 = %.16e\n b1 = %.16e, b2 = %.16e,\n b3 = %.16e, b4 = %.16e\n",
1538 nqcCoeffs.
a1, nqcCoeffs.
a2, nqcCoeffs.
a3,
1539 nqcCoeffs.
a3S, nqcCoeffs.
a4, nqcCoeffs.
a5,
1540 nqcCoeffs.
b1, nqcCoeffs.
b2, nqcCoeffs.
b3, nqcCoeffs.
b4 );
1544 (
double) m1SI, (
double) m2SI, (
double) m1, (
double) m2 );
1546 (
double) mTotal, (
double) mTScaled, (
double) eta );
1549 (
double) spin1[0], (
double) spin1[1], (
double) spin1[2],
1550 (
double) spin2[0], (
double) spin2[1], (
double) spin2[2]);
1552 (
double) mSpin1[0], (
double) mSpin1[1], (
double) mSpin1[2],
1553 (
double) mSpin2[0], (
double) mSpin2[1], (
double) mSpin2[2]);
1555 XLAL_PRINT_INFO(
"sigmaStar = {%lf,%lf,%lf}, sigmaKerr = {%lf,%lf,%lf}\n",
1556 (
double) sigmaStar->
data[0], (
double) sigmaStar->
data[1],
1557 (
double) sigmaStar->
data[2], (
double) sigmaKerr->
data[0],
1558 (
double) sigmaKerr->
data[1], (
double) sigmaKerr->
data[2]);
1560 (
double)
a, (
double) tplspin, (
double) chiS, (
double) chiA);
1565 XLAL_PRINT_INFO(
"a is used to compute Hamiltonian coefficients,\n tplspin and chiS and chiA for the multipole coefficients\n");
1568 (
double) s1VecOverMtMt.
data[1], (
double) s1VecOverMtMt.
data[2]);
1570 (
double) s2VecOverMtMt.
data[1], (
double) s2VecOverMtMt.
data[2]);
1572 double StasS1 = sqrt(spin1[0]*spin1[0] + spin1[1]*spin1[1] +spin1[2]*spin1[2]);
1573 double StasS2 = sqrt(spin2[0]*spin2[0] + spin2[1]*spin2[1] +spin2[2]*spin2[2]);
1574 XLAL_PRINT_INFO(
"Stas: amplitude of spin1 = %.16e, amplitude of spin2 = %.16e, theta1 = %.16e , theta2 = %.16e, phi1 = %.16e, phi2 = %.16e \n",
1575 StasS1, StasS2, acos(spin1[2]/StasS1)/
LAL_PI, acos(spin2[2]/StasS2)/
LAL_PI,
1576 atan2(spin1[1], spin1[0])/
LAL_PI, atan2(spin2[1], spin2[0])/
LAL_PI );
1600 const INT8 v3_Hamiltonian_variables = 14;
1602 if ( SpinsAlmostAligned ) {
1604 valuesV2->
data[0] = values->
data[0];
1605 valuesV2->
data[1] = 0.;
1606 valuesV2->
data[2] = values->
data[3];
1610 seobParams.
chi1 = spin1Norm*copysign(1., cos(theta1Ini));
1611 seobParams.
chi2 = spin2Norm*copysign(1., cos(theta2Ini));
1617 if (use_optimized && PrecEOBversion == 300) {
1619 }
else if (use_optimized && PrecEOBversion == 304) {
1649 if(debugPK) {
XLAL_PRINT_INFO(
"\n\n BEGINNING THE EVOLUTION\n\n"); fflush(NULL); }
1656 if ( SpinsAlmostAligned ) {
1658 seobParams.
chi1 = spin1Norm*copysign(1.,cos(theta1Ini));
1659 seobParams.
chi2 = spin2Norm*copysign(1.,cos(theta2Ini));
1674 if (dynamicsV2 != NULL){
1683 rVec.
data = dynamicsV2->
data+retLenLow;
1684 phiVec.
data = dynamicsV2->
data+2*retLenLow;
1685 prVec.
data = dynamicsV2->
data+3*retLenLow;
1686 pPhiVec.
data = dynamicsV2->
data+4*retLenLow;
1689 for (
i = 0;
i < retLenLow;
i++) {
1693 dynamics->
data[3*retLenLow +
i] = 0.;
1696 dynamics->
data[6*retLenLow +
i] = 0.;
1697 dynamics->
data[7*retLenLow +
i] = 0.;
1698 dynamics->
data[8*retLenLow +
i] = 0.;
1699 dynamics->
data[9*retLenLow +
i] = spin1[2]*(m1*m1/mTotal/mTotal);
1700 dynamics->
data[10*retLenLow +
i] = 0.;
1701 dynamics->
data[11*retLenLow +
i] = 0.;
1702 dynamics->
data[12*retLenLow +
i] = spin2[2]*(m2*m2/mTotal/mTotal);
1703 dynamics->
data[13*retLenLow +
i]= phiVec.
data[
i];
1704 dynamics->
data[14*retLenLow +
i]= 0.;
1712 XLALPrintError(
"XLALAdaptiveRungeKuttaDenseandSparseOutput failed!\n");
1717 retLenLow = (int)(dynamicsEOMLo->
data[retLenEOMLow-1] / (
deltaT/mTScaled))+ 1;
1720 posVecxEOM->
data = dynamicsEOMLo->
data+retLenEOMLow;
1721 posVecyEOM->data = dynamicsEOMLo->
data+2*retLenEOMLow;
1722 posVeczEOM->data = dynamicsEOMLo->
data+3*retLenEOMLow;
1723 tVecEOM->data = dynamicsEOMLo->
data;
1726 0., 20./mTScaled,
deltaT/mTScaled, &dynamics );
1740 if (!use_optimized) {
1742 posVecx.
data = dynamics->
data+retLenLow;
1743 posVecy.
data = dynamics->
data+2*retLenLow;
1744 posVecz.
data = dynamics->
data+3*retLenLow;
1745 momVecx.
data = dynamics->
data+4*retLenLow;
1746 momVecy.
data = dynamics->
data+5*retLenLow;
1747 momVecz.
data = dynamics->
data+6*retLenLow;
1748 s1Vecx.
data = dynamics->
data+7*retLenLow;
1749 s1Vecy.
data = dynamics->
data+8*retLenLow;
1750 s1Vecz.
data = dynamics->
data+9*retLenLow;
1751 s2Vecx.
data = dynamics->
data+10*retLenLow;
1752 s2Vecy.
data = dynamics->
data+11*retLenLow;
1753 s2Vecz.
data = dynamics->
data+12*retLenLow;
1754 phiDMod.
data= dynamics->
data+13*retLenLow;
1755 phiMod.
data = dynamics->
data+14*retLenLow;
1757 if(debugPK) {
XLAL_PRINT_INFO(
"\n\n FINISHED THE EVOLUTION\n\n"); fflush(NULL); }
1761 out = fopen(
"seobDynamics.dat",
"w" );
1762 for (
i = 0;
i < retLenLow;
i++ )
1765 fprintf( out,
"%.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e\n",
1782 if (tStepBack > retLenLow*
deltaT)
1784 tStepBack = 0.5*retLenLow*
deltaT;
1785 nStepBack = ceil( tStepBack /
deltaT );
1790 hiSRndx = retLenLow - nStepBack;
1792 HiSRstart = tVec.
data[hiSRndx];
1797 XLAL_PRINT_INFO(
"Stepping back %d points - we expect %d points at high SR\n", nStepBack, nStepBack*resampFac );
1802 if (!use_optimized) {
1803 values->
data[0] = posVecx.
data[hiSRndx];
1804 values->
data[1] = posVecy.
data[hiSRndx];
1805 values->
data[2] = posVecz.
data[hiSRndx];
1806 values->
data[3] = momVecx.
data[hiSRndx];
1807 values->
data[4] = momVecy.
data[hiSRndx];
1808 values->
data[5] = momVecz.
data[hiSRndx];
1809 values->
data[6] = s1Vecx.
data[hiSRndx];
1810 values->
data[7] = s1Vecy.
data[hiSRndx];
1811 values->
data[8] = s1Vecz.
data[hiSRndx];
1812 values->
data[9] = s2Vecx.
data[hiSRndx];
1813 values->
data[10]= s2Vecy.
data[hiSRndx];
1814 values->
data[11]= s2Vecz.
data[hiSRndx];
1815 values->
data[12]= phiDMod.
data[hiSRndx];
1816 values->
data[13]= phiMod.
data[hiSRndx];
1819 if (use_optimized) {
1820 for(
i=1;
i<=14;
i++)
1821 values->
data[
i-1] = dynamics->
data[
i*retLenLow+hiSRndx];
1838 if ( SpinsAlmostAligned ) {
1840 seobParams.
chi1 = spin1Norm*copysign(1., cos(theta1Ini));
1841 seobParams.
chi2 = spin2Norm*copysign(1.,cos(theta2Ini));
1843 valuesV2->
data[0] = rVec.
data[hiSRndx];
1844 valuesV2->
data[1] = phiVec.
data[hiSRndx];
1845 valuesV2->
data[2] = prVec.
data[hiSRndx];
1846 valuesV2->
data[3] = pPhiVec.
data[hiSRndx];
1847 if (debugPK) {
XLAL_PRINT_INFO(
"Start high SR integration at: valuesV2->data[0], valuesV2->data[1], valuesV2->data[2], valuesV2->data[3] %e %e %e %e\n", valuesV2->
data[0], valuesV2->
data[1], valuesV2->
data[2], valuesV2->
data[3]);}
1850 retLen =
XLALAdaptiveRungeKutta4( integrator, &seobParams, valuesV2->
data, 0., tStepBack/mTScaled, deltaTHigh/mTScaled, &dynamicsV2Hi );
1863 if (dynamicsV2 != NULL){
1866 if (dynamicsV2Hi != NULL){
1875 rVecHi.
data = dynamicsV2Hi->
data+retLenHi;
1876 phiVecHi.
data = dynamicsV2Hi->
data+2*retLenHi;
1877 prVecHi.
data = dynamicsV2Hi->
data+3*retLenHi;
1878 pPhiVecHi.
data = dynamicsV2Hi->
data+4*retLenHi;
1881 for (
i = 0;
i < retLenHi;
i++) {
1883 dynamicsHi->
data[retLenHi +
i] = rVecHi.
data[
i]*cos(phiVecHi.
data[
i]);
1884 dynamicsHi->
data[2*retLenHi +
i] = rVecHi.
data[
i]*sin(phiVecHi.
data[
i]);
1885 dynamicsHi->
data[3*retLenHi +
i] = 0.;
1888 dynamicsHi->
data[6*retLenHi +
i] = 0.;
1889 dynamicsHi->
data[7*retLenHi +
i] = 0.;
1890 dynamicsHi->
data[8*retLenHi +
i] = 0.;
1891 dynamicsHi->
data[9*retLenHi +
i] = spin1[2]*(m1*m1/mTotal/mTotal);
1892 dynamicsHi->
data[10*retLenHi +
i] = 0.;
1893 dynamicsHi->
data[11*retLenHi +
i] = 0.;
1894 dynamicsHi->
data[12*retLenHi +
i] = spin2[2]*(m2*m2/mTotal/mTotal);
1895 dynamicsHi->
data[13*retLenHi +
i] = phiVecHi.
data[
i];
1896 dynamicsHi->
data[14*retLenHi +
i] = 0.;
1904 retLenHi = (int)(dynamicsEOMHi->
data[retLenEOMHi-1] / (deltaTHigh/mTScaled))+ 1;
1906 retLen =
XLALAdaptiveRungeKutta4( integrator, &seobParams, values->
data, 0., tStepBack/mTScaled, deltaTHigh/mTScaled, &dynamicsHi );
1917 if (dynamicsV2 != NULL){
1920 if (dynamicsV2Hi != NULL){
1923 if (dynamics != NULL){
1926 if (dynamicsHi != NULL){
1933 timeHi.
length = retLenHi;
1944 posVecxHi.
data = dynamicsHi->
data+retLenHi;
1945 posVecyHi.
data = dynamicsHi->
data+2*retLenHi;
1946 posVeczHi.
data = dynamicsHi->
data+3*retLenHi;
1947 momVecxHi.
data = dynamicsHi->
data+4*retLenHi;
1948 momVecyHi.
data = dynamicsHi->
data+5*retLenHi;
1949 momVeczHi.
data = dynamicsHi->
data+6*retLenHi;
1950 s1VecxHi.
data = dynamicsHi->
data+7*retLenHi;
1951 s1VecyHi.
data = dynamicsHi->
data+8*retLenHi;
1952 s1VeczHi.
data = dynamicsHi->
data+9*retLenHi;
1953 s2VecxHi.
data = dynamicsHi->
data+10*retLenHi;
1954 s2VecyHi.
data = dynamicsHi->
data+11*retLenHi;
1955 s2VeczHi.
data = dynamicsHi->
data+12*retLenHi;
1956 phiDModHi.
data= dynamicsHi->
data+13*retLenHi;
1957 phiModHi.
data = dynamicsHi->
data+14*retLenHi;
1960 if(debugPK) {
XLAL_PRINT_INFO(
"Finished high SR integration... \n" ); fflush(NULL); }
1963 out = fopen(
"seobDynamicsHi.dat",
"w" );
1964 for (
i = 0;
i < retLenHi;
i++ )
1966 fprintf( out,
"%.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e\n",
1985 INT4 phaseCounterA = 0, phaseCounterB = 0;
1986 if (use_optimized) {
1990 EulerAnglesI2P(Alpha, Beta, Gamma, &phaseCounterA, &phaseCounterB, *tVecEOM, *posVecxEOM, *posVecyEOM, *posVeczEOM, retLenEOMLow, 0., 0.5*
LAL_PI, 0, 1);
1995 EulerAnglesI2P(Alpha, Beta, Gamma, &phaseCounterA, &phaseCounterB, tVec, posVecx, posVecy, posVecz, retLenLow, 0., 0.5*
LAL_PI, 0, 0);
1998 XLAL_PRINT_INFO(
"Writing Alpha and Beta angle timeseries at low SR to alphaANDbeta.dat\n" );
2000 out = fopen(
"alphaANDbeta.dat",
"w");
2001 for(
i = 0;
i < retLenLow;
i++ ) {
2006 XLAL_PRINT_INFO(
"Writing Gamma angle timeseries at low SR to gamma.dat\n");
2008 out = fopen(
"gamma.dat",
"w");
2009 for(
i = 0;
i < retLenLow;
i++ ) {
2010 fprintf( out,
"%.16e %.16e\n", tVec.
data[
i], Gamma->data[
i]);
2019 if (use_optimized) {
2023 REAL8 precEulerresult = 0, precEulererror = 0;
2024 gsl_integration_workspace * precEulerw = gsl_integration_workspace_alloc (1000);
2025 gsl_function precEulerF;
2031 gsl_interp_accel *alpha_acc = gsl_interp_accel_alloc();
2032 gsl_spline *alpha_spline = gsl_spline_alloc( gsl_interp_cspline, retLenEOMLow );
2033 gsl_spline_init( alpha_spline, dynamicsEOMLo->
data, Alpha->
data, retLenEOMLow );
2035 gsl_interp_accel *beta_acc = gsl_interp_accel_alloc();
2036 gsl_spline *beta_spline = gsl_spline_alloc( gsl_interp_cspline, retLenEOMLow );
2037 gsl_spline_init( beta_spline, dynamicsEOMLo->
data, Beta->data, retLenEOMLow );
2042 precEulerparams.
beta_acc = beta_acc;
2045 precEulerF.params = &precEulerparams;
2048 int hiSRndxEOMf=retLenEOMLow-1;
2049 for (;dynamicsEOMLo->
data[hiSRndxEOMf] > dynamics->
data[hiSRndx]; hiSRndxEOMf--);
2052 gsl_integration_qags (&precEulerF, dynamicsEOMLo->
data[hiSRndxEOMf], dynamics->
data[hiSRndx], 1
e-9, 1
e-9, 1000, precEulerw, &precEulerresult, &precEulererror);
2053 gammaHiSRndx = Gamma->data[hiSRndxEOMf]+precEulerresult;
2054 alphaHiSRndx = gsl_spline_eval(alpha_spline,tVec.
data[hiSRndx],alpha_acc);
2055 gsl_spline_free(alpha_spline);
2056 gsl_interp_accel_free(alpha_acc);
2057 gsl_spline_free(beta_spline);
2058 gsl_interp_accel_free(beta_acc);
2059 gsl_integration_workspace_free(precEulerw);
2061 EulerAnglesI2P(AlphaHi, BetaHi, GammaHi, &phaseCounterA, &phaseCounterB, timeHi, posVecxHi, posVecyHi, posVeczHi, retLenHi, alphaHiSRndx, gammaHiSRndx, 1, 1);
2063 EulerAnglesI2P(AlphaHi, BetaHi, GammaHi, &phaseCounterA, &phaseCounterB, timeHi, posVecxHi, posVecyHi, posVeczHi, retLenHi, Alpha->
data[hiSRndx], Gamma->data[hiSRndx], 1, 0);
2067 XLAL_PRINT_INFO(
"Writing Alpha and Beta angle timeseries at high SR to alphaANDbetaHi.dat\n" );
2069 out = fopen(
"alphaANDbetaHi.dat",
"w");
2070 for(
i = 0;
i < retLenHi;
i++ ) {
2071 fprintf( out,
"%.16e %.16e %.16e\n", tVec.
data[hiSRndx] + timeHi.
data[
i], AlphaHi->
data[
i], BetaHi->data[
i]);
2075 XLAL_PRINT_INFO(
"Writing Gamma angle timeseries at high SR to gammaHi.dat\n");
2077 out = fopen(
"gammaHi.dat",
"w");
2078 for(
i = 0;
i < retLenHi;
i++ ) {
2079 fprintf( out,
"%.16e %.16e\n", tVec.
data[hiSRndx] + timeHi.
data[
i], GammaHi->data[
i]);
2086 modefreqVec.
data = &modeFreq;
2096 retLenRDPatchHi= (
UINT4)ceil( 40 / ( cimag(modeFreq) * deltaTHigh ));
2097 retLenRDPatchLow = (
UINT4)ceil( 40 / ( cimag(modeFreq) *
deltaT ));
2116 for (
i = 0;
i < retLenHi;
i++ )
2118 for ( j = 0; j < 3; j++ )
2120 values->
data[j] = dynamicsHi->
data[(j+1)*retLenHi +
i];
2126 int foundPeakOmega = 0;
2131 tPeakOmega =
XLALSimLocateOmegaTime(dynamicsHi, values->
length, retLenHi, seobParams, seobCoeffs, m1, m2, radiusVec, &foundPeakOmega, &tMaxOmega, use_optimized);
2133 if(tPeakOmega == 0.0 || foundPeakOmega==0){
2135 XLAL_PRINT_INFO(
"maximum of omega and A(r) is not found, looking for amplitude maximum\n");
2140 XLAL_PRINT_INFO(
"The omega-related time is found and it's %f \n", tPeakOmega);
2144 XLAL_PRINT_INFO(
"Estimation of the peak is now at time %.16e, %.16e \n",
2145 tPeakOmega, tPeakOmega+HiSRstart);
2151 spline = gsl_spline_alloc( gsl_interp_cspline, retLenHi );
2152 acc = gsl_interp_accel_alloc();
2155 for ( j = 0; j < values->
length; j++ )
2157 gsl_spline_init( spline,
2158 dynamicsHi->
data, dynamicsHi->
data+(j+1)*retLenHi, retLenHi );
2159 values->
data[j] = gsl_spline_eval( spline, tPeakOmega, acc );
2161 gsl_spline_free(spline);
2162 gsl_interp_accel_free(acc);
2169 memset( dvalues->
data, 0, 14*
sizeof(dvalues->
data[0]));
2185 memcpy( rdotvec, dvalues->
data, 3*
sizeof(
REAL8));
2186 memcpy( rvec, values->
data, 3*
sizeof(
REAL8));
2187 memcpy( pvec, values->
data+3,3*
sizeof(
REAL8));
2191 Lx = rcrossp[0]; Ly = rcrossp[1]; Lz = rcrossp[2];
2194 Jx = eta*Lx + values->
data[6] + values->
data[9];
2195 Jy = eta*Ly + values->
data[7] + values->
data[10];
2196 Jz = eta*Lz + values->
data[8] + values->
data[11];
2197 magJ = sqrt( Jx*Jx + Jy*Jy + Jz*Jz );
2200 XLAL_PRINT_INFO(
"J at merger: %e, %e, %e (mag = %e)\n", Jx, Jy, Jz, magJ);
2206 chi1J = values->
data[6]*Jx + values->
data[7] *Jy + values->
data[8] *Jz;
2207 chi2J = values->
data[9]*Jx + values->
data[10]*Jy + values->
data[11]*Jz;
2208 chi1J/= magJ*m1*m1/mTotal/mTotal;
2209 chi2J/= magJ*m2*m2/mTotal/mTotal;
2210 chiJ = (chi1J+chi2J)/2. + (chi1J-chi2J)/2.*((m1-m2)/(m1+m2))/(1. - 2.*eta);
2211 kappaJL = (Lx*Jx + Ly*Jy + Lz*Jz) / magL / magJ;
2213 JLN = (Jx*rcrossrdot[0] + Jy*rcrossrdot[1] + Jz*rcrossrdot[2])/magLN/magJ;
2216 chi1L = values->
data[6]*Lx + values->
data[7] *Ly + values->
data[8] *Lz;
2217 chi2L = values->
data[9]*Lx + values->
data[10]*Ly + values->
data[11]*Lz;
2218 chi1L /= magL*m1*m1/mTotal/mTotal;
2219 chi2L /= magL*m2*m2/mTotal/mTotal;
2220 chiL = (chi1L+chi2L)/2. + (chi1L-chi2L)/2.*((m1-m2)/(m1+m2))/(1. - 2.*eta);
2224 XLAL_PRINT_INFO(
"chi1J,chi2J,chiJ = %3.10f %3.10f %3.10f\n", chi1J,chi2J,chiJ); fflush(NULL); fflush(NULL);
2225 XLAL_PRINT_INFO(
"chi1L,chi2L,chiL = %3.10f %3.10f %3.10f\n", chi1L,chi2L,chiL); fflush(NULL); fflush(NULL);
2228 XLAL_PRINT_INFO(
"L.LN = %4.11f \n", (Lx*rcrossrdot[0] + Ly*rcrossrdot[1] + Lz*rcrossrdot[2])/magL/magLN);
2234 switch ( SpinAlignedEOBversion )
2242 combSize, deltaNQC);
2249 if ( chi1L == 0. && chi2L == 0. ) combSize = 11.;
2250 if (chiL >= 0.8 && eta >30.0/(31.*31) && eta <10.0/121.) combSize = 13.5;
2251 if (chiL >= 0.9 && eta < 30./(31.*31.)) combSize = 12.0;
2252 if (chiL >= 0.8 && eta > 10./121.) combSize = 8.5;
2256 combSize, deltaNQC);
2261 XLALPrintError(
"XLAL Error - %s: wrong SpinAlignedEOBversion value, must be 1 or 2!\n", __func__ );
2272 tAttach = tPeakOmega - deltaNQC;
2275 if ( ! foundPeakOmega ){
2276 tAttach = tPeakOmega;
2280 XLAL_PRINT_INFO(
"tPeakOmega - deltaNQC, tPeakOmega, deltaNQC %e %e %e\n", tPeakOmega - deltaNQC + HiSRstart, tPeakOmega + HiSRstart, deltaNQC);
2281 XLAL_PRINT_INFO(
"For RD: DeltaNQC = %3.10f, comb = %3.10f \n", deltaNQC, combSize);
2282 XLAL_PRINT_INFO(
"NOTE! that additional shift (sh) is computed and added in XLALSimIMREOBHybridAttachRingdownPrec\n");
2290 JframeEz[0] = Jx / magJ;
2291 JframeEz[1] = Jy / magJ;
2292 JframeEz[2] = Jz / magJ;
2294 if ( fabs(1.+ JframeEz[2]) <= 1.0e-13 )
2295 { JframeEx[0] = -1.; JframeEx[1] = 0.; JframeEx[2] = 0.; }
2298 if ( fabs(1. - JframeEz[2]) <= 1.0e-13 )
2300 { JframeEx[0] = 1.0; JframeEx[1] = 0.0; JframeEx[2] = 0.; }
2302 JframeEx[0] = JframeEz[1];
2303 JframeEx[1] = -JframeEz[0];
2308 JExnorm = sqrt(JframeEx[0]*JframeEx[0] + JframeEx[1]*JframeEx[1]);
2310 JframeEx[0] /= JExnorm;
2311 JframeEx[1] /= JExnorm;
2312 JframeEy[0] = JframeEz[1]*JframeEx[2] - JframeEz[2]*JframeEx[1];
2313 JframeEy[1] = JframeEz[2]*JframeEx[0] - JframeEz[0]*JframeEx[2];
2314 JframeEy[2] = JframeEz[0]*JframeEx[1] - JframeEz[1]*JframeEx[0];
2318 XLAL_PRINT_INFO(
"J-frameEx = [%.16e\t%.16e\t%.16e]\n", JframeEx[0], JframeEx[1], JframeEx[2]);
XLAL_PRINT_INFO(
"J-frameEy = [%.16e\t%.16e\t%.16e]\n", JframeEy[0], JframeEy[1], JframeEy[2]);
2319 XLAL_PRINT_INFO(
"J-frameEz = [%.16e\t%.16e\t%.16e]\n", JframeEz[0], JframeEz[1], JframeEz[2]);fflush(NULL);
2332 if (use_optimized) {
2357 XLALEOBSpinPrecGenerateHplusHcrossTSFromEOMSoln(hVecEOM,retLenEOMLow,Alpha,Beta,Gamma,JframeEx,JframeEy,JframeEz,Y,dynamicsEOMLo,&seobParams);
2366 XLALPrintError(
"Failed to allocate REAL8Vector tlistRDPatch!\n");
2370 memset( tlistRDPatch->
data, 0, tlistRDPatch->
length *
sizeof(
REAL8 ));
2371 for (
i = 0;
i < retLenLow;
i++ ){
2381 if ( !(alphaI2PTS =
XLALCreateREAL8TimeSeries(
"alphaI2P", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenLow )) + !(betaI2PTS =
XLALCreateREAL8TimeSeries(
"betaI2P", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenLow )) + !(gammaI2PTS =
XLALCreateREAL8TimeSeries(
"gammaI2P", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenLow )) + !(alphaP2JTS =
XLALCreateREAL8TimeSeries(
"alphaP2J", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenLow )) + !(betaP2JTS =
XLALCreateREAL8TimeSeries(
"betaP2J", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenLow )) + !(gammaP2JTS =
XLALCreateREAL8TimeSeries(
"gammaP2J", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenLow )) ) {
2384 XLALPrintError(
"Failed to allocate alphaI2PTS or betaI2PTS or gammaI2PTS or alphaP2JTS or betaP2JTS or gammaP2JTS!\n");
2389 if ( !(h22TS =
XLALCreateCOMPLEX16TimeSeries(
"H_22", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenLow )) + !(h21TS =
XLALCreateCOMPLEX16TimeSeries(
"H_21", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenLow )) + !(h20TS =
XLALCreateCOMPLEX16TimeSeries(
"H_20", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenLow )) + !(h2m1TS =
XLALCreateCOMPLEX16TimeSeries(
"H_2m1", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenLow )) + !(h2m2TS =
XLALCreateCOMPLEX16TimeSeries(
"H_2m2", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenLow ))) {
2392 XLALPrintError(
"Failed to allocate h22TS or h21TS or h20TS or h2m1TS or h2m2TS!\n");
2404 XLALPrintError(
"Failed to allocate REAL8Vector tlistRDPatch!\n");
2425 if (!use_optimized) {
2428 memset( tlistRDPatch->
data, 0, tlistRDPatch->
length *
sizeof(
REAL8 ));
2431 for (
i = 0;
i < retLenLow;
i++ )
2436 for (
i = retLenLow;
i < retLenLow + retLenRDPatchLow;
i++ )
2443 if (use_optimized) {
2446 if (!(alphaP2JTSHi =
XLALCreateREAL8TimeSeries(
"alphaP2J", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenHi )) + !(betaP2JTSHi =
XLALCreateREAL8TimeSeries(
"betaP2J", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenHi )) + !(gammaP2JTSHi =
XLALCreateREAL8TimeSeries(
"gammaP2J", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenHi )) )
2454 XLALPrintError(
"Failed to allocate alphaI2PTSHi or betaI2PTSHi or gammaI2PTSHi or alphaP2JTSHi or betaP2JTSHi or gammaP2JTSHi!\n");
2464 for (
i = retLenLow;
i < retLenLow + retLenRDPatchLow;
i++ ){
2469 memset( tlistRDPatchHi->
data, 0, tlistRDPatchHi->
length *
sizeof(
REAL8 ));
2470 for (
i = 0;
i < retLenHi;
i++ ){
2471 tlistHi->
data[
i] =
i * deltaTHigh/mTScaled + HiSRstart;
2472 tlistRDPatchHi->
data[
i] =
i * deltaTHigh/mTScaled + HiSRstart;
2474 for (
i = retLenHi;
i < retLenHi + retLenRDPatchHi;
i++ ){
2475 tlistRDPatchHi->
data[
i] =
i * deltaTHigh/mTScaled + HiSRstart;
2478 for(
i=0;
i<retLenHi;
i++){
2479 for ( j = 0; j < values->
length; j++ )
2480 values->
data[j] = dynamicsHi->
data[(j+1)*retLenHi +
i];
2482 memset( dvalues->
data, 0, 14*
sizeof(dvalues->
data[0]));
2492 XLALPrintError(
"XLALSpinPrecHcapRvecDerivative_exact failed!\n");
2496 rvec[0] = posVecxHi.
data[
i];
2497 rvec[1] = posVecyHi.
data[
i];
2498 rvec[2] = posVeczHi.
data[
i];
2501 LNhx = rcrossrdot[0] / magLN;
2502 LNhy = rcrossrdot[1] / magLN;
2503 LNhz = rcrossrdot[2] / magLN;
2516 EulerAnglesP2J(&aP2J,&bP2J,&gP2J,AlphaHi->
data[
i],BetaHi->data[
i], GammaHi->data[
i], LNhx, LNhy, LNhz, JframeEx, JframeEy, JframeEz );
2517 alphaP2JTSHi->data->data[
i]=-aP2J;
2518 betaP2JTSHi->data->data[
i]=bP2J;
2519 gammaP2JTSHi->data->data[
i]=-gP2J;
2536 *hlmPTSoutput = hlmPTSout;
2545 "HIMRJHi", &tc, 0.0, deltaTHigh, &
lalStrainUnit, retLenHi + retLenRDPatchHi);
2550 out = fopen(
"PWavesHi.dat",
"w" );
2551 for (
i = 0;
i < retLenHi;
i++ )
2553 fprintf( out,
"%.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e\n",
2554 i*deltaTHigh/mTScaled + HiSRstart, creal(h22PTSHi->
data->
data[
i]),
2562 XLAL_PRINT_INFO(
"YP: P-frame waveforms written to file for High SR.\n");
2571 XLAL_PRINT_INFO(
"maximum of Amplitude or dot{Ampl} are not found \n");
2575 XLAL_PRINT_INFO(
"The Amplitude-related time is found and it's %f \n", tAmpMax);
2579 if( foundAmp==0 && foundPeakOmega == 0){
2581 XLALPrintError(
"Houston, we've got a problem SOS, SOS, SOS, cannot find the RD attachment point... m1 = %.16e, m2 = %.16e, fMin = %.16e, inclination = %.16e, Mtotal = %.16e, eta = %.16e, spin1 = {%.16e, %.16e, %.16e}, spin2 = {%.16e, %.16e, %.16e} \n",
2582 m1, m2, (
double)fMin, (
double)inc, mTotal, eta, spin1[0], spin1[1], spin1[2], spin2[0], spin2[1], spin2[2]);
2585 tAttach = tAttach -2.0;
2594 if (tAmpMax < tAttach){
2596 XLAL_PRINT_INFO(
"Stas the attachment time will be modified from %f to %f \n", tAttach, tAmpMax);
2602 XLAL_PRINT_INFO(
"Stas: the final decision on the attachment time is %f \n", tAttach);
2612 XLAL_PRINT_INFO(
"Generating precessing-frame modes for coarse dynamics\n");
2614 out = fopen(
"rotDynamics.dat",
"w" );
2617 for (
i = 0;
i < retLenLow;
i++ )
2619 for ( j = 0; j < values->
length; j++ )
2621 values->
data[j] = dynamics->
data[(j+1)*retLenLow +
i];
2625 memset( dvalues->
data, 0, 14*
sizeof(dvalues->
data[0]));
2638 memcpy( rdotvec, dvalues->
data, 3*
sizeof(
REAL8));
2639 rvec[0] = posVecx.
data[
i]; rvec[1] = posVecy.
data[
i];
2640 rvec[2] = posVecz.
data[
i];
2643 omega = sqrt(
inner_product(rcrossrdot, rcrossrdot)) / (magR*magR);
2648 cartPosVec.
data = cartPosData;
2649 cartMomVec.
data = cartMomData;
2650 memset( cartPosData, 0,
sizeof( cartPosData ) );
2651 memset( cartMomData, 0,
sizeof( cartMomData ) );
2653 LNhx = rcrossrdot[0];
2654 LNhy = rcrossrdot[1];
2655 LNhz = rcrossrdot[2];
2656 magLN = sqrt(LNhx*LNhx + LNhy*LNhy + LNhz*LNhz);
2657 LNhx = LNhx / magLN;
2658 LNhy = LNhy / magLN;
2659 LNhz = LNhz / magLN;
2662 aI2P = Alpha->
data[
i];
2663 bI2P = Beta->data[
i];
2664 gI2P = Gamma->data[
i];
2684 EulerAnglesP2J(&aP2J, &bP2J, &gP2J, aI2P, bI2P, gI2P, LNhx, LNhy, LNhz, JframeEx, JframeEy, JframeEz);
2690 betaI2PTS->data->data[
i] = bI2P;
2691 gammaI2PTS->data->data[
i] = -gI2P;
2692 alphaP2JTS->data->data[
i] = -aP2J;
2693 betaP2JTS->data->data[
i] = bP2J;
2694 gammaP2JTS->data->data[
i] = -gP2J;
2702 s1Vec.
data = s1Data;
2703 s2Vec.
data = s2Data;
2705 s1VecOverMtMt.
data = s1DataNorm;
2706 s2VecOverMtMt.
data = s2DataNorm;
2707 for( k = 0; k < 3; k++ )
2709 s1VecOverMtMt.
data[k] = values->
data[k+6];
2710 s2VecOverMtMt.
data[k] = values->
data[k+9];
2711 s1Vec.
data[k] = s1VecOverMtMt.
data[k] * mTotal * mTotal;
2712 s2Vec.
data[k] = s2VecOverMtMt.
data[k] * mTotal * mTotal;
2715 seobParams.
s1Vec = &s1VecOverMtMt;
2716 seobParams.
s2Vec = &s2VecOverMtMt;
2723 rcrossrdot[0] = LNhx;
2724 rcrossrdot[1] = LNhy;
2725 rcrossrdot[2] = LNhz;
2730 chiS = 0.5 * (s1dotLN + s2dotLN);
2731 chiA = 0.5 * (s1dotLN - s2dotLN);
2733 switch ( SpinAlignedEOBversion )
2741 tplspin = (1.-2.*eta) * chiS + (m1 - m2)/(m1 + m2) * chiA;
2744 XLALPrintError(
"XLAL Error - %s: Unknown SEOBNR version!\nAt present only v1 and v2 are available.\n", __func__);
2753 XLAL_PRINT_INFO(
"\nSomething went wrong evaluating XLALSimIMRCalculateSpinPrecEOBHCoeffs in step %d of coarse dynamics\n",
2760 XLAL_PRINT_INFO(
"\nSomething went wrong evaluating XLALSimIMRCalculateSpinPrecEOBHCoeffs in step %d of coarse dynamics\n",
2762 XLALPrintError(
"XLALSimIMREOBCalcSpinPrecFacWaveformCoefficients failed!\n");
2768 &s1VecOverMtMt, &s2VecOverMtMt,
2769 sigmaKerr, sigmaStar, seobParams.
tortoise, &seobCoeffs );
2772 polarDynamics.
length = 4;
2773 polarDynamics.
data = polData;
2782 polarDynamics.
data[3] = magL;
2785 &polarDynamics, values, v, ham, 2, 2, &seobParams ) ==
XLAL_FAILURE )
2789 XLALPrintError(
"XLALSimIMRSpinEOBGetPrecSpinFactorizedWaveform failed!\n");
2804 h2m2TS->data->data[
i] = conj(hLM);
2807 fprintf( out,
"%.16e %.16e %.16e %.16e %.16e %.16e %.16e ",
2808 i*
deltaT/mTScaled, aI2P, bI2P, gI2P, aP2J, bP2J, gP2J );
2809 fprintf( out,
"%.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e\n",
2810 polData[0], polData[1], polData[2], polData[3], ham, v,
2811 creal(hLM), cimag(hLM), creal(hLM/hNQC), cimag(hLM/hNQC) );
2816 &polarDynamics, values, v, ham, 2, 1, &seobParams ) ==
XLAL_FAILURE )
2820 XLALPrintError(
"XLALSimIMRSpinEOBGetPrecSpinFactorizedWaveform failed!\n");
2824 h21TS->data->data[
i] = hLM;
2825 h2m1TS->data->data[
i] = conj(hLM);
2826 h20TS->data->data[
i] = 0.0;
2831 XLAL_PRINT_INFO(
"YP: quasi-nonprecessing modes generated.\n"); fflush(NULL);
2850 XLAL_PRINT_INFO(
"YP: SphHarmTS structures populated.\n"); fflush(NULL);
2851 out = fopen(
"PWaves.dat",
"w" );
2852 for (
i = 0;
i < retLenLow;
i++ )
2855 "%.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e\n",
2870 if ( !(alphaI2PTSHi =
XLALCreateREAL8TimeSeries(
"alphaI2P", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenHi )) + !(betaI2PTSHi =
XLALCreateREAL8TimeSeries(
"betaI2P", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenHi )) + !(gammaI2PTSHi =
XLALCreateREAL8TimeSeries(
"gammaI2P", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenHi )) + !(alphaP2JTSHi =
XLALCreateREAL8TimeSeries(
"alphaP2J", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenHi )) + !(betaP2JTSHi =
XLALCreateREAL8TimeSeries(
"betaP2J", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenHi )) + !(gammaP2JTSHi =
XLALCreateREAL8TimeSeries(
"gammaP2J", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenHi )) )
2878 XLALPrintError(
"Failed to allocate alphaI2PTSHi or betaI2PTSHi or gammaI2PTSHi or alphaP2JTSHi or betaP2JTSHi or gammaP2JTSHi!\n");
2883 if ( !(h22TSHi =
XLALCreateCOMPLEX16TimeSeries(
"H_22", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenHi )) + !(h21TSHi =
XLALCreateCOMPLEX16TimeSeries(
"H_21", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenHi )) + !(h20TSHi =
XLALCreateCOMPLEX16TimeSeries(
"H_20", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenHi )) + !(h2m1TSHi =
XLALCreateCOMPLEX16TimeSeries(
"H_2m1", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenHi )) + !(h2m2TSHi =
XLALCreateCOMPLEX16TimeSeries(
"H_2m2", &tc, 0.0,
deltaT, &
lalStrainUnit, retLenHi ))) {
2890 XLALPrintError(
"Failed to allocate h22TSHi or h21TSHi or h20TSHi or h2m1TSHi or h2m2TSHi!\n");
2896 "HIMRJHi", &tc, 0.0, deltaTHigh, &
lalStrainUnit, retLenHi + retLenRDPatchHi);
2905 memset( tlistRDPatchHi->
data, 0, tlistRDPatchHi->
length *
sizeof(
REAL8 ));
2906 for (
i = 0;
i < retLenHi;
i++ )
2908 tlistHi->
data[
i] =
i * deltaTHigh/mTScaled + HiSRstart;
2909 tlistRDPatchHi->
data[
i] =
i * deltaTHigh/mTScaled + HiSRstart;
2911 for (
i = retLenHi;
i < retLenHi + retLenRDPatchHi;
i++ )
2913 tlistRDPatchHi->
data[
i] =
i * deltaTHigh/mTScaled + HiSRstart;
2919 XLAL_PRINT_INFO(
"Generating precessing-frame modes for fine dynamics\n");
2922 if (debugPK) out = fopen(
"rotDynamicsHi.dat",
"w" );
2923 for (
i = 0;
i < retLenHi;
i++ )
2925 for ( j = 0; j < values->
length; j++ )
2927 values->
data[j] = dynamicsHi->
data[(j+1)*retLenHi +
i];
2931 memset( dvalues->
data, 0, 14*
sizeof(dvalues->
data[0]));
2948 rvec[0] = posVecxHi.
data[
i];
2949 rvec[1] = posVecyHi.
data[
i];
2950 rvec[2] = posVeczHi.
data[
i];
2951 memcpy( rdotvec, dvalues->
data, 3*
sizeof(
REAL8));
2955 omega = sqrt(
inner_product(rcrossrdot, rcrossrdot)) / (magR*magR);
2960 cartPosVec.
data = cartPosData;
2961 cartMomVec.
data = cartMomData;
2962 memset( cartPosData, 0,
sizeof( cartPosData ) );
2963 memset( cartMomData, 0,
sizeof( cartMomData ) );
2966 LNhx = rcrossrdot[0] / magLN;
2967 LNhy = rcrossrdot[1] / magLN;
2968 LNhz = rcrossrdot[2] / magLN;
2970 aI2P = AlphaHi->
data[
i];
2971 bI2P = BetaHi->data[
i];
2972 gI2P = GammaHi->data[
i];
2974 EulerAnglesP2J(&aP2J, &bP2J, &gP2J, aI2P, bI2P, gI2P, LNhx, LNhy, LNhz, JframeEx, JframeEy, JframeEz);
2978 betaI2PTSHi->data->data[
i] = bI2P;
2979 gammaI2PTSHi->data->data[
i] = -gI2P;
2980 alphaP2JTSHi->data->data[
i] = -aP2J;
2981 betaP2JTSHi->data->data[
i] = bP2J;
2982 gammaP2JTSHi->data->data[
i] = -gP2J;
2989 s1Vec.
data = s1Data;
2990 s2Vec.
data = s2Data;
2992 s1VecOverMtMt.
data = s1DataNorm;
2993 s2VecOverMtMt.
data = s2DataNorm;
2994 for( k = 0; k < 3; k++ )
2996 s1VecOverMtMt.
data[k] = values->
data[k+6];
2997 s2VecOverMtMt.
data[k] = values->
data[k+9];
2998 s1Vec.
data[k] = s1VecOverMtMt.
data[k] * mTotal * mTotal;
2999 s2Vec.
data[k] = s2VecOverMtMt.
data[k] * mTotal * mTotal;
3002 seobParams.
s1Vec = &s1VecOverMtMt;
3003 seobParams.
s2Vec = &s2VecOverMtMt;
3010 rcrossrdot[0] = LNhx;
3011 rcrossrdot[1] = LNhy;
3012 rcrossrdot[2] = LNhz;
3016 chiS = 0.5 * (s1dotLN + s2dotLN);
3017 chiA = 0.5 * (s1dotLN - s2dotLN);
3019 switch ( SpinAlignedEOBversion )
3027 tplspin = (1.-2.*eta) * chiS + (m1 - m2)/(m1 + m2) * chiA;
3030 XLALPrintError(
"XLAL Error - %s: Unknown SEOBNR version!\nAt present only v1 and v2 are available.\n", __func__);
3044 XLAL_PRINT_INFO(
"\nSomething went wrong evaluating XLALSimIMRCalculateSpinPrecEOBHCoeffs in step %d of coarse dynamics\n",
3050 XLAL_PRINT_INFO(
"\nSomething went wrong evaluating XLALSimIMRCalculateSpinPrecEOBHCoeffs in step %d of coarse dynamics\n",
3058 XLALPrintError(
"XLALSimIMREOBCalcSpinPrecFacWaveformCoefficients failed!\n");
3064 &s1VecOverMtMt, &s2VecOverMtMt,
3065 sigmaKerr, sigmaStar, seobParams.
tortoise, &seobCoeffs );
3068 polarDynamics.
length = 4;
3069 polarDynamics.
data = polData;
3089 XLALPrintError(
"XLALSimIMRSpinEOBGetPrecSpinFactorizedWaveform failed!\n");
3107 h2m2TSHi->data->data[
i] = conj(hLM);
3110 fprintf( out,
"%.16e %.16e %.16e %.16e %.16e %.16e %.16e ",
3111 i*deltaTHigh/mTScaled + HiSRstart, aI2P, bI2P, gI2P, aP2J, bP2J, gP2J );
3112 fprintf( out,
"%.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e, %.16e\n",
3113 rdotvec[0], rdotvec[1], rdotvec[2], LNhx, LNhy, LNhz, creal(hLM), cimag(hLM), polData[0]);
3125 XLALPrintError(
"XLALSimIMRSpinEOBGetPrecSpinFactorizedWaveform failed!\n");
3129 h21TSHi->data->data[
i] = hLM;
3130 h2m1TSHi->data->data[
i] = conj(hLM);
3131 h20TSHi->data->data[
i] = 0.0;
3135 XLAL_PRINT_INFO(
"YP: quasi-nonprecessing modes generated.for High SR\n");
3151 *hlmPTSoutput = hlmPTSout;
3162 out = fopen(
"PWavesHi.dat",
"w" );
3163 for (
i = 0;
i < retLenHi;
i++ )
3165 fprintf( out,
"%.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e\n",
3166 i*deltaTHigh/mTScaled + HiSRstart, creal(h22PTSHi->
data->
data[
i]),
3174 XLAL_PRINT_INFO(
"YP: P-frame waveforms written to file for High SR.\n");
3184 XLAL_PRINT_INFO(
"maximum of Amplitude or dot{Ampl} are not found \n");
3189 XLAL_PRINT_INFO(
"The Amplitude-related time is found and it's %f \n", tAmpMax);
3193 if( foundAmp==0 && foundPeakOmega == 0){
3195 XLALPrintError(
"Houston, we've got a problem SOS, SOS, SOS, cannot find the RD attachment point... m1 = %.16e, m2 = %.16e, fMin = %.16e, inclination = %.16e, Mtotal = %.16e, eta = %.16e, spin1 = {%.16e, %.16e, %.16e}, spin2 = {%.16e, %.16e, %.16e} \n",
3196 m1, m2, (
double)fMin, (
double)inc, mTotal, eta, spin1[0], spin1[1], spin1[2], spin2[0], spin2[1], spin2[2]);
3199 tAttach = tAttach -2.0;
3209 if (tAmpMax < tAttach){
3211 XLAL_PRINT_INFO(
"Stas the attachment time will be modified from %f to %f \n", tAttach, tAmpMax);
3217 XLAL_PRINT_INFO(
"Stas: the final decision on the attachment time is %f \n", tAttach);
3231 if(!use_optimized) {
3239 XLALPrintError(
"XLALSimInspiralPrecessionRotateModes failed!\n");
3252 out = fopen(
"JWaves.dat",
"w" );
3253 for (
i = 0;
i < retLenLow;
i++ )
3256 "%.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e\n",
3272 alphaP2JTSHi, betaP2JTSHi, gammaP2JTSHi ) ==
XLAL_FAILURE )
3279 XLALPrintError(
"XLALSimInspiralPrecessionRotateModes failed!\n");
3289 *hlmPTSHiOutput = hlmPTSHi;
3292 out = fopen(
"JWavesHi.dat",
"w" );
3293 for (
i = 0;
i < retLenHi;
i++ )
3296 "%.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e\n",
3297 timeHi.
data[
i]+HiSRstart,
3309 if ( !sigReHi || !sigImHi )
3311 XLALPrintError(
"Failed to allocate REAL8Vector sigReHi or sigImHi!\n");
3315 memset( sigReHi->
data, 0, sigReHi->
length *
sizeof( sigReHi->
data[0] ));
3316 memset( sigImHi->data, 0, sigImHi->length *
sizeof( sigImHi->data[0] ));
3324 if ( combSize > tAttach )
3326 XLALPrintError(
"Function: %s, The comb size looks to be too big!!!\n", __func__ );
3335 rdMatchPoint->
data[0] = combSize < tAttach ? tAttach - combSize : 0;
3336 rdMatchPoint->
data[1] = tAttach;
3337 rdMatchPoint->
data[2] = (retLenHi-1)*deltaTHigh/mTScaled;
3340 rdMatchPoint->
data[0],rdMatchPoint->
data[1]);
3342 tAttach, rdMatchPoint->
data[0]+HiSRstart,
3343 rdMatchPoint->
data[1]+HiSRstart);
3347 rdMatchPoint->
data[0] = trunc(rdMatchPoint->
data[0] / (deltaTHigh/mTScaled) ) * (deltaTHigh/mTScaled);
3348 rdMatchPoint->
data[1] = trunc(rdMatchPoint->
data[1] / (deltaTHigh/mTScaled) ) * (deltaTHigh/mTScaled);
3352 rdMatchPoint->
data[0],rdMatchPoint->
data[1],
3353 rdMatchPoint->
data[0]+HiSRstart,rdMatchPoint->
data[1]+HiSRstart);
3358 REAL8 chi = tplspin/(1. - 2.*eta);
3359 if (chi >= 0.7 && chi < 0.8) {
3360 sh = -9. * (eta - 0.25);
3362 if ((eta > 30. / 31. / 31. && eta <= 10. / 121. && chi >= 0.8) || (eta <= 30. / 31. / 31. && chi >= 0.8 && chi < 0.9)) {
3364 sh = -9. * (eta - 0.25) * (1. + 2. * exp(-(chi - 0.85) * (chi - 0.85) / 0.05 / 0.05)) * (1. + 1. / (1. + exp((eta - 0.01) / 0.001)));
3366 if (eta < 30. / 31. / 31. && chi >= 0.9) {
3368 sh = 0.55 - 9. * (eta - 0.25) * (1. + 2. * exp(-(chi - 0.85) * (chi - 0.85) / 0.05 / 0.05)) * (1. + 1. / (1. + exp((eta - 0.01) / 0.001)));
3370 if (eta > 10. / 121. && chi >= 0.8) {
3372 sh = 1. - 9. * (eta - 0.25) * (1. + 2. * exp(-(chi - 0.85) * (chi - 0.85) / 0.05 / 0.05)) * (1. + 1. / (1. + exp((eta - 0.01) / 0.001)));
3377 int CheckRDAttachment = 1;
3378 if (CheckRDAttachment ){
3380 if (debugPK)
XLAL_PRINT_INFO(
"Stas: checking the RD attachment point....\n");fflush(NULL);
3383 rdMatchPoint->
data[0] = combSize < tAttach ? tAttach - combSize : 0;
3384 rdMatchPoint->
data[1] = tAttach;
3385 rdMatchPoint->
data[0] = rdMatchPoint->
data[0] - sh;
3386 rdMatchPoint->
data[1] = rdMatchPoint->
data[1] - sh;
3387 rdMatchPoint->
data[2] = (retLenHi-1)*deltaTHigh/mTScaled;
3388 rdMatchPoint->
data[0] = trunc(rdMatchPoint->
data[0] / (deltaTHigh/mTScaled) ) * (deltaTHigh/mTScaled);
3389 rdMatchPoint->
data[1] = trunc(rdMatchPoint->
data[1] / (deltaTHigh/mTScaled) ) * (deltaTHigh/mTScaled);
3392 REAL8 ratio22 = 1.0;
3393 REAL8 ratio2m2 = 1.0;
3394 REAL8 timediff = 0.;
3396 for (
i = 0;
i < retLenHi;
i++ )
3399 sigImHi->data[
i] = cimag(h22JTSHi->
data->
data[
i]);
3403 deltaTHigh, m1, m2, 0.0, 0.0, chi1L, 0.0, 0.0, chi2L,
3404 &timeHi, rdMatchPoint, spinEOBApproximant, kappaJL, &timediff) ==
XLAL_FAILURE )
3416 memset( sigReHi->
data, 0, sigReHi->
length *
sizeof( sigReHi->
data[0] ));
3417 memset( sigImHi->data, 0, sigImHi->length *
sizeof( sigImHi->data[0] ));
3419 for (
i = 0;
i < retLenHi;
i++ )
3422 sigImHi->data[
i] = cimag(h2m2JTSHi->
data->
data[
i]);
3426 deltaTHigh, m1, m2, 0.0, 0.0, chi1L, 0.0, 0.0, chi2L,
3427 &timeHi, rdMatchPoint, spinEOBApproximant, kappaJL, &timediff ) ==
XLAL_FAILURE ) {
3439 XLAL_PRINT_INFO(
"At first check: ratio22 ratio2m2 %e %e\n", ratio22, ratio2m2);fflush(NULL);
3441 if(ratio22 <= thr && ratio2m2 <=thr){
3452 memset( sigReHi->
data, 0, sigReHi->
length *
sizeof( sigReHi->
data[0] ));
3453 memset( sigImHi->data, 0, sigImHi->length *
sizeof( sigImHi->data[0] ));
3456 &ratio22, &ratio2m2, &tAttach, thr,
3457 deltaTHigh, m1, m2, 0.0, 0.0, chi1L, 0.0, 0.0, chi2L,
3458 &timeHi, rdMatchPoint, spinEOBApproximant, kappaJL, combSize, tMaxOmega, tMaxAmp);
3461 if (found_att == 1){
3462 XLAL_PRINT_INFO(
"we have found new attachment point tAtt = %f, with ratios %f, %f \n",
3463 tAttach, ratio22, ratio2m2);fflush(NULL);
3465 else if (found_att == 2) {
3466 XLAL_PRINT_INFO(
"we haven't found proper attachment point, we picked the best point at tAtt = %f with ratios %f, %f\n", tAttach, ratio22, ratio2m2);fflush(NULL);
3470 XLAL_PRINT_INFO(
"we haven't found proper attachment point, best ratios are %f, %f at tAtt = %f \n",
3471 ratio22, ratio2m2, tAttach);fflush(NULL);
3476 memset( sigReHi->
data, 0, sigReHi->
length *
sizeof( sigReHi->
data[0] ));
3477 memset( sigImHi->data, 0, sigImHi->length *
sizeof( sigImHi->data[0] ));
3483 out = fopen(
"tAttach.dat",
"w" );
3484 fprintf( out,
"%.16e %.16e %.16e %.16e \n", tPeakOmega, deltaNQC, tAmpMax, tAttach);
3488 AttachParams->
data[0] = tPeakOmega;
3489 AttachParams->
data[1] = deltaNQC;
3490 AttachParams->
data[2] = tAmpMax;
3491 AttachParams->
data[3] = tAttach;
3492 AttachParams->
data[4] = HiSRstart;
3494 rdMatchPoint->
data[0] = combSize < tAttach ? tAttach - combSize : 0;
3495 rdMatchPoint->
data[1] = tAttach;
3496 rdMatchPoint->
data[0] = rdMatchPoint->
data[0] - sh;
3497 rdMatchPoint->
data[1] = rdMatchPoint->
data[1] - sh;
3498 rdMatchPoint->
data[2] = (retLenHi-1)*deltaTHigh/mTScaled;
3499 rdMatchPoint->
data[0] = trunc(rdMatchPoint->
data[0] / (deltaTHigh/mTScaled) ) * (deltaTHigh/mTScaled);
3500 rdMatchPoint->
data[1] = trunc(rdMatchPoint->
data[1] / (deltaTHigh/mTScaled) ) * (deltaTHigh/mTScaled);
3505 for (
m = -2;
m < 3;
m++ )
3508 for (
i = 0;
i < retLenHi;
i++ )
3511 sigImHi->data[
i] = cimag(hJTSHi->
data->
data[
i]);
3514 deltaTHigh, m1, m2, 0.0, 0.0, chi1L, 0.0, 0.0, chi2L,
3515 &timeHi, rdMatchPoint, spinEOBApproximant, kappaJL )
3522 XLALPrintError(
"XLALSimIMREOBHybridAttachRingdownPrec failed!\n");
3527 for (
i = 0;
i < (int)sigReHi->
length;
i++ )
3529 hIMRJTSHi->
data->
data[
i] = (sigReHi->
data[
i]) + I * (sigImHi->data[
i]);
3534 if (debugPK){
XLAL_PRINT_INFO(
"YP: J wave RD attachment done.\n"); fflush(NULL); }
3546 for (
i=0;
i < retLenHi + retLenRDPatchHi;
i++ ){
3560 for (
i=1;
i < retLenHi + retLenRDPatchHi - 1;
i++){
3563 invAmpmax = invAmp->
data[
i];
3567 XLAL_PRINT_INFO(
"We set tc = %.16e, %.16e \n", (tlistRDPatchHi->
data[i_maxiA] ), -mTScaled * (tlistRDPatchHi->
data[i_maxiA] ));
3583 *hIMRlmJTSHiOutput = hIMRlmJTSHi;
3585 out = fopen(
"JIMRWavesHi.dat",
"w" );
3586 for (
i = 0;
i < retLenHi + retLenRDPatchHi;
i++ )
3589 "%.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e\n",
3590 tlistRDPatchHi->
data[
i],
3599 XLAL_PRINT_INFO(
"Stas: down sampling and make the complete waveform in J-frame\n");
3608 *hIMRlmJTSHiOutput = hIMRlmJTSHi;
3611 for ( k = 2; k > -3; k-- ) {
3613 for (
i = 0;
i < retLenHi + retLenRDPatchHi;
i++ )
3616 sigImHi->data[
i] = cimag(hIMRJTS2mHi->
data->
data[
i]);
3620 for (
i = 0;
i< retLenLow;
i++){
3621 if (
i*
deltaT/mTScaled > HiSRstart)
break;
3626 for (
i = 0;
i< retLenLow;
i++){
3627 if (
i*
deltaT/mTScaled > HiSRstart)
break;
3633 spline = gsl_spline_alloc( gsl_interp_cspline, retLenHi + retLenRDPatchHi);
3634 acc = gsl_interp_accel_alloc();
3635 gsl_spline_init( spline, tlistRDPatchHi->
data, sigReHi->
data, retLenHi + retLenRDPatchHi);
3636 for (
i = idxRD;
i< retLenLow+retLenRDPatchLow;
i++){
3637 if(
i*
deltaT/mTScaled <= tlistRDPatchHi->
data[ retLenHi + retLenRDPatchHi- 1]) {
3638 hIMRJTS->
data->
data[
i] = gsl_spline_eval( spline, tlistRDPatch->
data[
i], acc );
3645 gsl_spline_free(spline);
3646 gsl_interp_accel_free(acc);
3648 spline = gsl_spline_alloc( gsl_interp_cspline, retLenHi + retLenRDPatchHi);
3649 acc = gsl_interp_accel_alloc();
3650 gsl_spline_init( spline, tlistRDPatchHi->
data, sigImHi->data, retLenHi + retLenRDPatchHi);
3651 for (
i = idxRD;
i< retLenLow+retLenRDPatchLow;
i++){
3652 if(
i*
deltaT/mTScaled <= tlistRDPatchHi->
data[ retLenHi + retLenRDPatchHi- 1]) {
3653 hIMRJTS->
data->
data[
i] += I * gsl_spline_eval( spline, tlistRDPatch->
data[
i], acc );
3659 gsl_spline_free(spline);
3660 gsl_interp_accel_free(acc);
3665 for (
i=0;
i<(int)tlistRDPatch->
length;
i++){
3669 if (debugPK){
XLAL_PRINT_INFO(
"Stas: J-wave with RD generated.\n"); fflush(NULL); }
3678 out = fopen(
"JIMRWaves.dat",
"w" );
3679 for (
i = 0;
i < retLenLow + retLenRDPatchLow;
i++ )
3682 "%.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e\n",
3702 gamJtoI = atan2(JframeEz[1], -JframeEz[0]);
3703 betJtoI = acos(JframeEz[2]);
3704 alJtoI = atan2(JframeEy[2], JframeEx[2]);
3705 if (fabs(betJtoI -
LAL_PI) < 1.e-10){
3707 alJtoI = atan2(JframeEx[1], JframeEx[0]);
3709 if (fabs(betJtoI) < 1.e-10){
3711 alJtoI = atan2(JframeEx[1], JframeEx[0]);
3715 XLAL_PRINT_INFO(
"Stas: J->I EA = %.16e, %.16e, %.16e \n", alJtoI, betJtoI, gamJtoI);
3726 for (
i=0;
i< retLenLow + retLenRDPatchLow;
i++){
3728 betI->data->data[
i] = betJtoI;
3729 gamI->data->data[
i] = -gamJtoI;
3731 for (
i=0;
i<(int)tlistRDPatch->
length;
i++){
3743 if (debugPK){
XLAL_PRINT_INFO(
"Rotation to inertial I-frame\n"); fflush(NULL); }
3747 XLALPrintError(
"XLALSimInspiralPrecessionRotateModes failed!\n");
3765 out = fopen(
"IWaves.dat",
"w" );
3766 for (
i = 0;
i < retLenLow + retLenRDPatchLow;
i++ )
3769 "%.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e %.16e\n",
3770 tlistRDPatch->
data[
i],
3785 if(!use_optimized) {
3812 if(debugPK){
XLAL_PRINT_INFO(
"Ylm %e %e %e %e %e %e %e %e %e %e \n", creal(Y22), cimag(Y22), creal(Y2m2), cimag(Y2m2), creal(Y21), cimag(Y21), creal(Y2m1), cimag(Y2m1), creal(Y20), cimag (Y20)); fflush(NULL); }
3819 hPlusTS->
data->
data[
i] = amp0*creal(x11);
3820 hCrossTS->
data->
data[
i] = -amp0*cimag(x11);
3824 for (
i = 0;
i < idxRD;
i++ )
3834 (*hcross) = hCrossTS;
3886 if ( dynamicsEOMLo != NULL ) {
3889 if ( dynamicsEOMHi != NULL ) {
3898 for (tmp_idx_ii=0; tmp_idx_ii < tmp_vec->
length; tmp_idx_ii++)
3900 tmp_vec->
data[tmp_idx_ii] = dynamicsHi->
data[tmp_idx_ii];
3905 if (dynamicsV2 != NULL){
3908 if (dynamicsV2Hi != NULL){
3911 if(debugPK){
XLAL_PRINT_INFO(
"Memory cleanup ALL done.\n"); fflush(NULL); }
3916 #undef FREE_EVERYTHING
INT4 XLALSimIMREOBGenerateQNMFreqV2Prec(COMPLEX16Vector *modefreqs, const REAL8 mass1, const REAL8 mass2, const REAL8 spin1[3], const REAL8 spin2[3], UINT4 l, INT4 m, UINT4 nmodes, Approximant approximant)
This function generates the quasinormal mode frequencies for a black hole ringdown.
double XLALSimLocateAmplTime(REAL8Vector *timeHi, COMPLEX16Vector *hP22, REAL8Vector *radiusVec, int *found, REAL8 *tMaxAmp)
int XLALSimAdjustRDattachmentTime(REAL8Vector *signal1, REAL8Vector *signal2, COMPLEX16TimeSeries *h22, COMPLEX16TimeSeries *h2m2, REAL8 *ratio22, REAL8 *ratio2m2, REAL8 *tAttach, const REAL8 thr, const REAL8 dt, const REAL8 m1, const REAL8 m2, const REAL8 spin1x, const REAL8 spin1y, const REAL8 spin1z, const REAL8 spin2x, const REAL8 spin2y, const REAL8 spin2z, REAL8Vector *timeVec, REAL8Vector *matchrange, Approximant approximant, const REAL8 JLN, const REAL8 combSize, const REAL8 tMaxOmega, const REAL8 tMaxAmp)
double XLALSimLocateOmegaTime(REAL8Array *dynamicsHi, unsigned int numdynvars, unsigned int retLenHi, SpinEOBParams seobParams, SpinEOBHCoeffs seobCoeffs, REAL8 m1, REAL8 m2, REAL8Vector *radiusVec, int *found, REAL8 *tMaxOmega, INT4 use_optimized)
INT4 XLALSimCheckRDattachment(REAL8Vector *signal1, REAL8Vector *signal2, REAL8 *ratio, const REAL8 tAtt, const INT4 l, const INT4 m, const REAL8 dt, const REAL8 mass1, const REAL8 mass2, const REAL8 spin1x, const REAL8 spin1y, const REAL8 spin1z, const REAL8 spin2x, const REAL8 spin2y, const REAL8 spin2z, REAL8Vector *timeVec, REAL8Vector *matchrange, Approximant approximant, const REAL8 JLN, REAL8 *timediff)
static int XLALSimIMRCalculateSpinPrecEOBHCoeffs(SpinEOBHCoeffs *coeffs, const REAL8 eta, const REAL8 a, const UINT4 SpinAlignedEOBversion)
This function is used to calculate some coefficients which will be used in the spinning EOB Hamiltoni...
static UNUSED INT4 XLALSimIMREOBHybridAttachRingdownPrec(REAL8Vector *signal1, REAL8Vector *signal2, const INT4 l, const INT4 m, const REAL8 dt, const REAL8 mass1, const REAL8 mass2, const REAL8 spin1x, const REAL8 spin1y, const REAL8 spin1z, const REAL8 spin2x, const REAL8 spin2y, const REAL8 spin2z, REAL8Vector *timeVec, REAL8Vector *matchrange, Approximant approximant, const REAL8 JLN)
The main workhorse function for performing the ringdown attachment for EOB models EOBNRv2 and SEOBNRv...
static UNUSED int XLALSimIMRSpinEOBNonQCCorrection(COMPLEX16 *restrict nqc, REAL8Vector *restrict values, const REAL8 omega, EOBNonQCCoeffs *restrict coeffs)
This function calculates the non-quasicircular correction to apply to the waveform.
static UNUSED REAL8 XLALSimIMREOBGetNRSpinPeakDeltaTv2(INT4 UNUSED l, INT4 UNUSED m, REAL8 UNUSED m1, REAL8 UNUSED m2, REAL8 chi1, REAL8 chi2)
The time difference between the orbital peak and the peak amplitude of the mode in question (currentl...
static UNUSED REAL8 XLALSimIMREOBGetNRSpinPeakDeltaT(INT4 l, INT4 m, REAL8 UNUSED eta, REAL8 a)
The time difference between the orbital peak and the peak amplitude of the mode in question (currentl...
static UNUSED REAL8 XLALSimIMREOBGetNRSpinPeakOmegav2(INT4 UNUSED l, INT4 UNUSED m, REAL8 UNUSED eta, REAL8 a)
Peak frequency predicted by fitting NR results (currently only 2,2 available).
static UNUSED int XLALSimIMRGetEOBCalibratedSpinNQC(EOBNonQCCoeffs *restrict coeffs, INT4 UNUSED l, INT4 UNUSED m, REAL8 eta, REAL8 a)
More recent versions of the EOB models, such as EOBNRv2 and SEOBNRv1, utilise a non-quasicircular cor...
static UNUSED int XLALSimIMRGetEOBCalibratedSpinNQC3D(EOBNonQCCoeffs *restrict coeffs, INT4 UNUSED l, INT4 UNUSED m, REAL8 m1, REAL8 m2, REAL8 a, REAL8 chiAin)
Function to 3D-interpolate known amplitude NQC coeffcients of spin terms for SEOBNRv2,...
static UNUSED int XLALSimIMREOBComputeNewtonMultipolePrefixes(NewtonMultipolePrefixes *prefix, const REAL8 m1, const REAL8 m2)
Function which computes the various coefficients in the Newtonian multipole.
static double f_alphadotcosi(double x, void *inparams)
static int XLALSpinAlignedHcapDerivative(double t, const REAL8 values[], REAL8 dvalues[], void *funcParams)
static int XLALSimIMRSpinEOBCalculateSigmaKerr(REAL8Vector *sigmaKerr, REAL8 mass1, REAL8 mass2, REAL8Vector *s1, REAL8Vector *s2)
Function to calculate normalized spin of the deformed-Kerr background in SEOBNRv1.
static int XLALSimIMRSpinEOBCalculateSigmaStar(REAL8Vector *sigmaStar, REAL8 mass1, REAL8 mass2, REAL8Vector *s1, REAL8Vector *s2)
Function to calculate normalized spin of the test particle in SEOBNRv1.
static REAL8 XLALSimIMRSpinPrecEOBHamiltonian(const REAL8 eta, REAL8Vector *restrict x, REAL8Vector *restrict p, REAL8Vector *restrict s1Vec, REAL8Vector *restrict s2Vec, REAL8Vector *restrict sigmaKerr, REAL8Vector *restrict sigmaStar, int tortoise, SpinEOBHCoeffs *coeffs)
static REAL8 * cross_product(const REAL8 values1[], const REAL8 values2[], REAL8 result[])
static int XLALSpinPrecHcapRvecDerivative(double UNUSED t, const REAL8 values[], REAL8 dvalues[], void *funcParams)
Function to calculate numerical derivatives of the spin EOB Hamiltonian, to get , as decribed in Eqs.
static REAL8 inner_product(const REAL8 values1[], const REAL8 values2[])
Functions to compute the inner product and cross products between vectors.
static int XLALSpinPrecHcapExactDerivative(double UNUSED t, const REAL8 values[], REAL8 dvalues[], void *funcParams)
Function to calculate numerical derivatives of the spin EOB Hamiltonian, which correspond to time der...
static int XLALSpinPrecHcapNumericalDerivative(double UNUSED t, const REAL8 values[], REAL8 dvalues[], void *funcParams)
Function to calculate numerical derivatives of the spin EOB Hamiltonian, which correspond to time der...
static int XLALSimIMRSpinEOBInitialConditions(REAL8Vector *initConds, const REAL8 mass1, const REAL8 mass2, const REAL8 fMin, const REAL8 inc, const REAL8 spin1[], const REAL8 spin2[], SpinEOBParams *params, INT4 use_optimized_v2)
Main function for calculating the spinning EOB initial conditions, following the quasi-spherical init...
static int XLALSimIMRSpinEOBInitialConditionsPrec(REAL8Vector *initConds, const REAL8 mass1, const REAL8 mass2, const REAL8 fMin, const REAL8 inc, const REAL8 spin1[], const REAL8 spin2[], SpinEOBParams *params, INT4 use_optimized)
Main function for calculating the spinning EOB initial conditions, following the quasi-spherical init...
static UNUSED int XLALEOBSpinPrecStopConditionBasedOnPR(double UNUSED t, const double values[], double dvalues[], void UNUSED *funcParams)
Stopping conditions for dynamics integration for SEOBNRv3.
static int XLALSpinPrecAlignedHiSRStopCondition(double UNUSED t, const double UNUSED values[], double dvalues[], void UNUSED *funcParams)
Stopping condition for the high resolution SEOBNRv1/2 orbital evolution – stop when reaching a minimu...
static int XLALEOBSpinPrecAlignedStopCondition(double UNUSED t, const double values[], double dvalues[], void *funcParams)
Stopping condition for the regular resolution SEOBNRv1/2 orbital evolution – stop when reaching max o...
SEOBHCoeffConstants XLALEOBSpinPrecCalcSEOBHCoeffConstants(REAL8 eta)
Optimized routine for calculating coefficients for the v3 Hamiltonian.
int XLALSimIMRSpinEOBWaveformAll(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8Vector **dynHi, SphHarmTimeSeries **hlmPTSoutput, SphHarmTimeSeries **hlmPTSHiOutput, SphHarmTimeSeries **hIMRlmJTSHiOutput, SphHarmTimeSeries **hIMRoutput, REAL8Vector **AttachPars, const REAL8 phiC, const REAL8 deltaT, const REAL8 m1SI, const REAL8 m2SI, const REAL8 fMin, const REAL8 r, const REAL8 inc, const REAL8 INspin1x, const REAL8 INspin1y, const REAL8 INspin1z, const REAL8 INspin2x, const REAL8 INspin2y, const REAL8 INspin2z, const UINT4 PrecEOBversion)
This function generates precessing spinning SEOBNRv3 waveforms h+ and hx.
int XLALSimIMRSpinEOBWaveform(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, const REAL8 phiC, const REAL8 deltaT, const REAL8 m1SI_in, const REAL8 m2SI_in, const REAL8 fMin, const REAL8 r, const REAL8 inc, const REAL8 INspin1[], const REAL8 INspin2[], const UINT4 PrecEOBversion)
Standard interface for SEOBNRv3 waveform generator: calls XLALSimIMRSpinEOBWaveformAll.
static UNUSED void EulerAnglesP2J(REAL8 *aP2J, REAL8 *bP2J, REAL8 *gP2J, const REAL8 aI2P, const REAL8 bI2P, const REAL8 gI2P, const REAL8 LNhx, const REAL8 LNhy, const REAL8 LNhz, const REAL8 JframeEx[], const REAL8 JframeEy[], const REAL8 JframeEz[])
Given Euler angles to go from initial inertial frame to precessing frama and the LNhat vector,...
static UNUSED int EulerAnglesI2P(REAL8Vector *Alpha, REAL8Vector *Beta, REAL8Vector *Gamma, INT4 *phaseCounterA, INT4 *phaseCounterB, const REAL8Vector tVec, const REAL8Vector posVecx, const REAL8Vector posVecy, const REAL8Vector posVecz, const UINT4 retLenLow, const REAL8 InitialAlpha, const REAL8 InitialGamma, UINT4 flag_highSR, const UINT4 use_optimized)
Given the trajectory in an inertial frame, this computes Euler angles of the roation from the inertia...
static int SEOBNRv3OptimizedInterpolatorGeneral(REAL8 *yin, REAL8 tinit, REAL8 deltat, UINT4 num_input_times, REAL8Array **yout, size_t dim)
static void XLALEOBSpinPrecGenerateHTSModesFromEOMSoln(COMPLEX16 *hTSm2, COMPLEX16 *hTSm1, COMPLEX16 *hTS0, COMPLEX16 *hTSp1, COMPLEX16 *hTSp2, int retLen, REAL8Array *dynamics, SpinEOBParams *seobParams)
static void XLALEOBSpinPrecGenerateHplusHcrossTSFromEOMSoln(REAL8Vector *h, int retLen, REAL8Vector *AlphaI2PVec, REAL8Vector *BetaI2PVec, REAL8Vector *GammaI2PVec, REAL8 Jx[3], REAL8 Jy[3], REAL8 Jz[3], COMPLEX16 Y[5], REAL8Array *dynamics, SpinEOBParams *seobParams)
Module containing the energy and flux functions for waveform generation.
static int XLALSpinPrecHcapRvecDerivative_exact(double UNUSED t, const REAL8 values[], REAL8 dvalues[], void *funcParams)
Function to calculate exact derivatives of the spin EOB Hamiltonian, to get , as decribed in Eqs.
REAL8Array * XLALCreateREAL8ArrayL(UINT4,...)
void XLALDestroyREAL8Array(REAL8Array *)
int XLALAdaptiveRungeKutta4(LALAdaptiveRungeKuttaIntegrator *integrator, void *params, REAL8 *yinit, REAL8 tinit, REAL8 tend, REAL8 deltat, REAL8Array **yout)
void XLALAdaptiveRungeKuttaFree(LALAdaptiveRungeKuttaIntegrator *integrator)
LALAdaptiveRungeKuttaIntegrator * XLALAdaptiveRungeKutta4InitEighthOrderInstead(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)
int XLALAdaptiveRungeKuttaDenseandSparseOutput(LALAdaptiveRungeKuttaIntegrator *integrator, void *params, REAL8 *yinit, REAL8 tinit, REAL8 tend, REAL8 deltat, REAL8Array **sparse_output, REAL8Array **dense_output)
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)
Approximant
Enum that specifies the PN approximant to be used in computing the waveform.
@ SEOBNRv3
Spin precessing EOBNR model v3.
@ SEOBNRv3_opt
Optimized Spin precessing EOBNR model v3.
int XLALSimInspiralPrecessionRotateModes(SphHarmTimeSeries *h_lm, REAL8TimeSeries *alpha, REAL8TimeSeries *beta, REAL8TimeSeries *gam)
Takes in the h_lm spherical harmonic decomposed modes and rotates the modes by Euler angles alpha,...
SphHarmTimeSeries * XLALSphHarmTimeSeriesAddMode(SphHarmTimeSeries *appended, const COMPLEX16TimeSeries *inmode, UINT4 l, INT4 m)
Prepend a node to a linked list of SphHarmTimeSeries, or create a new head.
COMPLEX16TimeSeries * XLALSphHarmTimeSeriesGetMode(SphHarmTimeSeries *ts, UINT4 l, INT4 m)
Get the time series of a waveform's (l,m) spherical harmonic mode from a SphHarmTimeSeries linked lis...
void XLALSphHarmTimeSeriesSetTData(SphHarmTimeSeries *ts, REAL8Sequence *tdata)
Set the tdata member for all nodes in the list.
void XLALDestroySphHarmTimeSeries(SphHarmTimeSeries *ts)
Delete list from current pointer to the end of the list.
COMPLEX16 XLALSpinWeightedSphericalHarmonic(REAL8 theta, REAL8 phi, int s, int l, int m)
REAL8TimeSeries * XLALCreateREAL8TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
void XLALDestroyCOMPLEX16TimeSeries(COMPLEX16TimeSeries *series)
void XLALDestroyREAL8TimeSeries(REAL8TimeSeries *series)
COMPLEX16TimeSeries * XLALCreateCOMPLEX16TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
const LALUnit lalStrainUnit
REAL8Vector * XLALCreateREAL8Vector(UINT4 length)
void XLALDestroyREAL8Vector(REAL8Vector *vector)
#define XLAL_PRINT_INFO(...)
#define XLAL_PRINT_WARNING(...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
int int XLALPrintWarning(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
The coefficients which are used in calculating the non-quasicircular correction to the EOBNRv2 model.
Structure containing all the parameters needed for the EOB waveform.
FacWaveformCoeffs * hCoeffs
NewtonMultipolePrefixes * prefixes
int(* stop)(double t, const double y[], double dydt[], void *params)
Structure containing all the terms of the Newtonian multipole which are constant over the course of t...
gsl_spline * alpha_spline
gsl_interp_accel * alpha_acc
gsl_interp_accel * beta_acc
Structure to carry a collection of spherical harmonic modes in COMPLEX16 time series.
Parameters for the spinning EOB model, used in calculating the Hamiltonian.
UINT4 SpinAlignedEOBversion
Parameters for the spinning EOB model.
SpinEOBHCoeffs * seobCoeffs
EOBNonQCCoeffs * nqcCoeffs
SEOBHCoeffConstants * seobCoeffConsts
Approximant seobApproximant
Tidal parameters for EOB model of NS: mByM - dimensionless ratio m_{NS}/M lambda2Tidal - dimensionles...