ptime.f
138 lines · 1 definitions · on GitHub (7be4133)
Python version: ptime.py, 84 lines, on the right (switch to Python above the code).
Purpose
Limits the time step by how much the structure changed from the previous model to this one. Its comment: the changes "in T, P, R, and L [must] be less than the user parameters ATIME(8)–ATIME(11) at any model point"; this criterion "dominates in the pre-main sequence, and this SR must be used (LPTIME=T) to perform pre-main sequence evolution."
How it fits
- Inputs: the last step
DELTS; the current model (HL,HP,HR,HT,M) and the previous one (HLO,HPO,HRO,HTOinOLDMOD_MOD); the limitsATIMEinNMLPAR_MOD(set by PARMIN, possibly through REMAP). - Who calls it: HTIMER, when
LPTIME; otherwise HTIMER uses $10^{20}$. - Output:
PDELT, the proposed step; HTIMER takes the smallest of its candidates.
The method
Over all shells, the largest changes $\Delta\log P$, $\Delta\log T$, $\Delta\log r$, and the relative luminosity change $\Delta L / \bar L$ (with $\bar L$ the mean of the shell and its inner neighbour). Then
$$f = \max\left(\frac{\Delta\log P}{a_9},\ \frac{\Delta\log T}{a_8},\ \frac{\Delta\log r}{a_{10}},\ \frac{\Delta L/\bar L}{a_{11}\ln 10}\right),\qquad \frac{1}{a_{13}} \le f \le a_{13},\qquad \texttt{PDELT} = \frac{\Delta t}{f},$$
with $a_k$ = ATIME(k), and $f = 1$ if nothing changed. The shells where the maxima occur are recorded in NHMAX, which nothing reads (unused?). The header still calls ATIME(12) the "maximum percentage change in the timestep"; since MHP 10/14 the code uses ATIME(13) as the factor, and REMAP now sets ATIME(12) from TIME_DY_SHELL, the helium-shell limit that YTIME reads, and ATIME(13) from TIME_MAX_DT_FRAC: The header's line is older wording (settled from the code, Nov 9, 2026: line 68↗; lines 128–135↗; remap.f, lines 274–275↗; remap.f, lines 291–294↗).
Definitions
subroutinePTIME
Uses modules DIMENSIONS_MOD, NMLPAR_MOD, OLDMOD_MOD
Called by HTIMER
Compiler warnings (1)
gfortran -Wall -Wextra, compiling only; nothing was run.
- line 127: Equality comparison for REAL(8) [-Wcompare-reals]
Change log
The changes since rp_1
Changed since rp_1. Declarations only: COMMON blocks to modules (/OLDMOD/ to OLDMOD_MOD, ATIME of /CTLIM/ to NMLPAR_MOD; the unused /CONST/–/CONST3/ dropped), JSON from DIMENSIONS_MOD, IMPLICIT NONE.