A million-particle source, collision and loss lifecycle
View code · Download Python script · Download complete ZIP
A million-particle source, collision and loss lifecycle
Section titled “A million-particle source, collision and loss lifecycle”The collision sampler can divide each one-second observation interval into shorter passes. Each pass schedules the full trial demand for its duration. All boxes reach the same observation time.
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 pltimport numpy as npfrom scripts.docs_gpu_figures import lifecycle_figuresfrom scripts.gpu_studies.cases import StudyCase, build_case, radius_histogramfrom 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) report["initial_histogram"] = histogram.mean(axis=0, keepdims=True).tolist() plot_results(report) print("Initial active count:", int(initial.particles.concentration.sum())) print("Slot capacity:", case.boxes * case.slots) plt.show() return report
def plot_results(report): """Draw the measured histories from a completed CUDA run.""" return lifecycle_figures( report, np.asarray(report["initial_histogram"]), "1.57 million active particles", )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 2.49 ms (cached)
Module particula.gpu.kernels.nucleation 1124f09 load on device 'cuda:0' took 4.11 ms (cached)
Module particula.gpu.kernels._population_validation 65eaa49 load on device 'cuda:0' took 1.97 ms (cached)
Module particula.gpu.kernels.slot_management 0375e2c load on device 'cuda:0' took 2.86 ms (cached)
Module particula.gpu.kernels.exhaustion 616f81d load on device 'cuda:0' took 2.77 ms (cached)
Module particula.execution.prepared_guards 5366864 load on device 'cuda:0' took 9.24 ms (cached)
Module particula.gpu.kernels.environment e11375e load on device 'cuda:0' took 4.68 ms (cached)
Module particula.gpu.kernels.coagulation 84ae354 load on device 'cuda:0' took 2.90 ms (cached)
Module particula.gpu.kernels._coagulation_native f93a244 load on device 'cuda:0' took 2.56 ms (cached)
Module particula.gpu.kernels._brownian_parallel 5433dfc load on device 'cuda:0' took 1.91 ms (cached)
Module particula.gpu.kernels._brownian_parallel f84feee load on device 'cuda:0' took 16.14 ms (cached)
Module particula.gpu.kernels._coagulation_subcycling 93efbd4 load on device 'cuda:0' took 551.00 ms (cached)
Module particula.gpu.kernels._coagulation_budget b4a3978 load on device 'cuda:0' took 20.57 ms (cached)
Module particula.gpu.kernels._brownian_parallel c0acfec load on device 'cuda:0' took 7.11 ms (cached)
Module particula.gpu.kernels.coagulation fd5b5c9 load on device 'cuda:0' took 1.61 ms (cached)
Module particula.gpu.kernels.coagulation 79e9aa8 load on device 'cuda:0' took 2.96 ms (cached)
Module particula.gpu.kernels._coagulation_subcycling ca6b3ba load on device 'cuda:0' took 4.07 ms (cached)
Module particula.gpu.kernels._coagulation_subcycling a49d377 load on device 'cuda:0' took 2887.64 ms (cached)
Module particula.gpu.kernels.condensation 14a649a load on device 'cuda:0' took 1.44 ms (cached)
Module particula.gpu.kernels.condensation 2c7d291 load on device 'cuda:0' took 4.13 ms (cached)
Module particula.gpu.kernels._condensation_native 34375de load on device 'cuda:0' took 3.61 ms (cached)
Module particula.gpu.kernels.thermodynamics 563d292 load on device 'cuda:0' took 4.04 ms (cached)
Module particula.gpu.kernels.condensation c7ee7df load on device 'cuda:0' took 2.01 ms (cached)
Module particula.gpu.kernels.condensation 57dfed0 load on device 'cuda:0' took 3.86 ms (cached)
Module particula.gpu.kernels.condensation 90d906f load on device 'cuda:0' took 0.70 ms (cached)
Module particula.gpu.kernels._condensation_native 9623455 load on device 'cuda:0' took 16.81 ms (cached)
Module particula.gpu.kernels.condensation ad1042e load on device 'cuda:0' took 1.24 ms (cached)
Module particula.gpu.kernels._condensation_native 76403ad load on device 'cuda:0' took 3.69 ms (cached)
Module particula.gpu.kernels.condensation 988653c load on device 'cuda:0' took 2.57 ms (cached)
Module particula.gpu.kernels._condensation_native c295a4d load on device 'cuda:0' took 3.50 ms (cached)
Module particula.gpu.kernels._condensation_native a80ebff load on device 'cuda:0' took 3.06 ms (cached)
Module particula.gpu.kernels.condensation 6eb1df8 load on device 'cuda:0' took 6.61 ms (cached)
Module particula.gpu.kernels.condensation c2ff18f load on device 'cuda:0' took 1.08 ms (cached)
Module particula.gpu.kernels.condensation 04fd3c4 load on device 'cuda:0' took 1.46 ms (cached)
Module particula.gpu.kernels._condensation_native ff4cf87 load on device 'cuda:0' took 84.07 ms (cached)
Module particula.gpu.kernels.wall_loss 6dc09db load on device 'cuda:0' took 3.00 ms (cached)
Module particula.gpu.kernels._wall_loss_native 314c0ac load on device 'cuda:0' took 2.70 ms (cached)
Module particula.gpu.kernels.dilution 0472484 load on device 'cuda:0' took 1.52 ms (cached)
Module warp.utils f35afd3 load on device 'cuda:0' took 1.25 ms (cached)
Module warp.math edde159 load on device 'cuda:0' took 2.39 ms (cached)
Module warp.marching_cubes fb6e712 load on device 'cuda:0' took 2.61 ms (cached)
Module particula.execution.communication 2909959 load on device 'cuda:0' took 1.25 ms (cached)
Module particula.gpu.kernels.communication ac9b2a2 load on device 'cuda:0' took 2.03 ms (cached)
Module particula.gpu.properties.gas_properties edde159 load on device 'cuda:0' took 2.38 ms (cached)
Module particula.gpu.properties.particle_properties edde159 load on device 'cuda:0' took 2.39 ms (cached)
Module particula.gpu.dynamics.coagulation_funcs edde159 load on device 'cuda:0' took 2.39 ms (cached)
Module particula.gpu.dynamics.condensation_funcs edde159 load on device 'cuda:0' took 2.38 ms (cached)
Module particula.gpu.kernels._condensation_parallel edde159 load on device 'cuda:0' took 2.42 ms (cached)
Module particula.execution.gpu_resources 30f296c load on device 'cuda:0' took 2.23 ms (cached)
Module particula.gpu.warp_types edde159 load on device 'cuda:0' took 1.42 ms (cached)
Module particula.execution.prepared_diagnostics ca06582 load on device 'cuda:0' took 4.04 ms (cached)
Module particula.gpu.dynamics.ion_pair_data edde159 load on device 'cuda:0' took 4.54 ms (cached)
Module particula.gpu.dynamics.van_der_waals edde159 load on device 'cuda:0' took 4.54 ms (cached)
Module particula.gpu.kernels.ion_condensation 79e70b9 load on device 'cuda:0' took 3.40 ms (cached)
Module particula.gpu.dynamics.wall_loss_funcs edde159 load on device 'cuda:0' took 2.40 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': 1577646.0, 'sink_mass_kg_by_material': [0.0, 0.0], 'max_box_species_relative_error': 6.661338147750939e-16}
{'process': 'MassCondensation', 'number_before': 1577646.0, 'number_after': 1577646.0, 'sink_mass_kg_by_material': [0.0, 0.0], 'max_box_species_relative_error': 4.440892098500626e-16}
{'process': 'WallLoss', 'number_before': 1577646.0, 'number_after': 1564044.0, 'sink_mass_kg_by_material': [2.4882406718601863e-10, 1.0346345769750808e-14], 'max_box_species_relative_error': 1.3322676295501878e-15}
{'process': 'Dilution', 'number_before': 1564044.0, 'number_after': 1533073.853793391, 'sink_mass_kg_by_material': [2.25430032252044e-09, 1.1244857075915826e-14], 'max_box_species_relative_error': 3.1086244689504383e-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 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.
Study resources
Section titled “Study resources”Explore this topic: Prepared simulations