Skip to content

[WIP] regenerate helm_table.dat - #1119

Open
zingale wants to merge 4 commits into
mainfrom
MZ/update-helm
Open

zingale wants to merge 4 commits into
mainfrom
MZ/update-helm

Conversation

@zingale

@zingale zingale commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

This regenerates helm_table.dat with 128-bit floating point / 400 quadrature points per integration interval and a wider density range (1.e-15 to 1.e-15) instead of (1.e-12 to 1.e15).

The code to generate this is here:
https://github.com/zingale/electron_positron_cxx/tree/main/generate_table

There will be floating point differences because of the change in precision / quadrature, and also (likely) because of the fundamental constants. I don't know what value of constants was used in the original table construction. The values I used come from SciPy (which in turn uses CODATA), and are here:

https://github.com/zingale/electron_positron_cxx/blob/main/src/fundamental_constants.H

It's easy to regenerate this if we want to change things.

This now uses 128-bit precision for the integration, with 400 point
quadrature per interval using the method of Gong et al. 2001.  It
also expands the density range down to 1.e-15 (from 1.e-12).
@zingale

zingale commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator Author

I ran a 15 $M_\odot$ model from pre-MS to core-collapse with the old and new tables, disabling all but the OPAL_SCHV and helm EOSes:

      use_Skye = .false.
      use_PC = .false.
      use_OPAL_SCVH = .true.
      use_FreeEOS = .false.
      use_CMS = .false.

I used the latest git with PRs #1103, #1112, and #1115.

Here's the comparison of the central evolution:

compare

The inlists are essentially those from:
https://github.com/zingale/mesa_massive_star_setup

@zingale zingale linked an issue Nov 16, 2026 that may be closed by this pull request
@zingale zingale added the eos Equation of state module label Nov 16, 2026
@fxt44

fxt44 commented Nov 16, 2026

Copy link
Copy Markdown
Member

I don't know what value of constants was used in the original table construction.

2014 CODATA

@Debraheem

Copy link
Copy Markdown
Member

Perhaps it's a good time to update the fundamental constants in MESA with recent CODATA used to generate the helm tables? in $MESA_DIR/const/public/const_def.f90?

@fxt44

fxt44 commented Nov 16, 2026

Copy link
Copy Markdown
Member

2022 CODATA is the current, but

"The CODATA Task Group on Fundamental Constants (TGFC) is currently collecting data for the 2026 adjustment (closing December 31, 2026), with updated values expected in early 2027."

so maybe waiting a few more months is worth it?

@zingale

zingale commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

one issue with constants is that there are a lot of places where duplicate (but slightly different) values of fundamental constants are hardcoded instead of pulled in from const/. It might make sense to centralize those first.

a quick codex audit shows:

Location Lines Constants defined or embedded locally Notes
kap/private/op_eval_mombarg.f90 35–37; 111, 360, 696, 897 log_c=10.476820702927927d0, log10_bohr_radius_sqr=-16.55280d0, logNa=23.779750912481397d0; atomic mass unit 1.660538782d-24 Logarithmic constants and mass conversions bypass const/.
kap/private/op_ev.f90 75, 78 Atomic mass unit 1.660531d-24 Embedded in mass conversions.
kap/private/op_radacc.f90 86, 89 Atomic mass unit 1.660531d-24 Embedded in mass conversions.
kap/private/op_osc.f 58 Atomic mass unit 1.660531e-24 Embedded in mass conversion.
rates/private/ratelib.f90 4391 Avogadro factor 6.022548d23 Embedded in the expression for sn56ec.
eos/private/eospc_eval.f90 279 Gas constant 8.31447d7 Embedded in Tnk; equivalent quantity is cgas in const/.
eos/private/pc_eos.f90 1579, 1642 Inverse fine-structure constant BOHR=137.036d0 Corresponds to 1/fine.
ionization/preprocessor/src/def_const.f90 33–76 Independent physical, astronomical, and conversion constants Includes light speed, gravity, Planck and Boltzmann constants, particle masses, charge, Bohr radius, fine-structure constant, Avogadro constant, and radiation constants. Several values differ from const/.
eos/eosDT_builder/src/opal_core.f 662–663 Na=6.0221367e23, k=1.380658e-16, c=2.9979245e10, sigma=5.67051e-5 Also defines related conversion and radiation factors.
eos/eosDT_builder/src/xtrin.f 599–600 Same Avogadro, Boltzmann, light-speed, and Stefan–Boltzmann values as opal_core.f Also defines related conversion and radiation factors.
eos/eosDT_builder/src/eos5_xtrin_h-he.f 549–550 Same Avogadro, Boltzmann, light-speed, and Stefan–Boltzmann values as opal_core.f Also defines related conversion and radiation factors.
eos/eosDT_builder/src/scvh_core.f90 641; 1073 ssol=5.67051d-5; kerg=1.3806504d-16 Local Stefan–Boltzmann and Boltzmann constants; radiation constant derived from ssol.
eos/eosCMS_builder/src/cms_mixing.f90 153 kerg=1.380649d-16 Matches const/, but duplicates the definition.
stella/src/stl/phys_constants.f90 16–70 Independent physical-constant set Includes Planck, light speed, Boltzmann, Avogadro, atomic mass unit, electron mass, charge, gravity, radiation, fine-structure, and conversion constants.
stella/src/fundrad.inc 1–27 Another independent physical-constant set Similar parameter blocks occur throughout STELLA's .f files, including strad/, src/, eve/, and vladsf/.
stella/vladsf/edensol.f 14–18 Boltzmann, Planck, light speed, Thomson cross section, charge, and electron mass Older values also occur in lineexpab_cor.f, sahaeqn.f, pfsaha.f, rlnexp.f, and opacex.f.
stella/vladsf/gffcalc.f 21–22 bc=1.38054d-16, h=6.6262d-27 Additional local Boltzmann and Planck constants.
adipls/adipack.c/adipls/adipls.c.d.f 700 cgrav=6.6732d-8 Local gravitational constant.
adipls/adipack.c/adipls/rdfrqr.d.f 56 cgrav=6.67232d-8 Additional gravity literals occur throughout adipls/adipack.c/adiajobs/.
turb/test/src/test_turb.f90 193 cgrav=6.6743000000000004d-8 Test input matching the standard gravity value to floating-point precision.
num/private/mod_newton.f90 1312 secyer=3.1558149984d7 Related time-conversion duplicate; differs from the Julian-year definition in const/.

@Debraheem

Copy link
Copy Markdown
Member

great point, I'll add that to the issue.

@Debraheem

Debraheem commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

@zingale , perhaps you can quickly use the eos plotter or something to plot the difference between the old and new helm tables to show the differences for a few different values of X,Y,Z. You'll want to regenerate the eos table images used in the docs using the plotter as well.

@zingale

zingale commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

sure, I'll try to do some plots tomorrow or Wed.

@fxt44

fxt44 commented Nov 17, 2026

Copy link
Copy Markdown
Member

there are microphysics where there is limited or no knowledge of the fundamental constants that were used. for example, several of the eos that mesa currently uses in its patchwork and the opacity tables. also challenging to catch are hardcoded compound constants comprised of some combination of the fundamental constants.

@VincentVanlaer

Copy link
Copy Markdown
Member

The table size seems to have bloated quite a bit. It looks like it has been saved with excessive precision (i.e. beyond ~16 digits). This is not needed as MESA will load the table as doubles anyway, so this just increases the download size.

@zingale

zingale commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator Author

I'll regenerate without the extra precision, using `{:.17g}' since you only worry about double. We need 17 digits for subnormal numbers.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

eos Equation of state module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

proposal: helm_table.dat regeneration with higher precision?

4 participants