class pybamm.Array(entries: ndarray | list[float] | csr_matrix, 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, entries_string: str | None = None)[source]#

Node in the expression tree that holds an tensor type variable (e.g. numpy.array)

  • entries (numpy.array or list) – the array associated with the node. If a list is provided, it is converted to a numpy array

  • 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, optional) – dictionary of auxiliary domains, defaults to empty dict

  • 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.

  • entries_string (str) – String representing the entries (slow to recalculate when copying)

Extends: pybamm.expression_tree.symbol.Symbol

create_copy(new_children=None, perform_simplifications: bool = True)[source]#

See pybamm.Symbol.new_copy().


See pybamm.Symbol.is_constant().

property ndim#

returns the number of dimensions of the tensor.


See pybamm.Symbol.set_id().

property shape#

returns the number of entries along each dimension.

to_equation() ImmutableDenseNDimArray[source]#

Returns the value returned by the node when evaluated.


Method to serialise an Array object into JSON.

pybamm.linspace(start: float, stop: float, num: int = 50, **kwargs) Array[source]#

Creates a linearly spaced array by calling numpy.linspace with keyword arguments ‘kwargs’. For a list of ‘kwargs’ see the numpy linspace documentation

pybamm.meshgrid(x: Array, y: Array, **kwargs) tuple[Array, Array][source]#

Return coordinate matrices as from coordinate vectors by calling numpy.meshgrid with keyword arguments ‘kwargs’. For a list of ‘kwargs’ see the numpy meshgrid documentation