Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.mso.anu.edu.au/pfrancis/simulations/cv.py
Дата изменения: Tue Apr 1 06:24:49 2014
Дата индексирования: Sun Apr 10 03:15:55 2016
Кодировка:

Поисковые слова: comet tail
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 = color.gray(0.5)

theta = 0.0

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

wdlight = local_light(pos=wdpos,
color=wdcol)
wd = sphere(pos = wdpos, radius = wdrad, color=wdcol,
material=materials.emissive)

# Set up accretion disk
diskrad = 0.08
diskthickness = 0.002
diskcol = (0.4,0.7,1.0)

dlight = local_light(pos=wdpos,color=diskcol)
disk = cylinder(pos=wdpos,radius=diskrad,axis=(0.0,diskthickness,0.0),
material=materials.emissive,color=diskcol)

# 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,0.2,0.0)
star = sphere(pos = starpos, radius = starrad, color=starcol,
material=materials.emissive)
starlight = local_light(pos=starpos,
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,
material=materials.emissive)
bulgelight = local_light(pos=bulgepos,
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,
material=materials.emissive)
bulge2light = local_light(pos=bulge2pos,
color=starcol)

# Set up stream
spotangle = 0.15
srad = 0.005
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=starcol,
radius = srad)

# Set up hotspot
spotlen = 0.005
spotheight = 0.015
spotwidth = 0.01
spotcol = color.white
spotaxis = 0.3*vector(diskrad*math.sin(theta-spotangle),0.0,
-1.0*diskrad*math.cos(theta-spotangle))
spot = ellipsoid(pos = streamend, axis = spotaxis, color=spotcol, length = spotlen,
height = spotheight, width = spotwidth,material=materials.emissive)
spotlight = local_light(pos = streamend-spotaxis/5, color=spotcol)
spotback = ellipsoid(pos = 1.02*streamend, axis = spotaxis, color=diskcol, length = spotlen,
height = spotheight, width = spotwidth,)

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
wdlight.pos = wdpos

# Move Disk
disk.pos = wdpos
dlight.pos = wdpos

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

# Move bulge
bulgepos = vector(-dbulge*math.cos(theta),0.0,-dbulge*math.sin(theta))
bulge.pos = bulgepos
bulgelight.pos = bulgepos
bulge2pos = vector(-dbulge2*math.cos(theta),0.0,-dbulge2*math.sin(theta))
bulge2.pos = bulge2pos
bulge2light.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

# Move spot
spotaxis = 0.3*vector(diskrad*math.sin(theta-spotangle),0.0,
-1.0*diskrad*math.cos(theta-spotangle))
spot.pos = streamend-spotaxis/5
spot.axis = spotaxis
spotback.pos = 1.02*(streamend-spotaxis/5)
spotback.axis = spotaxis
if random.random() > 0.5:
spot.color=(0.2,0.2,0.2)
else:
spot.color=spotcol