Skip to content
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 option to symmetrize fields #1038

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

AlexanderSinn
Copy link
Member

@AlexanderSinn AlexanderSinn commented Nov 7, 2023

Add option to symmetrize the fields (charge and currents before the field solve).

fields.do_symmetrize = 0

x-y plot with an offset beam:
image

fields.do_symmetrize = 1

image

  • Small enough (< few 100s of lines), otherwise it should probably be split into smaller PRs
  • Tested (describe the tests in the PR description)
  • Runs on GPU (basic: the code compiles and run well with the new module)
  • Contains an automated test (checksum and/or comparison with theory)
  • Documented: all elements (classes and their members, functions, namespaces, etc.) are documented
  • Constified (All that can be const is const)
  • Code is clean (no unwanted comments, )
  • Style and code conventions are respected at the bottom of https://github.com/Hi-PACE/hipace
  • Proper label and GitHub project, if applicable

@AlexanderSinn AlexanderSinn added the component: fields About 3D fields and slices, field solvers etc. label Nov 7, 2023
@AlexanderSinn AlexanderSinn changed the title symmetrize fields Symmetrize fields Nov 7, 2023
@AlexanderSinn AlexanderSinn changed the title Symmetrize fields Add option to symmetrize fields Nov 7, 2023
@MaxThevenet
Copy link
Member

MaxThevenet commented Nov 30, 2023

Looks great, thanks for this PR! I tested it with

mpirun -np 4 $HIPACE_dev inputs hipace.file_prefix=diags_dev/ \
    'electron.density(x,y,z) = 2.e22' \
    'ion.density(x,y,z) = 2.e22' \
    &> output_dev.txt
mpirun -np 4 $HOME/hipace/build/bin/hipace inputs hipace.file_prefix=diags_new/ \
    'electron.density(x,y,z) = 2.e22' \
    'ion.density(x,y,z) = 2.e22' \
    &> output_new.txt
mpirun -np 4 $HOME/hipace/build/bin/hipace inputs \
    fields.do_symmetrize = 1 \
    hipace.file_prefix=diags_4fold/ \
    &> output_4fold.txt

and this input file, and it works perfectly, the beam is identical after 3 time steps. We should also implement the two-fold symmetry.

Here initialised only 1/4 or the plasma, and multiplied the density by 4. When the symmetry is satisfied, it gives the same results with 4x fewer plasma particles.

@SeverinDiederichs
Copy link
Member

I can confirm, I also used the feature for the ionization-induced hosing and it worked flawlessly.

@MaxThevenet MaxThevenet merged commit 052e19d into Hi-PACE:development Nov 30, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: fields About 3D fields and slices, field solvers etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants