Post-Process Variables

class pybamm.ProcessedVariable(base_variables, base_variables_casadi, solution, warn=True)[source]

An object that can be evaluated at arbitrary (scalars or vectors) t and x, and returns the (interpolated) value of the base variable at that t and x.

  • base_variables (list of pybamm.Symbol) – A list of base variables with a method evaluate(t,y), each entry of which returns the value of that variable for that particular sub-solution. A Solution can be comprised of sub-solutions which are the solutions of different models. Note that this can be any kind of node in the expression tree, not just a pybamm.Variable. When evaluated, returns an array of size (m,n)

  • base_variable_casadis (list of casadi.Function) – A list of casadi functions. When evaluated, returns the same thing as base_Variable.evaluate (but more efficiently).

  • solution (pybamm.Solution) – The solution object to be used to create the processed variables

  • warn (bool, optional) – Whether to raise warnings when trying to evaluate time and length scales. Default is True.

call_1D(t, x, r, z, R)[source]

Evaluate a 1D variable

call_2D(t, x, r, y, z, R)[source]

Evaluate a 2D variable

property data

Same as entries, but different name

get_spatial_scale(name, domain)[source]

Returns the spatial scale for a named spatial variable


Initialise a 2D object that depends on x and r, x and z, x and R, or R and r.


Set up the sensitivity dictionary

property sensitivities

Returns a dictionary of sensitivities for each input parameter. The keys are the input parameters, and the value is a matrix of size (n_x * n_t, n_p), where n_x is the number of states, n_t is the number of time points, and n_p is the size of the input parameter