Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.mso.anu.edu.au/pfrancis/simulations/XRB.py
Дата изменения: Sat Apr 12 10:22:32 2014
Дата индексирования: Sun Apr 10 03:25:36 2016
Кодировка:
from __future__ import division
from visual import *
import random
import math

scene = display(range=(1.0,1.0,1.0),width=1300,height=800,forward=(0.2,0.6,-1.0))

scene.lights=[]
scene.ambient = 0.1*vector(0.7,0.5,0.2)

theta = 0.0

# Set up white dwarf
dwd = 0.12
wdpos = vector(dwd*math.cos(theta),0.0,dwd*math.sin(theta))
wdrad = 0.002
wdcol = (0.8,0.4,1.0)

wdlight1 = local_light(pos=wdpos+vector(0.0,0.01,0.0),
color=wdcol)
wdlight2 = local_light(pos=wdpos-vector(0.0,0.01,0.0),
color=wdcol)
wd = sphere(pos = wdpos, radius = wdrad, color=wdcol,
material=materials.emissive)

# Set up accretion disk
diskrad = 0.08
diskthickness = 0.002
diskcol = wdcol

disk = cylinder(pos=wdpos,radius=diskrad,axis=(0.0,diskthickness,0.0),
opacity=0.8,color=(0.7,0.9,1.0))

# Set up secondary star
dstar = 0.2
starpos = vector(-dstar*math.cos(theta),0.0,-dstar*math.sin(theta))
starrad = 0.185
starcol = 0.5*vector(0.9,0.5,0.2)
star = sphere(pos = starpos, radius = starrad, color=starcol)

# Set up Roche bulge on secondary star
dbulge = 0.09
bulgepos = vector(-dbulge*math.cos(theta),0.0,-dbulge*math.sin(theta))
bulgerad = 0.085
bulge = sphere(pos = bulgepos, radius = bulgerad, color=starcol)

dbulge2 = 0.05
bulge2pos = vector(-dbulge2*math.cos(theta),0.0,-dbulge2*math.sin(theta))
bulge2rad = 0.049
bulge2 = sphere(pos = bulge2pos, radius = bulge2rad, color=starcol)

# Set up stream
spotangle = 0.15
srad = 0.002
dstart = dbulge2-bulge2rad+0.01
streamstart = vector(-dstart*math.cos(theta),0.0,-dstart*math.sin(theta))
streamend = wdpos - vector(diskrad*math.cos(theta-spotangle),0.0,
diskrad*math.sin(theta-spotangle))
stream = cylinder(pos=streamstart,axis=streamend-streamstart,color=diskcol,
radius = srad)


dtheta = -0.003
while 1:
rate(100)
theta += dtheta

# Move White Dwarf
wdpos = vector(dwd*math.cos(theta),0.0,dwd*math.sin(theta))
wd.pos = wdpos
wdlight1.pos = wdpos+vector(0.0,0.01,0.0)
wdlight2.pos = wdpos-vector(0.0,0.01,0.0)

# Move Disk
disk.pos = wdpos

# Move secondary
starpos = vector(-dstar*math.cos(theta),0.0,-dstar*math.sin(theta))
star.pos = starpos

# Move bulge
bulgepos = vector(-dbulge*math.cos(theta),0.0,-dbulge*math.sin(theta))
bulge.pos = bulgepos
bulge2pos = vector(-dbulge2*math.cos(theta),0.0,-dbulge2*math.sin(theta))
bulge2.pos = bulge2pos

# Move stream
streamstart = vector(-dstart*math.cos(theta),0.0,-dstart*math.sin(theta))
streamend = wdpos - vector(diskrad*math.cos(theta-spotangle),
0.0,diskrad*math.sin(theta-spotangle))
stream.pos = streamstart
stream.axis = streamend-streamstart