-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add automated test for particle absorption on new stair-case approximation #5562
Merged
RemiLehe
merged 34 commits into
BLAST-WarpX:development
from
RemiLehe:eb_absorption_test
Jan 22, 2025
Merged
Add automated test for particle absorption on new stair-case approximation #5562
RemiLehe
merged 34 commits into
BLAST-WarpX:development
from
RemiLehe:eb_absorption_test
Jan 22, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…to move_stair_case_approx
This reverts commit 4fd4dc7.
c9ead4d
to
df82ace
Compare
bb9b4df
to
0bba7c9
Compare
Add file for checksum tests Update comment
0bba7c9
to
069a63e
Compare
roelof-groenewald
pushed a commit
that referenced
this pull request
Jan 21, 2025
# Overview This PR changes the definition of the stair-case approximation of the EB (used in the Yee solver), so that the actual EB boundary (where e.g. particles are removed from the simulation) is **inside** the stair-case-approximated boundary - as opposed to the definition used in the current `development` branch, for which the actual EB is **outside** the stair-case-approximated boundary. This ensures that the algorithm remains charge conserving, when charged particles are absorbed or emitted by the embedded boundary, **for particle shape of order 1**. (Higher-order particle shapes will be addressed in #5209.) As illustrated in the figure below (and as discussed in [this paper](https://www.researchgate.net/publication/318642364_Charge_Conserving_Emission_from_Conformal_Boundaries_in_Electromagnetic_PIC_simulations)), this is fundamentally because the particle does not deposit any charge in the valid cells, at the time when it is removed/emitted. <img width="608" alt="Screenshot 2025-01-12 at 8 56 17 AM" src="https://github.com/user-attachments/assets/bd803ef0-faf8-4ea5-973b-240c15b2ba4b" /> (The black crosses show the locations where the electric field is not updated, and thus usually remains equal to 0. The red dots show the locations where the particle deposits charge, for particle shape of order 1.) The better behavior with respect to charge-conservation can be observed in the following animations, which show two particles of opposing charge separating and going into the embedded boundary. (Note that a static error in `divE` remains at the position where the particle was absorbed, with the `development` branch. The propagating errors in `divE` are expected: they are due to electromagnetic waves reflecting on the EB.) - **development branch**  - **this PR**  Input script: [inputs.txt](https://github.com/user-attachments/files/18428873/inputs.txt) Analysis script: [openPMD-visualization.ipynb.txt](https://github.com/user-attachments/files/18428878/openPMD-visualization.ipynb.txt) (An automated tests using a similar configuration has been added in a separate, follow-up PR: #5562) Note that, as part of this PR, the above new definition has been adopted for all the finite-difference solvers, except for the ECT solver (which uses a cut-cell representation instead of a stair-case representation). # Implementation This PR uses the changes of #5574. It still uses `MarkUpdateECellsECT` and `MarkUpdateBCellsECT` for the ECT sover - which preserve the previous behavior of the embedded boundary for this solver, but now uses `MarkUpdateCellsStairCase` for the other FDTD solvers - which introduce the above-mentioned new stair-case definition.
roelof-groenewald
approved these changes
Jan 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice test! There was just one typo I spotted in the comment below, then it should be ready to merge.
Examples/Tests/embedded_boundary_em_particle_absorption/analysis.py
Outdated
Show resolved
Hide resolved
…is.py Co-authored-by: Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com>
RemiLehe
added a commit
that referenced
this pull request
Jan 28, 2025
**Description edited by @RemiLehe** # Overview This PR reduces the particle shape to order 1, when the particle gets closer to the embedded boundary: <img width="991" alt="Screenshot 2025-01-23 at 8 46 34 AM" src="https://github.com/user-attachments/assets/2e206606-110e-4018-aedc-385567fe43e7" /> This ensures that the particle does not deposit charge in valid cells, at the time when it is removed, which in turn ensures proper charge conservation with the electromagnetic solver. # Implementation - This PR allocates and initializes a new mask `eb_reduce_particle_shape` (and `iMultiFab`) that indicates in which cells to reduce the particle shape. - The deposition kernels have been modified to use this flag. In order to make sure that this PR does not affect the performance of the deposition kernel in the absence of EB, two versions of the deposition kernel are compiled. # Tests This PR adds tests similar to the ones introduced in #5562 to check for charge conservation near the embedded boundary, but with higher-order shape factors: - The 2D tests fail on `development` for shape 2 and 3 but pass on this PR. - For some reason, the 3D and RZ tests only fail on `development` for shape 3 ; they do pass for this PR. It is not clear why the tests do not fail on `development` with shape 2. **Note:** For now, this PR only modifies the current deposition (and only the Esirkepov kernel). A follow-up PR will also modify the charge deposition. --------- Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This introduces automated tests in 2D, 3D and RZ, as a follow up to #5534, to check that a particle does not leave a spurious charge behind, when absorbed by the embedded boundary, and when using an EM solver.
In this test, the embedded boundary is a cylinder aligned with the z axis. (In 2D, this reduces to two parallel plates.)
The tests fail on the
development
branch, before #5534 is merged. They pass after #5534 is merged.development
branch, before Modify stair-case approximation to the EB #5534 is merged:Note that these tests fails for higher-order shapes. This will be fixed in #5209