-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimulate.py
More file actions
74 lines (67 loc) · 1.78 KB
/
simulate.py
File metadata and controls
74 lines (67 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import toybox
import dynamics
import particle
#Constants
dt = 0.0001
day = 86400 #seconds in a day
n = 6
m = 1
q = 1
s = 1
g = 0
boundary = None
update_rate = int(2e3)
part_name = 'Charge'
memory = 100000 #remember most recent points
planet_framerate = 5
particles = particle.make_particles(n,m=m,rmax=1,vmax=0,charge=q,s=s,g=g,
name=part_name,a0=1e-1)
#particles.extend([toybox.spring1,toybox.spring2])
#particles.extend([toybox.positive1,toybox.negative1])
#particles = particle.make_particles(n,m,rmax=2,rtype='gaussian',charge=q)
solar_system = toybox.solar_system
close_planets = toybox.close_planets
planets = solar_system
frames=100
dir = f'Gifs/solar_system/close_planets'
fname = f'close_planets_day_100_frames{frames}'
dynamics.sim_particle_motions(planets,boundary,memory,day*5e-1,timeit=True,
xlim=1.1*planets[-1].rvec[0],ylim=1.1*planets[-1].rvec[0],
save=False,dir=dir,fname=fname,frames=frames,update_rate=update_rate,set_legend=True)
dir = f'Gifs/frames{frames}'
fname = f'n{n}_m{m}_q{q}_s{s}_g{g}_memory{memory}_boundary{boundary}_dt{dt}'
# dynamics.sim_particle_motions(particles,
# boundary,
# memory,
# dt,
# save=False,
# timeit=True,
# dir=dir,
# fname=fname,
# frames=frames,
# update_rate=100,
# display_rate=1,
# closest_N=n)
n_neutrons = 4
n_protons = 0
n_ups = 1*n_neutrons + 2*n_protons
n_downs = 2*n_neutrons + 1*n_protons
quarks = []
for i in range(n_ups):
quarks.append(toybox.make_up())
for i in range(n_downs):
quarks.append(toybox.make_down())
fname = f'quarks_memory{memory}_boundary{boundary}_dt{dt}'
# dynamics.sim_particle_motions(quarks,
# boundary,
# memory,
# dt,
# save=False,
# timeit=True,
# dir=dir,
# fname=fname,
# frames=frames,
# update_rate=update_rate,
# display_rate=1,
# closest_N=n,
# set_legend=False)