pyrcel.aerosol
.AerosolSpecies¶
-
class
pyrcel.aerosol.
AerosolSpecies
(species, distribution, kappa, rho=None, mw=None, bins=None, r_min=None, r_max=None)¶ Container class for organizing aerosol metadata.
To allow flexibility with how aerosols are defined in the model, this class is meant to act as a wrapper to contain metadata about aerosols (their species name, etc), their chemical composition (particle mass, hygroscopicity, etc), and the particular size distribution chosen for the initial dry aerosol. Because the latter could be very diverse - for instance, it might be desired to have a monodisperse aerosol population, or a bin representation of a canonical size distribution - the core of this class is designed to take those representations and homogenize them for use in the model.
To construct an
AerosolSpecies
, only the metadata (species
andkappa
) and the size distribution needs to be specified. The size distribution (distribution
) can be an instance ofLognorm
, as long as an extra parameterbins
, which is an integer representing how many bins into which the distribution should be divided, is also passed to the constructor. In this case, the constructor will figure out how to slice the size distribution to calculate all the aerosol dry radii and their number concentrations. Ifr_min
andr_max
are supplied, then the size range of the aerosols will be bracketed; else, the supplieddistribution
will contain a shape parameter or other bounds to use.Alternatively, a
dict
can be passed asdistribution
where that slicing has already occurred. In this case, distribution must have 2 keys:r_drys
andNis
. Each of the values stored to those keys should fit the attribute descriptors above (although they don’t need to be arrays - they can be any iterable.)Parameters: - species : string
Name of aerosol species.
- distribution : { LogNorm, MultiLogNorm, dict }
Representation of aerosol size distribution.
- kappa : float
Hygroscopicity of species.
- rho : float, optional
Density of dry aerosol material, kg m**-3.
- mw : float, optional
Molecular weight of dry aerosol material, kg/mol.
- bins : int
Number of bins in discretized size distribution.
Examples
Constructing sulfate aerosol with a specified lognormal distribution -
>>> aerosol1 = AerosolSpecies('(NH4)2SO4', Lognorm(mu=0.05, sigma=2.0, N=300.), ... bins=200, kappa=0.6)
Constructing a monodisperse sodium chloride distribution -
>>> aerosol2 = AerosolSpecies('NaCl', {'r_drys': [0.25, ], 'Nis': [1000.0, ]}, ... kappa=0.2)
Warning
Throws a
ValueError
if an unknown type ofdistribution
is passed to the constructor, or if bins isn’t present whendistribution
is an instance ofLognorm
.Attributes: - nr : float
Number of sizes tracked for this aerosol.
- r_drys : array of floats of length
nr
Dry radii of each representative size tracked for this aerosol, m.
- rs : array of floats of length
nr + 1
Edges of bins in discretized aerosol distribution representation, m.
- Nis : array of floats of length
nr
Number concentration of aerosol of each representative size, m**-3.
- total_N : float
Total number concentration of aerosol in this species, cm**-3.
-
__init__
(species, distribution, kappa, rho=None, mw=None, bins=None, r_min=None, r_max=None)¶ x.__init__(…) initializes x; see help(type(x)) for signature
-
stats
()¶ Compute useful statistics about this aerosol’s size distribution.
Returns: - dict
Inherits the values from the
distribution
, and ifrho
was provided, adds some statistics about the mass and mass-weighted properties.
Raises: - ValueError
If the stored
distribution
does not implement astats()
function.