Hi-PACE / hipace

Highly efficient Plasma Accelerator Emulation, quasistatic particle-in-cell code
https://hipace.readthedocs.io
Other
54 stars 15 forks source link

Add option to symmetrize fields #1038

Closed AlexanderSinn closed 12 months ago

AlexanderSinn commented 1 year ago

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

MaxThevenet commented 12 months ago

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 commented 12 months ago

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