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

checkc.f

188 lines · 1 definitions · on GitHub (7be4133)

Python version: checkc.py, 117 lines, on the right (switch to Python above the code).

Variables on this page (12)

amuenv, amum, hcompp, ishort, itdif2, json, lexcom, sr, xenv, y3env, yenv, zenv

Purpose

This file checks the composition after a step of rotational mixing for anomalous abundances (below 0 or above 1), cuts the diffusion time step if it finds any, and recomputes the mean molecular weight, which the mixing changes.

How it fits

The method

  1. Species checked: on every iteration only $X$, $Y$ and $^3$He (1, 2, 4); species 5 to 11 (5 to 15 with LEXCOM) are mixed by SECULR once, after its iteration loop, and the code's comment names the clip to $[0,1]$ at the start of the next step in MIX and ROTMIX as their safeguard. $Z$ (3) is skipped, since it "is not diffused as a unit." Only interior points $2..M-1$ are checked.
  2. A value outside $[0, 1]$ that is tiny in size, $|X_{j,i}| < 10^{-5} X_{j,M}$ (relative to the surface value), is replaced by $\max(0, \tfrac12(X_{j,i+1} + X_{j,i-1}))$ (lines 109–117↗): the comment explains that mixing into a burning region can give small negative abundances. The branch inside it that sets the centre or surface value to 0 (I.EQ.1.OR.I.EQ.M, lines 110–111↗) is never taken, since the loop runs over $2..M-1$ (line 103↗): unused? Otherwise the time step is halved (LREDO), up to 3 times; then the run stops with exit status 1. On the first anomaly that is not repaired, the routine jumps to its end, so $\mu$ is not recomputed in that call.

  3. At the last iteration, with LPRT, print the largest fractional change of an abundance over the step, and the surface lithium if LEXCOM.

  4. For IT > 1, the mean molecular weight of a fully ionized gas: per ion, from the surface value and the local differences; per electron, directly: $$\frac{1}{\mu_\mathrm{ion}} = \frac{1}{\mu_\mathrm{ion,env}} + \sum_k \frac{X_k - X_{k,\mathrm{env}}}{A_k}, \qquad \frac{1}{\mu_e} = \frac{X}{A_\mathrm{H}} + 2\left(\frac{Y}{A_4} + \frac{X_3}{A_3}\right) + \frac{Z}{2},$$ for $k$ = H, $^4$He, $Z$ (with $A = 12$), $^3$He; then $\mu = \mu_\mathrm{ion}\mu_e/(\mu_\mathrm{ion} + \mu_e)$, that is $1/\mu = 1/\mu_\mathrm{ion} + 1/\mu_e$. The comment notes that partial ionization would need a correction in massive stars.

Definitions

subroutineCHECKC

lines 2–188 · GitHub

Checks abundances after rotational mixing (repairs tiny negatives, halves the step otherwise, stops after 3 cuts) and recomputes the mean molecular weight $\mu$ for a fully ionized gas.

Uses modules COMP2_MOD, COMP_MOD, DIMENSIONS_MOD, IOUNITS_MOD, MDPHY_MOD, NMLPAR_MOD, OLDMOD_MOD

Called by SECULR

Change log

The changes since rp_1

Changed since rp_1. Declarations only: COMMON blocks to modules, IMPLICIT NONE; the local CMIN renamed CMINCHK.

Changed since a8a5950. Species 1, 2, and 4 are checked on every iteration, as before; the last iteration's check of species 5 to 11, which ran before SECULR mixed them, is commented out (settles former question 2); the stop after 3 cuts is STOP 1 (KNOWN_ISSUES.md, issue 38).