Previous topic

Unary Operators

Next topic

Broadcasting Operators

This Page

Concatenations

class pybamm.Concatenation(*children, name=None, check_domain=True, concat_fun=None)[source]

A node in the expression tree representing a concatenation of symbols.

Extends: pybamm.Symbol

Parameters:children (iterable of pybamm.Symbol) – The symbols to concatenate
create_copy()[source]

See pybamm.Symbol.new_copy().

evaluate(t=None, y=None, y_dot=None, inputs=None, known_evals=None)[source]

See pybamm.Symbol.evaluate().

is_constant()[source]

See pybamm.Symbol.is_constant().

to_equation()[source]

Convert the node and its subtree into a SymPy equation.

class pybamm.NumpyConcatenation(*children)[source]

A node in the expression tree representing a concatenation of equations, when we don’t care about domains. The class pybamm.DomainConcatenation, which is careful about domains and uses broadcasting where appropriate, should be used whenever possible instead.

Upon evaluation, equations are concatenated using numpy concatenation.

Extends: Concatenation

Parameters:children (iterable of pybamm.Symbol) – The equations to concatenate
class pybamm.DomainConcatenation(children, full_mesh, copy_this=None)[source]

A node in the expression tree representing a concatenation of symbols, being careful about domains.

It is assumed that each child has a domain, and the final concatenated vector will respect the sizes and ordering of domains established in mesh keys

Extends: pybamm.Concatenation

Parameters:
  • children (iterable of pybamm.Symbol) – The symbols to concatenate
  • full_mesh (pybamm.BaseMesh) – The underlying mesh for discretisation, used to obtain the number of mesh points in each domain.
  • copy_this (pybamm.DomainConcatenation (optional)) – if provided, this class is initialised by copying everything except the children from copy_this. mesh is not used in this case
class pybamm.SparseStack(*children)[source]

A node in the expression tree representing a concatenation of sparse matrices. As with NumpyConcatenation, we don’t care about domains. The class pybamm.DomainConcatenation, which is careful about domains and uses broadcasting where appropriate, should be used whenever possible instead.

Extends: Concatenation

Parameters:children (iterable of Concatenation) – The equations to concatenate
pybamm.numpy_concatenation(*children)[source]

Helper function to create numpy concatenations.

pybamm.domain_concatenation(children, mesh)[source]

Helper function to create domain concatenations.