Skip to content

Commit

Permalink
examples: Update printed code in examples to reflect SymPy ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
EdCaunt committed Nov 4, 2024
1 parent d97e63b commit 405ed78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/cfd/01_convection_revisited.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,9 @@
" for (int time = time_m, t0 = (time)%(2), t1 = (time + 1)%(2); time <= time_M; time += 1, t0 = (time)%(2), t1 = (time + 1)%(2))\n",
" {\n",
" START(section0)\n",
" for (int x = x_ltkn0 + x_m; x <= x_M - x_rtkn0; x += 1)\n",
" for (int x = x_m + x_ltkn0; x <= x_M - x_rtkn0; x += 1)\n",
" {\n",
" for (int y = y_ltkn0 + y_m; y <= y_M - y_rtkn0; y += 1)\n",
" for (int y = y_m + y_ltkn0; y <= y_M - y_rtkn0; y += 1)\n",
" {\n",
" u[t1][x + 1][y + 1] = dt*(-(-u[t0][x][y + 1]/h_x + u[t0][x + 1][y + 1]/h_x) - (-u[t0][x + 1][y]/h_y + u[t0][x + 1][y + 1]/h_y) + u[t0][x + 1][y + 1]/dt);\n",
" }\n",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_symbolic_coefficients.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ def test_staggered_equation(self):

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

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

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

0 comments on commit 405ed78

Please sign in to comment.