iounits_mod.f
54 lines · 1 definitions · on GitHub (7be4133)
Python version: iounits_mod.py, 131 lines, on the right (switch to Python above the code).
Variables on this page (29)
ialex06, iclcd, icondopacp, idebug, ifermi, ifirst, ijlast, ilast, iliv95, imilne, imodpt, ioatm, ioatma, iopale, iopatm, iopenv, iopmod, iopurez, iowr, irun, iscvh, iscvhe, iscvz, ishort, isnu, isound, istand, istor, itrack
Purpose
IOUNITS_MOD holds the Fortran logical unit numbers of every input and output file, shared by 57 routines. It replaces COMMON/IOUNITS/ (MHP via Claude, 10/14/26), which had gathered, on 9/25/26, the unit numbers once scattered over COMMON/LUOUT/, /LUNUM/, /ALEX06/, /ACDPTH/, /NEWOPAC/, /LOPAL95/, /ATMOS2/, /ALATM03/, /OPALEOS/ and /SCV2/ (the dead IDYN, ILLDAT, ISCOMP, IKUR of /LUNUM/ removed). All members are INTEGER*4.
What its variables hold, who sets them, who reads them. PARMIN assigns every number (its comments name the files; they can be changed only in the code) and opens most of the files; the routines that read or write a file use its unit.
- Run control:
IOWR= 6 (the status output, the screen; the main program sets it to 9 before calling PARMIN, which overwrites it),ISTAND= 14 andIRUN= 13 (theCONTROLandPHYSICSnamelists, read by PARMIN). - Models:
IFIRST= 12 (the starting model),ILAST= 11 (the last model),ISTOR= 23 (saved models). - Outputs:
ISHORT= 20 (all diagnostic information, the.shortfile),ITRACK= 19 (the track),IDEBUG= 18 (debugging),IMILNE= 21 (Milne's invariant variables, written byWRTMIL),IMODPT= 22 (shell-by-shell output),ISNU= 33 (neutrino fluxes),ISOUND= 500 (the sound-speed profile, written byWRTMODwithLSOUND),IOPMOD,IOPENV,IOPATM= 24, 25, 26 (interior, envelope and atmosphere for a pulsation code, also opened byPDIST),ICLCD= 91 (the acoustic-depth output, assigned only withLACOUT). - Input tables:
IFERMI= 15 (Fermi–Dirac tables, read bySETUPS),IOATM= 38 (Kurucz atmospheres, SETUPS),IOATMA= 66 (Allard atmospheres,ALFILEIN),ILIV95= 48 (OPAL95 opacities,LL95TBL),IALEX06= 90 (the low-temperature opacities of Ferguson et al. 2005, called ALEX06 in the code,READALEX06),IOPUREZ= 62 (the pure-metal, "pure Z," LAOL89 table, $Z = 1$; PARMIN's comment calls it "pure CN";RDZLAOL),IcondOpacP= 75 (Potekhin conductive opacities,CONDOPACP),IOPALE= 49 (OPAL 2006 equation of state,READCOEOS06),ISCVH,ISCVHE,ISCVZ= 72, 73, 74 (the SCV equation of state, SETUPS). IJLAST: the unit to whichWRTOUTwrites the model withLJLAST(acoustic-depth output, wrtout.f, lines 710–715↗), but assigned nowhere (PARMIN's assignment is commented out, parmin.f, lines 847–849↗; bug 1); the branch never runs, sinceLACOUTcannot be turned on (seeACDPTH_MOD).
Design
A blanket USE IOUNITS_MOD. Unit numbers are fixed in PARMIN rather than allocated, so a new file must pick a free number by hand (ISOUND's 500 stands apart).
Suspected bugs, checked by running the code
Each bug is marked by what running the code showed: (changes results, large) or (small), the fix moving a run clearly beyond a null change; (stops the run); (wrong output), the fix changing only what is written; (harmless in the runs), within the noise; (never occurred), the code ran but the fault did not; (not reached); (cannot be reached), a guard prevents it; (withdrawn), the suspicion was wrong.
1. (cannot be reached) IJLAST is never assigned.
(line 42↗; wrtout.f, lines 710–715↗, parmin.f, lines 847–849↗) WRTOUT writes the last model to unit IJLAST when LJLAST is true, but no routine gives IJLAST a number or opens its file: PARMIN's three lines that did (IJLAST = 93, the file name, the OPEN) are commented out. If the branch ran, the model would go to unit 0 (with gfortran, standard error). It does not run today: LJLAST is set true only in the main program's acoustic-depth branch (main.f, line 651↗), and LACOUT cannot be turned on (see ACDPTH_MOD).
A possible fix, a choice for the developers: restore PARMIN's three lines beside ICLCD, or remove IJLAST together with WRTOUT's LJLAST branch.
Checked by running YREC (Nov 9, 2026; a line added at each suspected path counted how often it was taken, the outputs otherwise unchanged): Not reached in 33 runs, and it cannot be reached at 7be4133: LJLAST is set only in the main program's LACOUT branch, and LACOUT is in no namelist group and set nowhere in src/ (acdpth_mod.f, line 55↗). The fix (PARMIN's three lines restored) was not run. Intent: The three lines are commented out beside PARMIN's comment of 9/25/26 that removed other unit reservations as "declared but never opened anywhere" (parmin.f, lines 844–849↗), so the unit may have been dropped with them.
Definitions
moduleIOUNITS_MOD
Used by (65 units)
(file level), ALEX06TAB, ALFILEIN, ALPRINT, ALSURFP, ALTABINIT, BSSTEP, CALCAD, CHECKC, CHECKJ, CHKCAL, CHKSCAL, CONDOPACP, CONVEC, COWIND, CRRECT, ENVINT, EQRELV, EQSAHA, EQSTAT2, ESAC06, GETOPAC, GETOPAL95, GETQUA, GRSETT, GTPURZ, HPOINT, KCSURFP, KEMCOM, KSPLINT, LIBURN, LL95TBL, MICRODIFF_RUN, MICRODIFF_SETUP, MIX, OEQOS06, OVERSH, PARMIN, PDIST, POLINT, PUTSTORE, RDZLAOL, READALEX06, READCOEOS06, ROTMIX, RSCALE, SCONVEC, SECULR, SETSCAL, SETUPS, SETUP_GRSETT, SPLINT, SPLINTD2, STARIN, STITCH, SURFBC, SURFP, T6RINTEOS06, TPGRAD, WIND, WRTHEAD, WRTLST, WRTMIL, WRTMOD, WRTOUT
Change log
The changes since rp_1
Changed since rp_1. New file: the unit numbers of ten COMMON blocks, and of /IOUNITS/ into which they were merged, as one module; the dead units IDYN, ILLDAT, ISCOMP, IKUR (and PARMIN's unshared ILSTBN, ISTOBN, IFSTBN) removed.