Skip to content

A million-particle source, collision and loss lifecycle

Download Python script · Download script with helper and data files (.zip)

A million-particle source, collision and loss lifecycle

Section titled “A million-particle source, collision and loss lifecycle”

Can a multi-process run explain why particles disappear while also preserving its exact continuation after a restart? Follow the first-cycle process ledger before reading the final size distribution. This connects physical source and sink accounting with the prepared simulation interface.

4,096 boxes × 512 slots × 75% occupancy = 1,572,864 active particles. Each particle has water and dry material; gas has an inert lane, a precursor and water. The ordered schedule is nucleation → Brownian coagulation → condensation → spherical wall loss → dilution, with four one-second cycles.

The first cycle injects exactly two neutral, unit-count particles per box. Remaining precursor is then explicitly removed and its mass recorded. This source-off boundary matters: dilution changes surviving multiplicities, so later injection of unit-count particles would violate the current Brownian requirement for equal active counts within a box.

Before the composed run, each process is observed separately to check its per-box, per-material source or sink. The composed first cycle must match those results exactly. A checkpoint then continues in a fresh session; captured and ordinary execution must produce identical complete state and random continuation. Editing detached inspection arrays must change neither. The downloadable ZIP includes the full auditable study helpers.

Python · section 1
"""Manually refreshed large native CUDA lifecycle with exact continuation."""
import matplotlib.pyplot as plt
import warp as wp
from scripts.docs_gpu_figures import lifecycle_figures
from scripts.gpu_studies.cases import StudyCase, build_case, radius_histogram
from scripts.gpu_studies.trajectories import run_trajectory
def run_example():
"""Run the full million-particle workload, reference ledger and continuations."""
case = StudyCase(
"million-lifecycle",
"full",
4096,
512,
occupancy=0.75,
time_step=1.0,
steps=4,
experiment="lifecycle",
)
initial, process, processes = build_case(case)
_, histogram = radius_histogram(initial)
report = run_trajectory(case, initial, process, processes)
lifecycle_figures(
report,
histogram,
"1.57 million active particles · " + wp.get_device("cuda:0").name,
)
print("Initial active count:", int(initial.particles.concentration.sum()))
print("Slot capacity:", case.boxes * case.slots)
plt.show()
return report

Distinguish process effects from conservation

Section titled “Distinguish process effects from conservation”

Nucleation increases number, coagulation decreases it, and condensation can grow particles without changing their count. Wall loss removes complete resolved slots; dilution scales represented counts and gas concentration. The signed count panel shows the first cycle only. The final histogram includes all four cycles. Neither number nor total aerosol mass is conserved across wall loss and dilution; the per-process ledger accounts for them.

This is a fixed-capacity illustration of supported physics, not a calibrated chamber. It uses real CUDA execution and float64 state. Refresh it manually; its full workload is excluded from routine CI and may use a longer timeout.

Python · section 2
if __name__ == "__main__":
run_example()
Explicit cuda invocation
result = run_example()
Warp 1.11.1 initialized:
   CUDA Toolkit 12.9, Driver 13.4
   Devices:
     "cpu"      : "CPU"
     "cuda:0"   : "NVIDIA GeForce RTX 5060" (8 GiB, sm_120, mempool enabled)
   Kernel cache:
     ~/.cache/warp/1.11.1
Module particula.execution.prepared_nucleation_kernels 666424a load on device 'cuda:0' took 1.49 ms  (cached)
Module particula.gpu.kernels.nucleation 1124f09 load on device 'cuda:0' took 2.49 ms  (cached)
Module particula.gpu.kernels._population_validation 65eaa49 load on device 'cuda:0' took 1.72 ms  (cached)
Module particula.gpu.kernels.slot_management 0375e2c load on device 'cuda:0' took 1.29 ms  (cached)
Module particula.gpu.kernels.exhaustion ccbadfa load on device 'cuda:0' took 2.22 ms  (cached)
Module particula.execution.prepared_guards e16d312 load on device 'cuda:0' took 5.89 ms  (cached)
Module particula.gpu.kernels.environment e11375e load on device 'cuda:0' took 0.84 ms  (cached)
Module particula.gpu.kernels.coagulation 9ee9d75 load on device 'cuda:0' took 1.39 ms  (cached)
Module particula.gpu.kernels._coagulation_native f93a244 load on device 'cuda:0' took 1.64 ms  (cached)
Module particula.gpu.kernels._brownian_parallel 17ce68f load on device 'cuda:0' took 1.64 ms  (cached)
Module particula.gpu.kernels._brownian_parallel 326c699 load on device 'cuda:0' took 279.19 ms  (cached)
Module particula.gpu.kernels.coagulation 2ead52b load on device 'cuda:0' took 15.27 ms  (cached)
Module particula.gpu.kernels.coagulation fed17be load on device 'cuda:0' took 0.67 ms  (cached)
Module particula.gpu.kernels.condensation 14a649a load on device 'cuda:0' took 1.49 ms  (cached)
Module particula.gpu.kernels.condensation 2c7d291 load on device 'cuda:0' took 1.78 ms  (cached)
Module particula.gpu.kernels._condensation_native 34375de load on device 'cuda:0' took 1.41 ms  (cached)
Module particula.gpu.kernels.thermodynamics 563d292 load on device 'cuda:0' took 1.75 ms  (cached)
Module particula.gpu.kernels.condensation c7ee7df load on device 'cuda:0' took 0.45 ms  (cached)
Module particula.gpu.kernels.condensation 57dfed0 load on device 'cuda:0' took 1.56 ms  (cached)
Module particula.gpu.kernels.condensation 532e336 load on device 'cuda:0' took 1.41 ms  (cached)
Module particula.gpu.kernels._condensation_native 9623455 load on device 'cuda:0' took 10.31 ms  (cached)
Module particula.gpu.kernels.condensation 6dcf18e load on device 'cuda:0' took 1.45 ms  (cached)
Module particula.gpu.kernels._condensation_native 76403ad load on device 'cuda:0' took 1.09 ms  (cached)
Module particula.gpu.kernels.condensation 2720b0c load on device 'cuda:0' took 2.58 ms  (cached)
Module particula.gpu.kernels._condensation_native c295a4d load on device 'cuda:0' took 1.03 ms  (cached)
Module particula.gpu.kernels._condensation_native a80ebff load on device 'cuda:0' took 2.32 ms  (cached)
Module particula.gpu.kernels.condensation b8d2505 load on device 'cuda:0' took 2.87 ms  (cached)
Module particula.gpu.kernels.condensation bda5d03 load on device 'cuda:0' took 2.02 ms  (cached)
Module particula.gpu.kernels.condensation 3ac4759 load on device 'cuda:0' took 1.97 ms  (cached)
Module particula.gpu.kernels._condensation_native ff4cf87 load on device 'cuda:0' took 54.03 ms  (cached)
Module particula.gpu.kernels.wall_loss 6dc09db load on device 'cuda:0' took 4.28 ms  (cached)
Module particula.gpu.kernels._wall_loss_native 314c0ac load on device 'cuda:0' took 1.67 ms  (cached)
Module particula.gpu.kernels.dilution 0472484 load on device 'cuda:0' took 1.86 ms  (cached)
Module warp.utils f35afd3 load on device 'cuda:0' took 1.34 ms  (cached)
Module warp.math edde159 load on device 'cuda:0' took 2.11 ms  (cached)
Module warp.marching_cubes fb6e712 load on device 'cuda:0' took 1.77 ms  (cached)
Module particula.execution.communication 2909959 load on device 'cuda:0' took 1.46 ms  (cached)
Module particula.gpu.kernels.communication ac9b2a2 load on device 'cuda:0' took 2.81 ms  (cached)
Module particula.gpu.properties.gas_properties edde159 load on device 'cuda:0' took 2.15 ms  (cached)
Module particula.gpu.properties.particle_properties edde159 load on device 'cuda:0' took 2.20 ms  (cached)
Module particula.gpu.dynamics.coagulation_funcs edde159 load on device 'cuda:0' took 2.20 ms  (cached)
Module particula.gpu.dynamics.condensation_funcs edde159 load on device 'cuda:0' took 2.20 ms  (cached)
Module particula.gpu.kernels._condensation_parallel edde159 load on device 'cuda:0' took 2.20 ms  (cached)
Module particula.execution.gpu_resources 30f296c load on device 'cuda:0' took 2.02 ms  (cached)
Module particula.gpu.warp_types edde159 load on device 'cuda:0' took 2.19 ms  (cached)
Module particula.execution.prepared_diagnostics ca06582 load on device 'cuda:0' took 1.90 ms  (cached)
Module particula.gpu.dynamics.wall_loss_funcs edde159 load on device 'cuda:0' took 2.04 ms  (cached)
{'process': 'Nucleation', 'number_before': 1572864.0, 'number_after': 1581056.0, 'sink_mass_kg_by_material': [0.0, 0.0], 'max_box_species_relative_error': 2.220446049250313e-16}
{'process': 'Coagulation', 'number_before': 1581056.0, 'number_after': 1577606.0, 'sink_mass_kg_by_material': [0.0, 0.0], 'max_box_species_relative_error': 6.661338147750939e-16}
{'process': 'MassCondensation', 'number_before': 1577606.0, 'number_after': 1577606.0, 'sink_mass_kg_by_material': [0.0, 0.0], 'max_box_species_relative_error': 4.440892098500626e-16}
{'process': 'WallLoss', 'number_before': 1577606.0, 'number_after': 1564015.0, 'sink_mass_kg_by_material': [2.478964457750803e-10, 1.0362556114959065e-14], 'max_box_species_relative_error': 1.3322676295501878e-15}
{'process': 'Dilution', 'number_before': 1564015.0, 'number_after': 1533045.428031865, 'sink_mass_kg_by_material': [2.2543186906550537e-09, 1.124453608957459e-14], 'max_box_species_relative_error': 2.886579864025407e-15}
Restart exact: True Capture exact: True Snapshot isolated: True
Explicit precursor removal (kg): 8.000265538524819e-21
Initial active count: 1572864
Slot capacity: 2097152
A million-particle source, collision and loss lifecycle: saved scientific figure
A million-particle source, collision and loss lifecycle · saved execution output

A reproducible trajectory still needs a physical comparison

Section titled “A reproducible trajectory still needs a physical comparison”

The first-cycle ledger identifies which process changes number or material; exact restart and capture comparisons show that execution choices preserve the tested trajectory. Those are different checks. A final histogram alone cannot identify how much change came from collisions versus selective wall removal.

To investigate that competition, rerun matched controls with one process omitted and compare number, species inventories, and size-dependent survival. Keep the source-off boundary and equal-count collision requirement explicit. Repeat seeds before interpreting small differences, and refine the timestep and process order before treating this fixed-capacity illustration as a chamber prediction.

Explore this topic: Prepared simulations