Skip to content

Commit 017e452

Browse files
committed
Merging python and numba versions of nbody/init.py
1 parent 2da5b53 commit 017e452

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

nbody/python/nbody/init.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import numpy as np
2-
from .physics import gamma_1
2+
from .physics import gamma_1, gamma_si
33

44
def init_solar_system():
55
bodies = np.array([[ 0, 0, 0, 0], #sun
@@ -33,7 +33,7 @@ def getOrbitalVelocity(xb, yb, mb, xs, ys):
3333
dist = np.sqrt(r[0] * r[0] + r[1] * r[1])
3434

3535
# Based on the distance from the sun calculate the velocity needed to maintain a circular orbit
36-
v = np.sqrt(gamma_1 * mb / dist)
36+
v = np.sqrt(gamma_si * mb / dist)
3737

3838
# Calculate a suitable vector perpendicular to r for the velocity of the tracer
3939
vxs = ( r[1] / dist) * v
@@ -65,7 +65,7 @@ def init_collisions(blackHole):
6565

6666
nstars = b['stars']
6767
rad = b['radstars']
68-
r = 0.1 + .8 * (rad * np.random.rand(nstars))
68+
r = 0.3 + .8 * (rad * np.random.rand(nstars))
6969
a = 2*np.pi*np.random.rand(nstars)
7070
tmp_mass = 0.03 + 20*np.random.rand(nstars)
7171
x = b['coord'][0] + r*np.sin(a)
@@ -75,8 +75,8 @@ def init_collisions(blackHole):
7575

7676
particles[ind:ind+nstars, 0] = x
7777
particles[ind:ind+nstars, 1] = y
78-
particles[ind:ind+nstars, 2] = 1e2 * (vx + vxb)
79-
particles[ind:ind+nstars, 3] = 1e2 * (vy + vyb)
78+
particles[ind:ind+nstars, 2] = vx + vxb
79+
particles[ind:ind+nstars, 3] = vy + vyb
8080
mass[ind:ind+nstars] = tmp_mass
8181
ind += nstars
8282

0 commit comments

Comments
 (0)