Commit 27a131fb authored by Martin Bauer's avatar Martin Bauer
Browse files

Bugfix: For certain MRT methods the CSE failed

- replace_density_and_velocity simplification produced terms like
  0 * omega, because sympy's auto-eval is turned off
- sympys CSE routine can apparently only handle evaluated terms
- solution: evaluate multiplications with zero (i.e. replace them by 0)
parent 9bfd862f
......@@ -250,7 +250,10 @@ def subs_additive(expr: sp.Expr, replacement: sp.Expr, subexpression: sp.Expr,
if not param_list:
return current_expr
return current_expr.func(*param_list, evaluate=False)
if current_expr.func == sp.Mul and sp.numbers.Zero() in param_list:
return sp.numbers.Zero()
return current_expr.func(*param_list, evaluate=False)
return visit(expr)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment