Previous topic

Solutions

Next topic

Experiments

This Page

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.

Parameters:
  • 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)[source]

Evaluate a 1D variable

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

Evaluate a 2D variable

data

Same as entries, but different name

get_spatial_scale(name, domain)[source]

Returns the spatial scale for a named spatial variable

initialise_2D()[source]

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

class pybamm.ProcessedSymbolicVariable(base_variable, solution)[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.

Parameters:
  • base_variable (pybamm.Symbol) – A base variable with a method evaluate(t,y) that returns the value of that variable. 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)
  • solution (pybamm.Solution) – The solution object to be used to create the processed variables
data

Same as entries, but different name

initialise_0D()[source]

Create a 0D variable

initialise_1D()[source]

Create a 1D variable

sensitivity(inputs=None, check_inputs=True)[source]

Returns the sensitivity of the variable to the symbolic inputs at the specified input values

Parameters:inputs (dict) – The inputs at which to evaluate the variable.
Returns:A casadi matrix of size (n_x * n_t, n_p), where n_x is the number of spatial discretisation points for the variable, n_t is the length of the time vector, and n_p is the number of input parameters
Return type:casadi.DM
value(inputs=None, check_inputs=True)[source]

Returns the value of the variable at the specified input values

Parameters:inputs (dict) – The inputs at which to evaluate the variable.
Returns:A casadi matrix of size (n_x * n_t, 1), where n_x is the number of spatial discretisation points for the variable, and n_t is the length of the time vector
Return type:casadi.DM
value_and_sensitivity(inputs=None)[source]

Returns the value of the variable and its sensitivity to the symbolic inputs at the specified input values

Parameters:inputs (dict) – The inputs at which to evaluate the variable.