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

codiff.f

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

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

Variables on this page (15)

c4pi, codm, fc, fesc, fgsfc, fssc, fw, hle, json, lcodm, lnoj, lvfc, ves, vgsf, vss

Purpose

This file computes the diffusion coefficients for rotational mixing: one for angular-momentum transport (COD) and one for composition transport (COD2), from the characteristic velocities of the rotational instabilities, at each interface between shells.

How it fits

The method

Element $i$ refers to the interface between shells $i-1$ and $i$, at $r_{\mathrm{mid},i} = \tfrac12(r_i + r_{i-1})$. With $v = v_\mathrm{ES} + v_\mathrm{GSF} + v_\mathrm{SS}$: $$D_J = 4\pi f_w\, v\, r_\mathrm{mid}, \qquad D_X = 4\pi f_w f_c \left(f_{c,\mathrm{ES}}\,v_\mathrm{ES} + f_{c,\mathrm{GSF}}\,v_\mathrm{GSF} + f_{c,\mathrm{SS}}\,v_\mathrm{SS}\right) r_\mathrm{mid},$$ with $f_{c,\mathrm{ES}}$, $f_{c,\mathrm{GSF}}$, $f_{c,\mathrm{SS}}$ = FESC, FGSFC, FSSC, as on VCIRC's page; or, with a variable $f_c$ (LVFC), $D_X = D_J\,f_c(r)$. The two sets of factors differ: FES, FGSF, FSS scale the velocities in VCIRC; FESC, FGSFC, FSSC weight each mechanism's share of composition mixing only. With LCODM, a constant CODM is added to $D_J$ ($4\pi f_w\,\mathrm{CODM}$; "MHP 9/14," "MHP 8/13"). It is added to $D_J$ only, never to $D_X$, in both branches (lines 129–131↗, lines 135–138↗): the Physics namelist page describes CODM as a magnetic diffusion term for angular-momentum transport (below), and KNOWN_ISSUES.md issue 1 records the same (settled from YREC's documentation, Nov 9, 2026). With LNOJ, $D_J = 0$: composition is mixed but angular momentum is not transported (MHP 9/93). So the coefficient is a velocity times a length, the radius: $v\,r$ is in cm$^2$ s$^{-1}$, and the factor $4\pi$ belongs to the form in which the equation is solved: ROTGRID multiplies the coefficients by $\rho r^4\,d\chi/dr$ and $I/(mr^2)$ (its comment: "a factor of 4PI has already been included in CODIFF"), giving the $D$ of DCOEFT's equation. The $\mu$-gradient enters only through the velocities: with IMU = 3, VCIRC subtracts the $\mu$ currents (VMU, scaled by FMU) from VES and VGSF before they reach CODIFF (vcirc.f, lines 540–566↗), and CODIFF does not read VMU (settled from the code, Nov 9, 2026).

From YREC's documentation

Physics Options (Angular momentum transport): LCODM adds a magnetic diffusion term CODM to angular-momentum transport (0 is pure hydrodynamics; 9e4 matches the constraints on the solar core's rotation; the code's default is 2.5e4); FW scales all angular-momentum diffusion coefficients, and FC the mixing coefficients relative to them, usually calibrated on lithium depletion (in clusters or the Sun). LVFC, experimental, is the variable-FC model of Zahn (1991).

Definitions

subroutineCODIFF

lines 3–149 · GitHub

Diffusion coefficients for angular momentum, $D_J = 4\pi f_w (v_\mathrm{ES} + v_\mathrm{GSF} + v_\mathrm{SS})\,r$, and for composition, $D_X$ (with the extra factors $f_c$ and per-mechanism weights), at the interfaces; options for a constant background and for no angular-momentum transport.

Uses modules CONSTANTS_MOD, DIMENSIONS_MOD, NMLPAR_MOD, TEMP2_MOD

Called by SECULR

Compiler warnings (2)

gfortran -Wall -Wextra, compiling only; nothing was run.

  • line 21: Unused variable ‘fadv’ declared [-Wunused-variable]
  • line 21: Unused variable ‘fadv0’ declared [-Wunused-variable]

Change log

The changes since rp_1

Changed since rp_1. VFC is now an argument (/VARFC/ retired); COMMON blocks to modules (the unused /INTVAR/ and /MDPHY/ dropped, /ADVEC/ made local), IMPLICIT NONE.