from Nbody import * import RandomArray ''' return an homogenous disk of n particles distributed homogeneously in an oval of axis a and b and of width dz ''' n = 1024 a = 30 b = 20 dz = 5 xx = RandomArray.random([n])**(1./2.) theta = 2.* RandomArray.random([n])*Numeric.pi x = a* xx * cos(theta) y = b* xx * sin(theta) z = dz*RandomArray.random([n]) - dz/2. pos = Numeric.transpose(Numeric.array([x,y,z])) # creation of the nbody object nb = Nbody('homodisk.dat',status='new',pos=pos,label='homogeneous disk') # write it on the disk nb.write()
See About this document... for information on suggesting changes.