29 #define UNUSED __attribute__ ((unused))
41 #include <gsl/gsl_const.h>
42 #include <gsl/gsl_errno.h>
43 #include <gsl/gsl_math.h>
44 #include <gsl/gsl_odeiv.h>
48 #define ODE_ABSTOL (1e-13)
49 #define ODE_RELTOL (1e-11)
50 #define INTERP_UNIFORM_GRID 1
152 const REAL8 distance,
153 const REAL8 inclination,
154 const REAL8 UNUSED longAscNodes,
156 const REAL8 UNUSED eccentricity,
157 const REAL8 UNUSED meanPerAno,
159 const REAL8 UNUSED f_ref
174 XLAL_CHECK(((S1x==0)&&(S1y==0)&&(S2x==0)&&(S2y==0)),
XLAL_EDOM,
"ERROR! Non-aligned spins not supported (yet)! Aborting.\n");
182 REAL8 m1_SI, m2_SI, LambdaAl2, LambdaAl3, LambdaAl4, LambdaBl2, LambdaBl3, LambdaBl4;
186 REAL8 spin1x, spin1y, spin1z, spin2x, spin2y, spin2z;
255 const INT4 chunk = 500;
258 INT4 store_dynamics = 0;
260 INT4 use_postadiab_dyn = 1;
271 use_postadiab_dyn = 0;
300 use_postadiab_dyn = 0;
316 XLALTEOBDynamicsSetParams(dyn, &ModeArray, m1_SI, m2_SI, spin1x, spin1y, spin1z, spin2x, spin2y, spin2z,
dt, LambdaAl2, LambdaBl2, LambdaAl3, LambdaBl3, LambdaAl4, LambdaBl4, LALparams);
320 INT4 use_tidal, use_spins;
321 INT4 merger_interp = 0;
344 store_dynamics = (use_postadiab_dyn || !use_tidal);
360 for (
int k=
KMAX-1; k>=0; k--)
378 if (use_postadiab_dyn)
389 for (
int i = 0;
i < size;
i++) tdata->
data[
i] = dyn->
time[
i];
393 for (
int i = 0;
i < size;
i++)
399 p_eob_dyn_rhs(dyn->
t, dyn->
y, dyn->
dy, dyn);
403 for (
int k = 0; k <
KMAX; k++)
412 this_hlm = this_hlm->
next;
421 goto END_ODE_EVOLUTION;
428 dyn->
dt = 0.5*(dyn->
time[iter]-dyn->
time[iter-1]);
469 dyn->
time[0] = dyn->
t;
483 p_eob_dyn_rhs(dyn->
t, dyn->
y, dyn->
dy, dyn);
490 for (
int k = 0; k <
KMAX; k++)
499 this_hlm = this_hlm->
next;
528 const gsl_odeiv2_step_type * T;
529 gsl_odeiv2_driver *
d;
533 T = gsl_odeiv2_step_rkf45;
539 T = gsl_odeiv2_step_rk8pd;
561 dyn->
ti = dyn->
t + dyn->
dt;
562 STATUS = gsl_odeiv2_driver_apply (
d, &dyn->
t, (
double) dyn->
ti, dyn->
y);
570 STATUS = gsl_odeiv2_evolve_apply_fixed_step (
e,
c,
s, &sys, &dyn->
t, dyn->
dt, dyn->
y);
572 STATUS = gsl_odeiv2_evolve_apply (
e,
c,
s, &sys, &dyn->
t, (
double) dyn->
t_stop, &dyn->
dt, dyn->
y);
578 if (dyn->
r > dyn->
rLSO)
580 STATUS = gsl_odeiv2_evolve_apply (
e,
c,
s, &sys, &dyn->
t, (
double) dyn->
t_stop, &dyn->
dt, dyn->
y);
585 dyn->
dt = dt_tuned_mrg;
586 dyn->
ti = dyn->
t + dyn->
dt;
587 STATUS = gsl_odeiv2_evolve_apply_fixed_step (
e,
c,
s, &sys, &dyn->
t, dyn->
dt, dyn->
y);
607 XLAL_CHECK(STATUS == GSL_SUCCESS,
XLAL_EFAULT | STATUS,
"GSL ODE solver failed. Error = %d\n", STATUS);
621 p_eob_dyn_rhs(dyn->
t, dyn->
y, dyn->
dy, dyn);
642 for (
int k = 0; k <
KMAX; k++)
651 this_hlm = this_hlm->
next;
657 dyn->
time[iter] = dyn->
t;
687 dyn->
dt =
MIN(dyn->
dt, dt_tuned_mrg);
707 gsl_odeiv2_evolve_free (
e);
708 gsl_odeiv2_control_free (
c);
709 gsl_odeiv2_step_free (
s);
710 gsl_odeiv2_driver_free (
d);
725 if (!(use_tidal) && !(rush_only))
742 REAL8 dt_merger_interp = 0.5;
764 if (tmax < hlm->tdata->
data[imax])
775 dt_merger_interp =
MIN(dt_merger_interp, dyn->
dt);
782 for (
int i = 0;
i < size_mrg;
i++)
783 mrgtime_interp->
data[
i] =
i*dt_merger_interp + hlm_mrg->
tdata->
data[0];
795 this_hlm->
ampl = Alm_mrg;
801 this_hlm->
phase = philm_mrg;
805 this_hlm = this_hlm->
next;
811 mrgtime_interp = NULL;
826 for (
int k=
KMAX-1; k>=0; k--)
846 strcat(this_hlm->
ampl->
name,
"_nqc");
848 this_hlm = this_hlm->
next;
869 strcat(this_hlm->
ampl->
name,
"_nqc");
871 this_hlm = this_hlm->
next;
884 dt_rngdn = dt_merger_interp;
890 for (
UINT4 i = size;
i < (size+size_ringdown);
i++)
894 size += size_ringdown;
898 strcat(hlm->
ampl->
name,
"_ringdown");
916 const REAL8 iota = inclination;
968 this_hlm->
ampl = A_ut;
976 this_hlm->
phase = phi_ut;
983 this_hlm = this_hlm->
next;
1002 memset ((*hplus)->data->data, 0, (*hplus)->data->length*
sizeof(*(*hplus)->data->data));
1003 memset ((*hcross)->data->data, 0, (*hcross)->data->length*
sizeof(*(*hcross)->data->data));
1019 XLAL_ERROR(
XLAL_EINVAL,
"Only HLM interpolation scheme is available. HPC is under reconstruction! Exiting...\n");
1038 REAL8 *Apc, *A_interp;
1039 REAL8 *phipc, *phi_interp;
1041 Apc = malloc(size *
sizeof(
REAL8));
1042 phipc = malloc(size *
sizeof(
REAL8));
1043 A_interp = malloc(size_out *
sizeof(
REAL8));
1044 phi_interp = malloc(size_out *
sizeof(
REAL8));
1046 for (
int i=0;
i<size;
i++) {
1058 size_out, A_interp);
1060 size_out, phi_interp);
1065 (*hplus)->data->data[
i] = amplitude_prefactor * A_interp[
i] * cos(phi_interp[
i]);
1066 (*hcross)->data->data[
i] = amplitude_prefactor * A_interp[
i] * sin(phi_interp[
i]);
int XLALDictContains(const LALDict *dict, const char *key)
INT4 XLALDictLookupINT4Value(LALDict *dict, const char *key)
const INT4 TEOB_MINDEX[KMAX]
const INT4 TEOB_LINDEX[KMAX]
GSL routines for ODE integration https://www.gnu.org/software/gsl/doc/html/ode-initval....
void eob_wav_hlm(LALTEOBResumSDynamics *dyn, LALTEOBResumSWaveformModeSingleTime *hlm)
int eob_dyn_Npostadiabatic(LALTEOBResumSDynamics *dyn, const REAL8 r0)
void eob_dyn_ic_s(REAL8 r0, LALTEOBResumSDynamics *dyn, REAL8 y_init[])
int eob_dyn_rhs(REAL8 t, const REAL8 y[], REAL8 dy[], void *d)
void eob_wav_hlmNQC_find_a1a2a3_mrg(LALTEOBResumSDynamics *dyn_mrg, SphHarmPolarTimeSeries *hlm_mrg, SphHarmPolarTimeSeries *hnqc, LALTEOBResumSDynamics *dyn, SphHarmPolarTimeSeries *hlm)
void eob_wav_ringdown(LALTEOBResumSDynamics *dyn, SphHarmPolarTimeSeries *hlm)
void eob_wav_hlmNQC_find_a1a2a3(LALTEOBResumSDynamics *dyn, SphHarmPolarTimeSeries *h, SphHarmPolarTimeSeries *hnqc)
int eob_dyn_rhs_s(REAL8 t, const REAL8 y[], REAL8 dy[], void *d)
REAL8 eob_dyn_r0_Kepler(REAL8 f0)
void eob_dyn_ic(REAL8 r0, LALTEOBResumSDynamics *dyn, REAL8 y_init[])
INT4 find_point_bisection(REAL8 x, INT4 n, REAL8 *xp, INT4 o)
void interp_spline(double *t, double *y, int n, double *ti, int ni, REAL8 *yi)
void XLALTEOBDynamicsPush(LALTEOBResumSDynamics **dyn, INT4 size)
void Waveform_lm_t_free(LALTEOBResumSWaveformModeSingleTime *wav)
void XLALTEOBDynamicsInit(LALTEOBResumSDynamics **dyn, INT4 size, const char *name)
void XLALFreeTEOBDynamics(LALTEOBResumSDynamics *dyn)
void XLALTEOBDynamicsSetParams(LALTEOBResumSDynamics *dyn, UNUSED LALValue **pModeArray, const REAL8 m1, const REAL8 m2, const REAL8 UNUSED S1x, const REAL8 UNUSED S1y, const REAL8 S1z, const REAL8 UNUSED S2x, const REAL8 UNUSED S2y, const REAL8 S2z, const REAL8 dt, const REAL8 lambda1, const REAL8 lambda2, const REAL8 lambda1oct, const REAL8 lambda2oct, const REAL8 lambda1hex, const REAL8 lambda2hex, LALDict *LALparams)
REAL8 time_units_factor(REAL8 M)
void XLALSimIMRComputePolarisationsPolar(REAL8Sequence *hplus_out, REAL8Sequence *hcross_out, SphHarmPolarTimeSeries *hlm, LALValue *modeArray, REAL8 amplitude_prefactor, REAL8 theta, REAL8 phi)
void XLALTEOBDynamicsInterp(LALTEOBResumSDynamics *dyn, const INT4 size, const REAL8 t0, const REAL8 dt, const char *name)
void XLALTEOBDynamicsExtract(LALTEOBResumSDynamics *dyna, const REAL8 to, const REAL8 tn, LALTEOBResumSDynamics **dynb, const char *name)
REAL8 get_mrg_timestep(REAL8 q, REAL8 chi1, REAL8 chi2)
void XLALTEOBDynamicsJoin(LALTEOBResumSDynamics *dyna, LALTEOBResumSDynamics *dynb, REAL8 to)
REAL8 q_to_nu(const REAL8 q)
void XLALSphHarmPolarJoin(SphHarmPolarTimeSeries *hlma, SphHarmPolarTimeSeries *hlmb, REAL8 to)
INT4 get_uniform_size(const REAL8 tN, const REAL8 t0, const REAL8 dt)
void unwrap_proxy(REAL8 *p, REAL8 *r, const INT4 size, const INT4 shift0)
void Waveform_lm_t_alloc(LALTEOBResumSWaveformModeSingleTime **wav)
Replaced by LAL COMPLEX16TimeSeries functions.
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 ...
This file is part of TEOBResumS.
#define POSTADIABATIC_RMIN_BBH
@ INTERP_UNIFORM_GRID_HPC
@ INTERP_UNIFORM_GRID_HLM
#define TEOB_R0_THRESHOLD
#define INTERP_UNIFORM_GRID_DEFAULT
#define POSTADIABATIC_RMIN_BNS
#define POSTADIABATIC_NSTEP_MIN
#define RINGDOWN_EXTEND_ARRAY
@ ODE_TSTEP_ADAPTIVE_UNIFORM_AFTER_LSO
void XLALDestroyValue(LALValue *value)
int XLALSimIMRTEOBResumS(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, const REAL8 phiRef, const REAL8 deltaT, const REAL8 m1, const REAL8 m2, const REAL8 S1x, const REAL8 S1y, const REAL8 S1z, const REAL8 S2x, const REAL8 S2y, const REAL8 S2z, const REAL8 lambda1, const REAL8 lambda2, const REAL8 distance, const REAL8 inclination, const REAL8 UNUSED longAscNodes, LALDict *LALparams, const REAL8 UNUSED eccentricity, const REAL8 UNUSED meanPerAno, const REAL8 f_min, const REAL8 UNUSED f_ref)
Driver routine to calculate a TEOBResumS inspiral-merger-ringdown waveform model in the time domain.
LALSimInspiralTidalOrder
Enumeration of allowed PN orders of tidal effects.
@ LAL_SIM_INSPIRAL_TIDAL_ORDER_0PN
SphHarmPolarTimeSeries * XLALSphHarmPolarTimeSeriesAddMode(SphHarmPolarTimeSeries *appended, const REAL8TimeSeries *inAmpl, const REAL8TimeSeries *inphase, UINT4 l, INT4 m)
Prepend a node to a linked list of SphHarmPolarTimeSeries, or create a new head.
void XLALDestroySphHarmPolarTimeSeries(SphHarmPolarTimeSeries *ts)
Delete list from current pointer to the end of the list.
void XLALSphHarmPolarTimeSeriesSetTData(SphHarmPolarTimeSeries *ts, REAL8Sequence *tdata)
Set the tdata member for all nodes in the list.
SphHarmPolarTimeSeries * XLALResizeSphHarmPolarTimeSeries(SphHarmPolarTimeSeries *ts, int first, size_t length)
For every (l,m) node in the SphHarmPolarTimeSeries linked list, call XLALResizeREAL8TimeSeries(ts->am...
SphHarmPolarTimeSeries * XLALCutSphHarmPolarTimeSeries(SphHarmPolarTimeSeries *ts, int first, size_t length)
Create a new SphHarmPolarTimeSeries linked listby extracting a section of an existing SphHarmPolarTim...
void XLALDestroyREAL8Sequence(REAL8Sequence *sequence)
REAL8Sequence * XLALResizeREAL8Sequence(REAL8Sequence *sequence, int first, size_t length)
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 lalStrainUnit
const LALUnit lalDimensionlessUnit
#define XLAL_CHECK(assertion,...)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
REAL8 y[TEOB_EVOLVE_NVARS]
REAL8 * data[TEOB_DYNAMICS_NVARS]
REAL8 dy[TEOB_EVOLVE_NVARS]
REAL8TimeSeries * ampl
The sequences of mode amplitude.
REAL8TimeSeries * phase
The sequences of mode phase (not modulo 2Pi).
struct tagSphHarmPolarTimeSeries * next
next pointer
REAL8Sequence * tdata
Timestamp values.