Deposition

Deposition operates on fine particles. Once the coarse-to-fine interpolation is out of the picture, there isn’t much left to discuss.

lcode.deposit_kernel(grid_steps, grid_step_size, virtplasma_smallness_factor, c_x_offt, c_y_offt, c_m, c_q, c_px, c_py, c_pz, fine_grid, influence_prev, influence_next, indices_prev, indices_next, out_ro, out_jx, out_jy, out_jz)[source]

Interpolate coarse plasma into fine plasma and deposit it on the charge density and current grids.

First, the fine particle characteristics are interpolated from the coarse ones. Then the total contribution of the particles to the density and the currents is calculated and, finally, deposited on a grid in a 3x3 cell square with i, j as its center according to the weights calculated by weights(). Finally, the ion background density is added to the resulting array.

The strange incantation at the top and the need to modify the output arrays instead of returning them are dictated by the fact that ihis is actually not a function, but a CUDA kernel (for more info, refer to CUDA kernels with numba.cuda). It is launched in parallel for each fine particle, determines its 2D index (fi, fj), interpolates its characteristics from coarse particles and proceeds to deposit it.

lcode.deposit(config, ro_initial, x_offt, y_offt, m, q, px, py, pz, virt_params)[source]

Interpolate coarse plasma into fine plasma and deposit it on the charge density and current grids. This is a convenience wrapper around the deposit_kernel CUDA kernel.

This function allocates the output arrays, unpacks the arguments from config and virt_params, calculates the kernel dispatch parameters (for more info, refer to CUDA kernels with numba.cuda), and launches the kernel.

Todo

DOCS: explain deposition contribution formula (Lotov)