-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathEvolveProtostellar.F90
77 lines (61 loc) · 2.53 KB
/
EvolveProtostellar.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
subroutine EvolveProtostellar(dt)
use protostellar_interface, only: star, Msun, Rsun, secyr
implicit none
double precision, intent(in) :: dt
integer :: i, pno, nrOfStarsT, nrOfStarsL
double precision :: mass, md, mdot, n, r
double precision :: mmdot, dm
integer :: stage
double precision :: Ld, Lint, Li
double precision :: Lms, Lacc, Ldisk, Lh
double precision :: Ltot
double precision :: ag, beta, dlogbeta
! Get the star properties
mass = star%mass
mdot = star%mdot
r = star%radius
n = star%polyn
md = star%mdeut
Lint = star%lint
Ltot = star%lum
stage = star%stage
! If the the sink particle mass is above threshold mass, begin evolution
if (mass .GE. 0.1*Msun) then
! Convert mdot, which has units of g/s, into Msun/yr
mmdot = mdot * secyr / Msun
! If sink particle ready to begin evolving, advance to next stage
! and initialize characteristic sink particle quantities
if ( stage .EQ. 0 ) then
stage = 1
r = 2.5 * Rsun * (mmdot / 1.E-5)**(0.2)
n = 5 - 3 / (1.475 + 0.07 * log10(mmdot))
if ( n .LT. 1.5) n = 1.5
if ( n .GT. 3.0) n = 3.0
md = mass
endif
! Calculate intermediate values
call get_derived_values(stage, mass, mdot, r, n, & ! Input
Ld, Lint, Li, Lms, beta, dlogbeta, ag) ! Return
! (1) Update the radius and deuterium mass
call update_radius(mass, mdot, ag, beta, dlogbeta, dt, & ! Input
Ld, Lint, Li, stage, & ! Input
r ) ! In/Out
call update_D_mass(mdot, dt, Ld, & ! Input
md ) ! In/Out
! (2) Compute the new luminosity
call update_luminosity(Lint, mass, mdot, r, & ! Input
Ltot ) ! Return
! (3) Advance to next evolutionary stage
call update_stage(mass, md, Ld, Lms, & ! Input
n, r, stage) ! In/Out
! Store dummy values into particle list
star%mass = mass
star%mdot = mdot
star%radius = r
star%polyn = n
star%mdeut = md
star%lint = Lint
star%lum = Ltot
star%stage = stage
endif ! mass>0.1Msun
end subroutine EvolveProtostellar