Skip to content

fixed incorrect metal mass fraction array for Freedman lowT opacity tables#993

Merged
Debraheem merged 1 commit into
MESAHub:bugfix/freedman_kap_tablesfrom
esandford:lowT_opacity_Z
May 11, 2026
Merged

fixed incorrect metal mass fraction array for Freedman lowT opacity tables#993
Debraheem merged 1 commit into
MESAHub:bugfix/freedman_kap_tablesfrom
esandford:lowT_opacity_Z

Conversation

@esandford
Copy link
Copy Markdown

Updated $MESA_DIR/kap/public/kap_def.f90 and $MESA_DIR/kap/preprocessor/src/freedman.f90 to reflect the below:

Louis Siebenaler (cc'd) and I noticed a problem with the preprocessing & evaluation of the Freedman11 low-temperature opacity tables. Specifically, the "Z" values associated with each table, as e.g. enumerated in $MESA_DIR/kap/public/kap_def.f90,
num_kap_lowT_Zs(i) = 7
kap_lowT_Zs(1:num_kap_lowT_Zs(i), i) = [ 0.01d0, 0.02d0, 0.04d0, 0.100d0, 0.200d0, 0.63d0, 1.00d0 ]

are not metal mass fractions. Rather, they are related to number fractions; for example, a Freedman [M/H] value of -0.3 corresponds to a metal number fraction of 10**(-0.3)solar = 0.5solar; [M/H]=0 corresponds to a solar number fraction, etc. It appears that there was a decision made to equate the solar metal number fraction with a metal mass fraction of 0.02 and scale the other values in the array accordingly.

The metal mass fraction array should instead look something like this (with small variations possible depending on which protosolar abundance table you work with; the below values are based on Lodders 2003 table 2):
[M/H] = [-0.3, 0.0, 0.3, 0.7, 1.0, 1.5, 1.7]
Z = [0.0075, 0.0148, 0.029, 0.0698, 0.1303, 0.3215, 0.4288]

@esandford esandford requested review from Debraheem and fxt44 as code owners May 11, 2026 13:15
@Debraheem Debraheem changed the base branch from main to bugfix/freedman_kap_tables May 11, 2026 21:34
@Debraheem
Copy link
Copy Markdown
Member

Awesome, I'll merge this into a branch so we can get it tested and reopen a pr for that branch into main! I'll try to fix whatever is messing with the build as well on that branch.

@Debraheem Debraheem merged commit 58b84b0 into MESAHub:bugfix/freedman_kap_tables May 11, 2026
1 of 5 checks passed
@esandford
Copy link
Copy Markdown
Author

Perfect! Just in case---I also had to edit the $MESA_DIR/kap/preprocessor/rn_freedman script in order to successfully build & export the correctly-labeled opacity tables in my local MESA installation. I didn't add that file to this commit because there was no existing version of that script in the repo, but it was a very simple change, just substituting the correct Zs for the incorrect ones.

@Debraheem
Copy link
Copy Markdown
Member

no worries, i've regenerated it in my commit, and some other tweaks. I'm just having some git issues preventing me pushing the lfs files, so i can't commit yet, hopefully it will be solved tomorrow.

@esandford esandford deleted the lowT_opacity_Z branch May 12, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants