Skip to content

Commit

Permalink
Charge: sum->sum_unique
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Aug 11, 2022
1 parent 2ee33d2 commit 0e291d7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tests/python/test_charge_deposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ def test_charge_deposition():
sim.evolve()

rho = sim.rho(lev=0)
# TODO: for non-cell-centered data, this double counts non-owned cells with MPI
rs = rho.sum(comp=0, local=False)
rs = rho.sum_unique(comp=0, local=False)

gm = sim.Geom(lev=0)
dr = gm.data().CellSize()
dV = np.prod(dr)

beam_charge = dV*rs # in C
# TODO: does not yet pass with MPI runs (too large value, see above)
#assert math.isclose(beam_charge, 1.0e-9)
assert math.isclose(beam_charge, 1.0e-9)

f = plt.figure()
ax = f.gca()
Expand Down

0 comments on commit 0e291d7

Please sign in to comment.