Previous topic

Parameter

Next topic

Independent Variable

This Page

Variable

class pybamm.Variable(name, domain=None, auxiliary_domains=None, bounds=None)[source]

A node in the expression tree represending a dependent variable.

This node will be discretised by Discretisation and converted to a pybamm.StateVector node.

Parameters
  • name (str) – name of the node domain : iterable of str, optional list of domains that this variable is valid over

  • auxiliary_domains (dict, optional) – dictionary of auxiliary domains ({‘secondary’: …, ‘tertiary’: …, ‘quaternary’: …}). For example, for the single particle model, the particle concentration would be a Variable with domain ‘negative particle’ and secondary auxiliary domain ‘current collector’. For the DFN, the particle concentration would be a Variable with domain ‘negative particle’, secondary domain ‘negative electrode’ and tertiary domain ‘current collector’

  • bounds (tuple, optional) – Physical bounds on the variable

  • *Extends

diff(variable)[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.VariableDot(name, domain=None, auxiliary_domains=None, bounds=None)[source]

A node in the expression tree represending the time derviative of a dependent variable

This node will be discretised by Discretisation and converted to a pybamm.StateVectorDot node.

Parameters
  • name (str) – name of the node

  • domain (iterable of str) – list of domains that this variable is valid over

  • auxiliary_domains (dict) – dictionary of auxiliary domains ({‘secondary’: …, ‘tertiary’: …, ‘quaternary’: …}). For example, for the single particle model, the particle concentration would be a Variable with domain ‘negative particle’ and secondary auxiliary domain ‘current collector’. For the DFN, the particle concentration would be a Variable with domain ‘negative particle’, secondary domain ‘negative electrode’ and tertiary domain ‘current collector’

  • bounds (tuple, optional) – Physical bounds on the variable. Included for compatibility with VariableBase, but ignored.

  • *Extends

diff(variable)[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

get_variable()[source]

return a Variable corresponding to this VariableDot

Note: Variable._jac adds a dash to the name of the corresponding VariableDot, so we remove this here

class pybamm.ExternalVariable(name, size, domain=None, auxiliary_domains=None)[source]

A node in the expression tree representing an external variable variable.

This node will be discretised by Discretisation and converted to a Vector node.

Parameters
  • name (str) – name of the node

  • domain (iterable of str) – list of domains that this variable is valid over

  • auxiliary_domains (dict) – dictionary of auxiliary domains ({‘secondary’: …, ‘tertiary’: …, ‘quaternary’: …}). For example, for the single particle model, the particle concentration would be a Variable with domain ‘negative particle’ and secondary auxiliary domain ‘current collector’. For the DFN, the particle concentration would be a Variable with domain ‘negative particle’, secondary domain ‘negative electrode’ and tertiary domain ‘current collector’

  • *Extends

create_copy()[source]

See pybamm.Symbol.new_copy().

diff(variable)[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

property size

Size of an object, found by evaluating it with appropriate t and y