Particle Resampling

Ordinary total-f resampling

Resampling constructs candidates within populated configuration/velocity bins and fits the signed particle amounts q=w0*w1. The five equality moments are particle number, parallel momentum, magnetic moment, perpendicular energy and parallel energy. Finite positive marker volumes and normalization weights are required. A failed solve or failed physical-moment validation retains the original bin rather than committing an approximate unconstrained result.

resamp_up_choice='copy' splits each donor’s w0 and phase-space volume V=1/g among its descendants. With resamp_max_shift=0, copies retain the original coordinates exactly and preserve w0*g. A nonzero shift perturbs the coordinates before moment fitting. resamp_up_choice='random' instead draws new coordinates within the bin and interpolates w0 and g using unchanged old-marker support. The candidate volumes are normalized to preserve summed V before fitting w1. Marker w2 is reset using the configured production background, including f0_mesh_order and the species’ grid contribution.

Downsampling choices are random, weight, weight_replace and volume. Poisson-disc upsampling and empty-bin filling are unavailable. The retired optional total-f normalization-weight optimization is no longer part of this sequence. This describes total-f markers, not a dedicated full-f species path. Nodal inequalities, variance-based acceptance and relaxed-tolerance retries are not enabled by this ordinary implementation.

New marker reservations are initialized before sorting/geometry access. Final compaction removes inactive rejected reservations before the next pusher sees the particle array. Instantaneous moment and scalar-volume preservation do not establish preservation of future trajectories or long-time transport.

Portable verification

With testing enabled, build resampling_pointKernel-cpu and run it with --test. This single-MPI-rank fixture generates circular analytic geometry and noisy total-f markers at one initial spatial point without a saved mesh, equilibrium or checkpoint. The marker distribution is a constant plus a positive perturbation; the represented plasma is a bi-Maxwellian with T_perp/T_parallel=1.3 and mean parallel flow 0.3*vth, where vth=sqrt(T/m). Density, temperature and flow have modest constant radial slopes. The test checks physical moments, volume, background weight consistency, exact copies, constant-w0 random interpolation, rejected-bin identity and the active-prefix/padding contract.

The unit target also contains focused signed-weight, invalid/infeasible-fit, copy-splitting, interpolation-support and inactive-lane tests. GPU execution and long-time physical qualification require separate runs.

Post-QP validation reporting

The resampling report separately lists post-QP validation rejections for downsampling, variance resampling and upsampling. These are candidates for which the native QP solver returned success, but the fitted weights were nonfinite or the original physical moments failed the existing relative 1e-8 check. They remain included in the total failed-bin counts, and the original markers are retained. Invalid inputs and native QP failures do not enter this subset.