Skip to content

Commit 2fe4b36

Browse files
committed
add missing example
1 parent 9c3ca0e commit 2fe4b36

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
from matplotlib import pyplot
2+
from amuse.lab import *
3+
from prepare_figure import *
4+
from distinct_colours import get_distinct
5+
import numpy
6+
7+
set_printing_strategy("custom", #nbody_converter = converter,
8+
preferred_units = [units.MSun, units.AU, units.Myr],
9+
precision = 4, prefix = "",
10+
separator = " [", suffix = "]")
11+
12+
def maximum_stellar_radius():
13+
M = (10**numpy.arange(-0.2, 2, 0.05)) | units.MSun
14+
R = [] | units.AU
15+
for mi in M:
16+
stellar = SeBa()
17+
s = Particle()
18+
s.mass = mi
19+
stellar.particles.add_particle(s)
20+
rmax = 0|units.AU
21+
while stellar.particles[0].stellar_type<9|units.stellar_type:
22+
stellar.evolve_model()
23+
rmax = max(rmax, stellar.particles[0].radius)
24+
print("Time=", mi, stellar.particles[0].mass, \
25+
stellar.model_time, stellar.particles[0].radius)
26+
R.append(rmax)
27+
return M, R
28+
29+
names = [r"$\tau$ CMa", "V* CQ Dra", r"$\xi$ Tau", "V* V1334 Cyg",
30+
"V* DL Vir", "V* d Ser", "HD 97131", "KIC002856960"]
31+
Mprim = [50.0, 6.3, 5.5, 4.4, 3.68, 2.5, 1.5, 0.76] | units.MSun
32+
Rprim = [0.95, 2.64, 0.42, 3.99, 2.34, 0.62, 0.26, 0.12]| units.AU
33+
34+
colors = get_distinct(4)
35+
figure = pyplot.figure(figsize=(16, 12))
36+
ax = pyplot.gca()
37+
ax.minorticks_on() # switch on the minor ticks
38+
ax.locator_params(nbins=3)
39+
40+
M, Rmax = maximum_stellar_radius()
41+
42+
x_label = "m [$M_\odot$]"
43+
y_label = "$r [AU]$"
44+
pyplot.xlabel(x_label)
45+
pyplot.ylabel(y_label)
46+
pyplot.semilogx()
47+
pyplot.semilogy()
48+
pyplot.xlim(0.6, 100.0)
49+
pyplot.ylim(0.07, 20.0)
50+
pyplot.scatter(Mprim.value_in(units.MSun), Rprim.value_in(units.AU),
51+
c=colors[0], lw=0, s=300)
52+
pyplot.plot(M.value_in(units.MSun), Rmax.value_in(units.AU),
53+
c=colors[1], lw=4)
54+
for i in range(len(names)):
55+
pyplot.text(1.1*Mprim[i].value_in(units.MSun),
56+
0.9*Rprim[i].value_in(units.AU), names[i], fontsize=20)
57+
58+
save_file = 'fig_RLOF_triples_R.png'
59+
pyplot.savefig(save_file)
60+
print('\nSaved figure in file', save_file,'\n')
61+
pyplot.show()

0 commit comments

Comments
 (0)