CNMC Operations

Constant Number Monte Carlo (CNMC) maintains a fixed particle count during stochastic coagulation by performing mass-conserving merge, clone, and volume rescale operations.

StochParticles.cnmc_merge!Function
cnmc_merge!(u, sys, i, j)

Merge particle j into particle i: μᵢ ← μᵢ + μʲ. Then swap-delete particle j (move last active to slot j, decrement n_active).

StochParticles.cnmc_clone!Function
cnmc_clone!(u, sys, target_slot, source_idx)

Copy particle sourceidx into targetslot. Increment nactive. Used after merge to restore nsim count.

StochParticles.cnmc_volume_rescale!Function
cnmc_volume_rescale!(sys, μ_cloned)

Update computational volume to conserve mass concentration after cloning. Vnew = Vold × (1 + |μcloned| / Mtotal)

StochParticles.cnmc_coagulate!Function
cnmc_coagulate!(u, sys, ::Val{A}, i, j)

Full CNMC coagulation step:

  1. Merge particles i and j (mass conserving, n_active decrements)
  2. Clone a random particle into the vacated slot (n_active increments)
  3. Rescale volume to conserve mass concentration (n_sim maintained)