Skip to content
Projects

Merging and splitting

The equations of plasmacoll.population, declared on the code that implements them and checked by the tests.

merge_markers

functionsource

Merge markers until about target remain, conserving weight, momentum and energy.

moments
W=∑iwi,u=1W∑iwivi,s2=max⁡(1W∑iwi∣vi∣2−∣u∣2, 0)W = \sum_i w_i, \qquad \mathbf u = \frac{1}{W}\sum_i w_i\mathbf v_i, \qquad s^2 = \max\Big(\frac{1}{W}\sum_i w_i|\mathbf v_i|^2 - |\mathbf u|^2,\ 0\Big)
merged
two markers of weight W2 at u±s n^, n^ isotropic, at the mean position\text{two markers of weight } \frac W2 \text{ at } \mathbf u \pm s\,\hat{\mathbf n}, \ \hat{\mathbf n} \text{ isotropic, at the mean position}
conservation
W2[(u+sn^)+(u−sn^)]=Wu,W2⋅2(∣u∣2+s2)=∑iwi∣vi∣2\frac W2\big[(\mathbf u + s\hat{\mathbf n}) + (\mathbf u - s\hat{\mathbf n})\big] = W\mathbf u, \qquad \frac W2\cdot 2\big(|\mathbf u|^2 + s^2\big) = \sum_i w_i|\mathbf v_i|^2
groups
runs of max⁡(3,⌈2NNtarget⌉) markers\text{runs of } \max\Big(3, \Big\lceil\frac{2N}{N_\mathrm{target}}\Big\rceil\Big) \text{ markers}
Assumes
  • groups within a spatial cell (cell_size) and velocity octant, sorted by speed; runs of three or more merge into two
  • weight, momentum and kinetic energy exact; the result can exceed the target when the cells hold few markers; on the host
References

split_markers

functionsource

Split every marker heavier than max_weight into equal lighter copies.

split
w→k copies of weight wk,k=⌈wwmax⁡⌉w \to k \text{ copies of weight } \frac{w}{k}, \qquad k = \Big\lceil\frac{w}{w_{\max}}\Big\rceil
Assumes
  • at the same position and velocity: weight, momentum and energy exact