Skip to content

v.2.0.0

Choose a tag to compare

@robtejada robtejada released this 20 Nov 20:30
· 254 commits to main since this release

This new release improves the inversion methods of the original CMS19, CD21, and CMS19+HG23 H-He equations of state.
The most updated version of the H-He-Z tables now live in eos_class.py which can be initialized in a script of Jupyter notebook. For example, to initialize the CMS19+HG23 EOS:

from eos import eos_class
mixtures_eos = eos_class.mixtures(hhe_eos='cms', z_eos='aqua', hg=True, y_prime=False)

The y_prime parameter controls what input helium mass fraction the EOS receives. This could be Y' = Y/(X+Y) or the total Y, namely Y/(X + Y + Z). For evolutionary calculations with APPLE (Sur et al. 2024), we use the total Y, so we set y_prime=False.

The function names are now more descriptive. Now, to obtain T(S, P), for example, one calls:

logt = mixtures_eos.get_logt_sp(s_input, logp_input, y_input, z_input, tab=True)

to obtain a value of logt at the given inputs. Recall that s_input must be in kb/baryon units. The tab=True argument gives the option to use the precomputed tables as a function of S, logP. When tab=False, the eos_class.py file will execute an optimized inversion instead of a table interpolation.

The derivatives can be accessed in a similar fashion. For example,

# Ledoux condition derivative
dsdy_rhop = mixtures_eos.get_dsdy_rhop_srho(s_input, logrho_input, y_input, z_input, tab=True)
# Schwarzschild condition derivative
dsdy_pt = mixtures_eos.get_dsdy_pt(logp_input, logt_input, y_input, z_input).

This version also pre-computes the original H-He P, T tables combined with the water EOS, AQUA (Haldemann et al. 2020). These can be accessed like so:

s = mixtures_eos.get_s_pt_tab(logp_input, logt_input, y_input, z_input)
logrho = mixtures_eos.get_logrho_pt_tab(logp_input, logt_input, y_input, z_input)

However, the volume-addition law version can still be accessed:

s = mixtures_eos.get_s_pt(logp_input, logt_input, y_input, z_input)
logrho = mixtures_eos.get_logrho_pt(logp_input, logt_input, y_input, z_input)

The new tables are saved in .npz files to preserve the original independent variable grids in the same file. These files can be read like a dictionary in python, for example:

hhe_eos = 'cd'
z_eos = 'aqua'
sp_data = np.load('eos/{}/{}_{}_sp.npz'.format(hhe_eos, hhe_eos, z_eos))

# reading grid values of precomputed S, P table
logpvals_sp = self.sp_data['logpvals'] # grid of log pressure in dyn/cm^2
svals_sp = self.sp_data['s_vals'] # kb/baryon
yvals_sp = self.sp_data['yvals'] # ygrid of precomputed S, P table
zvals_sp = self.sp_data['zvals'] # zgrid of precomputed S, P table

# 4-D tables to interpolate over
logt_sp_tab = self.sp_data['logt_sp'] # logt(s, logp)
logrho_sp_tab = self.sp_data['logrho_sp'] # logrho(s, logp)

All of these interpolations are performed in eos_class.py.