forked from SterlingYM/physics77project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbulge.py
More file actions
23 lines (13 loc) · 662 Bytes
/
bulge.py
File metadata and controls
23 lines (13 loc) · 662 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
bulgechar = [] #bulge characteristics
def bulge (gal_bulge_r,):
radius = numpy.random.uniform(0.0,gal_bulge_r,0,(self.number_of_particles,1))
theta = numpy.random.uniform(0.,1.,(self.number_of_particles,1))*pi
phi = numpy.arccos(1-2*numpy.random.uniform(0.0,1.,(self.number_of_particles,1)))
x = radius * numpy.sin( theta ) * numpy.cos( phi )
y = radius * numpy.sin( theta ) * numpy.sin( phi )
z = radius * numpy.cos( theta )
totalmassgas = 9E18 #solar masses atomic and molecular
m = totalmassinbulge/number_of_particles
R = numpy.sqrt(x**2 + y**2 + z**2)
velc = sqrt.((G * m )/ R)
bulgechar.append(x,y,z,m,velc)