POSEIDON.chemistry

Functions to interpolate chemical composition grids.

Module Contents

Functions

load_chemistry_grid(chemical_species[, grid, comm, rank])

Load a chemical abundance grid.

interpolate_log_X_grid(chemistry_grid, log_P, T, ...)

Interpolate a pre-computed grid of chemical abundances (e.g. an equilibrium

POSEIDON.chemistry.load_chemistry_grid(chemical_species, grid='fastchem', comm=MPI.COMM_WORLD, rank=0)

Load a chemical abundance grid.

Parameters:
  • chemical_species (list or np.array of str) – List of chemical species to load mixing ratios from grid.

  • grid (str) – Name of the pre-computed chemical abundance grid. The file should be located in the POSEIDON input directory (specified in your .bashrc file) with a name format like ‘GRID_database.hdf5’ (e.g. ‘fastchem_database.hdf5’). By default, POSEIDON ships with an equilibrium chemistry grid computed from the fastchem code: https://github.com/exoclime/FastChem (Options: fastchem).

  • comm (MPI communicator) – Communicator used to allocate shared memory on multiple cores.

  • rank (MPI rank) – Rank used to allocate shared memory on multiple cores.

Returns:

Dictionary containing the chemical abundance database.

Return type:

chemistry_grid (dict)

POSEIDON.chemistry.interpolate_log_X_grid(chemistry_grid, log_P, T, C_to_O, log_Met, chemical_species, return_dict=True)

Interpolate a pre-computed grid of chemical abundances (e.g. an equilibrium chemistry grid) onto a model P-T profile, metallicity, and C/O ratio.

Parameters:
  • chemistry_grid (dict) – Dictionary containing the chemical abundance database.

  • log_P (float or np.array of float) – Pressure profile provided by the user (in log scale and in bar). A single value will be expanded into an array np.full(length, P), where length == max(len(P_array), len(T_array), len(C_O), len(Met)). 10^{-7} to 10^{2} bar are supported.

  • T (float or np.array of float) – Temperature profile provided by the user (K). A single value will be expanded into an array np.full(length, T), where length == max(len(P_array), len(T_array), len(C_O), len(Met)). 300 to 4000 K are supported.

  • C_to_O (float or np.array of float) – Carbon to Oxygen (C/O) ratio provided by the user. A single value will be expanded into an array np.full(length, C_O), where length == max(len(P_array), len(T_array), len(C_O), len(Met)). 0.2 to 2 are supported.

  • log_Met (float or np.array of float) – Planetary metallicity (in log scale. 0 represents 1x solar). A single value will be expanded into an array np.full(length, Met), where length == max(len(P_array), len(T_array), len(C_O), len(Met)). -1 to 4 are supported.

  • chemical_species (str or np.array of str) – List of chemical species to interpolate mixing ratios for.

  • return_dict (bool) – If False, return an array of shape (len(species), len(P_array)).

Returns:

A dictionary of log mixing ratios with keys being the same names as

specified in chemical_species.

log_X_interp_array (np.array of float) —> if return_dict=False:

An array containing the log mixing ratios for the species specified in chemical_species.

Return type:

log_X_interp_dict (dict) —> if return_dict = True