uclchem.model#
Module Contents#
Classes#
Functions#
|
Run cloud model from UCLCHEM |
|
Run collapse model from UCLCHEM based on Priestley et al 2018 AJ 156 51 (https://ui.adsabs.harvard.edu/abs/2018AJ....156...51P/abstract) |
|
Run C-type shock model from UCLCHEM |
|
Run hot core model from UCLCHEM, based on Viti et al. 2004 and Collings et al. 2004 |
|
Run J-type shock model from UCLCHEM |
|
Convert the output arrays to a pandas dataframe |
|
Run cloud model from UCLCHEM |
|
|
|
Attributes#
- 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:
- 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