ECP-WarpX / WarpX

WarpX is an advanced electromagnetic & electrostatic Particle-In-Cell code.
https://ecp-warpx.github.io
Other
303 stars 191 forks source link

RZ: `parse_density_function` incorrect on-axis density #3121

Open jjvdwOX opened 2 years ago

jjvdwOX commented 2 years ago

Hi,

Using parse_density_function in the RZ geometry is resulting in a spike in density on-axis. Here is an example setting the density function to a constant. input.txt rho_electrons_Iteration000006000

RemiLehe commented 2 years ago

Thanks for reporting this. I think that what you are seeing is a known issue for RZ grid. You can read more about it in this paper: https://www.sciencedirect.com/science/article/pii/S0021999101969232 The algorithm described in this paper mitigates the issue, but does not suppress it entirely (at least for a finite number of macroparticles per cell) - and this is indeed the algorithm that we implemented in WarpX.

In order to confirm that this is the issue, you could try to run with more particles in the r direction, i.e.

electrons.num_particles_per_cell_each_dim = 4 12 2

In principle, using more macroparticles should reduce the amplitude of the effect that you are seeing here.

jjvdwOX commented 2 years ago

Thank you for your reply. I tried doubling the number of particles per cell in the r direction as advised, but it did not reduce the on-axis density error. rho_electrons_Iteration000006000_1 input_1.txt

My main worry is that this on-axis density spike is not just a plotting error, but a real effect in the simulation which can affect on-axis physics.

jjvdwOX commented 2 years ago

As an example of how the density error affects the on-axis physics, here is a previous run of a gaussian laser pulse in a parabolic channel with high radial grid resolution rho_electrons_Iteration000042000 input_RZ_channel.txt

The density error on-axis reacts to the laser pulse and causes wave-breaking, which makes it impossible to study injection

ax3l commented 2 years ago

@dpgrote @RemiLehe does one of you like to take the lead here or assign another developer?

jlvay commented 2 years ago

@jjvdwOX There is indeed an issue on axis with the RZ FDTD solver, which needs to be addressed. In the meantime, it is best that you use the RZ PSATD solver.

jlvay commented 2 years ago

@dpgrote @RemiLehe @ax3l The RZ FDTD solver should be disabled until the issue on axis is fixed.