Previous topic

Solution

Next topic

Utility functions

This Page

Post-Process Variables

pybamm.post_process_variables(variables, t_sol, u_sol, mesh=None, interp_kind='linear')[source]

Post-process all variables in a model

Parameters:
  • variables (dict) – Dictionary of variables
  • t_sol (array_like, size (m,)) – The time vector returned by the solver
  • u_sol (array_like, size (m, k)) – The solution vector returned by the solver. Can include solution values that other than those that get read by base_variable.evaluate() (i.e. k>=n)
  • mesh (pybamm.Mesh) – The mesh used to solve, used here to calculate the reference x values for interpolation
  • interp_kind (str) – The method to use for interpolation
Returns:

Dictionary of processed variables

Return type:

dict

class pybamm.ProcessedVariable(base_variable, t_sol, u_sol, mesh=None, interp_kind='linear', known_evals=None)[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)
  • t_sol (array_like, size (m,)) – The time vector returned by the solver
  • u_sol (array_like, size (m, k)) – The solution vector returned by the solver. Can include solution values that other than those that get read by base_variable.evaluate() (i.e. k>=n)
  • mesh (pybamm.Mesh) – The mesh used to solve, used here to calculate the reference x values for interpolation
  • interp_kind (str) – The method to use for interpolation
call_2D(t, x, r, z)[source]

Evaluate a 2D variable

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

Evaluate a 3D variable

initialise_3D()[source]

Initialise a 3D object that depends on x and r. Needs to be generalised to deal with other domains