pybamm.
BaseSolver
(method=None, rtol=1e-06, atol=1e-06, root_method=None, root_tol=1e-06, extrap_tol=0, max_steps='deprecated')[source]¶Solve a discretised model.
Parameters: |
|
---|
calculate_consistent_state
(model, time=0, inputs=None)[source]¶Calculate consistent state for the algebraic equations through root-finding. model.y0 is used as the initial guess for rootfinding
Parameters: |
|
---|---|
Returns: | y0_consistent – Initial conditions that are consistent with the algebraic equations (roots of the algebraic equations). If self.root_method == None then returns model.y0. |
Return type: | array-like, same shape as y0_guess |
check_extrapolation
(solution, events)[source]¶Check if extrapolation occurred for any of the interpolants. Note that with the current approach (evaluating all the events at the solution times) some extrapolations might not be found if they only occurred for a small period of time.
Parameters: |
|
---|
get_termination_reason
(solution, events)[source]¶Identify the cause for termination. In particular, if the solver terminated due to an event, (try to) pinpoint which event was responsible. If an event occurs the event time and state are added to the solution object. Note that the current approach (evaluating all the events and then finding which one is smallest at the final timestep) is pretty crude, but is the easiest one that works for all the different solvers.
Parameters: |
|
---|
set_up
(model, inputs=None, t_eval=None, ics_only=False)[source]¶Unpack model, perform checks, and calculate jacobian.
Parameters: |
|
---|
solve
(model, t_eval=None, external_variables=None, inputs=None, initial_conditions=None, nproc=None, calculate_sensitivities=False)[source]¶Execute the solver setup and calculate the solution of the model at specified times.
Parameters: |
|
---|---|
Returns: | If type of inputs is list, return a list of corresponding
|
Return type: |
|
Raises: |
|
step
(old_solution, model, dt, npts=2, external_variables=None, inputs=None, save=True)[source]¶Step the solution of the model forward by a given time increment. The first time this method is called it executes the necessary setup by calling self.set_up(model).
Parameters: |
|
---|---|
Raises: |
|