Skip to content

fixed incorrect metal mass fraction array for Freedman lowT opacity t…#994

Open
Debraheem wants to merge 2 commits into
mainfrom
bugfix/freedman_kap_tables
Open

fixed incorrect metal mass fraction array for Freedman lowT opacity t…#994
Debraheem wants to merge 2 commits into
mainfrom
bugfix/freedman_kap_tables

Conversation

@Debraheem
Copy link
Copy Markdown
Member

(#993) @esandford

Co-authored-by: Emily Sandford emily@Emilys-MacBook-Air.local

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]

…ables (#993)

Co-authored-by: Emily Sandford <emily@Emilys-MacBook-Air.local>

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]
@Debraheem Debraheem requested a review from fxt44 as a code owner May 11, 2026 21:38
@Debraheem Debraheem added bug Something isn't working kap Opacity module labels May 11, 2026
…ersion, add known_bugs/changelog docs, fix kap preprocessor typos and missing kap file build call introduced by 0030af6 ("kap: port preprocessor to new build system", update atm test output).
@Debraheem
Copy link
Copy Markdown
Member Author

commit incoming, once git lfs let's me upload these files.

@Debraheem
Copy link
Copy Markdown
Member Author

I think this pr is the simplest way of changing the opacities from [M/H] to Z but it only does 6 sig figs in Z, using the file names. Is this enough, should the file be named such that they include near full precision names?

@Debraheem Debraheem requested a review from VincentVanlaer May 12, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working kap Opacity module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants