Skip to content
Snippets Groups Projects
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
No related merge requests found
......@@ -250,7 +250,10 @@ def subs_additive(expr: sp.Expr, replacement: sp.Expr, subexpression: sp.Expr,
if not param_list:
return current_expr
else:
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()
else:
return current_expr.func(*param_list, evaluate=False)
return visit(expr)
......
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