constants_mod.f
75 lines · 1 definitions · on GitHub (7be4133)
Python version: constants_mod.py, 48 lines, on the right (switch to Python above the code).
Variables on this page (31)
c4pi, c4pi3l, c4pil, c_2, ca3, ca3l, cavog, cc13, cc23, cdelrl, cgas, cgl, cln, clndp, clni, clnsun, clsun, clsunl, cmbol, cmixl2, cmixl3, cmkh, cmkhn, cmsun, cmsunl, cpi, crsun, crsunl, csecyr, csig, csigl
Purpose
CONSTANTS_MOD holds the physical and mathematical constants (solar units, $\ln 10$, $\pi$, $G$, $\sigma$, the gas constant, and logarithms of them) shared by 89 routines. It replaces COMMON/CONST/, /CONST1/, /CONST2/ and /CONST3/ of rp_1, first merged into COMMON/CONSTANTS/ and then made a module (MHP via Claude, 10/14/26), without CMIXL (now passed as an argument) and with C_2 from COMMON/CWIND/. All members are REAL*8.
What its variables hold, who sets them, who reads them.
CAVOG: Avogadro's number, defined as the reciprocal of the atomic mass unit, $N_A = 1/(1.6605402\times10^{-24}\ \mathrm{g})$, the scale on whichENGEBgives its nuclear massesANUC. The onePARAMETER(a fixed value, never set at run time); read byENGEBandDEUTRATEin the deuterium-burning rate, where it replaces the hard-coded $6.023\times10^{23}$.CLSUN,CRSUN: the solar luminosity and radius (cgs), with initial values 3.8515D33 and 6.9598D10 moved from PARMIN'sDATAstatement; both are in thePHYSICSnamelist read byPARMIN, so a run can change them.- Set once in
SETUPS(its comments name them):CLNDPandCLN($\ln 10$),CLNI($1/\ln 10$),CLSUNL,CMSUNL,CRSUNL(log of the solar luminosity, mass, radius),CLNSUN($\ln 10/L_\odot$),CMSUN(1.9891D33 g),CMBOL(the Sun's bolometric magnitude, 4.79),CSECYR(seconds per year, 3.1558D7),CC13,CC23(1/3, 2/3),CPI,C4PI,C4PIL($\log 4\pi$),C4PI3L($\log 4\pi/3$),CSIGandCSIGL(Stefan–Boltzmann),CA3$=4\sigma/3c$ ($a/3$) andCA3L,CGAS(the gas constant),CGL($\log G$),CMKH($\log[(2\pi m_e)^{3/2}k^{5/2}/h^3]$, for the Saha equation),CDELRL$= -\log(4\pi/3) - \log\sigma - \log 16$ (the radiative gradient),CMIXL2(1/3) andCMIXL3$=16\sqrt2\,\sigma$ (mixing length). CLN,CC13,CC23are also set inPARMIN(to the same values, beforeSETUPSruns) and written in itsDERIVEDnamelist to the.shortfile.C_2(0.0506, the centrifugal term of the Matt et al. wind law) is set inPARMINand read byMWINDandMCOWIND.- Readers: nearly every physics routine;
CLNalone by 68 files,CGLby 34. CMKHNis set and read nowhere (line 67↗; unused?);CA3LandCMSUNLare set (setups.f, line 162↗, setups.f, line 142↗) but never read (unused?).
Design
A blanket USE CONSTANTS_MOD in each routine. Apart from CAVOG, the constants are module variables set at run time rather than PARAMETERs, so a routine run before SETUPS would see them undefined.
Definitions
moduleCONSTANTS_MOD
Used by (89 units)
(file level), AMCALC, CALCAD, CHKSCAL, CODIFF, COEFFT, COWIND, CRRECT, DBURNM, DEUTRATE, ENGEB, ENVINT, EQRELV, EQSAHA, EQSCVE, EQSCVG, EQSTAT, EQSTAT2, FPFT, FUNC, GETALEX06, GETFC, GETGRID, GETMODEL2, GETNEWENV, GETQUA, GETTAU, GETW, GETYREC7, GRSETT, HPOINT, HSUBP, HTIMER, INTMOM, LAX_WENDROF1, LAX_WENDROF2, LIBURN, LIBURN2, LIRATE88, MASSLOSS, MCOWIND, MDOT, MICRODIFF_COD, MICRODIFF_RUN, MICRODIFF_SETUP, MIDMOD, MIX, MIXGRID, MOMI, MU, MWIND, OEQOS06, OVERSH, PARMIN, PHYSIC, PUTMODEL2, PUTSTORE, PUTYREC7, QATM, QENV, RATES, REDUCE, ROTGRID, ROTMIX, RSCALE, SCONVEC, SECULR, SETSCAL, SETSCV, SETUPS, SETUPV, SETUP_GRSETT, SHAPE, STARIN, STITCH, SURFBC, TAUCAL, TAUINT, TAUINTNEW, TPGRAD, VCIRC, VISCOS, WCZIMP, WIND, WRTMIL, WRTMOD, WRTOUT, XTIME, YTIME
Change log
The changes since rp_1
Changed since rp_1. New file: COMMON/CONST/–/CONST3/ as one module, without CMIXL, with C_2 from /CWIND/, and the defaults of CLSUN, CRSUN moved from PARMIN.
Changed since 09c3b9b. New PARAMETER CAVOG (Avogadro's number as $1/m_u$), used by ENGEB and DEUTRATE for the deuterium-burning rate.