Here is a code that simulates in 2D (the 3D version is coming soon) the fusion of stars into a black hole with the associated gravitational wave signal (in Newtonian approximation).
I assume in my simulation that the stars are immersed in a "fluid" filling all space and slowing down their movement through friction. For this fluid, I choose the characteristic fusion time tmtm at which the stars will merge. I also choose the distance at which my stars merge. If this distance is reached, then the stars turn into a black hole (shown in gray).
Let's start with pen and paper to numerically simulate the Newtonian equations for our compact binary.
We use the 2nd Newton's law :
In Cartesian coordinates, the system of equations for star 1 is quite the same as the one for the solar system:
$\displaystyle \frac{d^2x}{dt^2} = -\frac{Gm_2}{r^2} \cos(\theta) - k(r) \frac{dx}{dt}$ $\displaystyle \frac{d^2y}{dt^2} = -\frac{Gm_2}{r^2} \sin(\theta) - k(r) \frac{dy}{dt}$
where
We numerically solve this differential equation with odeint from the scipy.integrate library according to our initial conditions
initial_conditions = [a * (1 - e)*m1/M, 0, 0, v(a), -a * (1 - e)*m2/M, 0, 0, -v(a)]
It gives us 4 different arrays, 2 for the positions
if dist < fusion_distance:
star1.set_data(0, 0)
star2.set_data(0, 0)
star_merged.set_data(0, 0)
star_merged.set_markersize(33)
star_merged.set_color('gray') # Set color to gray
else:
star1.set_data(solution[frame, 0], solution[frame, 1])
star2.set_data(solution[frame, 4], solution[frame, 5])
star_merged.set_data([], []) # Clear merged star data
Then, for the gravitational signal, we use the same newtonian approximation that we used before.
For a compact binary with masses
- the Chirp Mass :
$\displaystyle \mathcal{M}_c = \frac{(m_1m_2)^{3/5}}{(m_1 + m_2)^{1/5}}$ - the Scaling Amplitude :
$\displaystyle h_0 = 4 \frac{G}{c^2} \frac{\mathcal{M}_c}{R} \big(\frac{G\pi \mathcal{M}_c}{c^3} f \big) ^{2/3}$ - Chirp
$\displaystyle \dot{f} = \frac{96c^3 f}{5G\mathcal{M}_c} \big(\frac{G\pi \mathcal{M}_c}{c^3} f \big) ^{8/3}$ - the gravitational phase :
$\displaystyle \phi(t) = 2\pi (ft + \frac{1}{2} \dot{f}t^2)$
The signal is given by the equation
$\displaystyle h_0 = 4 \frac{G}{c^2} \frac{\mathcal{M}_c}{R} \big(\frac{G\pi \mathcal{M}_c}{c^3} f \big) ^{2/3}$ $\displaystyle \phi = 2\pi (ft + \frac{1}{2} \dot{f}t^2)$
The waveform is given by :
def h(t):
f_GW = [np.sqrt(G*M/distances[i]**3)/(np.pi) for i, dist in enumerate(distances)]
h0 = [4*G*Mc/(c**2*R) * (G/c**3 * np.pi * f_GW[i]* Mc)**(2/3) for i, dist in enumerate(distances)]
dfdt = [96/5 * c**3/G * f_GW[i]/Mc * (G/c**3 * np.pi * f_GW[i] * Mc)**(8/3) for i, dist in enumerate(distances)]
ϕ = [2*np.pi*(f_GW[i]*t[i] + 0.5 * dfdt[i] * t[i]**2) for i, dist in enumerate(distances)]
h = [0 if dist < fusion_distance else h0[i]*np.cos(ϕ[i]) for i, dist in enumerate(distances)]
return h
Finally, we animate the movement of the two stars as they approach each other and plot the expected gravitational signal using the data collected from the simulation. We take the distance
![image](https://private-user-images.githubusercontent.com/140922475/305718175-00a57229-761e-4f42-aa7c-b03b54872e7a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1ODM0MzQsIm5iZiI6MTcyNDU4MzEzNCwicGF0aCI6Ii8xNDA5MjI0NzUvMzA1NzE4MTc1LTAwYTU3MjI5LTc2MWUtNGY0Mi1hYTdjLWIwM2I1NDg3MmU3YS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyNVQxMDUyMTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02OWVhZmEzZjhlNzdhODJiZjBiMDZkNDIxNTE5ZGYzOWRjZjY2MGMyNTAyNWQ1OWZkYjFiYzk3NzAyYTlkMzAyJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.QAjmg6_LXGoPsFTNfb9pyPdoa7FEgSmVYWuvnFOWT2w)