You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
proposal: helm_table.dat regeneration with higher precision? #1113
A while back I wrote an electron-positron EOS that computes the Fermi integrals with 64-, 80-, 128-, or 256-bit precision and with a large number of quadrature points (up to 800 per interval) using the method of Gong et al. 2001.
For cold temperatures, using higher precision and more quadrature points is important for thermodyanmic consistency:
This also computes all of the derivatives by differentiating the integrand instead of doing a finite-difference approximation (e.g. for the 3rd and 4th derivatives).
My question is whether it is worth investigating different tables with more precision in MESA. The table generation is pretty quick (it is threaded), so I am posting here just to see if there is interest in me exploring this.
As a separate bit, it can also use the almost-log spacing of https://arxiv.org/abs/2501.05410 which I coded up for GPUs (where logs are expensive).
helmeos style equations of state depend crucially on subtractions. some quantities, hence the thermodynamic consistency, runs into precision troubles in the upper left (high T, low ρ) and lower right (low T, high ρ) where it becomes the subtraction of two large numbers and hoping for the correct small answer (as adjudicated by your approach above where such subtractions don't occur).
using a cascading accumulator on the helmeos subtractions would be another interesting experiment to try.
Agreed re: "experiments are good"! I do wonder how much a relative deviation of say 10^-60 buys when we ultimately do double precision arithmetic? I don't have much experience here, so it could be more than I anticipate.
Regarding the not quite transcendental (NQT) logarithms -- have you experimented with thermodynamic consistency when interpolating with them? I have not but I am a bit cautious: the NQT functions leverage a C^1 continuous interpolant. It's unclear how well it plays with e.g., bi-quintic interpolation and higher order thermodynamic derivatives.
I have not looked at the consistency with those the NQT. I mainly implemented to see how it affects GPU performance in our codes, since logs are expensive, but it wasn't really a big change, so I haven't pursued it further. It's not the 10^-60 that we care about, but its the O(1) error when 64-bit precision is used in some regimes in the thermodynamic plane that is the concern.
And since this is only a cost paid once -- when generating the table -- it's pretty easy to do. I can generate a new table tomorrow -- I just will need to sync up the physical constants to the values MESA uses first. 128-bit runs reasonably fast.
Activity
Debraheem commentedon Nov 11, 2026
related: #839
fxt44 commentedon Nov 11, 2026
experiments are good!
helmeos style equations of state depend crucially on subtractions. some quantities, hence the thermodynamic consistency, runs into precision troubles in the upper left (high T, low ρ) and lower right (low T, high ρ) where it becomes the subtraction of two large numbers and hoping for the correct small answer (as adjudicated by your approach above where such subtractions don't occur).
using a cascading accumulator on the helmeos subtractions would be another interesting experiment to try.
AstroBarker commentedon Nov 11, 2026
Agreed re: "experiments are good"! I do wonder how much a relative deviation of say 10^-60 buys when we ultimately do double precision arithmetic? I don't have much experience here, so it could be more than I anticipate.
Regarding the not quite transcendental (NQT) logarithms -- have you experimented with thermodynamic consistency when interpolating with them? I have not but I am a bit cautious: the NQT functions leverage a C^1 continuous interpolant. It's unclear how well it plays with e.g., bi-quintic interpolation and higher order thermodynamic derivatives.
zingale commentedon Nov 11, 2026
I have not looked at the consistency with those the NQT. I mainly implemented to see how it affects GPU performance in our codes, since logs are expensive, but it wasn't really a big change, so I haven't pursued it further. It's not the 10^-60 that we care about, but its the O(1) error when 64-bit precision is used in some regimes in the thermodynamic plane that is the concern.
And since this is only a cost paid once -- when generating the table -- it's pretty easy to do. I can generate a new table tomorrow -- I just will need to sync up the physical constants to the values MESA uses first. 128-bit runs reasonably fast.
fxt44 commentedon Nov 11, 2026
per eb's link, even extending a new helm table down to 1e-15 g/cm³ , or even 1e-20 g/cm³ if one dares, could be useful.