Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove internal use of deprecated set_parameters method #4638

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
- Separated extrapolation options for `pybamm.BoundaryValue` and `pybamm.BoundaryGradient`, and updated the default to be "linear" for the value and "quadratic" for the gradient. ([#4614](https://github.com/pybamm-team/PyBaMM/pull/4614))
- Double-layer SEI models have been removed (with the corresponding parameters). All models assume now a single SEI layer. ([#4470](https://github.com/pybamm-team/PyBaMM/pull/4470))

## Bug fixes

- Remove internal use of deprecated `set_parameters` function in the `Simulation` class which caused warnings. ([#4638](https://github.com/pybamm-team/PyBaMM/pull/4638))

# [v24.11.2](https://github.com/pybamm-team/PyBaMM/tree/v24.11.2) - 2024-11-27

## Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion src/pybamm/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def build(self, initial_soc=None, inputs=None):
self._model_with_set_params = self._model
self._built_model = self._model
else:
self.set_parameters()
self._set_parameters()
self._mesh = pybamm.Mesh(self._geometry, self._submesh_types, self._var_pts)
self._disc = pybamm.Discretisation(
self._mesh, self._spatial_methods, **self._discretisation_kwargs
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_basic_ops(self):
assert V.has_symbol_of_classes(pybamm.Parameter)
assert not V.has_symbol_of_classes(pybamm.Matrix)

sim.set_parameters()
sim._set_parameters()
assert sim._mesh is None
assert sim._disc is None
V = sim.model_with_set_params.variables["Voltage [V]"]
Expand Down Expand Up @@ -138,8 +138,8 @@ def test_solve_already_partially_processed_model(self):
def test_reuse_commands(self):
sim = pybamm.Simulation(pybamm.lithium_ion.SPM())

sim.set_parameters()
sim.set_parameters()
sim._set_parameters()
sim._set_parameters()
Comment on lines +141 to +142
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one of the tricky parts of the change that did the deprecation. The private method should not really be used here since it is outside of the class

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not have the SLF inspection turned on in PyBaMM, but it probably should be enabled


sim.build()
sim.build()
Expand All @@ -149,7 +149,7 @@ def test_reuse_commands(self):

sim.build()
sim.solve([0, 600])
sim.set_parameters()
sim._set_parameters()

def test_set_crate(self):
model = pybamm.lithium_ion.SPM()
Expand Down
Loading