Data Types
Three composite data types abstract the DMA setup. The type DMAconfig includes geometry, flow rate, and polarity. The type DifferentialMobilityAnalyzer includes the DMA transmission functions, convolution matrices, and a native DMA mobility grid discretization. The type SizeDistribution includes a list of vectors to represent aerosol size distributions. Constructor functions are available to initialize these types.
Index
DifferentialMobilityAnalyzers.DMAconfig
DifferentialMobilityAnalyzers.DifferentialMobilityAnalyzer
DifferentialMobilityAnalyzers.Regvars
DifferentialMobilityAnalyzers.SizeDistribution
DifferentialMobilityAnalyzers.DMALognormalDistribution
DifferentialMobilityAnalyzers.lognormal
DifferentialMobilityAnalyzers.setupDMA
DifferentialMobilityAnalyzers.setupSMPS
DifferentialMobilityAnalyzers.setupSMPSdata
DifferentialMobilityAnalyzers.triangular
Types
DMAconfig
DifferentialMobilityAnalyzers.DMAconfig
— TypeDMAconfig
Data type to abstract the DMA geometry and state of the fluid.
t::AbstractFloat # Temperature [K]
p::AbstractFloat # Pressure [Pa]
qsa::AbstractFloat # Sample flow [m3 s-1]
qsh::AbstractFloat # Sheath flow [m3 s-1]
r1::AbstractFloat # Inner column radius [m]
r2::AbstractFloat # Outer column radius [m]
l::AbstractFloat # Column length [m]
leff::AbstractFloat # Effective length [m]
polarity::Symbol # Power supply polarity [:+] or [:-]
m::Int8 # Number of charges in charge correction [-]
DMAtype::Symbol # Designate :radial, :cylindrical
Example Usage
t,p = 295.15, 1e5
qsa,qsh = 1.66e-5, 8.3e-5
r₁,r₂,l = 9.37e-3,1.961e-2,0.44369
Λ = DMAconfig(t,p,qsa,qsh,r₁,r₂,l,13.0,:-,6,:cylindrical)
julia
When defining a radial DMA, r₁,r₂,l map to r₁,r₂,b as defined in Zhang Shou-Hua Zhang, Yoshiaki Akutsu, Lynn M. Russell, Richard C. Flagan & John H. Seinfeld (1995) Radial Differential Mobility Analyzer, Aerosol Science and Technology, 23:3, 357-372, DOI: 10.1080/02786829508965320.
DifferentialMobilityAnalyzer
DifferentialMobilityAnalyzers.DifferentialMobilityAnalyzer
— TypeDifferentialMobilityAnalyzer
The type DifferentialMobilityAnalyzer contains the DMA transmission functions, a discretized mobility grid to represent the mobility distribution and precomputed convolution matrices.
Ω::Function # DMA transfer function
Tc::Function # Charge filter Function
Tl::Function # DMA Penetration efficiency function
Z::Vector{<:AbstractFloat} # Mobility array midpoints
Ze::Vector{<:AbstractFloat} # Mobility array bin edges
Dp::Vector{<:AbstractFloat} # Mobility diameter midpoints
De::Vector{<:AbstractFloat} # Mobility diameter bin edges
ΔlnD::Vector{<:AbstractFloat} # ln(de[i+1])-ln(de[i])
𝐀::AbstractMatrix # Convolution matrix
𝐒::AbstractMatrix # Convolution matrix for initial guess
𝐎::AbstractMatrix # Convolution matrix for no charge filter
𝐈::AbstractMatrix # IdentiyMatrix
The field is initialized using one of the the constructor functions:
Diameters stored in δ are in units of nm. Mobility in m2 s-1 V-1. The functions Transfer Function Ω, Charging Probability Tc and Transmission Loss Tl take diameter in units of nm
SizeDistribution
DifferentialMobilityAnalyzers.SizeDistribution
— TypeSizeDistribution
The type SizeDistribution abstracts the aerosol size distribution. The parameter A is a set of input parameters, e.g. for a lognormal function. The form contains a symbol that traces the function or process that created the distribution.
A::Any # Input parameters [[N1,Dg1,σg1], ...] or DMA
De::Vector{<:AbstractFloat} # bin edges
Dp::Vector{<:AbstractFloat} # bin midpoints
ΔlnD::Vector{<:AbstractFloat} # ΔlnD of the grid
S::Vector{<:AbstractFloat} # spectral density
N::Vector{<:AbstractFloat} # number concentration per bin
form::Symbol # form of the size distribution [:lognormal, ....]
SizeDistributionscan be created by hand or through one of the constructor functions:
Regvars
DifferentialMobilityAnalyzers.Regvars
— TypeRegvars
The type Regvars abstracts the inversion setup, including the convolution matrix, the idenity matrix, the response function (residual vector) and the initial guess. The matrix 𝐀'𝐀 is stored as precomputed matrix to avoid recomputing it when evaluating the derivatives in the l-curve search. Setting the number of BLAS threads is experimental.
𝐀::Matrix{Float64} # Convolution matrix
𝐈::Matrix{Float64} # Identity matrix
B::Array{Float64} # residual vector
X₀::Array{Float64} # initial guess
AA::Matrix{Float64} # precomputed 𝐀'𝐀 for speed
n::Int # Blas threads
Regvars is initialized in the rinv function. See examples folder on how to use this structure at the top level.
Constructor Functions
setupDMA
DifferentialMobilityAnalyzers.setupDMA
— FunctionsetupDMA(Λ::DMAconfig, z1::Number, z2::Number, bins::Int)
Construct the DifferentialMobilityAnalyzer type for DMA configuration DMAconfig. The size grid is constructed between mobility z1 and z2, with bin + 1 edges and bin number of midpoints. Per convenction instantiations of this type are denoted as δ, or δ₁, δ₂ ... to distinguish DMA chains. The grid must be setup from low to high mobility, corresponding to large to small mobility diameter.
Diameters stored in δ are in units of nm.
Example Usage
t,p = 295.15, 1e5
qsa,qsh = 1.66e-5, 8.3e-5
r₁,r₂,l = 9.37e-3,1.961e-2,0.44369
Λ = DMAconfig(t,p,qsa,qsh,r₁,r₂,l,0.0,:-,6,:cylindrical)
bins,z₁,z₂ = 60, vtoz(Λ,10000), vtoz(Λ,10)
δ = setupDMA(Λ, z₁, z₂, bins)
setupSMPS
DifferentialMobilityAnalyzers.setupSMPS
— FunctionsetupSMPS(Λ::DMAconfig, v1::Number, v2::Number, tscan::Number, tc::Number)
Construct the DifferentialMobilityAnalyzer type for DMA configuration DMAconfig. The size grid is constructed between voltage v1 and v2, tscan is the duration of the SMPS scan in seconds, tc is the integration time per bin. The number of bins is given by tscan / tc. Per convenction instantiations of this type are denoted as δ, or δ₁, δ₂ ... to distinguish DMA chains. The grid must be setup from low voltage to high voltage. The grid is then setup in order from high to low diameter.
Diameters stored in δ are in units of nm.
t,p = 295.15, 1e5
qsa,qsh = 1.66e-5, 8.3e-5
r₁,r₂,l = 9.37e-3,1.961e-2,0.44369
Λ = DMAconfig(t,p,qsa,qsh,r₁,r₂,l,0.0,:-,6,:cylindrical)
δ = setupSMPS(Λ, 10, 10000, 180, 1.5)
setupSMPSdata
DifferentialMobilityAnalyzers.setupSMPSdata
— FunctionsetupSMPSdata(Λ::DMAconfig, V::AbstractVector)
Construct the DifferentialMobilityAnalyzer type for DMA configuration DMAconfig. The size grid is constructed for a vector of voltages sorted from low to high. The voltage correspond to bin edges and might correspond to gridded data output obtained from an SMPS. The number of bins is bins = length(V)-1.
Diameters stored in δ are in units of nm.
t,p = 295.15, 1e5
qsa,qsh = 1.66e-5, 8.3e-5
r₁,r₂,l = 9.37e-3,1.961e-2,0.44369
Λ = DMAconfig(t,p,qsa,qsh,r₁,r₂,l,0.0,:-,6,:cylindrical)
V = range(10, stop = 10000, length=121)
δ = setupSMPSdata(Λ, V)
lognormal
DifferentialMobilityAnalyzers.lognormal
— Functionlognormal(A; d1 = 8.0, d2 = 2000.0, bins = 256)
The lognormal function instantiates a the SizeDistribution type with a multi-modal lognormal distribution. The multi-modal lognormal size distribution is given by (e.g. Seinfeld and Pandis, 2006)
$\frac{dN}{d\ln D_p} = \sum_{i=1}^n \frac{N_{t,i}}{\sqrt{2\pi}\ln\sigma_{g,i}} \exp \left(- \frac{\left[\ln D_p-\ln D_{pg,i}\right]^2}{2\ln \sigma_{g,i}^2}\right)$
where $\frac{dN}{d\ln D_p}$ is the spectral number density, $N_{t,i}$ is the total number concentration, $\sigma_{g,i}$ is the geometric standard deviation, $D_{pg,i}$ is the geometric mean diameter of the $i^{th}$ mode, $n$is the number of modes.
Each mode is coded as an array of [Nt, Dg, sg]. The inputs are
- A is an array of arrays with modes, i.e. [[Nt1,Dg1,sg1],[Nt2,Dg2,sg2], ...]
- d1 is the lower diameter of the grid
- d2 is the upper diameter of the grid
- bins is the number of size bins.
By definition of the function sg >= 1, with sg1 corresponding to an infinitely narrow mode The function is unit agnostic.
Example Usage
𝕟 = lognormal([[200.0, 80.0, 1.3]]; d1 = 10, d2 = 500.0, bins = 120)
𝕟 = lognormal([[200.0, 80.0, 1.3], [200.0, 150.0, 1.3]]; d1 = 10, d2 = 800.0, bins = 60)
DMALognormalDistribution
DifferentialMobilityAnalyzers.DMALognormalDistribution
— FunctionDMALognormalDistribution(A, δ::DifferentialMobilityAnalyzer)
The DMALognormalDistribution function instantiates a the SizeDistribution type with a multi-modal lognormal distribution. The multi-modal lognormal size distribution is given by (e.g. Seinfeld and Pandis, 2006)
$\frac{dN}{d\ln D_p} = \sum_{i=1}^n \frac{N_{t,i}}{\sqrt{2\pi}\ln\sigma_{g,i}} \exp \left(- \frac{\left[\ln D_p-\ln D_{pg,i}\right]^2}{2\ln \sigma_{g,i}^2}\right)$
where $\frac{dN}{d\ln D_p}$ is the spectral number density, $N_{t,i}$ is the total number concentration, $\sigma_{g,i}$ is the geometric standard deviation, $D_{pg,i}$ is the geometric mean diameter of the $i^{th}$ mode, $n$is the number of modes.
Each mode is coded as an array of [Nt, Dg, sg]. The inputs are
- A is an array of arrays with modes, i.e. [[Nt1,Dg1,sg1],[Nt2,Dg2,sg2], ...]
- δ is a DifferentialMobilityAnalyzer
By definition of the function sg >= 1, with sg1 corresponding to an infinitely narrow mode The function is unit agnostic. The diameter grid is that from the DifferentialMobilityAnalyzer δ.
Example Usage
t,p = 295.15, 1e5
qsa,qsh = 1.66e-5, 8.3e-5
r₁,r₂,l = 9.37e-3,1.961e-2,0.44369
Λ = DMAconfig(t,p,qsa,qsh,r₁,r₂,l,0.0,:-,6,:cylindrical)
bins,z₁,z₂ = 30, vtoz(Λ,10000), vtoz(Λ,10)
δ = setupDMA(Λ, z₁, z₂, bins)
𝕟 = DMALognormalDistribution([[200.0, 80.0, 1.3]], δ)
𝕟 = DMALognormalDistribution([[200.0, 80.0, 1.3], [200.0, 150.0, 1.3]], δ)
triangular
DifferentialMobilityAnalyzers.triangular
— Functiontriangular(Λ::DMAconfig, δ::DifferentialMobilityAnalyzer, A)
Instantiates a single mode triangular distribution in mobility space with number concentration Nt and mode diameter Dg. This is a convenient constructor to model a single mode of the distribution output of an idealized DMA.
Example Usage
𝕟 = triangular(Λ, δ, [200.0, 50.0])