xso.flux
- xso.flux(flux_func=None, *, dims=(), group=None, group_to_arg=None, description='', attrs={})[source]
Create a flux function.
This is a function decorator that registers a method within a component as a flux (i.e. term in the ODE). It ta
The parameter can be of variable dimensionality.
- Parameters:
flux_func (decorator argument) – Allows decorator to be used with and without arguments.
dims (str or tuple or list, optional) – Dimension label(s) of the forcing. An empty tuple corresponds to a scalar variable (default), a string or a 1-length tuple corresponds to a 1-d variable and a n-length tuple corresponds to a n-d variable. A list of str or tuple items may also be provided if the variable accepts different numbers of dimensions.
group (str, optional) – Output of flux is stored in xsimlab group variable, to be referenced in other fluxes, via the group_to_arg argument. This way the flux output can be routed to multiple other fluxes, for more complex mathematical constructs.
group_to_arg (str, optional) – The string supplied is used as a reference for an xsimlab group variable. This group variable collects the output of fluxes in other components, that have defined the same string label for the group argument. The values thus collected are inserted into the function as a variable of the same name, for further computations.
description (str, optional) – Short description of the flux.
attrs (dict, optional) – Dictionnary of additional metadata (e.g., standard_name, units, math_symbol…).