Skip to content

Separate particle properties from population weights

Download Python script

Separate particle properties from population weights

Section titled “Separate particle properties from population weights”

Does initializing from mass rather than radius change the physical population? The answer depends on both the per-particle properties and the weights assigned to them. This CPU example compares mass input, radius input, component masses, and represented counts. Its deliberately large masses make the arithmetic easy to inspect; they are not aerosol-scale experimental inputs.

Read size distributions first. Discrete bins sum number densities, continuous PDFs integrate dN/dr, and resolved slots sum counts before division by physical volume. The examples below use native ParticleData construction.

Python · section 1
import numpy as np
import particula as par

Retain five illustrative masses from zero to 10 kg at density 1000 kg/m^3. These large values demonstrate arithmetic, not a realistic aerosol spectrum. Each bin has number density 1 m^-3 at unit reference volume.

Python · section 2
mass_distribution = np.linspace(0, 10, 5)
mass_bins = (
par.particles.ParticleDataBuilder()
.set_distribution_type("discrete")
.set_masses(mass_distribution[:, None])
.set_density(np.array([1000.0]))
.set_concentration(np.ones(5))
.set_charge(np.zeros(5))
.set_volume(np.array([1.0]))
.build()
)
print("Radii [m]:", mass_bins.radii)
print("Material mass density [kg/m^3]:", mass_bins.species_mass_density)
print("Material inventory [kg]:", mass_bins.species_mass_inventory)
Radii [m]: [[0.         0.08419452 0.10607844 0.1214295  0.13365046]]
Material mass density [kg/m^3]: [[25.]]
Material inventory [kg]: [[25.]]

Preserve the illustrative zero-radius endpoint as zero mass in the builder. The convenience radius initializer accepts strictly positive radii; direct mass construction also expresses this zero-material bin explicitly.

Python · section 3
radii_distribution = np.linspace(0, 0.1, 5)
radius_masses = 4 * np.pi / 3 * 1000 * radii_distribution**3
radius_bins = (
par.particles.ParticleDataBuilder()
.set_distribution_type("discrete")
.set_masses(radius_masses[:, None])
.set_density(np.array([1000.0]))
.set_concentration(np.ones(5))
.set_charge(np.zeros(5))
.set_volume(np.array([1.0]))
.build()
)
print("Per-particle masses [kg]:", radius_bins.total_mass)
print("Material inventory [kg]:", radius_bins.species_mass_inventory)
Per-particle masses [kg]: [[0.         0.06544985 0.52359878 1.76714587 4.1887902 ]]
Material inventory [kg]: [[6.54498469]]

For two materials, particle volume is the sum of mass/density over material lanes. Keep each material’s inventory separately instead of losing species information in a total-mass scalar.

Python · section 4
masses_combined = np.column_stack((mass_distribution, mass_distribution))
speciated_bins = (
par.particles.ParticleDataBuilder()
.set_distribution_type("discrete")
.set_masses(masses_combined)
.set_density(np.array([1000.0, 2000.0]))
.set_concentration(np.ones(5))
.set_charge(np.zeros(5))
.set_volume(np.array([1.0]))
.build()
)
print("Radii [m]:", speciated_bins.radii)
print("Material inventory [kg]:", speciated_bins.species_mass_inventory)
Radii [m]: [[0.         0.09637866 0.1214295  0.13900208 0.15299159]]
Material inventory [kg]: [[25. 25.]]

The same positive-material particles can represent weighted physical counts. At volume 0.25 m^3, counts of two give density eight per slot. Changing a distribution tag alone is not a conversion: construct the intended weights.

Python · section 5
resolved = par.particles.create_resolved_particle_data(
masses=masses_combined[1:],
density=[1000.0, 2000.0],
concentration=np.full(4, 2.0),
volume=0.25,
)
print("Number density [m^-3]:", resolved.number_density)
print("Material inventory [kg]:", resolved.species_mass_inventory)
Number density [m^-3]: [32.]
Material inventory [kg]: [[50. 50.]]

The last resolved population represents four positive-material slots, each with count two in 0.25 m³, giving the printed 32 m⁻³. Its material inventories differ from the earlier bins because the weights and volume convention changed. The examples are separate populations, not a conservation test of a conversion.

For a faithful conversion, choose weights that preserve integrated number and each material inventory, then compare those quantities before and after. Changing only distribution_type cannot supply the missing bin widths or physical volume. Use particle construction to prepare realistic inputs, then compare coagulation representations to see why equal initial totals still do not guarantee identical trajectories.

Explore this topic: Population measures and weights