Forward Models
These routines are used for forward models.
Index
Functions
TDMA1Dpdf
DifferentialMobilityAnalyzers.TDMA1Dpdf
β FunctionTDMA1Dpdf(πα΅’β, Ξβα΅’β , Ξβα΅’β, dma2rangeα΅’β)
Returns a function model that models the output of a tandem DMA for an input pdf of growth factors. Tne function is specialized for a specific size distribution
- πα΅’β is the size distribution with Dp sorted in in ascending order and units of nm
- Ξβα΅’β , Ξβα΅’β DMA 1 and 2 configuration of type of DMAconfig
- dma2rangeα΅’β a tuple (Dd, gmin, gmax, n) where Dd is the dry diameter selected by DMA 1 in units of m gmin is the lower range of growth factors scanned by DMA2 gmax is the upper range of growth factor scanned by DMA2 n is the number of bins to represent the DMA2 grid
Example use
using Distributions
using DifferentialMobilityAnalyzers
using Gadfly
t, p = 295.15, 1e5
qsa, qsh = 1.66e-5, 8.33e-5
rβ, rβ, l = 9.37e-3, 1.961e-2, 0.44369
Ξβ = DMAconfig(t, p, qsa, qsh, rβ, rβ, l, 0.0, :-, 6, :cylindrical)
Ξβ = DMAconfig(t, p, qsa, qsh, rβ, rβ, l, 0.0, :-, 6, :cylindrical)
bins, zβ, zβ = 120, dtoz(Ξβ, 500e-9), dtoz(Ξβ, 30e-9) # bins, upper, lower mobility limit
Ξ΄β = setupDMA(Ξβ, zβ, zβ, bins)
Ax = [[1300.0, 60.0, 1.4], [5000.0, 220.0, 1.6]]
π = DMALognormalDistribution(Ax, Ξ΄β)
# scan 100 nm Dd from 0.8Dd to 3.0Dd with 100 bins
dma2range = (100e-9, 0.8, 3.0, 30)
# Get the model function
model = TDMA1Dpdf(π, Ξβ, Ξβ, dma2range)
# Growth factor grid along with the PDF is evaluated over
Ax = [[1300.0, 60.0, 1.4], [5000.0, 220.0, 1.6]]
π = DMALognormalDistribution(Ax, Ξ΄β)
P = [0.5,0.15, 0.10, 0.25] # Probability of growth factor (4 populations)
gf = [1.0, 1.2, 1.6, 2.1] # Values of growth factor
π = mymodel(π, P, dma2range[1], gf)
plot(x = π.Dp/(dma2range[1]*1e9), y = π.N, Geom.line,
Guide.xticks(ticks = 0.8:0.2:3),
Coord.cartesian(xmin = 0.8, xmax = 3.0))
TDMA1Ddomainfunction
DifferentialMobilityAnalyzers.TDMA1Ddomainfunction
β FunctionTDMA1Ddomainfunction(πα΅’β, Ξβα΅’β , Ξβα΅’β, dma2rangeα΅’β)
Returns a domain function that can be used with RegularizationTools.jl to create a domain matrix. The inputs are same as for TDMA1Dpdf to compute a model that models the output of a tandem DMA for an input pdf of growth factors. Tne function and matrix are specialized for a specific size distribution
- πα΅’β is the size distribution with Dp sorted in in ascending order and units of nm
- Ξβα΅’β , Ξβα΅’β DMA 1 and 2 configuration of type of DMAconfig
- dma2rangeα΅’β a tuple (Dd, gmin, gmax, n) where Dd is the dry diameter selected by DMA 1 in units of m gmin is the lower range of growth factors scanned by DMA2 gmax is the upper range of growth factor scanned by DMA2 n is the number of bins to represent the DMA2 grid
Example
using Distributions
using DifferentialMobilityAnalyzers
using RegularizationTools
using Gadfly
t, p = 295.15, 1e5
qsa, qsh = 1.66e-5, 8.33e-5
rβ, rβ, l = 9.37e-3, 1.961e-2, 0.44369
Ξβ = DMAconfig(t, p, qsa, qsh, rβ, rβ, l, 0.0, :-, 6, :cylindrical)
Ξβ = DMAconfig(t, p, qsa, qsh, rβ, rβ, l, 0.0, :-, 6, :cylindrical)
π = lognormal([[9., 40., 1.5], [500., 180., 1.4]]; d1 = 800, d2 = 10.0, bins = 120)
# scan 100 nm Dd from 0.8Dd to 3.0Dd with 100 bins
dma2range = (100e-9, 0.8, 3.0, 30)
# Get the model function
model = TDMA1Dpdf(π, Ξβ, Ξβ, dma2range)
# Growth factor grid along with the PDF is evaluated over
mgf = 0.8:0.05:2.5
# A growth factor PDF
gfpdf = pdf(truncated(Normal(1.2,0.2) , 1, 17), mgf)
# The output model
π = model(π, gfpdf, dma2range[1], mgf)
# The domain function
f = TDMA1Ddomainfunction(π, Ξβ, Ξβ, dma2range)
# Computes the design matrix
A = designmatrix(mgf, f)
# Computes the output via matrix multiplication
g = A*gfpdf
# Compare with the regular model. Note that the matrix method follows the mgf grid.
# which can be different than the model grid given via dma2range
plot(layer(x = π.Dp/(dma2range[1]*1e9), y = π.N), layer(x = mgf, y = g, Geom.line))