State Vector#

class pybamm.StateVector(*y_slices: slice, name: str | None = None, domain: list[str] | str | None = None, auxiliary_domains: dict[str, str] | None = None, domains: dict[str, list[str] | str] | None = None, evaluation_array: list[bool] | None = None)[source]#

Node in the expression tree that holds a slice to read from an external vector type.

Parameters:
  • y_slice (slice) – the slice of an external y to read

  • name (str, optional) – the name of the node

  • domain (iterable of str, optional) – list of domains the parameter is valid over, defaults to empty list

  • auxiliary_domains (dict of str, optional) – dictionary of auxiliary domains

  • domains (dict) – A dictionary equivalent to {‘primary’: domain, auxiliary_domains}. Either ‘domain’ and ‘auxiliary_domains’, or just ‘domains’, should be provided (not both). In future, the ‘domain’ and ‘auxiliary_domains’ arguments may be deprecated.

  • evaluation_array (list, optional) – List of boolean arrays representing slices. Default is None, in which case the evaluation_array is computed from y_slices.

Extends: pybamm.expression_tree.state_vector.StateVectorBase

diff(variable: Symbol)[source]#

Differentiate a symbol with respect to a variable. For any symbol that can be differentiated, return 1 if differentiating with respect to yourself, self._diff(variable) if variable is in the expression tree of the symbol, and zero otherwise.

Parameters:

variable (pybamm.Symbol) – The variable with respect to which to differentiate

class pybamm.StateVectorDot(*y_slices: slice, name: str | None = None, domain: list[str] | str | None = None, auxiliary_domains: dict[str, str] | None = None, domains: dict[str, list[str] | str] | None = None, evaluation_array: list[bool] | None = None)[source]#

Node in the expression tree that holds a slice to read from the ydot.

Parameters:
  • y_slice (slice) – the slice of an external ydot to read

  • name (str, optional) – the name of the node

  • domain (iterable of str, optional) – list of domains the parameter is valid over, defaults to empty list

  • auxiliary_domains (dict of str, optional) – dictionary of auxiliary domains

  • domains (dict) – A dictionary equivalent to {‘primary’: domain, auxiliary_domains}. Either ‘domain’ and ‘auxiliary_domains’, or just ‘domains’, should be provided (not both). In future, the ‘domain’ and ‘auxiliary_domains’ arguments may be deprecated.

  • evaluation_array (list, optional) – List of boolean arrays representing slices. Default is None, in which case the evaluation_array is computed from y_slices.

Extends: pybamm.expression_tree.state_vector.StateVectorBase

diff(variable: Symbol)[source]#

Differentiate a symbol with respect to a variable. For any symbol that can be differentiated, return 1 if differentiating with respect to yourself, self._diff(variable) if variable is in the expression tree of the symbol, and zero otherwise.

Parameters:

variable (pybamm.Symbol) – The variable with respect to which to differentiate