Vector Field#

class pybamm.VectorField(*components: Symbol, disc_state_vector: StateVector | None = None)[source]#

A node in the expression tree representing a vector field.

VectorField is a convenience subclass of TensorField for rank-1 tensors with N >= 2 components. Components are stored by integer index; the properties lr_field and tb_field are aliases for [0] and [1].

Parameters:

*components (pybamm.Symbol) – Two or more component symbols, all sharing the same domain.

Extends: pybamm.expression_tree.tensor_field.TensorField

create_copy(new_children: list[Symbol] | None = None, perform_simplifications: bool = True) → VectorField[source]#

Create a copy of this tensor field with optional new children.

property disc_state_vector#

State vector attached by the unstructured FV discretisation (else None).

evaluates_on_edges(dimension: str) → bool[source]#

Check if any component evaluates on edges.

Returns True if all components evaluate on edges, False if none do, raises error if mixed.

property lr_field: Symbol#

Component 0 (left-right / x).

property n_components: int#

Number of vector components.

property tb_field: Symbol#

Component 1 (top-bottom / y).

with_meshes(mesh: Mesh, domains: dict[str, list[str]] | None = None) → VectorField[source]#

See pybamm.Symbol.with_meshes(); components carry the meshes too.