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

alsurfp.f

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

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

Variables on this page (19)

ap, at, glmax, glmin, gls, glxmax, glxmin, iglmax, iglmin, ishort, istor, laltptau100, nteff, p100ls, pls, t100ls, tefflmax, tefflmin, teffls

Purpose

This file gives the outer boundary condition from the Allard model atmospheres: for a star's $\log T_\mathrm{eff}$ and $\log g$, it returns the pressure (and temperature) at which the interior is joined to the atmosphere. By default it returns $\log P$ at the point where $T = T_\mathrm{eff}$; with the option LALTPTau100, $\log P$ and $\log T$ at $\tau = 100$.

How it fits

  • Inputs: the arguments TEFFL ($\log T_\mathrm{eff}$), GL ($\log g$) and LPRT (print to the model file); the table in ALATM01_MOD from ALFILEIN and its limits in ALATM02_MOD from ALTABINIT; the option LALTPTau100 in NMLPAR_MOD, set in PARMIN.
  • Who calls it: ENVINT (the envelope integration, for the surface boundary condition) and MASSLOSS.
  • What it calls: LOCATE (bisection in a table) and POLINT (polynomial interpolation through 4 points).
  • Outputs: AP ($\log P$) and AT ($\log T$) in ATMPRT_MOD, shared with ENVINT, SURFP, KCSURFP, QATM and MASSLOSS; the flag LAlFail, which tells the caller that the point is outside the table. Its comment says the caller should then switch to a gray (KTTAU = 0) or Kurucz (KTTAU = 3) atmosphere.
  • What the callers do on failure: ENVINT switches to a gray atmosphere (KTTAU = 0, LTTAU = .TRUE.); MASSLOSS (marked "experimental code … llp 06/15/2009") tests LAlFail and skips the accreted matter's entropy, so the previous lookup's AT, AP are not used (massloss.f, lines 182–191↗; settled from the code, Nov 9, 2026).
  • Text output: a line to ISHORT at every call, and to ISTOR as well when LPRT is true.

The method

  1. If $\log T_\mathrm{eff} \ge t_\mathrm{max}$, or $\log g$ is outside the overall range (GLXmin, GLXmax), set LAlFail and return. If $\log T_\mathrm{eff} \le t_\mathrm{min}$, stop the run.

  2. Find 4 rows in $\log T_\mathrm{eff}$ around the point, shifted to stay inside the table. In each row, find 4 valid columns in $\log g$ around the point; if $\log g$ is outside that row's allowed range, set LAlFail and return. The header says this range extends one column's width beyond the table on each side (lines 13–16↗); ALTABINIT sets four widths below (altabinit.f, question 1).

  3. In each row $i$, interpolate in $\log g$ with the polynomial through the 4 points: $$y_i(g) = \sum_{k=1}^{4} y(t_i, g_k) \prod_{l \ne k} \frac{g - g_l}{g_k - g_l},$$ for $y = \log P_\mathrm{eff}$, $\log P_{100}$ and $\log T_{100}$.

  4. Interpolate the 4 row values in $\log T_\mathrm{eff}$ the same way. Without the $\tau = 100$ option, AP is $\log P$ at $T = T_\mathrm{eff}$ and AT $= \log T_\mathrm{eff}$; with it, AP $= \log P_{100}$ and AT $= \log T_{100}$.

Since rows can have different valid columns, each row uses its own 4 values of $\log g$: the grid need not be rectangular.

Design

The routine stops the program below the table in $T_\mathrm{eff}$ but only flags the other failures; the stop is a bare STOP, exit status 0 (lines 312–319↗; KNOWN_ISSUES.md, issue 38, open). It writes to ISHORT on every call, which can make the short output long.

Definitions

subroutineALSURFP

lines 81–321 · GitHub

Two-dimensional 4×4 Lagrange interpolation (in $\log g$, then in $\log T_\mathrm{eff}$) in the Allard table; returns $\log P$ and $\log T$ at the fitting point in ATMPRT_MOD, or sets LAlFail outside the table.

Uses modules ALATM01_MOD, ALATM02_MOD, ATMPRT_MOD, IOUNITS_MOD, NMLPAR_MOD

Called by ENVINT, MASSLOSS

Flowchart of its calls, in order (8)

Change log

The changes since rp_1

Changed since rp_1. Declarations only: COMMON blocks to modules (/ALATM01/, /ALATM02/, /ATMPRT/; LALTPTau100 from /ALATM03/ to NMLPAR_MOD, /LUOUT/ to IOUNITS_MOD; the unused /ALATM04/ dropped), IMPLICIT NONE.