Variable#
- class pybamm.Variable(name, domain=None, auxiliary_domains=None, domains=None, bounds=None, print_name=None, scale=1, reference=0)[source]#
A node in the expression tree represending a dependent variable.
This node will be discretised by
Discretisation
and converted to apybamm.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’
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.
bounds (tuple, optional) – Physical bounds on the variable
print_name (str, optional) – The name to use for printing. Default is None, in which case self.name is used.
scale (float or
pybamm.Symbol
, optional) – The scale of the variable, used for scaling the model when solving. The state vector representing this variable will be multiplied by this scale. Default is 1.reference (float or
pybamm.Symbol
, optional) – The reference value of the variable, used for scaling the model when solving. This value will be added to the state vector representing this variable. Default is 0.
Extends:
pybamm.expression_tree.variable.VariableBase
- 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, domains=None, bounds=None, print_name=None, scale=1, reference=0)[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 apybamm.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’
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.
bounds (tuple, optional) – Physical bounds on the variable. Included for compatibility with VariableBase, but ignored.
print_name (str, optional) – The name to use for printing. Default is None, in which case self.name is used.
scale (float or
pybamm.Symbol
, optional) – The scale of the variable, used for scaling the model when solving. The state vector representing this variable will be multiplied by this scale. Default is 1.reference (float or
pybamm.Symbol
, optional) – The reference value of the variable, used for scaling the model when solving. This value will be added to the state vector representing this variable. Default is 0.
Extends:
pybamm.expression_tree.variable.VariableBase
- 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