Skip to content

Commit 8bc2087

Browse files
committed
api: fix substitution when derivative appears multiple times
1 parent d70ded4 commit 8bc2087

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

devito/types/equation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def _apply_coeffs(cls, expr, coefficients):
9898
if not mapper:
9999
return expr
100100

101-
return expr.xreplace(mapper)
101+
return expr.subs(mapper)
102102

103103
def _evaluate(self, **kwargs):
104104
"""

examples/seismic/tutorials/07_DRP_schemes.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"name": "stdout",
8484
"output_type": "stream",
8585
"text": [
86-
"Eq(-u(t, x, y)/dt + u(t + dt, x, y)/dt + (0.1*u(t, x, y) - 0.6*u(t, x - h_x, y) + 0.6*u(t, x + h_x, y))/h_x, 0)\n"
86+
"Eq(-u(t, x, y)/dt + u(t + dt, x, y)/dt + 0.1*u(t, x, y)/h_x - 0.6*u(t, x - h_x, y)/h_x + 0.6*u(t, x + h_x, y)/h_x, 0)\n"
8787
]
8888
}
8989
],

tests/test_symbolic_coefficients.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ def test_staggered_equation(self):
202202

203203
eq_f = Eq(f, f.dx2(weights=weights))
204204

205-
expected = 'Eq(f(x + h_x/2), (1.0*f(x - h_x/2) - 2.0*f(x + h_x/2)'\
206-
' + 1.0*f(x + 3*h_x/2))/h_x**2)'
205+
expected = 'Eq(f(x + h_x/2), 1.0*f(x - h_x/2)/h_x**2 - 2.0*f(x + h_x/2)/h_x**2 '\
206+
'+ 1.0*f(x + 3*h_x/2)/h_x**2)'
207207
assert(str(eq_f.evaluate) == expected)
208208

209209
@pytest.mark.parametrize('stagger', [True, False])

0 commit comments

Comments
 (0)