22 def make_test_case(nsys = 16, nbod = 3 , spacing_factor = 1.4, planet_mass = 0.001, ejection_factor = 1, seed = None):
25 for i
in range(0,d.nsys):
30 s[0].pos = [ 0, 0, 0 ]
31 s[0].vel = [ 0, 0, 0 ]
34 for j
in range(0,d.nbod):
35 fill(s[j].attributes, 0)
37 for j
in range(1,d.nbod):
38 r = spacing_factor ** (j-1)
39 v = sqrt(1/r) * ejection_factor
40 phi = random.uniform(0,2*pi)
41 s[j].pos = [ r*cos(phi), r*sin(phi), 0 ]
42 s[j].vel = [ -v*sin(phi), v*cos(phi), 0 ]
43 s[j].mass = planet_mass
46 if __name__ ==
'__main__':
47 ens = make_test_case()
50 ens.save_to_text(
"sample.txt")
57 ens.save_to_bin(
"sample.bin")