1C Subroutine ALPRINT
2
3C PURPOSE
4C To print the internal Allard-format tables and auxilliary information provided
5C by ALFILEIN and verified by ALTABINIT.
6
7
8
9 SUBROUTINE ALPRINT
10C 10/14/26 MHP via Claude
11C code changed to convert COMMON/ALATM02/ into ALATM02_MOD.
12 USE ALATM02_MOD
13C 10/14/26 MHP via Claude
14C code changed to convert COMMON/ALATM01/ into ALATM01_MOD.
15 USE ALATM01_MOD
16C 10/14/26 MHP via Claude
17C code changed to convert COMMON/IOUNITS/ into IOUNITS_MOD.
18 USE IOUNITS_MOD
19C 10/20/26 MHP via Claude
20C code changed to replace implicit typing with IMPLICIT NONE and
21C explicit declarations.
22 IMPLICIT NONE
23 INTEGER I,J
24
25 LOGICAL*4 LALTPTau100
26C 9/25/26 MHP via Claude
27C code changed to consolidate all I/O logical unit numbers, previously
28C scattered across COMMON/LUOUT/, COMMON/LUNUM/, COMMON/ALEX06/,
29C COMMON/ACDPTH/, COMMON/NEWOPAC/, COMMON/LOPAL95/, COMMON/ATMOS2/,
30C COMMON/ALATM03/, COMMON/OPALEOS/, and COMMON/SCV2/, into a single
31C COMMON/IOUNITS/
32C 10/13/26 MHP via Claude: removed the unused COMMON/NMLPAR/ declaration
33C (no member referenced here; residue of the obsolete-option removals).
34C MHP 8/25 Removed character file names from common block
35C 10/13/26 MHP via Claude
36C code changed to remove COMMON/ALATM04/: its four members DUMMY1..DUMMY4
37C are placeholders that no file references in executable code. Removing
38C it also retires the hazard behind the earlier alfilein.f fix, where a
39C mis-indented EXTERNAL was absorbed into this declaration and renamed
40C DUMMY4.
41
42 SAVE
43
44 TEFFLmin = TEFFLs(1) - (TEFFLs(2)-TEFFLs(1))
45 TEFFLmax = TEFFLs(nTeff) + (TEFFLs(nTeff)-TEFFLs(nTeff-1))
46
47 write(ISHORT,*)
48 write(ISHORT,*)' **************** Allard Table ***************'
49 write(ISHORT,*)
50 write(ISHORT,*)'nTeff= ',nTeff,' ,nGL=',nGL
51 write(ISHORT,*)'nFeH= ',nFeH,' ,nAlpha=',nAlpha
52 write(ISHORT,*)
53 write(ISHORT,*)'TEFFLmin= ',TEfflmin,' ,TEFFLmax= ',Tefflmax
54 write(ISHORT,*)'GLXmin=',GLXmin,' GLXmax=',GLXmax
55 write(ISHORT,*)
56 write(ISHORT,900)' PL @ Teff','GL ->',(GLs(j),j=1,nGL)
57 900 900 format(A10,16X,A,20(5X,F6.2,5X))
58 write(ISHORT,*)
59 write(ISHORT,*) 'PL at Teff,GL'
60 write(ISHORT,*)
61 do i = 1, nTeff
62 write(ISHORT,910) i,10D0**TEFFLs(i),iGLmin(i),iGLmax(i),
63 x x GLmin(i),GLmax(i),(PLs(i,j),j=1,nGL)
64 910 910 Format(I5,F6.0,2I4,2F6.2,1P20E16.8)
65 enddo
66 write(ISHORT,*)
67 write(ISHORT,*) 'PL at Tau=100'
68 write(ISHORT,*)
69 do i = 1, nTeff
70 write(ISHORT,910) i,10D0**TEFFLs(i),iGLmin(i),iGLmax(i),
71 x x GLmin(i),GLmax(i),(P100Ls(i,j),j=1,nGL)
72 enddo
73 write(ISHORT,*)
74 write(ISHORT,*) 'TL at Tau=100'
75 write(ISHORT,*)
76 do i = 1, nTeff
77 write(ISHORT,910) i,10D0**TEFFLs(i),iGLmin(i),iGLmax(i),
78 x x GLmin(i),GLmax(i),(T100Ls(i,j),j=1,nGL)
79 enddo
80 write(ISHORT,*)
81
82
83 END
84
1"""Python version of alprint.f (YREC 7be4133): a diagnostic print of the
2Allard atmosphere table, called by ALTABINIT before it stops the run."""
3
4from pyrec import alatm01_mod
5from pyrec import alatm02_mod
6from pyrec import iounits_mod
7
8
9def _row(i, values):
10 """FORMAT 910, (I5,F6.0,2I4,2F6.2,1P20E16.8): one row per Teff."""
11
12 a1 = alatm01_mod
13 a2 = alatm02_mod
14 text = (f"{i:5d}{10.0 ** a1.teffls[i]:6.0f}{a2.iglmin[i]:4d}"
15 f"{a2.iglmax[i]:4d}{a2.glmin[i]:6.2f}{a2.glmax[i]:6.2f}")
16 text += ''.join(f"{values[i, j]:16.8E}" for j in range(1, a1.ngl + 1))
17 return text
18
19
20def alprint() -> None:
21 """Print the Allard table to ISHORT: its sizes, its limits, and, one row
22 per Teff with its valid range in log g, the tables of log P at Teff,
23 log P at tau = 100 and log T at tau = 100. Also recomputes TEFFLmin and
24 TEFFLmax in ALATM02_MOD, with ALTABINIT's formulas.
25
26 Translates: alprint.f#ALPRINT (7be4133)
27
28 No arguments; nothing is returned. List-directed WRITEs are rendered
29 with Python's default formatting.
30
31 """
32
33 a1 = alatm01_mod
34 a2 = alatm02_mod
35 unit = iounits_mod.ishort
36 w = iounits_mod.write
37
38 # Question (see the page): a side effect on ALATM02_MOD.
39 # The range in log Teff (Fortran lines 44–45).
40 a2.tefflmin = a1.teffls[1] - (a1.teffls[2] - a1.teffls[1])
41 a2.tefflmax = (a1.teffls[a1.nteff]
42 + (a1.teffls[a1.nteff] - a1.teffls[a1.nteff - 1]))
43
44 # The sizes and limits (Fortran lines 47–55).
45
46 w(unit, "")
47 w(unit, " **************** Allard Table ***************")
48 w(unit, "")
49 w(unit, f" nTeff= {a1.nteff} ,nGL= {a1.ngl}")
50 w(unit, f" nFeH= {a1.nfeh} ,nAlpha= {a1.nalpha}")
51 w(unit, "")
52 w(unit, f" TEFFLmin= {a2.tefflmin} ,TEFFLmax= {a2.tefflmax}")
53 w(unit, f" GLXmin= {a2.glxmin} GLXmax= {a2.glxmax}")
54 w(unit, "")
55
56 # The log g grid, FORMAT 900, (A10,16X,A,20(5X,F6.2,5X)) (Fortran
57 # lines 56–57).
58 w(unit, f"{' PL @ Teff':10s}{'':16s}GL ->"
59 + ''.join(f"{'':5s}{a1.gls[j]:6.2f}{'':5s}"
60 for j in range(1, a1.ngl + 1)))
61
62 # The three tables, one row per Teff (Fortran lines 58–80).
63 for title, table in (("PL at Teff,GL", a1.pls),
64 ("PL at Tau=100", a1.p100ls),
65 ("TL at Tau=100", a1.t100ls)):
66 w(unit, "")
67 w(unit, f" {title}")
68 w(unit, "")
69 for i in range(1, a1.nteff + 1):
70 w(unit, _row(i, table))
71 w(unit, "")