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
- Inputs: the arguments
HRU(the radius of each shell's midpoint, not logged) andM; the velocitiesVES(meridional circulation),VGSF(Goldreich–Schubert–Fricke instability) andVSS(secular shear) inTEMP2_MOD, computed by VCIRC; the variable $f_c$, the argumentVFC(SECULR's array, filled by GETFC); inNMLPAR_MOD, the multipliersFW,FC,FESC,FGSFC,FSSC, the switchLVFC, the constant background coefficientCODM,LCODM, andLNOJ. All options are set in PARMIN. - Who calls it: SECULR.
- Outputs:
COD,COD2andRMID(arguments), from element 2 on: no routine setsCOD(1)orCOD2(1), and their readers, ROTGRID and MIXGRID, start at elementIBEG+1≥ 2 (rotgrid.f, lines 189–197↗, rotgrid.f, lines 205–210↗, mixgrid.f, lines 133–138↗; settled from the code, Nov 9, 2026).HLEinTEMP2_MOD, set to zero (lines 101–106↗; the lineHLE(I)=RMID(I)is commented out): unused?, since its only reader is the column "LENGTH" of CHECKJ's detailed print, which is switched off (checkj.f, line 326↗, checkj.f, line 363↗); the header's "characteristic velocity length scales" (lines 70–71↗) are thus not computed. - Unused?: the local arrays
FADV,FADV0(formerly/ADVEC/, declared only here, line 57↗).
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
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
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.