-
Notifications
You must be signed in to change notification settings - Fork 0
/
new123.f
1655 lines (1476 loc) · 73.2 KB
/
new123.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
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C Changes (to run inder unix f77):
C -------------------------------
C Programme renamed from nuc123.for to new123.f
C ir=1 -> ir=5 ... input unit number
C iw=1 -> iw=6 ... output unit number
C COMMON /check/ itime -> COMMON /checkcb/ itime
C COMMON /time/ -> COMMON /ttime/
C output nuc123.dat -> new123.dat
C
C========================IDENTIFICATION DIVISION================================
PROGRAM new123
C----------LINKAGES.
C CALLED BY - none
C CALLS - [subroutine] help, setcom, setmod, run, output
C----------REMARKS.
C Control program -
C Offers user the main menu and channels through to various options.
C Implementation -
C To run this program, new123.f must be linked with nuccom.f
C (containing the computation subroutines), nucrat.f (with the
C reaction rates), and newint.f (with an interface subroutine).
C This program has been written to be compatible with
C ANSI FORTRAN-77 with the exception of the END DO statement
C used to limit the number of statement labels.
C This code was modified on the DEC/AXP system.
C Notes -
C The program utilizes Wagoner's code as the core of the computational
C routines.
C Documentation -
C Kawano, L., 1992, Fermilab preprint FERMILAB-PUB-92/04-A,
C Kellogg Radiation Lab preprint OAP-714.
C Copy -
C Version 4.1 (December 1991)
C----------PARAMETERS.
PARAMETER (ir=5) !Input unit number (previous value = 1).
PARAMETER (iw=6) !Output unit number (previous value = 1).
PARAMETER (nrec=123) !Number of nuclear reactions. - Ninja
PARAMETER (nnuc=30) !Number of nuclides in calculation. - Ninja
C----------COMMON AREAS.
COMMON /recpr0/ reacpr !Reaction parameter values.
COMMON /recpr/ iform,ii,jj,kk,ll,rev,q9 !Reaction parameter names.
COMMON /rates/ f,r !Reaction rates.
COMMON /compr0/ cy0,ct0,t9i0,t9f0,ytmin0,inc0 !Default comp parameters.
COMMON /compr/ cy,ct,t9i,t9f,ytmin,inc !Computation parameters.
COMMON /modpr0/ c0,cosmo0,xi0 !Default model parameters.
COMMON /modpr/ g,tau,xnu,c,cosmo,xi !Model parameters.
COMMON /varpr0/ dt0,eta0 !Default variationl params.
COMMON /varpr/ dt1,eta1 !Variational parameters.
COMMON /checkcb/ itime !Computation location.
COMMON /runopt/ irun,isize,jsize !Run options.
COMMON /outopt/ nout,outfile !Output option.
C==========================DECLARATION DIVISION=================================
C----------REACTION PARAMETERS FROM BLOCK DATA.
REAL reacpr(nrec,8) !Reaction parameters.
C----------REACTION PARAMETERS.
INTEGER iform(nrec) !Reaction type code (1-11).
INTEGER ii(nrec) !Incoming nuclide type (1-27).
INTEGER jj(nrec) !Incoming light nuclide type (1-6).
INTEGER kk(nrec) !Outgoing light nuclide type (1-6).
INTEGER ll(nrec) !Outgoing nuclide type (1-27).
REAL rev(nrec) !Reverse reaction coefficient.
REAL q9(nrec) !Energy released in reaction.
C----------REACTION RATES.
REAL f(nrec) !Forward reaction rate coefficients.
REAL r(nrec) !Reverse reaction rate coefficients.
C----------DEFAULT COMPUTATION PARAMETERS.
REAL cy0 !Default cy.
REAL ct0 !Default ct.
REAL t9i0 !Default t9i.
REAL t9f0 !Default t9f.
REAL ytmin0 !Default ytmin.
INTEGER inc0 !Default accumulation increment.
C----------COMPUTATIONAL PARAMETERS.
REAL cy !Time step limiting constant on abundances.
REAL ct !Time step limiting constant on temperature.
REAL t9i !Initial temperature (in 10**9 K).
REAL t9f !Final temperature (in 10**9 k).
REAL ytmin !Smallest abundances allowed.
INTEGER inc !Accumulation increment.
C----------DEFAULT MODEL PARAMETERS.
REAL c0(3) !Default c.
REAL cosmo0 !Default cosmological constant.
REAL xi0(3) !Default neutrino degeneracy parameters.
C----------EARLY UNIVERSE MODEL PARAMETERS.
REAL c(3) !c(1) is variation of gravitational constant.
| !c(2) is neutron lifetime (sec).
| !c(3) is number of neutrino species.
REAL cosmo !Cosmological constant.
REAL xi(3) !Neutrino degeneracy parameters.
C----------DEFAULT VARIATIONAL PARAMETERS.
REAL dt0 !Default initial time step.
REAL eta0 !Default baryon-to-photon ratio.
C----------VARIATIONAL PARAMETERS.
REAL dt1 !Initial time step.
REAL eta1 !Baryon-to-photon ratio.
C----------COMPUTATION LOCATION.
INTEGER itime !Time check.
C----------RUN OPTION.
INTEGER irun !Run network size.
INTEGER isize !Number of nuclides in computation.
INTEGER jsize !Number of reactions in computation.
C----------OUTPUT FILE STATUS.
INTEGER nout !Number of output requests.
LOGICAL outfile !Indicates if output file used.
C----------USER RESPONSE VARIABLES.
INTEGER inum !Selection number.
C===========================PROCEDURE DIVISION==================================
C10--------OPEN FILES AND PRINT GREETING----------------------------------------
OPEN (unit=2, file='new123.dat', status='new') !Output file.
itime = 1 !Time = beginning of program.
CALL check !Check interface subroutine.
WRITE (iw,1000)
1000 FORMAT (6(/),
| 2(' ',4x,'NN',6x,'NN UU',6x,'UU',4x,8('C'),6x,'11',8x,
| 6('2'),6x,6('3'),/),
| 2(' ',4x,'NN',6x,'NN UU',6x,'UU CC',12x,'1111',6x,
| '22',6x,'22 33',6x,'33',/),
| 2(' ',4x,'NNNN NN UU',6x,'UU CC',14x,'11',14x,
| '22',10x,'33',/),
| 2(' ',4x,'NN NN NN UU',6x,'UU CC',14x,'11',12x,
| '22',10x,'33',/),
| 2(' ',4x,'NN NNNN UU',6x,'UU CC',14x,'11',10x,
| '22',14x,'33',/),
| 2(' ',4x,'NN',6x,'NN UU',6x,'UU CC',14x,'11',8x,
| '22',8x,'33',6x,'33',/),
| 2(' ',4x,'NN',6x,'NN ',10('U'),4x,8('C'),4x,6('1'),4x,
| 10('2'),4x,6('3'),/),/,
| ' ',26x,'MODIFIED APRIL 1994',///,
| ' ','(Press <RETURN> to continue): ',$)
C20--------INPUT INITIALIZATION INFORMATION AND PAUSE---------------------------
DO i = 1,nrec
C..........READ IN REACTION PARAMETERS.
iform(i) = int(reacpr(i,2))!Reaction type.
ii(i) = int(reacpr(i,3))!Incoming nuclide type.
jj(i) = int(reacpr(i,4))!Incoming nuclide type.
kk(i) = int(reacpr(i,5))!Outgoing nuclide type.
ll(i) = int(reacpr(i,6))!Outgoing nuclide type.
rev(i) = reacpr(i,7) !Reverse reaction coefficient.
q9(i) = reacpr(i,8) !Energy released.
C..........INITIALIZE REACTION RATES.
f(i) = 0. !Forward rate coeff.
r(i) = 0. !Reverse rate coeff.
C..........SET RUN OPTIONS TO DEFAULT.
END DO
irun = 1 !Do full run.
isize = nnuc !Use all 27 nuclides.
jsize = nrec !Use all 93 reactions.
C..........SET OUTPUT OPTION TO DEFAULT.
nout = 0 !No output requests.
outfile = .false. !Output file not used.
C..........SET VALUES TO DEFAULT.
cy = cy0 !Time step limiting constant on abundances.
ct = ct0 !Time step limiting constant on temperature.
t9i = t9i0 !Initial temperature.
t9f = t9f0 !Final temperature.
ytmin = ytmin0 !Smallest abundances allowed.
inc = inc0 !Accumulation increment.
c(1) = c0(1) !Variation of gravitational constant.
c(2) = c0(2) !Neutron lifetime.
c(3) = c0(3) !Number of neutrino species.
cosmo = cosmo0 !Cosmological constant.
xi(1) = xi0(1) !Electron degeneracy parameter.
xi(2) = xi0(2) !Muon degeneray parameter.
xi(3) = xi0(3) !Tauon degeneracy parameter.
dt1 = dt0 !Initial time step.
eta1 = eta0 !Baryon-to-photon ratio.
C..........ACCEPT RETURN TO CONTINUE.
READ (ir,*) !Pause.
C30--------PRINT MENU AND AWAIT RESPONSE----------------------------------------
C..........RETURN FROM LOOPING.
300 CONTINUE
C..........DISPLAY MENU.
WRITE (iw,3000)
3000 FORMAT (8(/),
| ' ',32x,'MENU SELECTION',/,
| ' ',32x,'---- ---------',//,
| ' ',24x,'1. HELP',/,
| ' ',24x,'2. SET COMPUTATION PARAMETERS',/,
| ' ',24x,'3. SET MODEL PARAMETERS',/,
| ' ',24x,'4. RUN',/,
| ' ',24x,'5. OUTPUT',/,
| ' ',24x,'6. EXIT',8(/),
| ' ',24x,'Enter selection (1-6): ',$)
C..........READ IN SELECTION NUMBER.
READ (ir,3001) inum
3001 FORMAT(i1)
C40--------BRANCH TO APPROPRIATE SECTION----------------------------------------
GO TO (410,420,430,440,450,460),inum
GO TO 460 !Improper input or <RETURN>.
410 CONTINUE !Help section.
CALL help
GO TO 500
420 CONTINUE !Set computation parameters section.
CALL setcom
GO TO 500
430 CONTINUE !Set model parameters section.
CALL setmod
GO TO 500
440 CONTINUE !Run section.
itime = 2 !Time = beginning of run section.
CALL check !Check interface subroutine.
CALL run
itime = 9 !Time = end of run section.
CALL check !Check interface subroutine.
GO TO 500
450 CONTINUE !Output section.
CALL output
GO TO 500
460 CONTINUE !Exit section.
IF (outfile) THEN
CLOSE (unit=2,status='keep') !Close output file.
ELSE
CLOSE (unit=2,status='delete') !File not used - dispose.
END IF
itime = 10 !Time = end of program.
CALL check !Check interface subroutine.
STOP
C50---------GO BACK TO MENU-----------------------------------------------------
500 CONTINUE
GO TO 300
END
C========================IDENTIFICATION DIVISION================================
SUBROUTINE help
C----------LINKAGES.
C CALLED BY - [program] nuc123
C CALLS - none
C----------REMARKS.
C Displays description and workings of the program.
C----------PARAMETERS.
PARAMETER (ir=5) !Input unit number (previous value = 1).
PARAMETER (iw=6) !Output unit number (previous value = 1).
C==========================DECLARATION DIVISION=================================
C----------USER RESPONSE VARIABLES.
INTEGER inum !Selection number.
C===========================PROCEDURE DIVISION==================================
C10--------PRINT HELP SELECTION-------------------------------------------------
C..........RETURN FROM LOOPING.
100 CONTINUE
C..........DISPLAY MENU.
WRITE (iw,1000)
1000 FORMAT (8(/),
| ' ',32x,'HELP SELECTION',/,
| ' ',32x,'---- ---------',//,
| ' ',24x,'1. INTRODUCTION',/,
| ' ',24x,'2. SETTING UP A RUN',/,
| ' ',24x,'3. RUNNING THE PROGRAM',/,
| ' ',24x,'4. OUTPUT OPTIONS',/,
| ' ',24x,'5. GENERAL METHOD OF COMPUTATION',/,
| ' ',24x,'6. USING THE INTERFACE SUBROUTINE',/,
| ' ',24x,'7. EXIT',7(/),
| ' ',24x,'Enter selection (1-7): ',$)
C..........READ IN SELECTION NUMBER.
READ (ir,1001) inum
1001 FORMAT (i1)
C20--------BRANCH TO APPROPRIATE SECTION----------------------------------------
GO TO (210,220,230,240,250,260,270),inum
GO TO 270 !Improper input or <RETURN>.
C21--------INTRODUCTION SECTION-------------------------------------------------
210 CONTINUE !Setting up a run section.
WRITE (iw,2100)
2100 FORMAT (/,
| ' ',31x,'INTRODUCTION',/,
| ' ',31x,'------------',2(/),
| ' ','Welcome to the wonderful world of primor',
| 'dial nucleosynthesis. NUC123 is a ',/,
| ' ','FORTRAN program designed to provide the ',
| 'early universe researcher with the tools',/,
| ' ','necessary for the investigation of primo',
| 'rdial nucleosynthesis. Its menu-driven ',/,
| ' ','interface allows the user to first set c',
| 'omputation parameters (such as the time ',/,
| ' ','step) and model parameters (such as the ',
| 'neutron lifetime and number of neutri- ',/,
| ' ','nos) before doing single runs or multipl',
| 'e runs (in which desired model parame- ',/,
| ' ','ters are varied over a desired range.) ',
| 'After the run, the user can utilize the ',/,
| ' ','menu to either produce an output file or',
| ' to view the most recent run on the ',/,
| ' ','screen. The program comes with an empty',
| ' subroutine CHECK into which the user ',/,
| ' ','may wish to put additional code to add t',
| 'o the computation in an original manner.',10(/),
| ' ','(Enter <RETURN> to go back to help menu): ',$)
READ (ir,*)
GO TO 300
C22--------SET UP RUN SECTION---------------------------------------------------
220 CONTINUE !Setting up a run section.
WRITE (iw,2200)
2200 FORMAT (/,
| ' ',29x,'SETTING UP A RUN',/,
| ' ',29x,'------- -- - ---',2(/),
| ' ','I. Setting computation parameters. ',/,
| ' ',' The accuracy of the computation and t',
| 'he relevant temperature region can be ',/,
| ' ',' set by the following parameters: ',/,
| ' ',' A. Time step limiting constant 1 (d',
| 'efault value of 0.03) ',/,
| ' ',' B. Time step limiting constant 2 (d',
| 'efault value of 0.003) ',/,
| ' ',' C. Initial time step (default value',
| ' of 10**-4) ',/,
| ' ',' D. Initial temperature (default val',
| 'ue of 10**2) ',/,
| ' ',' This is the temperature at the be',
| 'ginning of the run in units of 10**9 K ',/,
| ' ',' E. Final temperature (default value',
| ' of 10**-2) ',/,
| ' ',' This is the termination temperatu',
| 're of the run in units of 10**9 K ',/,
| ' ',' F. Smallest abundances allowed (def',
| 'ault value of 10**-25) ',/,
| ' ',' Elemental abundances are not allo',
| 'wed to drop below this value ',/,
| ' ',' G. # of iterations for each accumula',
| 'tion (default value of 300) ',/,
| ' ',' This is the number of iterations ',
| 'before values are put in an output array',6(/),
| ' ','(Enter 1 to continue, <RETURN> to end): ',$)
READ (ir,1001) inum
IF (inum.eq.1) THEN
WRITE (iw,2202)
2202 FORMAT (/,
| ' ','II. Setting model parameters. ',/,
| ' ',' Default values here give what is know',
| 'n as the standard model with best guess ',/,
| ' ',' figure on the neutron lifetime of 889',
| '.1 seconds. Nonstandard scenarios can',/,
| ' ',' be investigated by varying the follow',
| 'ing parameters: ',/,
| ' ',' A. The gravitational constant ',/,
| ' ',' (The default value of one here gi',
| 'ves the usual 6.6720e-8 dyne*cm**2/g**2)',/,
| ' ',' B. Neutron life-time (default value',
| ' of 889.1 seconds) ',/,
| ' ',' C. Number of neutrino species (defa',
| 'ult value of 3 light neutrinos) ',/,
| ' ',' D. Final baryon-to-photon ratio (se',
| 't to log(eta) = -9.5) ',/,
| ' ',' E. Cosmological constant (default v',
| 'alue of 0) ',/,
| ' ',' F. Neutrino degeneracy parameters (',
| 'default values all 0) ',/,
| ' ',' There are 3 separate parameters f',
| 'or the electron, muon, and tau neutrinos',11(/),
| ' ','(Enter <RETURN> to go back to help menu): ',$)
READ (ir,*)
GO TO 300
ELSE
GO TO 300
END IF !(inum.eq.1)
C23--------RUN PROGRAM SECTION--------------------------------------------------
230 CONTINUE !Running the program section.
WRITE (iw,2300)
2300 FORMAT (/,
| ' ',28x,'RUNNING THE PROGRAM',/,
| ' ',28x,'------- --- -------',2(/),
| ' ','I. Setting run speed. ',/,
| ' ',' The code can be run at 3 different se',
| 'ttings of speed. The running of the ',/,
| ' ',' code can be speeded up by reducing th',
| 'e number of nuclides and reactions. The',/,
| ' ',' complete computation takes into accou',
| 'nt the following nuclides: n, p, d, t, ',/,
| ' ',' He3, He4, Li6, Li7, Be7, Li8, B8, Be9',
| ',B10, B11, C11, B12, C12, N12, C13, N13,',/,
| ' ',' C14, N14, O14, N15, O15, and O16. ',/,
| ' ',' The given CPU percentages and abundan',
| 'ce variations are with regard to a ',/,
| ' ',' single run with all default parameter',
| ' values. ',/,
| ' ',' A. 27 nuclides, 93 reactions (defaul',
| 't) ',/,
| ' ',' nuclides from n to O16 ',/,
| ' ',' B. 18 nuclides, 60 reactions ',/,
| ' ',' nuclides from n to N12 ',/,
| ' ',' (63% CPU time, variation = .1%) ',/,
| ' ',' C. 9 nuclides, 25 reactions ',/,
| ' ',' nuclides from n to Be7 ',/,
| ' ',' (20% CPU time, variation = .5%) ',4(/),
| ' ','(Enter 1 to continue, <RETURN> to end): ',$)
READ (ir,1001) inum
IF (inum.eq.1) THEN
WRITE (iw,2302)
2302 FORMAT (/,
| ' ','II. Do single run. ',/,
| ' ',' A. Interactive. ',/,
| ' ',' In an interactive session, the us',
| 'er can readily input the computational ',/,
| ' ',' and model parameters and begin th',
| 'e computation process. The run itself ',/,
| ' ',' is commenced when option 2, "GO",',
| ' in the "RUN" section is requested. ',//,
| ' ',' B. Batch. ',/,
| ' ',' To run the program in a batch mod',
| 'e, it must be altered slightly so that ',/,
| ' ',' the I/O takes place with files in',
| 'stead of a terminal. This is done by ',/,
| ' ',' setting different values for the ',
| 'input and output unit number parameters ',/,
| ' ',' "ir" and "iw" and assigning them ',
| 'to different files in NUC123. In the ',/,
| ' ',' file assigned the "ir" unit numbe',
| 'r, one must place the responses to the ',/,
| ' ',' queries of the program. ',10(/),
| ' ','(Enter 1 to continue, <RETURN> to end): ',$)
READ (ir,1001) inum
IF (inum.eq.1) THEN
WRITE (iw,2304)
2304 FORMAT (/,
| ' ','III. Do multiple runs. ',/,
| ' ',' A wide range of early universe model',
| 's can be covered by doing many runs ',/,
| ' ',' while one or more parameters are var',
| 'ied over a range of interest. The ',/,
| ' ',' parameters that can be varied are th',
| 'e following: ',/,
| ' ',' A. Eta ',
| ' - Logrithmic variation ',/,
| ' ',' B. Gravitational constant ',
| ' - Linear variation ',/,
| ' ',' C. Neutron lifetime ',
| ' - Linear variation ',/,
| ' ',' D. Number of neutrino species ',
| ' - Linear variation ',/,
| ' ',' E. Cosmological constant ',
| ' - Linear variation ',/,
| ' ',' F. Neutrino degeneracy parameters ',
| ' - Linear variation ',/,
| ' ',' 1. Electron neutrino ',/,
| ' ',' 2. Muon neutrino ',/,
| ' ',' 3. Tauon neutrino ',/,
| ' ',' At most 3 parameters can be varied. ',
| ' The first parameter inputted will be ',/,
| ' ',' will be varied in the outermost loop',
| ' and the third parameter inputted will ',/,
| ' ',' be varied in the innermost loop. ',7(/),
| ' ','(Enter <RETURN> to go back to help menu): ',$)
READ (ir,*)
GO TO 300
ELSE
GO TO 300
END IF !(inum.eq.1)
ELSE
GO TO 300
END IF !(inum.eq.1)
C24--------OUTPUT OPTIONS SECTION-----------------------------------------------
240 CONTINUE !Output options section.
WRITE (iw,2400)
2400 FORMAT (/,
| ' ',30x,'OUTPUT OPTIONS',/,
| ' ',30x,'------ -------',2(/),
| ' ','I. Request output file. ',/,
| ' ',' After a run, the user can request the',
| ' program to put the resulting numbers ',/,
| ' ',' into an output file. This can be don',
| 'e as many times as desired and all the ',/,
| ' ',' information will be put in one new fi',
| 'le under the name of "NUC123.DAT." If ',/,
| ' ',' there is no request during the entire',
| ' running of the program, this file is ',/,
| ' ',' not created. If an output file is re',
| 'quested after a multiple run, only the ',/,
| ' ',' information from the very last run wi',
| 'll be given. The output file will give ',/,
| ' ',' the computational and model parameter',
| 's for each run and will contain the ',/,
| ' ',' following information: ',/,
| ' ',' A. Temperatures in decreasing order ',/,
| ' ',' B. Abundances for n, p, d, t, He3, H',
| 'e4, Li6, Li7, Be7, and Li8 & up ',/,
| ' ',' (p and He4 are in mass fraction, ',
| 'the rest in ratios to the p abundance) ',/,
| ' ',' C. Time, time interval, chemical pot',
| 'ential of the electron ',/,
| ' ',' D. Energy densities for photons, ele',
| 'ctrons, electron neutrinos, and baryons ',/,
| ' ',' E. Baryon-to-photon ratio, expansion',
| ' rate of the universe ',5(/),
| ' ','(Enter 1 to continue, <RETURN> to end): ',$)
READ (ir,1001) inum
IF (inum.eq.1) THEN
WRITE (iw,2402)
2402 FORMAT (/,
| ' ','II. Request output on screen. ',/,
| ' ',' Instead of waiting to print out an o',
| 'utput file, the user can immediately ',/,
| ' ',' access the results of the latest run',
| ' by requesting the output on the ',/,
| ' ',' screen. There are four screens on e',
| 'ach of which are displayed the ',/,
| ' ',' computational and model parameters a',
| 'nd the temperature: ',/,
| ' ',' A. Abundances for d, t, He3, He4, a',
| 'nd Li7 ',/,
| ' ',' (He4 in mass fraction, rest as a',
| ' ratio with the p abundance) ',/,
| ' ',' B. Abundances for n, p, Li6, Be7, a',
| 'nd Li8 & up ',/,
| ' ',' (p in mass fraction, rest as a r',
| 'atio with the p abundance) ',/,
| ' ',' C. Energy densities for photons, el',
| 'ectrons, electron neutrinos, & baryons ',/,
| ' ',' D. Time, time interval, chemical po',
| 'tential of the electron, ',/,
| ' ',' baryon-to-photon ratio, and expa',
| 'nsion rate of the universe ',11(/),
| ' ','(Enter <RETURN> to go back to help menu): ',$)
READ (ir,*)
GO TO 300
ELSE
GO TO 300
END IF !(inum.eq.1)
C25--------METHOD OF COMPUTATION SECTION----------------------------------------
250 CONTINUE !General method of computation section.
WRITE (iw,2500)
2500 FORMAT (/,
| ' ',22x,'GENERAL METHOD OF COMPUTATION',/,
| ' ',22x,'------- ------ -- -----------',2(/),
| ' ','I. Time evolution algorithm. ',/,
| ' ',' The program utilizes a 2-point Runge-',
| 'Kutta scheme (located in subroutine ',/,
| ' ',' DRIVER) to time-evolve the temperatur',
| 'e, the quantity hv (the ratio of the ',/,
| ' ',' baryon density to T**3), the chemical',
| ' potential of the electron, and the ',/,
| ' ',' nuclide abundances. In the 2-point R',
| 'unge-Kutta routine, a variable v at time',/,
| ' ',' t0 (= v0) is evolved to a time t1 by ',
| 'adding to v0 the average of the ',/,
| ' ',' derivatives evaluated at t0 and at t1',
| ' multiplied by dt: ',/,
| ' ',' v1 = v0 + 0.5(dvdt(t0)+dvdt(t1)) ',/,
| ' ',' where dvdt(t1) is gotten by first fin',
| 'ding v1'' = v0 + dvdt(t0). The ',/,
| ' ',' derivatives of the nuclide abundances',
| ' are first computed and these are used ',/,
| ' ',' to find the derivatives of t9, hv, an',
| 'd phie (this is done in subroutine ',/,
| ' ',' DERIVS). To compute the time derivat',
| 'ives of the nuclide abundances, a matrix',/,
| ' ',' equation is set up (in subroutine SOL',
| ') and is solved (in subroutine EQSLIN) ',/,
| ' ',' by gaussian elimination utilizing imp',
| 'licit differentiation. ',6(/),
| ' ','(Enter 1 to continue, <RETURN> to end): ',$)
READ (ir,1001) inum
IF (inum.eq.1) THEN
WRITE (iw,2502)
2502 FORMAT (/
| ' ','II. Hierarchy of Subroutines. ',/,
| ' ',' NUC123 ',
| ' Main program (main menu) ',/,
| ' ',' HELP ',
| ' Help option ',/,
| ' ',' SETCOM ',
| ' Set computational parameters',/,
| ' ',' SETMOD ',
| ' Set model parameters ',/,
| ' ',' RUN ',
| ' Run computation code ',/,
| ' ',' DRIVER ',
| ' Main routine (Runge-Kutta loop) ',/,
| ' ',' START ',
| ' Initialization routine ',/,
| ' ',' RATE0 ',
| ' Computes weak decay rates ',/,
| ' ',' DERIVS ',
| ' Computes time derivatives ',/,
| ' ',' THERM ',
| ' Computes energy densities ',/,
| ' ',' BESSEL ',
| ' Gives functions of Kn ',/,
| ' ',' KNUX ',
| ' Computes modified Bessel fcn Kn ',/,
| ' ',' NUDENS ',
| ' Computes neutrino energy density ',/,
| ' ',' RATE1-4 ',
| ' Computes rates for reactions',/,
| ' ',' SOL ',
| ' Builds A matrix for eqn dy/dt = Ay ',/,
| ' ',' EQSLIN ',
| ' Solves dy/dt=Ay by gaussian elim ',/,
| ' ',' ACCUM ',
| ' Output accumulator ',/,
| ' ',' OUTPUT ',
| ' Allows user to output result',4(/),
| ' ','(Enter <RETURN> to go back to help menu): ',$)
READ (ir,*)
GO TO 300
ELSE
GO TO 300
END IF !(inum.eq.1)
C26--------USING INTERFACE SUBROUTINE SECTION.
260 CONTINUE !Using the interface subroutine section.
WRITE (iw,2600)
2600 FORMAT (/,
| ' ',22x,'USING THE INTERFACE SUBROUTINE',/,
| ' ',22x,'----- --- --------- ----------',2(/),
| ' ','I. Purpose. ',/,
| ' ',' The interface subroutine CHECK is des',
| 'igned to be an outlet of the program ',/,
| ' ',' into which alterations can be easily ',
| 'plugged. Programs are normally modified',/,
| ' ',' by searching through the program, ide',
| 'ntifying the appropriate areas for ',/,
| ' ',' alterations, and interspersing new co',
| 'mmands while deleting some old ones. ',/,
| ' ',' This process can get tricky unless on',
| 'e actively documents the alterations: ',/,
| ' ',' one might lose track of all of the mo',
| 'difications and deletions. Thus, it is ',/,
| ' ',' worthwhile to put most if not all of ',
| 'the necessary changes into one ',/,
| ' ',' subroutine which is to be called from',
| ' strategic locations in the main ',/,
| ' ',' program. Furthermore, by putting cha',
| 'nges into one small subroutine, one need',/,
| ' ',' only to compile the subroutine CHECK ',
| 'each time instead of the entire nucleo- ',/,
| ' ',' synthesis code. ',8(/),
| ' ','(Enter 1 to continue, <RETURN> to end): ',$)
READ (ir,1001) inum
IF (inum.eq.1) THEN
WRITE (iw,2602)
2602 FORMAT (/,
| ' ','II. Description. ',/,
| ' ',' Subroutine CHECK is an empty subrouti',
| 'ne with a large COMMON area, giving the ',/,
| ' ',' user ready access to all of the impor',
| 'tant variables in the computations. The',/,
| ' ',' routine is called from various locati',
| 'ons in the main program and the location',/,
| ' ',' spot in the program is labeled by the'
| ' flag "itime". The set call locations ',/,
| ' ',' are given below: ',/,
| ' ',' A. itime = 1 (NUC123, very beginning',
| ' of program run) ',/,
| ' ',' (appropriate for opening files, i',
| 'nitializing variables) ',/,
| ' ',' B. itime = 2 (NUC123, right before g',
| 'oing into the RUN section) ',/,
| ' ',' C. itime = 3 (RUN, right before goin',
| 'g into DRIVER to do the computations) ',/,
| ' ',' D. itime = 4 (DRIVER, in 1st R-K loo',
| 'p after computing derivatives in DERIVS)',/,
| ' ',' E. itime = 7 (DRIVER, in 2nd R-K loo',
| 'p after computing derivatives in DERIVS)',/,
| ' ',' F. itime = 8 (RUN, right after comin',
| 'g back from DRIVER) ',/,
| ' ',' G. itime = 9 (NUC123, right after co',
| 'ming back from the RUN section) ',/,
| ' ',' H. itime =10 (NUC123, very end of pr',
| 'ogram run) ',/,
| ' ',' (appropriate for closing files) ',/,
| ' ',' The difference between the (2,9) pair',
| 'ing and the (3,8) pairing is that for a ',/,
| ' ',' multiple run, the (3,8) pairing would',
| ' be called before and after every run ',/,
| ' ',' but the (2,9) pairing would be called',
| ' before and after the entire sequence. ',4(/),
| ' ','(Enter 1 to continue, <RETURN> to end): ',$)
READ (ir,1001) inum
IF (inum.eq.1) THEN
WRITE (iw,2604)
2604 FORMAT (/,
| ' ','III. Implementation. ',/,
| ' ',' The additional program statements ar',
| 'e needed in the subroutine CHECK. If a',/,
| ' ',' particular command is to be executed',
| ' when the computer is at a certain ',/,
| ' ',' location in the program -- say label',
| 'ed by itime = 8 -- then in CHECK, one ',/,
| ' ',' must place the command under the sta',
| 'tement, IF (itime.eq.8).... The user ',/,
| ' ',' is at leisure to place his own locat',
| 'ion indicators (5,6) and CALL CHECK ',/,
| ' ',' statements anywhere in the program a',
| 's long as there is a COMMON /checkcb/ ',/,
| ' ',' statement in the particular subrouti',
| 'ne to carry the value of itime along. ',15(/),
| ' ','(Enter <RETURN> to go back to help menu): ',$)
READ (ir,*)
GO TO 300
ELSE
GO TO 300
END IF !(inum.eq.1)
ELSE
GO TO 300
END IF !(inum.eq.1)
C27--------EXIT SECTION---------------------------------------------------------
270 CONTINUE !Exit section.
RETURN
C30--------GO BACK TO MAIN MENU-------------------------------------------------
300 CONTINUE
GO TO 100
END
C========================IDENTIFICATION DIVISION================================
SUBROUTINE setcom
C----------LINKAGES.
C CALLED BY - [program] nuc123
C CALLS - none
C----------REMARKS.
C Allows resetting of computation parameters.
C----------PARAMETERS.
PARAMETER (ir=5) !Input unit number (previous value = 1).
PARAMETER (iw=6) !Output unit number (previous value = 1).
C----------COMMON AREAS.
COMMON /compr0/ cy0,ct0,t9i0,t9f0,ytmin0,inc0 !Default comp parameters.
COMMON /compr/ cy,ct,t9i,t9f,ytmin,inc !Computation parameters.
COMMON /varpr0/ dt0,eta0 !Default variationl params.
COMMON /varpr/ dt1,eta1 !Variational parameters.
C==========================DECLARATION DIVISION=================================
C----------DEFAULT COMPUTATION PARAMETERS.
REAL cy0 !Default cy.
REAL ct0 !Default ct.
REAL t9i0 !Default t9i.
REAL t9f0 !Default t9f.
REAL ytmin0 !Default ytmin.
INTEGER inc0 !Default accumulation increment.
C----------COMPUTATION PARAMETERS.
REAL cy !Time step limiting constant on abundances.
REAL ct !Time step limiting constant on temperature.
REAL t9i !Initial temperature (in 10**9 K).
REAL t9f !Final temperature (in 10**9 K).
REAL ytmin !Smallest abundances allowed.
INTEGER inc !Accumulation increment.
C----------DEFAULT VARIATIONAL PARAMETERS.
REAL dt0 !Default initial dt.
C----------VARIATIONAL PARAMETERS.
REAL dt1 !Initial time step.
C----------LOCAL VARIABLES.
INTEGER inum !Selection number.
C===========================PROCEDURE DIVISION==================================
C10--------PRINT RESET SELECTION AND AWAIT RESPONSE-----------------------------
C..........RETURN FROM LOOPING.
100 CONTINUE
C..........DISPLAY RESET SELECTIONS.
WRITE (iw,1000) cy,ct,dt1,t9i,t9f,ytmin,float(inc)
1000 FORMAT (8(/),
| ' ',21x,'SET COMPUTATION PARAMETERS SELECTION',/,
| ' ',21x,'--- ----------- ---------- ---------',//,
| ' ',10x,' 1. CHANGE TIME-STEP LIMITING CONSTANT 1 FROM ',
| f5.3,/,
| ' ',10x,' 2. CHANGE TIME-STEP LIMITING CONSTANT 2 FROM ',
| f5.3,/,
| ' ',10x,' 3. CHANGE INITIAL TIME-STEP FROM ',
| 1pe8.2,' SECONDS',/,
| ' ',10x,' 4. CHANGE INITIAL TEMPERATURE FROM ',
| 1pe8.2,' (10**9 K)',/,
| ' ',10x,' 5. CHANGE FINAL TEMPERATURE FROM ',
| 1pe8.2,' (10**9 K)',/,
| ' ',10x,' 6. CHANGE SMALLEST ABUNDANCES ALLOWED FROM ',
| 1pe8.2,/,
| ' ',10x,' 7. CHANGE ACCUMULATION INCREMENT FROM ',
| 1pe8.2,' ITERATIONS',/,
| ' ',10x,' 8. RESET ALL TO DEFAULT VALUES',/,
| ' ',10x,' 9. EXIT',5(/),
| ' ',10x,'Enter selection (1-9): ',$)
C..........READ IN SELECTION NUMBER.
READ (ir,1001) inum
1001 FORMAT (i1)
C20--------BRANCH TO APPROPRIATE SECTION----------------------------------------
GO TO (210,220,230,240,250,260,270,280,300),inum
GO TO 300 !Improper input or <RETURN>.
210 CONTINUE !Change time step limiting const 1 section.
WRITE (iw,2100)
2100 FORMAT (' ','Enter value for time step limiting constant 1: ',$)
READ (ir,*) cy
2101 FORMAT (f5.3)
GO TO 400
220 CONTINUE !Change time step limiting const 2 section.
WRITE (iw,2200)
2200 FORMAT (' ','Enter value for time step limiting constant 2: ',$)
READ (ir,*) ct
GO TO 400
230 CONTINUE !Change initial time step section.
WRITE (iw,2300)
2300 FORMAT (' ','Enter value for initial time step: ',$)
READ (ir,*) dt1
GO TO 400
240 CONTINUE !Change initial temperature section.
WRITE (iw,2400)
2400 FORMAT (' ','Enter value for initial temperature: ',$)
READ (ir,*) t9i
GO TO 400
250 CONTINUE !Change final temperature section.
WRITE (iw,2500)
2500 FORMAT (' ','Enter value for final temperature: ',$)
READ (ir,*) t9f
GO TO 400
260 CONTINUE !Change smallest abundances allowed section.
WRITE (iw,2600)
2600 FORMAT (' ','Enter value for smallest abundances allowed: ',$)
READ (ir,*) ytmin
GO TO 400
270 CONTINUE !Change accumulation increment section.
WRITE (iw,2700)
2700 FORMAT (' ','Enter value for accumulation increment: ',$)
READ (ir,*) inc
GO TO 400
280 CONTINUE !Reset all to default values section.
cy = cy0 !Time step limiting constant on abundances.
ct = ct0 !Time step limiting constant on temperature.
dt1 = dt0 !Time step.
t9i = t9i0 !Initial temperature.
t9f = t9f0 !Final temperature.
ytmin = ytmin0 !Smallest abundances allowed.
inc = inc0 !Accumulation increment.
WRITE (iw,2800)
2800 FORMAT (' ','All values reset to default - Press <RETURN> '
| 'to continue: ',$)
READ (ir,*)
GO TO 400
300 CONTINUE !Exit section.
RETURN
C40--------GO BACK TO MENU------------------------------------------------------
400 CONTINUE
GO TO 100
END
C========================IDENTIFICATION DIVISION================================
SUBROUTINE setmod
C----------LINKAGES.
C CALLED BY - [program] nuc123
C CALLS - none
C----------REMARKS.
C Allows resetting of model parameters.
C----------PARAMETERS.
PARAMETER (ir=5) !Input unit number (previous value = 1).
PARAMETER (iw=6) !Output unit number (previous value = 1).
C----------COMMON AREAS.
COMMON /modpr0/ c0,cosmo0,xi0 !Default model parameters.
COMMON /modpr/ g,tau,xnu,c,cosmo,xi !Model parameters.
COMMON /varpr0/ dt0,eta0 !Default variationl params.
COMMON /varpr/ dt1,eta1 !Variational parameters.
C==========================DECLARATION DIVISION=================================
C----------DEFAULT MODEL PARAMETERS.
REAL c0(3) !Default c.
REAL cosmo0 !Default cosmological constant.
REAL xi0(3) !Default neutrino degeneracy parameters.
C----------EARLY UNIVERSE MODEL PARAMETERS.
REAL c(3) !c(1) is variation of gravitational constant.
| !c(2) is neutron lifetime (sec).
| !c(3) is number of neutrino species.
REAL cosmo !Cosmological constant.
REAL xi(3) !Neutrino degeneracy parameters.
C----------DEFAULT VARIATIONAL PARAMETERS.
REAL eta0 !Default eta.
C----------VARIATIONAL PARAMETERS.
REAL eta1 !Intial baryon-to-photon ratio.
C----------USER RESPONSE VARIABLES.
INTEGER inum !Selection number.
C===========================PROCEDURE DIVISION==================================
C10--------PRINT RESET SELECTION AND AWAIT RESPONSE-----------------------------
C..........RETURN FROM LOOPING.
100 CONTINUE
C..........DISPLAY RESET SELECTIONS.
WRITE (iw,1000) c(1),c(2),c(3),eta1,cosmo,xi(1),xi(2),xi(3)
1000 FORMAT (8(/),
| ' ',24x,'SET MODEL PARAMETERS SELECTION',/,
| ' ',24x,'--- ----- ---------- ---------',//,
| ' ',10x,' 1. CHANGE GRAVITATIONAL CONSTANT FROM ',
| 1pe10.3,/,
| ' ',10x,' 2. CHANGE NEUTRON LIFETIME FROM ',
| 1pe10.3,' SECONDS',/,
| ' ',10x,' 3. CHANGE NUMBER OF NEUTRINO SPECIES FROM ',
| 1pe10.3,/,
| ' ',10x,' 4. CHANGE FINAL BARYON-TO-PHOTON RATIO FROM ',
| 1pe10.3,/,
| ' ',10x,' 5. CHANGE COSMOLOGICAL CONSTANT FROM ',
| 1pe10.3,/,
| ' ',10x,' 6. CHANGE XI-ELECTRON FROM ',
| 1pe10.3,/,
| ' ',10x,' 7. CHANGE XI-MUON FROM ',
| 1pe10.3,/,
| ' ',10x,' 8. CHANGE XI-TAUON FROM ',
| 1pe10.3,/,
| ' ',10x,' 9. RESET ALL TO DEFAULT VALUES',/,
| ' ',10x,'10. EXIT',4(/),
| ' ',10x,' Enter selection (1-10): ',$)
C..........READ IN SELECTION NUMBER.
READ (ir,1001) inum
1001 FORMAT (i2)
C20--------BRANCH TO APPROPRIATE SECTION----------------------------------------
GO TO (210,220,230,240,250,260,270,280,290,300),inum
GO TO 300 !Improper input or <RETURN>.
210 CONTINUE !Change gravitational constant section.
WRITE (iw,2100)