Skip to content

psd

psd

Particle size distributions for AERMOD's Method 1 particle deposition.

AERMOD's Method 1 takes a source's particle size distribution as three parallel lists on the SO pathway: PARTDIAM (one diameter per size category, microns), MASSFRAX (the mass fraction in each category) and PARTDENS (the particle density of each category, g/cm^3). This module builds those lists from the way size data usually arrive: cumulative mass fractions at a few cut points (AP-42's particle size multipliers, for example) or a lognormal mass distribution. It returns the :class:~pyaermod.sources.ParticleDepositionParams a source's particle_deposition field takes.

What AERMOD does with the three lists (v26135 Fortran, soset.f)
  • VDP1 computes each category's gravitational settling velocity from its diameter and density by Stokes' law with a Cunningham slip factor (:func:settling_velocity repeats it). The diameter AERMOD reads is therefore the physical (Stokes) diameter of a particle of density PARTDENS. Size data measured as aerodynamic diameters go in either as they are with PARTDENS 1.0, or converted to Stokes diameters with :func:aerodynamic_to_stokes and paired with the real density; both give AERMOD the same settling velocity.
  • SRCQA warns (W330) when the mass fractions do not sum to 1 within 2 per cent. INPPHI rejects a fraction outside 0-1 (E332), INPPDM a diameter at or below 0.001 or above 1000 microns (E335), and INPPDN a density at or below 0 (E334; W334 at or below 0.1).
Conventions

Every diameter this module takes or returns is in microns. Distributions are held in aerodynamic diameter; bin edges, cut points and lognormal medians are aerodynamic. :meth:SizeDistribution.to_deposition_params converts them to Stokes diameters whenever the density it is given is not 1, because that is the diameter AERMOD reads, and records which kind it wrote in ParticleDepositionParams.diameter_convention.

A bin's representative diameter is, by default, the mean-mass diameter ((d1^3 + d1^2 d2 + d1 d2^2 + d2^3)/4)^(1/3) (:func:mean_mass_diameter), which reproduces the 0.63, 1.85, 3.88 and 7.77 micron diameters of EPA's surfcoal test deck from the edges 0, 1, 2.5, 5 and 10 microns. The alternative is the settling-equivalent diameter sqrt((d2^2 - d1^2) / (2 ln(d2/d1))) (:func:settling_equivalent_diameter).

Examples:

AP-42 section 13.2.4 (aggregate handling) gives particle size multipliers k of 0.053, 0.20, 0.35, 0.48 and 0.74 for the mass below 2.5, 5, 10, 15 and 30 microns. With the mass below 2.5 microns spread log-linearly down to 0.5 microns:

>>> from pyaermod.psd import bins_from_cut_points
>>> dist = bins_from_cut_points(
...     {2.5: 0.053, 5: 0.20, 10: 0.35, 15: 0.48, 30: 0.74},
...     edges=[0.5, 1, 1.6, 2.5, 3.5, 5, 7, 10, 12.5, 15, 20, 25, 30],
... )
>>> round(dist.mass_fractions[0], 4)
0.0308
>>> round(dist.fraction_at_or_above(10), 3)
0.527
>>> params = dist.to_deposition_params(density=1.0)
>>> [round(d, 2) for d in params.diameters[:3]]
[0.78, 1.32, 2.08]

CumulativeMassDistribution

Bases: Protocol

A cumulative mass distribution F(d): the mass below diameter d.

F must not decrease with d. lower_limit and upper_limit are its values as d goes to 0 and to infinity; any consistent units of mass will do, because :func:bins_from_cdf normalises.

LogLinearCDF dataclass

Cumulative mass linear in ln d between knots.

knots maps a diameter (microns, above 0) to the cumulative mass below it. Between two knots F is interpolated linearly in the logarithm of the diameter; below the first knot it equals the first knot's value and above the last knot the last knot's value, so no mass lies outside the knots.

F = LogLinearCDF({0.5: 0.0, 2.5: 0.2, 10: 1.0}) round(F(5.0), 6) 0.6

lower_limit property

lower_limit: float

F below the first knot.

upper_limit property

upper_limit: float

F above the last knot.

top_knot property

top_knot: float

The largest knot diameter. The CDF is flat above it, which says nothing about the mass there: :func:bins_from_cdf reports truncated_above as unknown for bins that reach it.

LognormalCDF dataclass

Lognormal cumulative mass: Phi(ln(d / mmd) / ln(gsd)).

Parameters:

Name Type Description Default
mass_median_diameter float

Mass median diameter (microns).

required
geometric_std float

Geometric standard deviation, above 1.

required

SizeDistribution dataclass

Mass fractions in aerodynamic-diameter bins.

Parameters:

Name Type Description Default
edges sequence of float

Bin edges (microns, aerodynamic), strictly increasing, one more than there are bins. The first edge may be 0.

required
mass_fractions sequence of float

Fraction of the modelled mass in each bin; each 0 or above and summing to 1 within 1e-9.

required
anchor_ratio float

The mass in the bins divided by the mass between the first edge and the anchor size (for AP-42 factors the largest size the factor covers, such as 30 microns for PM30). Multiply the anchor's emission rate by anchor_ratio to get the rate that goes with these fractions. With the anchor inside the edges, the modelled mass below the anchor then equals the anchor's rate (for PM30, the mass below 30 um equals the AP-42 PM30 emission): the share of the anchor's mass that lay below the first edge is not lost but spread over the bins. Mass between the last edge and an anchor beyond it is lost, and lowers the ratio. 1 when the last edge is the anchor.

1.0
truncated_below float or None

Fractions of the whole distribution that lie below the first edge and above the last edge, and so are not modelled. None when the distribution does not say: cut points say nothing above the largest of them, and a power-law tail has no upper limit.

0.0
truncated_above float or None

Fractions of the whole distribution that lie below the first edge and above the last edge, and so are not modelled. None when the distribution does not say: cut points say nothing above the largest of them, and a power-law tail has no upper limit.

0.0

bins property

bins: List[Tuple[float, float, float]]

(lower, upper, mass_fraction) for every bin.

diameters

diameters(representative: str = 'mean_mass') -> List[float]

Representative aerodynamic diameter of every bin (microns).

representative is "mean_mass" (:func:mean_mass_diameter) or "settling_equivalent" (:func:settling_equivalent_diameter).

fraction_at_or_above

fraction_at_or_above(diameter: float) -> float

Fraction of the modelled mass in bins at or above diameter.

diameter must be a bin edge, or lie outside the edges, so that no bin is split. AERMOD's User's Guide recommends Method 1 when more than about 10 per cent of the mass is at or above 10 microns.

to_deposition_params

to_deposition_params(density: float = 1.0, *, representative: str = 'mean_mass', convert: Optional[bool] = None, stokes: Optional[bool] = None, slip: bool = True, drop_empty: bool = False, diameter_convention: str = 'aerodynamic') -> ParticleDepositionParams

Build the PARTDIAM/MASSFRAX/PARTDENS lists for a source.

AERMOD reads PARTDIAM as the physical (Stokes) diameter of a particle of density PARTDENS (soset.f VDP1), while this class holds aerodynamic diameters. With a density other than 1 the diameters are therefore converted with :func:aerodynamic_to_stokes before they are written, so that each bin settles in AERMOD as its aerodynamic size says. The result's diameter_convention records what was written.

Parameters:

Name Type Description Default
density float

Particle density (g/cm^3) for every bin, written to PARTDENS.

1.0
representative str

"mean_mass" or "settling_equivalent"; see :meth:diameters.

'mean_mass'
convert bool

Whether to convert the aerodynamic diameters to Stokes diameters for density. By default they are converted whenever density is not 1 (at 1 the two are the same). False writes the aerodynamic diameters unchanged beside density: with a density other than 1 that makes AERMOD settle every bin about density times faster than its aerodynamic size says, so this method warns and the validator warns again on the source.

None
stokes bool

The older spelling of convert: True converts and False does not. Earlier releases defaulted to False and so wrote aerodynamic diameters beside whatever density was given.

None
slip bool

Passed to :func:aerodynamic_to_stokes. True (the default) solves AERMOD's own settling equation, slip factor included, so the converted bin settles exactly as the aerodynamic one does; False is the textbook d_a / sqrt(rho), which AERMOD settles up to about 11 % too fast for the finest bins (tests/fixtures/psd/).

True
drop_empty bool

Leave out bins whose mass fraction is 0. AERMOD accepts them (E332 allows 0), and keeping them keeps every source on the same bins.

False
diameter_convention str

What the distribution's edges are: "aerodynamic" (the default, this class's convention) or "stokes" for a distribution measured as physical diameters of particles of density (a sieve or laser-diffraction analysis). Stokes edges are written as they are, with no conversion and no warning.

'aerodynamic'

Raises:

Type Description
ValueError

If a diameter, rounded to the four significant digits the source writer puts on PARTDIAM, falls outside AERMOD's accepted range, above 0.001 and up to 1000 microns (E335), or density is not above 0 (E334), or convert and stokes disagree. The diameters returned are not rounded.

mean_mass_diameter

mean_mass_diameter(lower: float, upper: float) -> float

Mean-mass diameter of the bin [lower, upper] (microns).

((d1^3 + d1^2 d2 + d1 d2^2 + d2^3) / 4)^(1/3): the cube root of the mean of d^3 for diameters spread uniformly across the bin, which is the diameter of the particle of average mass. From the edges 0, 1, 2.5, 5 and 10 microns it gives the 0.63, 1.85, 3.88 and 7.77 microns of EPA's surfcoal test deck. lower may be 0.

settling_equivalent_diameter

settling_equivalent_diameter(lower: float, upper: float) -> float

Settling-equivalent diameter of the bin [lower, upper] (microns).

sqrt((d2^2 - d1^2) / (2 ln(d2/d1))): the diameter whose d^2 (and so whose Stokes settling velocity, slip aside) equals the mass-weighted mean over a bin whose mass is spread uniformly in ln d. lower must be above 0, because the log-uniform spread is undefined there.

cunningham_slip_factor

cunningham_slip_factor(diameter: float) -> float

AERMOD's Cunningham slip correction for a particle of diameter microns.

1 + 2 xmfp (a1 + a2 exp(-a3 d/xmfp)) / d with d in cm, xmfp = 6.5e-6 cm, a1 = 1.257, a2 = 0.4 and a3 = 0.55, exactly as soset.f subroutine VDP1 computes SCF.

settling_velocity

settling_velocity(diameter: float, density: float) -> float

AERMOD's gravitational settling velocity (m/s) for one size category.

max(0, rho - rhoair) g d^2 SCF / (18 mu) with d in cm, rho in g/cm^3, rhoair = 1.2e-3 g/cm^3, mu = 1.81e-4 g/(cm s) and g = 9.80616 m/s^2, as soset.f subroutine VDP1 computes AVGRAV. diameter is the value on the PARTDIAM card and density the value on PARTDENS. It agrees with the Vg column AERMOD v26135 writes under DEBUGOPT DEPOS to the six digits AERMOD prints (tests/fixtures/psd/).

aerodynamic_to_stokes

aerodynamic_to_stokes(aerodynamic_diameter: float, density: float, *, slip: bool = True) -> float

Stokes (physical) diameter that AERMOD settles like aerodynamic_diameter.

Parameters:

Name Type Description Default
aerodynamic_diameter float

Aerodynamic diameter (microns): the diameter of the unit-density sphere that settles at the same speed.

required
density float

Particle density (g/cm^3), the value that will go on PARTDENS.

required
slip bool

With True (the default) the result solves AERMOD's own settling equation, so (result, density) on the PARTDIAM/PARTDENS cards gives the same settling velocity as (aerodynamic_diameter, 1.0): (rho - rhoair) d^2 SCF(d) = (1 - rhoair) d_a^2 SCF(d_a) with :func:cunningham_slip_factor. With False it is the textbook d_a / sqrt(rho), which ignores the slip factor and AERMOD's air-density term. The smaller Stokes diameter slips more, so AERMOD settles it faster than the aerodynamic size says: at density 2.65, 11% faster at 0.78 microns, 1% at 11 and 0.2% at 69 (tests/fixtures/psd/).

True
Notes

Only gravitational settling is matched. AERMOD's Brownian diffusion term depends on the physical diameter, so (d_s, rho) and (d_a, 1.0) still deposit fine particles at different rates, as real particles of those sizes would.

stokes_to_aerodynamic

stokes_to_aerodynamic(stokes_diameter: float, density: float, *, slip: bool = True) -> float

Aerodynamic diameter of a particle of stokes_diameter microns and density.

The inverse of :func:aerodynamic_to_stokes, with the same meaning of slip: with True AERMOD settles (stokes_diameter, density) and (result, 1.0) at the same speed; with False the result is d_s sqrt(rho).

bins_from_cdf

bins_from_cdf(cdf: CumulativeMassDistribution, edges: Sequence[float], *, anchor: Optional[float] = None) -> SizeDistribution

Mass fractions of cdf in the bins edges.

The mass below the first edge and above the last is dropped (truncated_below and truncated_above report it as fractions of the whole distribution) and the rest is renormalised to sum to 1. truncated_above is None when the bins reach the last knot of a :class:LogLinearCDF, which is flat there and so says nothing about the mass above it; both are None when the distribution has no upper limit (a power-law tail).

Parameters:

Name Type Description Default
cdf CumulativeMassDistribution

:class:LogLinearCDF, :class:LognormalCDF or anything with the same interface.

required
edges sequence of float

Bin edges (microns, aerodynamic), strictly increasing.

required
anchor float

The diameter the emission rate's mass refers to (30 for a PM30 rate). anchor_ratio of the result is the mass between the first edge and the last divided by the mass between the first edge and anchor; the mass below the first edge is in neither, so the anchor's rate is spread over the bins (see :class:SizeDistribution). Defaults to the last edge, giving 1.

None

bins_from_cut_points

bins_from_cut_points(cut_points: Mapping[float, float], edges: Sequence[float], *, lower: Optional[float] = None, anchor: Optional[float] = None, tail: object = None) -> SizeDistribution

Bins from cumulative mass at cut points, log-linear in between.

Parameters:

Name Type Description Default
cut_points mapping of float to float

Diameter (microns, aerodynamic) to the cumulative mass below it, in any consistent units: AP-42's particle size multipliers k work as they are.

required
edges sequence of float

Bin edges (microns, aerodynamic), strictly increasing.

required
lower float

The diameter below which there is no mass (F(lower) = 0); the mass of the first cut point is spread log-linearly down to it. Defaults to the first edge, which must then be above 0. Every cut point must lie above it.

None
anchor float

The diameter the emission rate refers to; defaults to the largest cut point. See :func:bins_from_cdf.

None
tail ``"zero"``, float or cumulative distribution

What lies above the largest cut point, needed when the edges reach beyond it: the cut points say nothing there (AP-42's multipliers stop at 30 microns), so truncated_above is None unless the tail says. "zero" puts no mass above it (truncated_above 0). A number is a power-law exponent m: the cumulative mass continues as F(top) * (d / top) ** m (the Gates-Gaudin-Schuhmann form for crushed material), unbounded, so truncated_above and truncated_below are None. A :class:LognormalCDF, or any object with the :class:CumulativeMassDistribution interface, continues the distribution with its own shape, scaled to agree at the largest cut point: F(d) = F(top) * tail(d) / tail(top). In every case the mass added above the largest cut point raises anchor_ratio with the default anchor, so the anchor's emission rate is scaled up for it. Left out with edges beyond the largest cut point, the bins there get no mass and a FutureWarning names the choices; a future release will require tail there.

None

bins_from_lognormal

bins_from_lognormal(mass_median_diameter: float, geometric_std: float, edges: Sequence[float], *, anchor: Optional[float] = None) -> SizeDistribution

Bins from a lognormal mass distribution truncated to the edges.

Mass below the first edge and above the last is left out of the bins and reported in truncated_below and truncated_above, as fractions of the whole lognormal; the rest is renormalised to sum to 1. anchor is as in :func:bins_from_cdf: the anchor's mass is counted from the first edge, so an anchor emission rate times anchor_ratio puts all of that rate in the bins, including the share the lognormal had below the first edge.