Post-Process Variables#
- class pybamm.ProcessedVariable(base_variables, base_variables_casadi, solution, time_integral: ProcessedVariableTimeIntegral | None = 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_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 apybamm.Variable
. When evaluated, returns an array of size (m,n)base_variables_casadi (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 variablestime_integral (
pybamm.ProcessedVariableTimeIntegral
, optional) – Not none if the variable is to be time-integrated (default is None)
- property data#
Same as entries, but different name
- property entries#
Returns the raw data entries of the processed variable. If the processed variable has not been initialized (i.e. the entries have not been calculated), then the processed variable is initialized first.
- observe_and_interp(t, fill_value)[source]#
Interpolate the variable at the given time points and y values. t must be a sorted array of time points.
- 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