A general spatial methods class, with default (trivial) behaviour for some spatial operations. All spatial methods will follow the general form of SpatialMethod in that they contain a method for broadcasting variables onto a mesh, a gradient operator, and a divergence operator.
mesh – Contains all the submeshes for discretisation
Implements the boundary integral for a spatial method.
child (pybamm.Symbol
) – The symbol to which is being integrated
discretised_child (pybamm.Symbol
) – The discretised symbol of the correct size
region (str) – The region of the boundary over which to integrate. If region is None (default) the integration is carried out over the entire boundary. If region is negative tab or positive tab then the integration is only carried out over the appropriate part of the boundary corresponding to the tab.
Contains the result of acting the discretised boundary integral on the child discretised_symbol
class: pybamm.Array
Returns the boundary value or flux using the approriate expression for the spatial method. To do this, we create a sparse vector ‘bv_vector’ that extracts either the first (for side=”left”) or last (for side=”right”) point from ‘discretised_child’.
symbol (pybamm.Symbol
) – The boundary value or flux symbol
discretised_child (pybamm.StateVector
) – The discretised variable from which to calculate the boundary value
bcs (dict (optional)) – The boundary conditions. If these are supplied and “use bcs” is True in the options, then these will be used to improve the accuracy of the extrapolation.
The variable representing the surface value.
Broadcast symbol to a specified domain.
symbol (pybamm.Symbol
) – The symbol to be broadcasted
domain (iterable of strings) – The domain to broadcast to
auxiliary_domains (dict of strings) – The auxiliary domains for broadcasting
broadcast_type (str) – The type of broadcast: ‘primary to node’, ‘primary to edges’, ‘secondary to nodes’, ‘secondary to edges’, ‘tertiary to nodes’, ‘tertiary to edges’, ‘full to nodes’ or ‘full to edges’
broadcasted_symbol – The discretised symbol of the correct size for the spatial method
class: pybamm.Symbol
Discrete concatenation object.
disc_children (list) – List of discretised children
Concatenation of the discretised children
Implements the delta function on the approriate side for a spatial method.
symbol (pybamm.Symbol
) – The symbol to which is being integrated
discretised_symbol (pybamm.Symbol
) – The discretised symbol of the correct size
Implements the divergence for a spatial method.
symbol (pybamm.Symbol
) – The symbol that we will take the gradient of.
discretised_symbol (pybamm.Symbol
) – The discretised symbol of the correct size
boundary_conditions (dict) – The boundary conditions of the model ({symbol.id: {“left”: left bc, “right”: right bc}})
Contains the result of acting the discretised divergence on the child discretised_symbol
class: pybamm.Array
Implements the gradient for a spatial method.
symbol (pybamm.Symbol
) – The symbol that we will take the gradient of.
discretised_symbol (pybamm.Symbol
) – The discretised symbol of the correct size
boundary_conditions (dict) – The boundary conditions of the model ({symbol.id: {“left”: left bc, “right”: right bc}})
Contains the result of acting the discretised gradient on the child discretised_symbol
class: pybamm.Array
Implements the inner product of the gradient with itself for a spatial method.
symbol (pybamm.Symbol
) – The symbol that we will take the gradient of.
discretised_symbol (pybamm.Symbol
) – The discretised symbol of the correct size
boundary_conditions (dict) – The boundary conditions of the model ({symbol.id: {“left”: left bc, “right”: right bc}})
Contains the result of taking the inner product of the result of acting the discretised gradient on the child discretised_symbol with itself
class: pybamm.Array
Implements the indefinite integral for a spatial method.
child (pybamm.Symbol
) – The symbol to which is being integrated
discretised_child (pybamm.Symbol
) – The discretised symbol of the correct size
direction (str) – The direction of integration
Contains the result of acting the discretised indefinite integral on the child discretised_symbol
class: pybamm.Array
Implements the integral for a spatial method.
child (pybamm.Symbol
) – The symbol to which is being integrated
discretised_child (pybamm.Symbol
) – The discretised symbol of the correct size
integration_dimension (str, optional) – The dimension in which to integrate (default is “primary”)
Contains the result of acting the discretised integral on the child discretised_symbol
class: pybamm.Array
A method to find the internal neumann conditions between two symbols on adjacent subdomains.
left_symbol_disc (pybamm.Symbol
) – The discretised symbol on the left subdomain
right_symbol_disc (pybamm.Symbol
) – The discretised symbol on the right subdomain
left_mesh (list) – The mesh on the left subdomain
right_mesh (list) – The mesh on the right subdomain
Implements the laplacian for a spatial method.
symbol (pybamm.Symbol
) – The symbol that we will take the gradient of.
discretised_symbol (pybamm.Symbol
) – The discretised symbol of the correct size
boundary_conditions (dict) – The boundary conditions of the model ({symbol.id: {“left”: left bc, “right”: right bc}})
Contains the result of acting the discretised laplacian on the child discretised_symbol
class: pybamm.Array
Calculates the mass matrix for a spatial method.
symbol (pybamm.Variable
) – The variable corresponding to the equation for which we are
calculating the mass matrix.
boundary_conditions (dict) – The boundary conditions of the model ({symbol.id: {“left”: left bc, “right”: right bc}})
The (sparse) mass matrix for the spatial method.
Discretise binary operators in model equations. Default behaviour is to return a new binary operator with the discretised children.
bin_op (pybamm.BinaryOperator
) – Binary operator to discretise
left (pybamm.Symbol
) – The left child of bin_op
right (pybamm.Symbol
) – The right child of bin_op
disc_left (pybamm.Symbol
) – The discretised left child of bin_op
disc_right (pybamm.Symbol
) – The discretised right child of bin_op
Discretised binary operator
Convert a pybamm.SpatialVariable
node to a linear algebra object that
can be evaluated (here, a pybamm.Vector
on either the nodes or the
edges).
symbol (pybamm.SpatialVariable
) – The spatial variable to be discretised.
Contains the discretised spatial variable