Skip to content

Commit

Permalink
improvements for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
dschwoerer committed Jul 16, 2024
1 parent a2fee3c commit 2578ad9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions zoidberg/stencil_dagp_fv.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,10 @@ def zm(i, j, k):
this = -(coefsX[..., 0] * dx + coefsX[..., 1] * dz)
result[:-1] -= this
result[1:] += this
for r, t in zip(results, (coefsX[..., 0] * dx, coefsX[..., 1] * dz)):
for r, t in zip(results, (-coefsX[..., 0] * dx, -coefsX[..., 1] * dz)):
r[:-1] -= t
r[1:] += t
results[0]

print("expect 0:", np.max(np.abs((result - results[0] - results[1]))))
if 1:
dx2 = inp[2:] - inp[:-2]
dx2 = 0.5 * (np.roll(dx2, -1, axis=-1) + dx2)
Expand All @@ -275,11 +274,13 @@ def zm(i, j, k):
this = -(t1 + t2)
result[1:-1] -= this
result[1:-1] += np.roll(this, 1, -1)
for r, t in zip(results[2:], (t1, t2)):
for r, t in zip(results[2:], (-t1, -t2)):
r[1:-1] -= t
np.roll(r, -1, -1)[1:-1] += t
# np.roll(r, -1, -1)[1:-1] += t
r[1:-1] += np.roll(t, 1, -1)

result[0] = 0
result[-1] = 0
for r in results:
r[0] = 0
r[-1] = 0
Expand Down

0 comments on commit 2578ad9

Please sign in to comment.