Skip to content

Commit 26447b3

Browse files
#1100 remove ProcessedSymbolicVariable
1 parent 0cfdf6f commit 26447b3

8 files changed

+12
-559
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
## Breaking changes
1313

14-
- Renamed `quick_plot_vars` to `output_variables` in `Simulation` to be consistent with `QuickPlot`. Passing `quick_plot_vars` to `Simulation.plot()` has been deprecated and `output_variables` should be passed instead ([#1099](https://github.com/pybamm-team/PyBaMM/pull/1099))
14+
- Changed sensitivity API. Removed `ProcessedSymbolicVariable`, all sensitivity now handled within the solvers and `ProcessedVariable` ()
15+
- Renamed `quick_plot_vars` to `output_variables` in `Simulation` to be consistent with `QuickPlot`. Passing `quick_plot_vars` to `Simulation.plot()` has been deprecated and `output_variables` should be passed instead ([#1099](https://github.com/pybamm-team/PyBaMM/pull/1099))
1516

1617

1718
# [v0.2.3](https://github.com/pybamm-team/PyBaMM/tree/v0.2.3) - 2020-07-01

docs/source/solvers/processed_variable.rst

-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ Post-Process Variables
33

44
.. autoclass:: pybamm.ProcessedVariable
55
:members:
6-
7-
.. autoclass:: pybamm.ProcessedSymbolicVariable
8-
:members:

pybamm/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ def version(formatted=False):
206206
#
207207
from .solvers.solution import Solution, _BaseSolution
208208
from .solvers.processed_variable import ProcessedVariable
209-
from .solvers.processed_symbolic_variable import ProcessedSymbolicVariable
210209
from .solvers.base_solver import BaseSolver
211210
from .solvers.dummy_solver import DummySolver
212211
from .solvers.algebraic_solver import AlgebraicSolver

pybamm/solvers/casadi_algebraic_solver.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ def _integrate(self, model, t_eval, inputs=None):
5959
t_eval : :class:`numpy.array`, size (k,)
6060
The times at which to compute the solution
6161
inputs : dict, optional
62-
Any input parameters to pass to the model when solving. If any input
63-
parameters that are present in the model are missing from "inputs", then
64-
the solution will consist of `ProcessedSymbolicVariable` objects, which must
65-
be provided with inputs to obtain their value.
62+
Any input parameters to pass to the model when solving.
6663
"""
6764
# Record whether there are any symbolic inputs
6865
inputs = inputs or {}

pybamm/solvers/processed_symbolic_variable.py

-219
This file was deleted.

pybamm/solvers/processed_variable.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,9 @@ def __init__(self, base_variable, solution, known_evals=None, warn=True):
8080

8181
# The symbolic_inputs will be used for sensitivity
8282
symbolic_inputs = casadi.vertcat(*symbolic_inputs_dict.values())
83-
try:
84-
var_casadi = base_variable.to_casadi(
85-
t_MX, y_MX, inputs=symbolic_inputs_dict
86-
)
87-
except:
88-
n = 1
83+
var_casadi = base_variable.to_casadi(
84+
t_MX, y_MX, inputs=symbolic_inputs_dict
85+
)
8986
self.base_variable_sym = casadi.Function(
9087
"variable", [t_MX, y_MX, symbolic_inputs], [var_casadi]
9188
)

pybamm/solvers/solution.py

+6-13
Original file line numberDiff line numberDiff line change
@@ -239,19 +239,12 @@ def update(self, variables):
239239
# Process
240240
for key in variables:
241241
pybamm.logger.debug("Post-processing {}".format(key))
242-
# If there are symbolic inputs then we need to make a
243-
# ProcessedSymbolicVariable
244-
if self.has_symbolic_inputs is True:
245-
var = pybamm.ProcessedSymbolicVariable(self.model.variables[key], self)
246-
247-
# Otherwise a standard ProcessedVariable is ok
248-
else:
249-
var = pybamm.ProcessedVariable(
250-
self.model.variables[key], self, self._known_evals
251-
)
252-
# Update known_evals in order to process any other variables faster
253-
for t in var.known_evals:
254-
self._known_evals[t].update(var.known_evals[t])
242+
var = pybamm.ProcessedVariable(
243+
self.model.variables[key], self, self._known_evals
244+
)
245+
# Update known_evals in order to process any other variables faster
246+
for t in var.known_evals:
247+
self._known_evals[t].update(var.known_evals[t])
255248

256249
# Save variable and data
257250
self._variables[key] = var

0 commit comments

Comments
 (0)