Nbody6
 All Files Functions Variables
newtev.f
Go to the documentation of this file.
1  SUBROUTINE newtev(NNB,IX)
2 *
3 *
4 * New look-up time of hierarchy.
5 * ------------------------------
6 *
7  include 'common6.h'
8  common/binary/ cm(4,mmax),xrel(3,mmax),vrel(3,mmax),
9  & hm(mmax),um(4,mmax),umdot(4,mmax),tmdis(mmax),
10  & namem(mmax),nameg(mmax),kstarm(mmax),iflag(mmax)
11  REAL*8 m0,m1,mg,tscls(20),lums(10),gb(10)
12 *
13 *
14 * Initialize iteration counter for binary component.
15  iter = 0
16 *
17 * Determine smallest look-up time for single stars.
18  1 iter = iter + 1
19  tm = 1.1d+10
20  DO 5 l = 1,nnb
21  i = jlist(l)
22 * Include safety check (just in case).
23  IF (i.LE.0) go to 5
24 * Replace any binary c.m. by primary component.
25  IF (i.GT.n) THEN
26  i = 2*(i - n) - 1
27  END IF
28  IF (tev(i).LT.tm) THEN
29  tm = tev(i)
30  ix = i
31  END IF
32  5 CONTINUE
33 *
34 * Skip increase of smallest look-up time above 10 Myr.
35  IF ((tev(ix) - time)*tstar.GT.10.0) THEN
36  go to 20
37  END IF
38 *
39 * Distinguish between ghost, single star or KS component.
40  IF (body(ix).EQ.0.0d0) THEN
41  CALL findm(ix,iterm,mg)
42  IF (iterm.LT.0) go to 20
43  m1 = mg*smu
44  ELSE IF (ix.GE.ifirst) THEN
45  m1 = body(ix)*smu
46  ELSE
47  iter = iter + 1
48  ipair = kvec(ix)
49  IF (name(n+ipair).GT.0) THEN
50  m1 = body(ix)*smu
51  ELSE
52 * Find the merger index by identifying original c.m. name.
53  im = 0
54  DO 10 k = 1,nmerge
55  IF (namem(k).EQ.name(n+ipair)) im = k
56  10 CONTINUE
57  IF (name(n+ipair).LT.-2*nzero) THEN
58  WRITE (6,12) name(n+ipair), name(i), im
59  12 FORMAT (' NEWTEV WARNING NAMC NAMI IM ',2i7,i4)
60  END IF
61  IF (im.EQ.0) go to 20
62 * Choose relevant component for standard triple first.
63  k = 1
64  IF (ix.EQ.2*ipair) k = 2
65  m1 = cm(k,im)*smu
66 * Copy mass from K=3 or K=4 for merged quadruple system.
67  IF (cm(3,im).GT.0.0d0) THEN
68  k = k + 2
69  m1 = cm(k,im)*smu
70 * Restore mass of second component if quad is excluded.
71  ELSE IF (ix.EQ.2*ipair) THEN
72  m1 = body(ix)*smu
73  END IF
74  IF (m1.EQ.0.0d0) THEN
75  m1 = cm(k,im)*smu
76  WRITE (6,15) name(ix), k, m1
77  15 FORMAT (' DANGER! NEWTEV NM K M1 ',2i6,f7.3)
78  END IF
79  END IF
80  END IF
81 *
82 * Obtain stellar evolution time-scales.
83  m0 = body0(ix)*smu
84  kw = kstar(ix)
85  CALL star(kw,m0,m1,tm,tn,tscls,lums,gb,zpars)
86 *
87 * Determine new time-scale for changes in radius & mass.
88  age = tev0(ix)*tstar - epoch(ix)
89  CALL trdot2(kw,age,tm,tn,tscls,dtm,dtr)
90  dt = dtm/tstar
91 *
92 * Increase look-up time by at most a factor 2 if due in 10 Myr.
93  dt = min(dt,10.0d0/tstar)
94 * Impose limit to prevent multiple increases without updating.
95  dtx = tev0(ix) + 2.0*dt - tev(ix)
96  dt = min(dtx,dt)
97  dt = max(dt,0.0d0)
98  tev(ix) = tev(ix) + dt
99 *
100 * Perform a second iteration for possible binary component.
101  IF (iter.LE.2) go to 1
102 *
103  20 RETURN
104 *
105  END