-
Notifications
You must be signed in to change notification settings - Fork 26
/
zfuncs.f
964 lines (964 loc) · 24.3 KB
/
zfuncs.f
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
***
real*8 FUNCTION lzamsf(m)
implicit none
real*8 m,mx,a(200)
common /MSCFF/ a
*
* A function to evaluate Lzams
* ( from Tout et al., 1996, MNRAS, 281, 257 ).
*
mx = SQRT(m)
lzamsf = (a(1)*m**5*mx + a(2)*m**11)/
& (a(3) + m**3 + a(4)*m**5 + a(5)*m**7 +
& a(6)*m**8 + a(7)*m**9*mx)
*
return
end
***
real*8 FUNCTION rzamsf(m)
implicit none
real*8 m,mx,a(200)
common /MSCFF/ a
*
* A function to evaluate Rzams
* ( from Tout et al., 1996, MNRAS, 281, 257 ).
*
mx = SQRT(m)
rzamsf = ((a(8)*m**2 + a(9)*m**6)*mx + a(10)*m**11 +
& (a(11) + a(12)*mx)*m**19)/
& (a(13) + a(14)*m**2 +
& (a(15)*m**8 + m**18 + a(16)*m**19)*mx)
*
return
end
***
real*8 FUNCTION tbgbf(m)
implicit none
real*8 m,a(200)
common /MSCFF/ a
*
* A function to evaluate the lifetime to the BGB or to
* Helium ignition if no FGB exists.
* (JH 24/11/97)
*
tbgbf = (a(17) + a(18)*m**4 + a(19)*m**(11.d0/2.d0) + m**7)/
& (a(20)*m**2 + a(21)*m**7)
*
return
end
***
real*8 FUNCTION tbgbdf(m)
implicit none
real*8 m,mx,f,df,g,dg,a(200)
common /MSCFF/ a
*
* A function to evaluate the derivitive of the lifetime to the BGB
* (or to Helium ignition if no FGB exists) wrt mass.
* (JH 24/11/97)
*
mx = SQRT(m)
f = a(17) + a(18)*m**4 + a(19)*m**5*mx + m**7
df = 4.d0*a(18)*m**3 + 5.5d0*a(19)*m**4*mx + 7.d0*m**6
g = a(20)*m**2 + a(21)*m**7
dg = 2.d0*a(20)*m + 7.d0*a(21)*m**6
tbgbdf = (df*g - f*dg)/(g*g)
*
return
end
***
real*8 FUNCTION tbgdzf(m)
implicit none
real*8 m,mx,f,df,g,dg,a(200)
common /MSCFF/ a
*
* A function to evaluate the derivitive of the lifetime to the BGB
* (or to Helium ignition if no FGB exists) wrt Z.
* (JH 14/12/98)
*
mx = m**5*SQRT(m)
f = a(17) + a(18)*m**4 + a(19)*mx + m**7
df = a(117) + a(118)*m**4 + a(119)*mx
g = a(20)*m**2 + a(21)*m**7
dg = a(120)*m**2
tbgdzf = (df*g - f*dg)/(g*g)
*
return
end
***
real*8 FUNCTION thookf(m)
implicit none
real*8 m,a(200)
common /MSCFF/ a
*
* A function to evaluate the lifetime to the end of the MS
* hook ( for those models that have one ) as a fraction of
* the lifetime to the BGB
* Note that this function is only valid for M > Mhook.
* (JH 24/11/97)
*
thookf = 1.d0 - 0.01d0*MAX(a(22)/m**a(23),a(24)+a(25)/m**a(26))
thookf = MAX(thookf,0.5d0)
*
return
end
***
real*8 FUNCTION ltmsf(m)
implicit none
real*8 m,a(200)
common /MSCFF/ a
*
* A function to evaluate the luminosity at the end of the MS
* (JH 24/11/97)
*
ltmsf = (a(27)*m**3 + a(28)*m**4 + a(29)*m**(a(32)+1.8d0))/
& (a(30) + a(31)*m**5 + m**a(32))
*
return
end
***
real*8 FUNCTION lalphf(m)
implicit none
real*8 m,mcut,a(200)
common /MSCFF/ a
*
* A function to evaluate the Luminosity alpha coefficent.
* (JH 24/11/97)
*
mcut = 2.d0
if(m.ge.mcut)then
lalphf = (a(33) + a(34)*m**a(36))/(m**0.4d0 + a(35)*m**1.9d0)
else
if(m.le.0.5d0)then
lalphf = a(39)
elseif(m.le.0.7d0)then
lalphf = a(39) + ((0.3d0 - a(39))/0.2d0)*(m - 0.5d0)
elseif(m.le.a(37))then
lalphf = 0.3d0 + ((a(40)-0.3d0)/(a(37)-0.7d0))*(m - 0.7d0)
elseif(m.le.a(38))then
lalphf = a(40) + ((a(41)-a(40))/(a(38)-a(37)))*(m - a(37))
else
lalphf = a(41) + ((a(42)-a(41))/(mcut-a(38)))*(m - a(38))
endif
endif
*
return
end
***
real*8 FUNCTION lbetaf(m)
implicit none
real*8 m,a1,a(200)
common /MSCFF/ a
*
* A function to evaluate the Luminosity beta coefficent.
* (JH 24/11/97)
*
lbetaf = a(43) - a(44)*m**a(45)
lbetaf = MAX(lbetaf,0.d0)
if(m.gt.a(46).and.lbetaf.gt.0.d0)then
a1 = a(43) - a(44)*a(46)**a(45)
lbetaf = a1 - 10.d0*a1*(m - a(46))
lbetaf = MAX(lbetaf,0.d0)
endif
*
return
end
***
real*8 FUNCTION lnetaf(m)
implicit none
real*8 m,a(200)
common /MSCFF/ a
*
* A function to evaluate the Luminosity neta exponent.
* (JH 24/11/97)
*
if(m.le.1.d0)then
lnetaf = 10.d0
elseif(m.ge.1.1d0)then
lnetaf = 20.d0
else
lnetaf = 10.d0 + 100.d0*(m - 1.d0)
endif
lnetaf = MIN(lnetaf,a(97))
*
return
end
***
real*8 FUNCTION lhookf(m,mhook)
implicit none
real*8 m,mhook,a2,a(200)
common /MSCFF/ a
*
* A function to evalute the luminosity at the start of
* the MS hook ( for those stars that have one ).
* Note that this function is only valid for M > Mhook.
* (JH 24/11/97)
*
if(m.le.mhook)then
lhookf = 0.d0
elseif(m.ge.a(51))then
lhookf = MIN(a(47)/m**a(48),a(49)/m**a(50))
else
a2 = MIN(a(47)/a(51)**a(48),a(49)/a(51)**a(50))
lhookf = a2*((m-mhook)/(a(51)-mhook))**0.4d0
endif
*
return
end
***
real*8 FUNCTION rtmsf(m)
implicit none
real*8 m,m2,rchk,a(200)
common /MSCFF/ a
real*8 rzamsf
external rzamsf
*
* A function to evaluate the radius at the end of the MS
* Note that a safety check is added to ensure Rtms > Rzams
* when extrapolating the function to low masses.
* (JH 24/11/97)
*
m2 = a(62) + 0.1d0
if(m.le.a(62))then
rchk = 1.5d0*rzamsf(m)
rtmsf = MAX(rchk,(a(52) + a(53)*m**a(55))/(a(54) + m**a(56)))
elseif(m.ge.m2)then
rtmsf = (a(57)*m**3+a(58)*m**a(61)+a(59)*m**(a(61)+1.5d0))/
& (a(60) + m**5)
else
rtmsf = a(63) + ((a(64) - a(63))/0.1d0)*(m - a(62))
endif
*
return
end
***
real*8 FUNCTION ralphf(m)
implicit none
real*8 m,a5,a(200)
common /MSCFF/ a
*
* A function to evaluate the radius alpha coefficent.
* (JH 24/11/97)
*
if(m.le.0.5d0)then
ralphf = a(73)
elseif(m.le.0.65d0)then
ralphf = a(73) + ((a(74) - a(73))/0.15d0)*(m - 0.5d0)
elseif(m.le.a(70))then
ralphf = a(74) + ((a(75)-a(74))/(a(70)-0.65d0))*(m - 0.65d0)
elseif(m.le.a(71))then
ralphf = a(75) + ((a(76) - a(75))/(a(71) - a(70)))*(m - a(70))
elseif(m.le.a(72))then
ralphf = (a(65)*m**a(67))/(a(66) + m**a(68))
else
a5 = (a(65)*a(72)**a(67))/(a(66) + a(72)**a(68))
ralphf = a5 + a(69)*(m - a(72))
endif
*
return
end
***
real*8 FUNCTION rbetaf(m)
implicit none
real*8 m,m2,m3,b2,b3,a(200)
common /MSCFF/ a
*
* A function to evaluate the radius beta coefficent.
* (JH 24/11/97)
*
m2 = 2.d0
m3 = 16.d0
if(m.le.1.d0)then
rbetaf = 1.06d0
elseif(m.le.a(82))then
rbetaf = 1.06d0 + ((a(81)-1.06d0)/(a(82)-1.d0))*(m-1.d0)
elseif(m.le.m2)then
b2 = (a(77)*m2**(7.d0/2.d0))/(a(78) + m2**a(79))
rbetaf = a(81) + ((b2-a(81))/(m2-a(82)))*(m-a(82))
elseif(m.le.m3)then
rbetaf = (a(77)*m**(7.d0/2.d0))/(a(78) + m**a(79))
else
b3 = (a(77)*m3**(7.d0/2.d0))/(a(78) + m3**a(79))
rbetaf = b3 + a(80)*(m - m3)
endif
rbetaf = rbetaf - 1.d0
*
return
end
***
real*8 FUNCTION rgammf(m)
implicit none
real*8 m,m1,b1,a(200)
common /MSCFF/ a
*
* A function to evaluate the radius gamma coefficent.
* (JH 24/11/97)
*
m1 = 1.d0
if(m.gt.(a(88)+0.1d0))then
rgammf = 0.d0
else
b1 = MAX(0.d0,a(83) + a(84)*(m1-a(85))**a(86))
if(m.le.m1)then
rgammf = a(83) + a(84)*ABS(m-a(85))**a(86)
elseif(m.le.a(88))then
rgammf = b1 + (a(89) - b1)*((m - m1)/(a(88) - m1))**a(87)
else
if(a(88).gt.m1) b1 = a(89)
rgammf = b1 - 10.d0*b1*(m - a(88))
endif
rgammf = MAX(rgammf,0.d0)
endif
*
return
end
***
real*8 FUNCTION rhookf(m,mhook)
implicit none
real*8 m,mhook,m2,b2,a(200)
common /MSCFF/ a
*
* A function to evalute the radius at the start of
* the MS hook ( for those stars that have one ).
* Note that this function is only valid for M > Mhook.
* (JH 24/11/97)
*
if(m.le.mhook)then
rhookf = 0.d0
elseif(m.le.a(94))then
rhookf = a(95)*SQRT((m-mhook)/(a(94)-mhook))
elseif(m.le.2.d0)then
m2 = 2.d0
b2 = (a(90) + a(91)*m2**(7.d0/2.d0))/
& (a(92)*m2**3 + m2**a(93)) - 1.d0
rhookf = a(95) + (b2-a(95))*((m-a(94))/(m2-a(94)))**a(96)
else
rhookf = (a(90) + a(91)*m**(7.d0/2.d0))/
& (a(92)*m**3 + m**a(93)) - 1.d0
endif
*
return
end
***
real*8 FUNCTION lbgbf(m)
real*8 m,a(200)
common /GBCFF/ a
*
* A function to evaluate the luminosity at the end of the
* FGB ( for those models that have one )
* Note that this function is only valid for LM & IM stars
* (JH 24/11/97)
*
lbgbf = (a(1)*m**a(5) + a(2)*m**a(8))/
& (a(3) + a(4)*m**a(7) + m**a(6))
*
return
end
***
real*8 FUNCTION lbgbdf(m)
real*8 m,a(200)
real*8 f,df,g,dg
common /GBCFF/ a
*
* A function to evaluate the derivitive of the Lbgb function.
* Note that this function is only valid for LM & IM stars
* (JH 24/11/97)
*
f = a(1)*m**a(5) + a(2)*m**a(8)
df = a(5)*a(1)*m**(a(5)-1.d0) + a(8)*a(2)*m**(a(8)-1.d0)
g = a(3) + a(4)*m**a(7) + m**a(6)
dg = a(7)*a(4)*m**(a(7)-1.d0) + a(6)*m**(a(6)-1.d0)
*
lbgbdf = (df*g - f*dg)/(g*g)
*
return
end
***
real*8 FUNCTION lbagbf(m,mhefl)
implicit none
real*8 m,mhefl,a4,a(200)
common /GBCFF/ a
*
* A function to evaluate the BAGB luminosity. (OP 21/04/98)
* Continuity between LM and IM functions is ensured by setting
* gbp(16) = lbagbf(mhefl,0.0) with gbp(16) = 1.0.
*
a4 = (a(9)*mhefl**a(10) - a(16))/(exp(mhefl*a(11))*a(16))
*
if(m.lt.mhefl)then
lbagbf = a(9)*m**a(10)/(1.d0 + a4*exp(m*a(11)))
else
lbagbf = (a(12) + a(13)*m**(a(15)+1.8d0))/(a(14) + m**a(15))
endif
*
return
end
***
real*8 FUNCTION rgbf(m,lum)
implicit none
real*8 m,lum,a1,a(200)
common /GBCFF/ a
*
* A function to evaluate radius on the GB.
* (JH 24/11/97)
*
a1 = MIN(a(20)/m**a(21),a(22)/m**a(23))
rgbf = a1*(lum**a(18) + a(17)*lum**a(19))
*
return
end
***
real*8 FUNCTION rgbdf(m,lum)
implicit none
real*8 m,lum,a1,a(200)
common /GBCFF/ a
*
* A function to evaluate radius derivitive on the GB (as f(L)).
* (JH 24/11/97)
*
a1 = MIN(a(20)/m**a(21),a(22)/m**a(23))
rgbdf = a1*(a(18)*lum**(a(18)-1.d0) +
& a(17)*a(19)*lum**(a(19)-1.d0))
*
return
end
***
real*8 FUNCTION ragbf(m,lum,mhelf)
implicit none
real*8 m,lum,mhelf,m1,a1,a4,xx,a(200)
common /GBCFF/ a
*
* A function to evaluate radius on the AGB.
* (JH 24/11/97)
*
m1 = mhelf - 0.2d0
if(m.ge.mhelf)then
xx = a(24)
elseif(m.ge.m1)then
xx = 1.d0 + 5.d0*(a(24)-1.d0)*(m-m1)
else
xx = 1.d0
endif
a4 = xx*a(19)
if(m.le.m1)then
a1 = a(29) + a(30)*m
elseif(m.ge.mhelf)then
a1 = MIN(a(25)/m**a(26),a(27)/m**a(28))
else
a1 = a(31) + 5.d0*(a(32)-a(31))*(m-m1)
endif
*
ragbf = a1*(lum**a(18) + a(17)*lum**a4)
*
return
end
***
real*8 FUNCTION ragbdf(m,lum,mhelf)
implicit none
real*8 m,lum,mhelf,m1,a1,a4,xx,a(200)
common /GBCFF/ a
*
* A function to evaluate radius derivitive on the AGB (as f(L)).
* (JH 24/11/97)
*
m1 = mhelf - 0.2d0
if(m.ge.mhelf)then
xx = a(24)
elseif(m.ge.m1)then
xx = 1.d0 + 5.d0*(a(24)-1.d0)*(m-m1)
else
xx = 1.d0
endif
a4 = xx*a(19)
if(m.le.m1)then
a1 = a(29) + a(30)*m
elseif(m.ge.mhelf)then
a1 = MIN(a(25)/m**a(26),a(27)/m**a(28))
else
a1 = a(31) + 5.d0*(a(32)-a(31))*(m-m1)
endif
*
ragbdf = a1*(a(18)*lum**(a(18)-1.d0) +
& a(17)*a4*lum**(a4-1.d0))
*
return
end
***
real*8 FUNCTION mctmsf(m)
implicit none
real*8 m,m525
*
* A function to evaluate core mass at the end of the MS as a
* fraction of the BGB value, i.e. this must be multiplied by
* the BGB value (see below) to give the actual core mass (JH 5/9/99)
*
m525 = m**(21.d0/4.d0)
mctmsf = (1.586d0 + m525)/(2.434d0 + 1.02d0*m525)
*
return
end
***
real*8 FUNCTION mcheif(m,mhefl,mchefl)
implicit none
real*8 m,mhefl,mchefl,mcbagb,a3,a(200)
common /GBCFF/ a
real*8 mcagbf
external mcagbf
*
* A function to evaluate core mass at BGB or He ignition
* (depending on mchefl) for IM & HM stars (OP 25/11/97)
*
mcbagb = mcagbf(m)
a3 = mchefl**4 - a(33)*mhefl**a(34)
mcheif = MIN(0.95d0*mcbagb,(a3 + a(33)*m**a(34))**(1.d0/4.d0))
*
return
end
***
real*8 FUNCTION mheif(mc,mhefl,mchefl)
implicit none
real*8 mc,mhefl,mchefl,m1,m2,a3,a(200)
common /GBCFF/ a
real*8 mbagbf
external mbagbf
*
* A function to evaluate mass at BGB or He ignition
* (depending on mchefl) for IM & HM stars by inverting
* mcheif
*
m1 = mbagbf(mc/0.95d0)
a3 = mchefl**4 - a(33)*mhefl**a(34)
m2 = ((mc**4 - a3)/a(33))**(1.d0/a(34))
mheif = MAX(m1,m2)
*
return
end
***
real*8 FUNCTION mcagbf(m)
implicit none
real*8 m,a(200)
common /GBCFF/ a
*
* A function to evaluate core mass at the BAGB (OP 25/11/97)
*
mcagbf = (a(37) + a(35)*m**a(36))**(1.d0/4.d0)
*
return
end
***
real*8 FUNCTION mbagbf(mc)
implicit none
real*8 mc,mc4,a(200)
common /GBCFF/ a
*
* A function to evaluate mass at the BAGB by inverting mcagbf.
*
mc4 = mc**4
if(mc4.gt.a(37))then
mbagbf = ((mc4 - a(37))/a(35))**(1.d0/a(36))
else
mbagbf = 0.d0
endif
*
return
end
***
real*8 FUNCTION mcgbtf(t,A,GB,tinf1,tinf2,tx)
implicit none
real*8 t,A,GB(10),tinf1,tinf2,tx
*
* A function to evaluate Mc given t for GB, AGB and NHe stars
*
if(t.le.tx)then
mcgbtf = ((GB(5)-1.d0)*A*GB(4)*(tinf1 - t))**
& (1.d0/(1.d0-GB(5)))
else
mcgbtf = ((GB(6)-1.d0)*A*GB(3)*(tinf2 - t))**
& (1.d0/(1.d0-GB(6)))
endif
*
return
end
***
real*8 FUNCTION lgbtf(t,A,GB,tinf1,tinf2,tx)
implicit none
real*8 t,A,GB(10),tinf1,tinf2,tx
*
* A function to evaluate L given t for GB, AGB and NHe stars
*
if(t.le.tx)then
lgbtf = GB(4)*(((GB(5)-1.d0)*A*GB(4)*(tinf1 - t))**
& (GB(5)/(1.d0-GB(5))))
else
lgbtf = GB(3)*(((GB(6)-1.d0)*A*GB(3)*(tinf2 - t))**
& (GB(6)/(1.d0-GB(6))))
endif
*
return
end
***
real*8 FUNCTION mcgbf(lum,GB,lx)
implicit none
real*8 lum,GB(10),lx
*
* A function to evaluate Mc given L for GB, AGB and NHe stars
*
if(lum.le.lx)then
mcgbf = (lum/GB(4))**(1.d0/GB(5))
else
mcgbf = (lum/GB(3))**(1.d0/GB(6))
endif
*
return
end
***
real*8 FUNCTION lmcgbf(mc,GB)
implicit none
real*8 mc,GB(10)
*
* A function to evaluate L given Mc for GB, AGB and NHe stars
*
if(mc.le.GB(7))then
lmcgbf = GB(4)*(mc**GB(5))
else
lmcgbf = GB(3)*(mc**GB(6))
endif
*
return
end
***
real*8 FUNCTION lHeIf(m,mhefl)
implicit none
real*8 m,mhefl,a(200)
common /GBCFF/ a
*
* A function to evaluate He-ignition luminosity (OP 24/11/97)
* Continuity between the LM and IM functions is ensured with a first
* call setting lhefl = lHeIf(mhefl,0.0)
*
if(m.lt.mhefl)then
lHeIf = a(38)*m**a(39)/(1.d0 + a(41)*EXP(m*a(40)))
else
lHeIf = (a(42) + a(43)*m**3.8d0)/(a(44) + m**2)
endif
*
return
end
***
real*8 FUNCTION lHef(m)
implicit none
real*8 m,a(200)
common /GBCFF/ a
*
* A function to evaluate the ratio LHe,min/LHeI (OP 20/11/97)
* Note that this function is everywhere <= 1, and is only valid
* for IM stars
*
lHef = (a(45) + a(46)*m**(a(48)+0.1d0))/(a(47) + m**a(48))
*
return
end
***
real*8 FUNCTION rminf(m)
implicit none
real*8 m,mx,a(200)
common /GBCFF/ a
*
* A function to evaluate the minimum radius during He-burning
* for IM & HM stars (OP 20/11/97)
*
mx = m**a(53)
rminf = (a(49)*m + (a(50)*m)**a(52)*mx)/(a(51) + mx)
*
return
end
***
real*8 FUNCTION tHef(m,mc,mhefl)
implicit none
real*8 m,mc,mhefl,mm,a(200)
common /GBCFF/ a
real*8 themsf
external themsf
*
* A function to evaluate the He-burning lifetime. (OP 26/11/97)
* For IM & HM stars, tHef is relative to tBGB.
* Continuity between LM and IM stars is ensured by setting
* thefl = tHef(mhefl,0.0,,0.0), and the call to themsf ensures
* continuity between HB and NHe stars as Menv -> 0.
*
if(m.le.mhefl)then
mm = MAX((mhefl - m)/(mhefl - mc),1.0d-12)
tHef = (a(54) + (themsf(mc) - a(54))*mm**a(55))*
& (1.d0 + a(57)*EXP(m*a(56)))
else
mm = m**5
tHef = (a(58)*m**a(61) + a(59)*mm)/(a(60) + mm)
endif
*
return
end
***
real*8 FUNCTION tblf(m,mhefl,mfgb)
implicit none
real*8 m,mhefl,mfgb,mr,m1,m2,r1,a(200)
common /GBCFF/ a
real*8 lheif,rminf,ragbf
external lheif,rminf,ragbf
*
* A function to evaluate the blue-loop fraction of the He-burning
* lifetime for IM & HM stars (OP 28/01/98)
*
mr = mhefl/mfgb
if(m.le.mfgb) then
m1 = m/mfgb
m2 = log10(m1)/log10(mr)
m2 = max(m2,1.0d-12)
tblf = a(64)*m1**a(63) + a(65)*m2**a(62)
else
r1 = 1.d0 - rminf(m)/ragbf(m,lheif(m,mhefl),mhefl)
r1 = max(r1,1.0d-12)
tblf = a(66)*m**a(67)*r1**a(68)
end if
tblf = MIN(1.d0,MAX(0.d0,tblf))
if(tblf.lt.1.0d-10) tblf = 0.d0
*
return
end
***
real*8 FUNCTION lzahbf(m,mc,mhefl)
implicit none
real*8 m,mc,mhefl,mm,a4,a5,a(200)
common /GBCFF/ a
real*8 lzhef
external lzhef
*
* A function to evaluate the ZAHB luminosity for LM stars. (OP 28/01/98)
* Continuity with LHe,min for IM stars is ensured by setting
* lx = lHeif(mhefl,z,0.0,1.0)*lHef(mhefl,z,mfgb), and the call to lzhef
* ensures continuity between the ZAHB and the NHe-ZAMS as Menv -> 0.
*
a5 = lzhef(mc)
a4 = (a(69) + a5 - a(74))/((a(74) - a5)*exp(a(71)*mhefl))
mm = MAX((m-mc)/(mhefl - mc),1.0d-12)
lzahbf = a5 + (1.d0 + a(72))*a(69)*mm**a(70)/
& ((1.d0 + a(72)*mm**a(73))*(1.d0 + a4*EXP(m*a(71))))
*
return
end
***
real*8 FUNCTION rzahbf(m,mc,mhefl)
implicit none
real*8 m,mc,mhefl,rx,ry,mm,f,a(200)
common /GBCFF/ a
real*8 rzhef,rgbf,lzahbf
*
* A function to evaluate the ZAHB radius for LM stars. (OP 28/01/98)
* Continuity with R(LHe,min) for IM stars is ensured by setting
* lx = lHeif(mhefl,z,0.0,1.0)*lHef(mhefl,z,mfgb), and the call to rzhef
* ensures continuity between the ZAHB and the NHe-ZAMS as Menv -> 0.
*
rx = rzhef(mc)
ry = rgbf(m,lzahbf(m,mc,mhefl))
mm = MAX((m-mc)/(mhefl - mc),1.0d-12)
f = (1.d0 + a(76))*mm**a(75)/(1.d0 + a(76)*mm**a(77))
rzahbf = (1.d0 - f)*rx + f*ry
*
return
end
***
real*8 FUNCTION lzhef(m)
implicit none
real*8 m,m15
*
* A function to evaluate Naked Helium star 'ZAMS' luminosity
*
m15 = m*SQRT(m)
lzhef = 1.5262d+04*m**(41.d0/4.d0)/
& (0.0469d0 + m**6*(31.18d0 + m15*(29.54d0 + m15)))
*
return
end
***
real*8 FUNCTION rzhef(m)
implicit none
real*8 m
*
* A function to evaluate Helium star 'ZAMS' radius
*
rzhef = 0.2391d0*m**4.6d0/(0.0065d0 + (0.162d0 + m)*m**3)
*
return
end
***
real*8 FUNCTION themsf(m)
implicit none
real*8 m
*
* A function to evaluate Helium star main sequence lifetime
*
themsf = (0.4129d0 + 18.81d0*m**4 + 1.853d0*m**6)/m**(13.d0/2.d0)
*
return
end
***
real*8 FUNCTION rhehgf(m,lum,rx,lx)
implicit none
real*8 m,lum,rx,lx,cm
*
* A function to evaluate Helium star radius on the Hertzsprung gap
* from its mass and luminosity.
*
cm = 2.0d-03*m**(5.d0/2.d0)/(2.d0 + m**5)
rhehgf = rx*(lum/lx)**0.2d0 + 0.02d0*(EXP(cm*lum) - EXP(cm*lx))
*
return
end
***
real*8 FUNCTION rhegbf(lum)
implicit none
real*8 lum
*
* A function to evaluate Helium star radius on the giant branch.
*
rhegbf = 0.08d0*lum**(3.d0/4.d0)
*
return
end
***
real*8 FUNCTION lpertf(m,mew)
implicit none
real*8 m,mew
real*8 b,c
*
* A function to obtain the exponent that perturbs luminosity.
*
b = 0.002d0*MAX(1.d0,2.5d0/m)
c = 3.d0
lpertf = ((1.d0 + b**c)*((mew/b)**c))/(1.d0+(mew/b)**c)
*
return
end
***
real*8 FUNCTION rpertf(m,mew,r,rc)
implicit none
real*8 m,mew,r,rc
real*8 a,b,c,q,fac,facmax
*
* A function to obtain the exponent that perturbs radius.
*
if(mew.le.0.d0)then
rpertf = 0.d0
else
a = 0.1d0
b = 0.006d0*MAX(1.d0,2.5d0/m)
c = 3.d0
q = log(r/rc)
fac = a/q
facmax = -14.d0/log10(mew)
fac = MIN(fac,facmax)
rpertf = ((1.d0 + b**c)*((mew/b)**c)*(mew**fac))/
& (1.d0+(mew/b)**c)
endif
*
return
end
***
real*8 FUNCTION vrotf(m)
implicit none
real*8 m
*
vrotf = 330.d0*m**3.3d0/(15.d0 + m**3.45d0)
*
return
end
***
real*8 FUNCTION celamf(kw,m,lum,rad,rzams,menv,fac)
implicit none
integer kw
real*8 m,lum,rad,rzams,menv,fac
real*8 lam1,lam2,m1,logm,logl
real*8 aa,bb,cc,dd
*
* A function to estimate lambda for common-envelope.
*
if(fac.ge.0.d0)then
*
* No fits yet for naked He stars...
*
if(kw.gt.6)then
celamf = 0.5d0
goto 90
endif
*
if(menv.gt.0.d0)then
* Formulae for giant-like stars; also used for HG and CHeB stars close
* to the Hayashi track.
logl = log10(lum)
logm = log10(m)
if(kw.le.5)then
m1 = m
if(kw.gt.3) m1 = 100.d0
lam1 = 3.d0/(2.4d0 + 1.d0/m1**(3.d0/2.d0)) - 0.15d0*logl
lam1 = MIN(lam1,0.8d0)
else
lam1 = -3.5d0 - 0.75d0*logm + logl
endif
if(kw.gt.3)then
lam2 = MIN(0.9d0,0.58d0 + 0.75d0*logm) - 0.08d0*logl
if(kw.lt.6)then
lam1 = MIN(lam2,lam1)
else
lam1 = MAX(lam2,lam1)
lam1 = MIN(lam1,1.d0)
endif
endif
lam1 = 2.d0*lam1
if(fac.gt.0.d0)then
* Use a fraction FAC of the ionization energy in the energy balance.
if(kw.le.3)then
aa = MIN(1.2d0*(logm - 0.25d0)**2 - 0.7d0,-0.5d0)
else
aa = MAX(-0.2d0 - logm,-0.5d0)
endif
bb = MAX(3.d0 - 5.d0*logm,1.5d0)
cc = MAX(3.7d0 + 1.6d0*logm,3.3d0 + 2.1d0*logm)
lam2 = aa + ATAN(bb*(cc - logl))
if(kw.le.3)then
dd = MAX(0.d0,MIN(0.15d0,0.15d0 - 0.25d0*logm))
lam2 = lam2 + dd*(logl - 2.d0)
endif
lam2 = MAX(lam2,1.d-2)
lam2 = MAX(1.d0/lam2,lam1)
if(fac.ge.1.d0)then
lam1 = lam2
else
lam1 = lam1 + fac*(lam2 - lam1)
endif
endif
endif
*
if(menv.lt.1.d0)then
* Formula for HG stars; also reasonable for CHeB stars in blue loop.
lam2 = 0.42d0*(rzams/rad)**0.4d0
* Alternatively:
* lam2 = 0.3d0*(rtms/rad)**0.4d0
lam2 = 2.d0*lam2
endif
*
if(menv.le.0.d0)then
celamf = lam2
elseif(menv.ge.1.d0)then
celamf = lam1
else
* Interpolate between HG and GB values depending on conv. envelope mass.
celamf = lam2 + sqrt(menv)*(lam1 - lam2)
endif
*
90 continue
*
else
celamf = -1.d0*fac
endif
*
return
end
***