Skip to content

Commit

Permalink
Add test copying entire discretised DFN rhs tree
Browse files Browse the repository at this point in the history
  • Loading branch information
pipliggins committed May 10, 2024
1 parent 1a60913 commit 182233e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/unit/test_expression_tree/test_operations/test_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,22 @@ def test_symbol_new_copy_warning(self):
with self.assertWarns(DeprecationWarning):
pybamm.Symbol("a").new_copy()

def test_symbol_copy_tree(self):
model = pybamm.lithium_ion.DFN()
geometry = model.default_geometry
param = model.default_parameter_values
param.process_model(model)
param.process_geometry(geometry)
mesh = pybamm.Mesh(geometry, model.default_submesh_types, model.default_var_pts)
disc = pybamm.Discretisation(mesh, model.default_spatial_methods)
disc.process_model(model)

y = model.concatenated_initial_conditions.evaluate()
copied_rhs = model.concatenated_rhs.create_copy()
np.testing.assert_array_equal(
model.concatenated_rhs.evaluate(None, y), copied_rhs.evaluate(None, y)
)


if __name__ == "__main__":
print("Add -v for more debug output")
Expand Down

0 comments on commit 182233e

Please sign in to comment.