Skip to content

Commit

Permalink
#1429 fix recursion error
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinsulzer committed Mar 27, 2021
1 parent c6eadba commit 2a7ed06
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pybamm/expression_tree/binary_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,10 @@ def simplified_division(left, right):
if left.id == right.id:
return pybamm.ones_like(left)

# Return constant if both sides are constant
if left.is_constant() and right.is_constant():
return pybamm.simplify_if_constant(pybamm.Division(left, right))

# Simplify (B @ c) / a to (B / a) @ c if (B / a) is constant
# This is a common construction that appears from discretisation of averages
elif isinstance(left, MatrixMultiplication) and right.is_constant():
Expand Down

0 comments on commit 2a7ed06

Please sign in to comment.