uclchem.model ============= .. py:module:: uclchem.model Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: uclchem.model.ReactionNamesStore Functions ~~~~~~~~~ .. autoapisummary:: uclchem.model.cloud uclchem.model.collapse uclchem.model.cshock uclchem.model.hot_core uclchem.model.jshock uclchem.model.outputArrays_to_DataFrame uclchem.model.postprocess uclchem.model.pre_flight_checklist uclchem.model.reaction_line_formatter Attributes ~~~~~~~~~~ .. autoapisummary:: uclchem.model.OUTPUT_MODE uclchem.model.get_reaction_names .. py:class:: ReactionNamesStore .. py:attribute:: reaction_names :value: None .. py:function:: cloud(param_dict=None, out_species=None, return_array=False, return_dataframe=False, return_rates=False, starting_chemistry=None, timepoints=TIMEPOINTS) Run cloud model from UCLCHEM :param param_dict: A dictionary of parameters where keys are any of the variables in defaultparameters.f90 and values are value for current run. :type param_dict: dict,optional :param out_species: A list of species for which final abundance will be returned. If None, no abundances will be returned.. Defaults to None. :type out_species: list, optional :param return_array: 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 :type return_array: bool, optional :param return_dataframe: 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 :type return_dataframe: bool, optional :param starting_chemistry: np.array containing the starting chemical abundances needed by uclchem :type starting_chemistry: array, optional :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. :rtype: if return_array and return_dataframe are False .. py:function:: collapse(collapse, physics_output, param_dict=None, out_species=None, return_array=False, return_dataframe=False, return_rates=False, starting_chemistry=None, timepoints=TIMEPOINTS) Run collapse model from UCLCHEM based on Priestley et al 2018 AJ 156 51 (https://ui.adsabs.harvard.edu/abs/2018AJ....156...51P/abstract) :param collapse: A string containing the collapse type, options are 'BE1.1', 'BE4', 'filament', or 'ambipolar' :type collapse: str :param physics_output: Filename to store physics output, only relevant for 'filament' and 'ambipolar' collapses. If None, no physics output will be saved. :type physics_output: str :param param_dict: A dictionary of parameters where keys are any of the variables in defaultparameters.f90 and values are value for current run. :type param_dict: dict,optional :param out_species: A list of species for which final abundance will be returned. If None, no abundances will be returned.. Defaults to None. :type out_species: list, optional :param return_array: 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 :type return_array: bool, optional :param return_dataframe: 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 :type return_dataframe: bool, optional :param starting_chemistry: np.array containing the starting chemical abundances needed by uclchem :type starting_chemistry: array, optional :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. :rtype: if return_array and return_dataframe are False .. py:function:: 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) Run C-type shock model from UCLCHEM :param shock_vel: Velocity of the shock in km/s :type shock_vel: float :param timestep_factor: Whilst the time is less than 2 times the dissipation time of shock, timestep is timestep_factor*dissipation time. Essentially controls :type timestep_factor: float, optional :param how well resolved the shock is in your model. Defaults to 0.01.: :param minimum_temperature: Minimum post-shock temperature. Defaults to 0.0 (no minimum). The shocked gas typically cools to `initialTemp` if this is not set. :type minimum_temperature: float, optional :param param_dict: A dictionary of parameters where keys are any of the variables in defaultparameters.f90 and values are value for current run. :type param_dict: dict,optional :param out_species: A list of species for which final abundance will be returned. If None, no abundances will be returned.. Defaults to None. :type out_species: list, optional :param return_array: 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 :type return_array: bool, optional :param return_dataframe: 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 :type return_dataframe: bool, optional :param starting_chemistry: np.array containing the starting chemical abundances needed by uclchem :type starting_chemistry: array, optional :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. :rtype: if return_array and return_dataframe are False .. py:function:: 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) Run hot core model from UCLCHEM, based on Viti et al. 2004 and Collings et al. 2004 :param temp_indx: Used to select the mass of hot core. 1=1Msun,2=5, 3=10, 4=15, 5=25,6=60] :type temp_indx: int :param max_temperature: Value at which gas temperature will stop increasing. :type max_temperature: float :param param_dict: A dictionary of parameters where keys are any of the variables in defaultparameters.f90 and values are value for current run. :type param_dict: dict,optional :param out_species: A list of species for which final abundance will be returned. If None, no abundances will be returned.. Defaults to None. :type out_species: list, optional :param return_array: 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 :type return_array: bool, optional :param return_dataframe: 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 :type return_dataframe: bool, optional :param starting_chemistry: np.array containing the starting chemical abundances needed by uclchem :type starting_chemistry: array, optional :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. :rtype: if return_array and return_dataframe are False .. py:function:: jshock(shock_vel, param_dict=None, out_species=None, return_array=False, return_dataframe=False, return_rates=False, starting_chemistry=None, timepoints=TIMEPOINTS) Run J-type shock model from UCLCHEM :param shock_vel: Velocity of the shock :type shock_vel: float :param param_dict: A dictionary of parameters where keys are any of the variables in defaultparameters.f90 and values are value for current run. :type param_dict: dict,optional :param out_species: A list of species for which final abundance will be returned. If None, no abundances will be returned.. Defaults to None. :type out_species: list, optional :param return_array: 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 :type return_array: bool, optional :param return_dataframe: 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 :type return_dataframe: bool, optional :param starting_chemistry: np.array containing the starting chemical abundances needed by uclchem :type starting_chemistry: array, optional 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. .. py:function:: outputArrays_to_DataFrame(physicalParameterArray, chemicalAbundanceArray, specname, ratesArray) Convert the output arrays to a pandas dataframe :param physicalParameterArray: Array with the output physical parameters :type physicalParameterArray: np.array :param chemicalAbundanceArray: Array with the output chemical abundances :type chemicalAbundanceArray: np.array :param specname: List with the names of all the species :type specname: list :param physParameter: Array with all the physical parameter names :type physParameter: list :returns: _description_ :rtype: _type_ .. py:function:: 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) Run cloud model from UCLCHEM :param param_dict: A dictionary of parameters where keys are any of the variables in defaultparameters.f90 and values are value for current run. :type param_dict: dict,optional :param out_species: A list of species for which final abundance will be returned. If None, no abundances will be returned.. Defaults to None. :type out_species: list, optional :param return_array: 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 :type return_array: bool, optional :param return_dataframe: 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 :type return_dataframe: bool, optional :param starting_chemistry: np.array containing the starting chemical abundances needed by uclchem :type starting_chemistry: array, optional :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. :rtype: if return_array and return_dataframe are False .. py:function:: pre_flight_checklist(return_array, return_dataframe, return_rates, starting_chemistry=None, user_params={}) .. py:function:: reaction_line_formatter(line) .. py:data:: OUTPUT_MODE :value: '' .. py:data:: get_reaction_names