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)
VDP1computes each category's gravitational settling velocity from its diameter and density by Stokes' law with a Cunningham slip factor (:func:settling_velocityrepeats it). The diameter AERMOD reads is therefore the physical (Stokes) diameter of a particle of densityPARTDENS. Size data measured as aerodynamic diameters go in either as they are withPARTDENS 1.0, or converted to Stokes diameters with :func:aerodynamic_to_stokesand paired with the real density; both give AERMOD the same settling velocity.SRCQAwarns (W330) when the mass fractions do not sum to 1 within 2 per cent.INPPHIrejects a fraction outside 0-1 (E332),INPPDMa diameter at or below 0.001 or above 1000 microns (E335), andINPPDNa 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
top_knot
property
¶
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 |
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. |
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. |
0.0
|
diameters ¶
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 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 |
1.0
|
representative
|
str
|
|
'mean_mass'
|
convert
|
bool
|
Whether to convert the aerodynamic diameters to Stokes
diameters for |
None
|
stokes
|
bool
|
The older spelling of |
None
|
slip
|
bool
|
Passed to :func: |
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'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If a diameter, rounded to the four significant digits the
source writer puts on |
mean_mass_diameter ¶
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 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 ¶
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 ¶
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 ¶
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 |
required |
slip
|
bool
|
With |
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 ¶
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: |
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). |
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 |
required |
edges
|
sequence of float
|
Bin edges (microns, aerodynamic), strictly increasing. |
required |
lower
|
float
|
The diameter below which there is no mass ( |
None
|
anchor
|
float
|
The diameter the emission rate refers to; defaults to the largest
cut point. See :func: |
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 |
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.