fix low density/Pressure SCVH EOS tables #997
Conversation
…low table edges instead of HELM fallback, fix FreeEOS low T boundary dlnE/dlnT partial bug
|
Wow. Did you actually rerun the full FreeEOS preprocessor to regenerate all of the FreeEOS tables after the fix for the MESA fallback points? What version of FreeEOS did you use? Last time I tried this, I was having trouble getting an external FreeEOS installation to compile, run, and be compatible with the MESA preprocessor. But that was a while ago. |
|
Rather than extrapolating "OPAL/SCVH" over to low density, why not just blend over to neutral ideal gas there? It seems like making a table that extrapolates toward ideal gas is maybe just a less-optimal version, since we can do it analytically with auto-diff now? |
| eos_result(i_lnPgas) = res(i_lnPgas)/ln10 | ||
| eos_result(i_lnE) = res(i_lnE)/ln10 | ||
| eos_result(i_lnS) = res(i_lnS)/ln10 | ||
| eos_result(i_lnRho) = log10Rho |
There was a problem hiding this comment.
Great catch! I think you're right about this. Do you know if it has an impact on anything?
In practice, I think we cut out most of the region where FreeEOS was failing and falling back to MESA with the "logQ_cut"-related boundary controls. Anyway, I've always been a bit uncomfortable with the idea that our "FreeEOS" tables that were meant to replace the older EOS might end up falling back to the older EOS without being very clear about that. So I like the fix, but I don't really like the existence of the thing that we're fixing here...
| end if | ||
|
|
||
| write (io_unit, '(f4.2,3(f10.5),7(1pe13.5),1(0pf9.5),4(0pf10.5),2(0pf11.5))') & | ||
| write (io_unit, '(f4.2,3(1x,f10.5),7(1x,1pe13.5),1x,0pf9.5,1x,f12.5,3(1x,1pe13.5),2(1x,0pf12.5))') & |
There was a problem hiding this comment.
Why did the write format change?
This pr is an attempt to address #995, which spawned from a mailing-list thread initially raised by Natasha Ivanova:
I believe the main concern was the mean molecular weight being that of an ionized mixture in the regions highighted in the plots below, when adopting both Free_EOS and OPAL/SCVH.
https://lists.mesastar.org/pipermail/mesa-users/2026-May/015873.html:

Particularly in the low T-rho regime, as I'm not sure there is a better fallback than HELM in the high pressure regime (that would require an actual eos for that region).
For the SCVH tables, below
logP_min = -0.6the SCVH coverage is now supplied analytically ineos/eosDT_builder/src/scvh_core.f90. For each fixedlogTrow and each species, the tail uses the edge state and extrapolates to the ideal gas limit.and the ideal low-pressure limit
The implementation uses this ideal value below the first lower-pressure grid
step and applies a local cubic correction between
logP0and that point so thetail is value-continuous and has the same
d/dlogPas the restored processedSCVH table at the edge. That keeps the generated eosDT interpolation support
smooth without editing the raw SCVH data files.
In this pr, I also noticed when regenerating the eos tables that there was a HELM fallback in
the high pressure region, and it produced noisy
mufeaturesnear the OPAL/SCVH support boundary in regenerated tables. I think this fallback didn't exist,
when the tables where generated the first time, so i turned it off for the table generation. see check_results :
was
gamma1_opalscvh <= 1d0 .or. gamma1_opalscvh >= 2d0 .or. grad_ad_opalscvh >= 50d0) thennow
gamma1_opalscvh <= 0d0) thenThis might not be correct, but it was the only way for me to make the new eos smooth like the old eos tables, but maybe this expression should be adjusted.
See the plots below


After adding the smooth extrapolation to SCVH, i also noticed there was a bad row of partials on the

FreeEOS SCVH boundary at logT = 3 - 3.1. It turns out the fallback here were rows generated from the
MESA EOS with
lnPgas,lnE, andlnSin natural log form, but the FreeEOS data filesstore those columns as base-10 logarithms. so i these just need to be converted in
eos/eosFreeEOS_builder/src/free_eos_table.f90. (See the original issue below).I had to regenerate the eos for this pr.
eos/eosFreeEOS_data.tar.xzeos/eosDT_data.tar.xzI bumped the the FreeEOS table version and the eosDT table version to
52.A few plots from the new eos looks like this:
(a bit low res for the eos plotter)

The eosDT region definitions shifted very slightly in
eos/eosDT_builder/src/eos_regions_defs.dekandeos/eosDT_builder/src/eos_regions_code.dekkeep the generated OPAL/SCVH supportout of the warm, very-low-density FreeEOS side. This prevents the SCVH
low-pressure floor from interacting with the FreeEOS boundary at
logrho ~ -15.This PR probably needs some further attention validation and testing, maybe clean up.