AerosolSpecies¶
Wraps a species name, hygroscopicity, and size distribution into a single object suitable for use as a parcel-model input. The constructor accepts continuous lognormal distributions (discretized at construction time) or pre-discretized bin arrays.
AerosolSpecies ¶
AerosolSpecies(
species: str,
distribution: BaseDistribution | dict[str, Any],
kappa: float,
rho: float | None = None,
mw: float | None = None,
bins: int | NDArray[floating[Any]] | None = None,
r_min: float | None = None,
r_max: float | None = None,
)
Container for aerosol metadata and discretized size distribution.
Wraps a species name, hygroscopicity, and size distribution into a single object suitable for use as a parcel-model input. The constructor accepts three kinds of size distributions:
- Lognorm — a single log-normal mode;
binsmust also be supplied. - MultiModeLognorm — multiple log-normal modes;
binsmust also be supplied. dictwith keys"r_drys"(microns) and"Nis"(cm⁻³) — a pre-discretized distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
species
|
str
|
Name or molecular formula of the aerosol species. |
required |
distribution
|
Lognorm, MultiModeLognorm, or dict
|
Size distribution. If a |
required |
kappa
|
float
|
Kappa hygroscopicity parameter (dimensionless). |
required |
rho
|
float
|
Density of the dry aerosol material (kg m⁻³). |
None
|
mw
|
float
|
Molecular weight of the dry aerosol material (kg mol⁻¹). |
None
|
bins
|
int or array - like
|
Number of bins (int), or explicit bin-edge array in microns.
Required when |
None
|
r_min
|
float
|
Override the auto-derived lower/upper radius bounds (microns) when computing log-spaced bins. |
None
|
r_max
|
float
|
Override the auto-derived lower/upper radius bounds (microns) when computing log-spaced bins. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
nr |
int
|
Number of size bins. |
r_drys |
(ndarray, shape(nr))
|
Dry radius of each representative bin (m). |
rs |
ndarray or None
|
Bin edges (microns) for the discretized distribution; |
Nis |
(ndarray, shape(nr))
|
Number concentration of each bin (m⁻³). |
total_N |
float
|
Total number concentration (cm⁻³). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
Log-normal sulfate aerosol:
>>> aerosol1 = AerosolSpecies('(NH4)2SO4', Lognorm(mu=0.05, sigma=2.0, N=300.),
... bins=200, kappa=0.6)
Monodisperse sodium chloride:
Source code in pyrcel/aerosol.py
stats ¶
Compute useful statistics about this aerosol's size distribution.
Returns:
| Type | Description |
|---|---|
dict
|
Statistics from the underlying distribution (see
stats). If |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the stored |
Source code in pyrcel/aerosol.py
dist_to_conc ¶
dist_to_conc(
dist: BaseDistribution, r_min: float, r_max: float, rule: str = "trapezoid"
) -> float
Convert a size distribution over a bin interval to a number concentration.
Aerosol size distributions are typically reported as dN/dr (number density
per unit radius). This function integrates the pdf over [r_min, r_max]
using a simple quadrature rule to obtain the actual number concentration
in that bin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dist
|
object with a ``pdf(r)`` method
|
Representation of the size distribution. |
required |
r_min
|
float
|
Lower and upper bounds of the size bin, in the native units of |
required |
r_max
|
float
|
Lower and upper bounds of the size bin, in the native units of |
required |
rule
|
('trapezoid', 'simpson', 'midpoint')
|
Quadrature rule. |
'trapezoid'
|
Returns:
| Type | Description |
|---|---|
float
|
Number concentration of aerosol particles in the given bin. |
Examples:
>>> dist = Lognorm(mu=0.015, sigma=1.6, N=850.0)
>>> r_min, r_max = 0.00326456461236, 0.00335634401598
>>> dist_to_conc(dist, r_min, r_max)
0.114256210943