|
1 | 1 | #!/usr/bin/env python
|
2 | 2 |
|
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 |
8 | 3 | """
|
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. |
11 | 15 | """
|
12 | 16 |
|
13 | 17 | from openpmd_viewer import OpenPMDTimeSeries
|
|
21 | 25 | end_avg_iter = 100
|
22 | 26 | divE_avg = divE_stacked[start_avg_iter:end_avg_iter].mean(axis=0)
|
23 | 27 |
|
| 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. |
24 | 31 | dim = ts.fields_metadata["divE"]["geometry"]
|
25 | 32 | if dim == "3dcartesian":
|
26 | 33 | tolerance = 5e-11
|
|
0 commit comments