uclchem.model#

Module Contents#

Classes#

Functions#

cloud([param_dict, out_species, return_array, ...])

Run cloud model from UCLCHEM

collapse(collapse, physics_output[, param_dict, ...])

Run collapse model from UCLCHEM based on Priestley et al 2018 AJ 156 51 (https://ui.adsabs.harvard.edu/abs/2018AJ....156...51P/abstract)

cshock(shock_vel[, timestep_factor, ...])

Run C-type shock model from UCLCHEM

hot_core(temp_indx, max_temperature[, param_dict, ...])

Run hot core model from UCLCHEM, based on Viti et al. 2004 and Collings et al. 2004

jshock(shock_vel[, param_dict, out_species, ...])

Run J-type shock model from UCLCHEM

outputArrays_to_DataFrame(physicalParameterArray, ...)

Convert the output arrays to a pandas dataframe

postprocess([param_dict, out_species, return_array, ...])

Run cloud model from UCLCHEM

pre_flight_checklist(return_array, return_dataframe, ...)

reaction_line_formatter(line)

Attributes#

class uclchem.model.ReactionNamesStore[source]#
reaction_names = None[source]#
uclchem.model.cloud(param_dict=None, out_species=None, return_array=False, return_dataframe=False, return_rates=False, starting_chemistry=None, timepoints=TIMEPOINTS)[source]#

Run cloud model from UCLCHEM

Parameters:
  • param_dict (dict,optional) – A dictionary of parameters where keys are any of the variables in defaultparameters.f90 and values are value for current run.

  • out_species (list, optional) – A list of species for which final abundance will be returned. If None, no abundances will be returned.. Defaults to None.

  • return_array (bool, optional) – A boolean on whether a np.array should be returned to a user, if both return_array and return_dataframe are false, this function will default to writing outputs to a file

  • return_dataframe (bool, optional) – A boolean on whether a pandas.DataFrame should be returned to a user, if both return_array and return_dataframe are false, this function will default to writing outputs to a file

  • starting_chemistry (array, optional) – np.array containing the starting chemical abundances needed by uclchem

Returns:

  • A list where the first element is always an integer which is negative if the model failed to run and can be sent to uclchem.utils.check_error() to see more details. If the out_species parametere is provided, the remaining elements of this list will be the final abundances of the species in out_species.

if return_array is True:
  • physicsArray (array): array containing the physical outputs for each written timestep

  • chemicalAbunArray (array): array containing the chemical abundances for each written timestep

  • abundanceStart (array): array containing the chemical abundances of the last timestep in the format uclchem needs in order to perform an additional run after the initial model

  • success_flag (integer): which is negative if the model failed to run and can be sent to uclchem.utils.check_error() to see more details.

if return_dataframe is True:
  • physicsDF (pandas.DataFrame): DataFrame containing the physical outputs for each written timestep

  • chemicalDF (pandas.DataFrame): DataFrame containing the chemical abundances for each written timestep

  • abundanceStart (array): array containing the chemical abundances of the last timestep in the format uclchem needs in order to perform an additional run after the initial model

  • success_flag (integer): which is negative if the model failed to run and can be sent to uclchem.utils.check_error() to see more details.

Return type:

if return_array and return_dataframe are False

uclchem.model.collapse(collapse, physics_output, param_dict=None, out_species=None, return_array=False, return_dataframe=False, return_rates=False, starting_chemistry=None, timepoints=TIMEPOINTS)[source]#

Run collapse model from UCLCHEM based on Priestley et al 2018 AJ 156 51 (https://ui.adsabs.harvard.edu/abs/2018AJ….156…51P/abstract)

Parameters:
  • collapse (str) – A string containing the collapse type, options are ‘BE1.1’, ‘BE4’, ‘filament’, or ‘ambipolar’

  • physics_output (str) – Filename to store physics output, only relevant for ‘filament’ and ‘ambipolar’ collapses. If None, no physics output will be saved.

  • param_dict (dict,optional) – A dictionary of parameters where keys are any of the variables in defaultparameters.f90 and values are value for current run.

  • out_species (list, optional) – A list of species for which final abundance will be returned. If None, no abundances will be returned.. Defaults to None.

  • return_array (bool, optional) – A boolean on whether a np.array should be returned to a user, if both return_array and return_dataframe are false, this function will default to writing outputs to a file

  • return_dataframe (bool, optional) – A boolean on whether a pandas.DataFrame should be returned to a user, if both return_array and return_dataframe are false, this function will default to writing outputs to a file

  • starting_chemistry (array, optional) – np.array containing the starting chemical abundances needed by uclchem

Returns:

  • A list where the first element is always an integer which is negative if the model failed to run and can be sent to uclchem.utils.check_error() to see more details. If the out_species parametere is provided, the remaining elements of this list will be the final abundances of the species in out_species.

if return_array is True:
  • physicsArray (array): array containing the physical outputs for each written timestep

  • chemicalAbunArray (array): array containing the chemical abundances for each written timestep

  • abundanceStart (array): array containing the chemical abundances of the last timestep in the format uclchem needs in order to perform an additional run after the initial model

  • success_flag (integer): which is negative if the model failed to run and can be sent to uclchem.utils.check_error() to see more details.

if return_dataframe is True:
  • physicsDF (pandas.DataFrame): DataFrame containing the physical outputs for each written timestep

  • chemicalDF (pandas.DataFrame): DataFrame containing the chemical abundances for each written timestep

  • abundanceStart (array): array containing the chemical abundances of the last timestep in the format uclchem needs in order to perform an additional run after the initial model

  • success_flag (integer): which is negative if the model failed to run and can be sent to uclchem.utils.check_error() to see more details.

Return type:

if return_array and return_dataframe are False

uclchem.model.cshock(shock_vel, timestep_factor=0.01, minimum_temperature=0.0, param_dict=None, out_species=None, return_array=False, return_dataframe=False, return_rates=False, starting_chemistry=None, timepoints=TIMEPOINTS)[source]#

Run C-type shock model from UCLCHEM

Parameters:
  • shock_vel (float) – Velocity of the shock in km/s

  • timestep_factor (float, optional) – Whilst the time is less than 2 times the dissipation time of shock, timestep is timestep_factor*dissipation time. Essentially controls

  • 0.01. (how well resolved the shock is in your model. Defaults to)

  • minimum_temperature (float, optional) – Minimum post-shock temperature. Defaults to 0.0 (no minimum). The shocked gas typically cools to initialTemp if this is not set.

  • param_dict (dict,optional) – A dictionary of parameters where keys are any of the variables in defaultparameters.f90 and values are value for current run.

  • out_species (list, optional) – A list of species for which final abundance will be returned. If None, no abundances will be returned.. Defaults to None.

  • return_array (bool, optional) – A boolean on whether a np.array should be returned to a user, if both return_array and return_dataframe are false, this function will default to writing outputs to a file

  • return_dataframe (bool, optional) – A boolean on whether a pandas.DataFrame should be returned to a user, if both return_array and return_dataframe are false, this function will default to writing outputs to a file

  • starting_chemistry (array, optional) – np.array containing the starting chemical abundances needed by uclchem

Returns:

  • A list where the first element is always an integer which is negative if the model failed to run and can be sent to uclchem.utils.check_error() to see more details. If the model succeeded, the second element is the dissipation time and further elements are the abundances of all species in out_species.

if return_array is True:
  • physicsArray (array): array containing the physical outputs for each written timestep

  • chemicalAbunArray (array): array containing the chemical abundances for each written timestep

  • disspation_time (float): dissipation time in years

  • abundanceStart (array): array containing the chemical abundances of the last timestep in the format uclchem needs in order to perform an additional run after the initial model

  • success_flag (integer): which is negative if the model failed to run and can be sent to uclchem.utils.check_error() to see more details.

if return_dataframe is True:
  • physicsDF (pandas.DataFrame): DataFrame containing the physical outputs for each written timestep

  • chemicalDF (pandas.DataFrame): DataFrame containing the chemical abundances for each written timestep

  • disspation_time (float): dissipation time in years

  • abundanceStart (array): array containing the chemical abundances of the last timestep in the format uclchem needs in order to perform an additional run after the initial model

  • success_flag (integer): which is negative if the model failed to run and can be sent to uclchem.utils.check_error() to see more details.

Return type:

if return_array and return_dataframe are False

uclchem.model.hot_core(temp_indx, max_temperature, param_dict=None, out_species=None, return_array=False, return_dataframe=False, return_rates=False, starting_chemistry=None, timepoints=TIMEPOINTS)[source]#

Run hot core model from UCLCHEM, based on Viti et al. 2004 and Collings et al. 2004

Parameters:
  • temp_indx (int) – Used to select the mass of hot core. 1=1Msun,2=5, 3=10, 4=15, 5=25,6=60]

  • max_temperature (float) – Value at which gas temperature will stop increasing.

  • param_dict (dict,optional) – A dictionary of parameters where keys are any of the variables in defaultparameters.f90 and values are value for current run.

  • out_species (list, optional) – A list of species for which final abundance will be returned. If None, no abundances will be returned.. Defaults to None.

  • return_array (bool, optional) – A boolean on whether a np.array should be returned to a user, if both return_array and return_dataframe are false, this function will default to writing outputs to a file

  • return_dataframe (bool, optional) – A boolean on whether a pandas.DataFrame should be returned to a user, if both return_array and return_dataframe are false, this function will default to writing outputs to a file

  • starting_chemistry (array, optional) – np.array containing the starting chemical abundances needed by uclchem

Returns:

  • A list where the first element is always an integer which is negative if the model failed to run and can be sent to uclchem.utils.check_error() to see more details. If the out_species parametere is provided, the remaining elements of this list will be the final abundances of the species in out_species.

if return_array is True:
  • physicsArray (array): array containing the physical outputs for each written timestep

  • chemicalAbunArray (array): array containing the chemical abundances for each written timestep

  • abundanceStart (array): array containing the chemical abundances of the last timestep in the format uclchem needs in order to perform an additional run after the initial model

  • success_flag (integer): which is negative if the model failed to run and can be sent to uclchem.utils.check_error() to see more details.

if return_dataframe is True:
  • physicsDF (pandas.DataFrame): DataFrame containing the physical outputs for each written timestep

  • chemicalDF (pandas.DataFrame): DataFrame containing the chemical abundances for each written timestep

  • abundanceStart (array): array containing the chemical abundances of the last timestep in the format uclchem needs in order to perform an additional run after the initial model

  • success_flag (integer): which is negative if the model failed to run and can be sent to uclchem.utils.check_error() to see more details.

Return type:

if return_array and return_dataframe are False

uclchem.model.jshock(shock_vel, param_dict=None, out_species=None, return_array=False, return_dataframe=False, return_rates=False, starting_chemistry=None, timepoints=TIMEPOINTS)[source]#

Run J-type shock model from UCLCHEM

Parameters:
  • shock_vel (float) – Velocity of the shock

  • param_dict (dict,optional) – A dictionary of parameters where keys are any of the variables in defaultparameters.f90 and values are value for current run.

  • out_species (list, optional) – A list of species for which final abundance will be returned. If None, no abundances will be returned.. Defaults to None.

  • return_array (bool, optional) – A boolean on whether a np.array should be returned to a user, if both return_array and return_dataframe are false, this function will default to writing outputs to a file

  • return_dataframe (bool, optional) – A boolean on whether a pandas.DataFrame should be returned to a user, if both return_array and return_dataframe are false, this function will default to writing outputs to a file

  • starting_chemistry (array, optional) – np.array containing the starting chemical abundances needed by uclchem

Returns:if return_array and return_dataframe are False:
  • A list where the first element is always an integer which is negative if the model failed to run and can be sent to uclchem.utils.check_error() to see more details. If the model succeeded, the second element is the dissipation time and further elements are the abundances of all species in out_species.

if return_array is True:
  • physicsArray (array): array containing the physical outputs for each written timestep

  • chemicalAbunArray (array): array containing the chemical abundances for each written timestep

  • abundanceStart (array): array containing the chemical abundances of the last timestep in the format uclchem needs in order to perform an additional run after the initial model

  • success_flag (integer): which is negative if the model failed to run and can be sent to uclchem.utils.check_error() to see more details.

if return_dataframe is True:
  • physicsDF (pandas.DataFrame): DataFrame containing the physical outputs for each written timestep

  • chemicalDF (pandas.DataFrame): DataFrame containing the chemical abundances for each written timestep

  • abundanceStart (array): array containing the chemical abundances of the last timestep in the format uclchem needs in order to perform an additional run after the initial model

  • success_flag (integer): which is negative if the model failed to run and can be sent to uclchem.utils.check_error() to see more details.

uclchem.model.outputArrays_to_DataFrame(physicalParameterArray, chemicalAbundanceArray, specname, ratesArray)[source]#

Convert the output arrays to a pandas dataframe

Parameters:
  • physicalParameterArray (np.array) – Array with the output physical parameters

  • chemicalAbundanceArray (np.array) – Array with the output chemical abundances

  • specname (list) – List with the names of all the species

  • physParameter (list) – Array with all the physical parameter names

Returns:

_description_

Return type:

_type_

uclchem.model.postprocess(param_dict=None, out_species=None, return_array=False, return_dataframe=False, return_rates=False, starting_chemistry=None, time_array=None, density_array=None, gas_temperature_array=None, dust_temperature_array=None, zeta_array=None, radfield_array=None, coldens_H_array=None, coldens_H2_array=None, coldens_CO_array=None, coldens_C_array=None)[source]#

Run cloud model from UCLCHEM

Parameters:
  • param_dict (dict,optional) – A dictionary of parameters where keys are any of the variables in defaultparameters.f90 and values are value for current run.

  • out_species (list, optional) – A list of species for which final abundance will be returned. If None, no abundances will be returned.. Defaults to None.

  • return_array (bool, optional) – A boolean on whether a np.array should be returned to a user, if both return_array and return_dataframe are false, this function will default to writing outputs to a file

  • return_dataframe (bool, optional) – A boolean on whether a pandas.DataFrame should be returned to a user, if both return_array and return_dataframe are false, this function will default to writing outputs to a file

  • starting_chemistry (array, optional) – np.array containing the starting chemical abundances needed by uclchem

Returns:

  • A list where the first element is always an integer which is negative if the model failed to run and can be sent to uclchem.utils.check_error() to see more details. If the out_species parametere is provided, the remaining elements of this list will be the final abundances of the species in out_species.

if return_array is True:
  • physicsArray (array): array containing the physical outputs for each written timestep

  • chemicalAbunArray (array): array containing the chemical abundances for each written timestep

  • abundanceStart (array): array containing the chemical abundances of the last timestep in the format uclchem needs in order to perform an additional run after the initial model

  • success_flag (integer): which is negative if the model failed to run and can be sent to uclchem.utils.check_error() to see more details.

if return_dataframe is True:
  • physicsDF (pandas.DataFrame): DataFrame containing the physical outputs for each written timestep

  • chemicalDF (pandas.DataFrame): DataFrame containing the chemical abundances for each written timestep

  • abundanceStart (array): array containing the chemical abundances of the last timestep in the format uclchem needs in order to perform an additional run after the initial model

  • success_flag (integer): which is negative if the model failed to run and can be sent to uclchem.utils.check_error() to see more details.

Return type:

if return_array and return_dataframe are False

uclchem.model.pre_flight_checklist(return_array, return_dataframe, return_rates, starting_chemistry=None, user_params={})[source]#
uclchem.model.reaction_line_formatter(line)[source]#
uclchem.model.OUTPUT_MODE = ''[source]#
uclchem.model.get_reaction_names[source]#