comp_mod.f
34 lines · 1 definitions · on GitHub (7be4133)
Python version: comp_mod.py, 21 lines, on the right (switch to Python above the code).
Purpose
COMP_MOD holds the composition of the envelope and the star's total and envelope masses, shared by 23 routines. It replaces COMMON/COMP/ (MHP via Claude, 10/14/26), with the same names and types (REAL*8 throughout) and an explicit SAVE.
What its variables hold, who sets them, who reads them.
XENV,ZENV: the envelope's $X$ and $Z$.STARINsets them fromXNEW,ZNEW;RSCALEandPARMINmay resetZENV. Read by the equation of state (EQSTAT2,EQSCVE,SETSCV),MU,PHYSIC,GETOPAC(ZENV),CHECKCandWRTMIL.ZENVM: "Z other than CNO cycle elements" (STARIN's comment):ZENVtimes the share of the metals' relative mass fractions left after removingV(6),V(8),V(9); set inSTARIN, read byMIXCZ.-
AMUENV,FXENV(12): set inSTARINfrom the envelope's mass fractions $X_i$ and atomic weights $A_i$ of the twelve species: $\mathtt{AMUENV} = \sum_i X_i/A_i$, the inverse mean molecular weight per ion (as PHYSIC's comment says), andFXENV(I)$= (X_i/A_i)/\mathtt{AMUENV}$, the number fractions. Read byMU,EQSTAT2(which passesFXENVon to the Saha solver),PHYSICandCHECKC, which correctAMUENVfor the local $X$ and $Z$.STARIN's comment on
AMUENVis stale. It callsAMUENVthe "mean atomic weight of surface Z" (starin.f, line 920↗), but loop 610 sums $X_i/A_i$ over all twelve species, hydrogen (V(7)) and helium (V(12)) included (starin.f, lines 926–937↗), soAMUENVis the inverse mean molecular weight per ion, as PHYSIC's comment says (physic.f, line 121↗). -XNEW,ZNEW: the surface $X$ and $Z$ for which the surface opacity table was last made. Set inSTARIN,RSCALEandHPOINT(which callsSURFOPACwhen the surface $X$ has changed by more than $10^{-8}$); read byCRRECTandWRTOUT. -STOTAL: $\log M_*$, set fromHSTOTinSTARIN,RSCALEandMDOT; read by the envelope and surface routines (QENV,SURFBC,GETNEWENV),CALCAD,MIXCZand the output routines. -SENV: $\log(m/M_*)$ at the fitting point between the interior model and the envelope. Set inSTARIN,HPOINT(when outer points are added or removed),MDOT,GETNEWENVandCRRECT; read byENVINT, which integrates the envelope down to it.
Design
A blanket USE COMP_MOD in each routine, the convention of the conversion: all 23 files declared the block identically, so the module brings in exactly the names the block made global. The header says SAVE is explicit because module variables are saved implicitly only from Fortran 2008, which the Intel compiler it names predates.
Definitions
moduleCOMP_MOD
Change log
The changes since rp_1
Changed since rp_1. New file: COMMON/COMP/ as a module.