2D Electrostatic PIC Algorithm Guide
2D Electrostatic PIC Algorithm Guide
The process of field gathering involves locating the grid nodes surrounding each active particle and interpolating the electric and magnetic field values from these nodes onto the particle's position. This interpolation uses weights calculated for the surrounding grid positions, ensuring that each particle interaction with the field is consistent with its location relative to the grid .
In the 2D PIC algorithm, charge and current deposition is handled by first zeroing out the charge density ρ(i, j) and current density J(i, j) arrays. Then, for each active particle, the indices of the cell it resides within are located, and weights are computed for neighboring cells. These weights are used to accumulate charge and current densities in the respective cell locations .
The Boris scheme is symplectic, meaning it preserves the phase space volume and energy very well by effectively splitting the updates into half time-step electric field integrations, rotating via a magnetic field, and completing the full time-step update with another half time-step electric field integration, thus ensuring energy is conserved over long simulation times .
Perfectly Matched Layers are implemented to absorb outgoing waves at the boundaries of the simulation domain. By absorbing these waves, PMLs prevent reflection back into the computational domain, which can cause errors and artificial interference in the simulation, improving the accuracy of the results in open-boundary scenarios .
Setting up conductor/geometry masks is crucial in defining the spatial distribution and effects of boundaries within the simulation. For a metallic grating, these masks determine how electromagnetic fields interact with physical obstacles, impacting scattering, absorption, and other boundary-related phenomena. This allows the simulation to accurately reflect real-world scenarios involving complex geometries .
Diagnostics in PIC simulations are used to track energy conservation and particle count, provide visualizations of fields and particles at intervals, and help in assessing the accuracy of simulation by comparing expected results. Monitoring these diagnostics helps in adjusting simulation parameters and methods to ensure that the simulation remains accurate and stable over time .
The Courant condition imposes a stability requirement on the timestep, stating that Δt must be less than 1/(c√1/Δx² + 1/Δy²), where c is the speed of light. This ensures that numerical wave propagation does not exceed the physical wave speed, preventing instabilities and ensuring accurate time evolution of the fields .
Resolving the Debye length (λ₄) and the plasma frequency (ωₚ) ensures that the grid spacing (Δx) and timestep (Δt) are sufficiently small to capture the physical phenomena correctly. The Debye length is crucial for resolving the shortest scale of charge separation, and the plasma frequency determines the fastest natural oscillations. Failing to resolve these scales can lead to numerical instability and inaccurate representation of physical behaviors .
The necessary initializations include defining physical constants such as ε₀, μ₀, and c, setting up the spatial grid with Nx, Ny cells and spacing Δx, Δy, initializing field arrays E(i, j), B(i, j) on a staggered Yee grid, and setting up charge density array ρ(i, j) and current density J(i, j). Additionally, particles should be initialized with positions, velocities, and active/inactive flags, and any static fields and PML damping profiles should be precomputed .
Within the PIC algorithm framework, electromagnetic field solutions often use the Yee FDTD method to update magnetic and electric fields in time using curl operations and current density contributions. Electrostatic solutions, on the other hand, solve Poisson's equation for the potential, which is then used to derive electric fields by calculating the negative gradient of the potential. The choice between these methods typically depends on relative speed and field configurations in the simulation .