Skip to content

Commit bb9b4df

Browse files
committed
Update comment
1 parent a592763 commit bb9b4df

File tree

1 file changed

+14
-7
lines changed
  • Examples/Tests/embedded_boundary_em_particle_absorption

1 file changed

+14
-7
lines changed

Examples/Tests/embedded_boundary_em_particle_absorption/analysis.py

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
#!/usr/bin/env python
22

3-
# TODO: update description: explain two particles separate, absorbed by the boundary
4-
# with EM solver, there can be a static spurious divE (spurious charge build-up) that remains at the position where particle was absorbed
5-
# this checks this is not the case. Since divE also has a (physical) component that propagate along the EB (due to EM waves reflecting),
6-
# we average in time to remove this component and only check the static part.
7-
# TODO: Adjust tolerances
83
"""
9-
This analysis script checks for any spurious charge build-up at the embedded boundary, when particles are removed in 3D.
10-
It averages the divergence of the electric field (divE) over the last 20 time steps and compares the results with a specified tolerance.
4+
This analysis script checks that there is no spurious charge build-up when a particle is absorbed by an embedded boundary.
5+
6+
More specifically, this test simulates two particles of oppposite charge that are initialized at
7+
the same position and then move in opposite directions. The particles are surrounded by a spherical
8+
embedded boundary, and are absorbed when their trajectory intersects this boundary. With an
9+
electromagnetic solver, this can lead to spurious charge build-up (i.e., div(E)!= rho/epsion_0)
10+
that remains at the position where particle was absorbed.
11+
12+
Note that, in this test, there will also be a (non-spurious) component of div(E) that propagates
13+
along the embedded boundary, due to electromagnetic waves reflecting on this boundary.
14+
When checking for static, spurious charge build-up, we average div(E) in time to remove this component.
1115
"""
1216

1317
from openpmd_viewer import OpenPMDTimeSeries
@@ -21,6 +25,9 @@
2125
end_avg_iter = 100
2226
divE_avg = divE_stacked[start_avg_iter:end_avg_iter].mean(axis=0)
2327

28+
# Adjust the tolerance so that the remaining error due to the propagating
29+
# div(E) (after averaging) is below this tolerance, but so that any typical
30+
# spurious charge build-up is above this tolerance. This is dimension-dependent.
2431
dim = ts.fields_metadata["divE"]["geometry"]
2532
if dim == "3dcartesian":
2633
tolerance = 5e-11

0 commit comments

Comments
 (0)