Adding bindings for binding models in CADET-Process

This is a short guide detailing the steps to add bindings for a binding model in CADET-Process.

Two files need to be modified:

  1. simulator/cadetAdapter.py
  2. processModel/binding.py

cadetAdapter.py

In cadetAdapter.py, you need to find the adsorption_parameters_map dictionary and add a mapping between the parameter names in CADET-core and the parameter names in CADET-Process.
This example for the Langmuir isotherm can illustrate this:

adsorption_parameters_map = {
 [...]
    'Langmuir': {
        'name': 'MULTI_COMPONENT_LANGMUIR',
        'parameters': {
            'IS_KINETIC': 'is_kinetic',
            'MCL_KA': 'adsorption_rate',
            'MCL_KD': 'desorption_rate',
            'MCL_QMAX': 'capacity'
        },
    },
[...]
}

Note, how the name, and the parameters, match exactly the interface specifications from CADET-core as detailed in the documentation.

binding.py

Then, in binding.py, you need to add a definition for your binding model like this:

class Langmuir(BindingBaseClass):
    """Parameters for Multi Component Langmuir binding model.

    Attributes
    ----------
    adsorption_rate : list of unsigned floats. Length depends on n_comp.
        Adsorption rate constants.
    desorption_rate : list of unsigned floats. Length depends on n_comp.
        Desorption rate constants.
    capacity : list of unsigned floats. Length depends on n_comp.
        Maximum adsorption capacities.

    """

    adsorption_rate = SizedUnsignedList(size='n_comp')
    desorption_rate = SizedUnsignedList(size='n_comp')
    capacity = SizedUnsignedList(size='n_comp')

    _parameters = [
        'adsorption_rate',
        'desorption_rate',
        'capacity',
    ]

Note, that the exact internal implementation might change with time, so it’s better to use the current version of e.g. the Langmuir isotherm in the current CADET-Process release as a guide.

Finally, add the name of you class to the __all__ section at the top of the file:

__all__ = [
    [...]
    'Langmuir',
    [...]
]
1 Like