uclchem.functional#

Functional API for UCLCHEM models.

This module provides a functional interface to UCLCHEM’s physics models, designed for backward compatibility with UCLCHEM v2 while leveraging the modern object-oriented architecture.

The functional API offers convenience functions that wrap the model classes (uclchem.model) with a simpler calling convention. Each function follows a consistent pattern:

  • Input: parameter dictionary, output species list, and return format flags

  • Output: Either file output (default) or in-memory arrays/DataFrames

  • Modes: Choose between disk I/O or memory-based workflows

Available Models#

Usage Patterns#

Disk mode (default) - Results written to files:

>>> import uclchem
>>>
>>> success_flag, abundance_CO, abundance_H2O = uclchem.functional.cloud(
...     param_dict={'initialDens': 1e4, 'outputFile': 'cloud.dat'},
...     out_species=['CO', 'H2O']
... )
>>>
>>> success_flag.check_error()
Model ran successfully

Memory mode - Results returned as arrays:

>>> phys, chem, rate_constants, heat, final_abun, success_flag = uclchem.functional.cloud(
...     param_dict={'initialDens': 1e4},
...     out_species=['CO', 'H2O'],
...     return_array=True,
...     return_rate_constants=True,
...     return_heating=True
... )

DataFrame mode - Results as pd.DataFrames:

>>> (
...     phys_df,
...     chem_df,
...     rate_constants_df,
...     heat_df,
...     final_abun,
...     success_flag,
... ) = uclchem.functional.cloud(
...     param_dict={'initialDens': 1e4},
...     out_species=['CO'],
...     return_dataframe=True,
...     return_rate_constants=True
... )

Note

You cannot mix file I/O parameters (outputFile, abundSaveFile) with memory return modes (return_array, return_dataframe). Choose one approach per run.

Tip

For interactive work and complex analysis, the object-oriented API (uclchem.model) offers more flexibility. Use the functional API when you need backward compatibility or prefer a simpler interface.

See Also:

Module Contents#

uclchem.functional.cloud[source]#
uclchem.functional.collapse[source]#
uclchem.functional.cshock[source]#
uclchem.functional.hot_core[source]#
uclchem.functional.jshock[source]#
uclchem.functional.prestellar_core[source]#