PyREC scaffolding (from YREC development, 7be4133)/ comp_mod.fGlossary

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).

Variables on this page (9)

amuenv, fxenv, senv, stotal, xenv, xnew, zenv, zenvm, znew

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$. STARIN sets them from XNEW, ZNEW; RSCALE and PARMIN may reset ZENV. Read by the equation of state (EQSTAT2, EQSCVE, SETSCV), MU, PHYSIC, GETOPAC (ZENV), CHECKC and WRTMIL.
  • ZENVM: "Z other than CNO cycle elements" (STARIN's comment): ZENV times the share of the metals' relative mass fractions left after removing V(6), V(8), V(9); set in STARIN, read by MIXCZ.
  • AMUENV, FXENV(12): set in STARIN from 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), and FXENV(I) $= (X_i/A_i)/\mathtt{AMUENV}$, the number fractions. Read by MU, EQSTAT2 (which passes FXENV on to the Saha solver), PHYSIC and CHECKC, which correct AMUENV for the local $X$ and $Z$.

    STARIN's comment on AMUENV is stale. It calls AMUENV the "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↗), so AMUENV is 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 in STARIN, RSCALE and HPOINT (which calls SURFOPAC when the surface $X$ has changed by more than $10^{-8}$); read by CRRECT and WRTOUT. - STOTAL: $\log M_*$, set from HSTOT in STARIN, RSCALE and MDOT; read by the envelope and surface routines (QENV, SURFBC, GETNEWENV), CALCAD, MIXCZ and the output routines. - SENV: $\log(m/M_*)$ at the fitting point between the interior model and the envelope. Set in STARIN, HPOINT (when outer points are added or removed), MDOT, GETNEWENV and CRRECT; read by ENVINT, 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

lines 19–34 · GitHub

Used by (23 units)

CALCAD, CHECKC, CRRECT, ENVINT, EQSCVE, EQSTAT2, GETNEWENV, GETOPAC, HPOINT, MDOT, MIXCZ, MU, PARMIN, PHYSIC, QENV, RSCALE, SETSCV, SETUPS, STARIN, SURFBC, WRTMIL, WRTMOD, WRTOUT

Change log

The changes since rp_1

Changed since rp_1. New file: COMMON/COMP/ as a module.