CoolDwarf.EOS.ChabrierDebras2021 package¶
Submodules¶
CoolDwarf.EOS.ChabrierDebras2021.EOS module¶
EOS.py – EOS class for Chabrier Debras 2021 EOS tables
This module contains the EOS class for the Chabrier Debras 2021 EOS tables. The class is designed to be used with the CoolDwarf Stellar Structure code, and provides the necessary functions to interpolate the EOS tables.
As with all EOS classes in CoolDwarf, the CH21EOS class is designed to accept linear values in cgs units, and return linear values in cgs units.
Dependencies¶
pandas
scipy
cupy
torch
Example usage¶
>>> from CoolDwarf.EOS.ChabrierDebras2021.EOS import CH21EOS
>>> eos = CH21EOS("path/to/eos/table")
>>> pressure = eos.pressure(7.0, -2.0)
>>> energy = eos.energy(7.0, -2.0)
- class CoolDwarf.EOS.ChabrierDebras2021.EOS.CH21EOS(tablePath)¶
Bases:
object
CH21EOS – EOS class for Chabrier Debras 2021 EOS tables
This class is designed to be used with the CoolDwarf Stellar Structure code, and provides the necessary functions to interpolate the Chabrier Debras 2021 EOS tables.
- Parameters:
- tablePathstr
Path to the Chabrier Debras 2021 EOS table
- Attributes:
Methods
pressure(logT, logRho)
Interpolates the pressure at the given temperature and density
energy(logT, logRho)
Interpolates the energy at the given temperature and density
- property TRange¶
Tuple containing the minimum and maximum temperature (log10(T)) in the EOS table
- Returns:
- tuple
Tuple containing the minimum and maximum temperature (log10(T)) in the EOS table
- check_forward_params(logT, logRho)¶
Check if the given temperature and density are within the bounds of the EOS table. If the values are out of bounds, a ValueError is raised.
- Parameters:
- logTfloat
Log10 of the temperature in K
- logRhofloat
Log10 of the density in g/cm^3
- Raises:
- ValueError
If the temperature or density is out of bounds
- energy(logT, logRho)¶
Find the energy at the given temperature and density.
- Parameters:
- logTfloat
Log10 of the temperature in K
- logRhofloat
Log10 of the density in g/cm^3
- energy_torch(logT, logRho)¶
Find the energy at the given temperature and density using PyTorch tensors.
- Parameters:
- logTtorch.Tensor
Log10 of the temperature in K
- logRhotorch.Tensor
Log10 of the density in g/cm^3
- parse_table()¶
Parse the Chabrier Debras 2021 EOS table and store the data in the class. Parsing is done using regular expressions to extract the data from the table file. Columns are named according to the table format, and the data is stored in a pandas DataFrame. The temperature and density values are extracted and stored in separate arrays, and the pressure and energy values are interpolated using RegularGridInterpolator.
Column Names (in order): - logT - logP - logRho - logU - logS - dlrho/dlT_P - dlrho/dlP_T - dlS/dlT_P - dlS/dlP_T
The EOS table is stored as a 3D array, with the first dimension corresponding to the temperature, the second dimension corresponding to the density, and the third dimension corresponding to the columns.
The temperature and density arrays are stored as 1D arrays.
- pressure(logT, logRho)¶
Find the pressure at the given temperature and density.
- Parameters:
- logTfloat
Log10 of the temperature in K
- logRhofloat
Log10 of the density in g/cm^3
- property rhoRange¶
Tuple containing the minimum and maximum density (log10(ρ)) in the EOS table
- Returns:
- tuple
Tuple containing the minimum and maximum density (log10(ρ)) in the EOS table