Forward Models

These routines are used for forward models.

Index

    Functions

    TDMA1Dpdf

    DifferentialMobilityAnalyzers.TDMA1Dpdf β€” Function
    TDMA1Dpdf(π•Ÿα΅’β‚™,  Λ₁ᡒₙ , Ξ›β‚‚α΅’β‚™, 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))
    source

    TDMA1Ddomainfunction

    DifferentialMobilityAnalyzers.TDMA1Ddomainfunction β€” Function
    TDMA1Ddomainfunction(π•Ÿα΅’β‚™,  Λ₁ᡒₙ , Ξ›β‚‚α΅’β‚™, 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))
    source