\n",
"\n",
" Notebook Version 2: This notebook has been updated to reflect changes made to the package DifferentialMobilityAnalyzers.jl to work with the Julia v1 series (tested with Julia 1.1.0). To read the original supplement published with the paper please switch to v1.0.0 of the package DifferentialMobilityAnalyzers.jl and/or download the virtual machine on zenodo.org which contains a complete installation that works with Julia 0.6.4 \n",
"\n",
"This notebook demostrates calculations related to the configuration where a single differential mobility analyzer (DMA) is used together with a condensation particle counter (CPC) and cloud condensation nuclei (CCN) counter. The notebook is a supplement to the manuscript \n",
"\n",
"Petters, M. D. (2018) A language to simplify computation of differential mobility analyzer response functions, Aerosol Science & Technology. \n",
"\n",
"Size resolved CCN measurements have a long history (e.g. Cruz and Pandis, 1997, Snider et al., 2006). The basic configuration is shown in Figure 1. Particles are typically dried, charge neutralized, and passed through the DMA. At the exit, the flow is split between a CPC that measures all particles and a CCN counter that measures particles that form cloud droplets at a water supersaturation set by the instrument. In this configuration the DMA voltage can either be stepped or continuously scanned. The ratio of CCN-to-CPC response function is used to determine the fraction of particles that activate at a given diameter. The diameter where 50% of the particles activate is taken to be the activation diameter. \n",
"\n",
"\n",
" Figure 1. Schematic of instrument setup for size resolved CCN measurements. \n",
"\n",
"The activation of particles into cloud droplets is proportional to the volume of solute in the particle. Therefore, larger multiply charged particles activate first. This leads to a bias in the inferred D50 diameter if the activated fraction is computed from the ratio of the raw response functions (Petters et al., 2007, 2009). This notebook demonstrates this effect using the formalism introduced with DifferentialMobilityAnalyzer.jl. \n",
"\n",
"## Block 1. Dependencies"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" \n"
],
"text/plain": [
"HTML{String}(\" \\n\")"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
"HTML{String}(\"\")"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
"HTML{String}(\"\")"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
" \n"
],
"text/plain": [
"HTML{String}(\" \\n\")"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"using Plots, Plots.PlotMeasures, Interpolations, LsqFit, DataFrames, Distributions \n",
"using DifferentialMobilityAnalyzers, SpecialFunctions, Random\n",
"plotlyjs();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Block 2. Setup DMA"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"t,p = 295.15, 1e5 # Temperature [K], Pressure [Pa]\n",
"qsa,β = 1.66e-5, 1/10 # Qsample [m3 s-1], Sample-to-sheath ratio,\n",
"r₁,r₂,l = 9.37e-3,1.961e-2,0.44369 # DMA geometry [m]\n",
"leff = 13.0 # DMA effective diffusion length [m]\n",
"m = 6 # Upper number of charges\n",
"Λ = DMAconfig(t,p,qsa,qsa/β,r₁,r₂,l,leff,:-,m,:cylindrical) # Specify DMA with negative polarity\n",
"bins,z₁,z₂ = 256, dtoz(Λ,1000e-9), dtoz(Λ,10e-9) # bins, upper, lower mobility limit\n",
"δ = setupDMA(Λ, z₁, z₂, bins); # Compute matrices"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Block 3. Compute the response functions for the above setup\n",
"The CCN transmission function is modelded using a cumulative Gauss integral \n",
"
\n",
"to find the μ,σ that best describes the data. An alternative method is to compute the regularized inverse from the the CN response function and use it to predict the ratio of 𝕣ᶜⁿ./𝕣ᶜᶜⁿ. In this case the model is\n",
"
\n",
"Methods 1 and 2 mirror the approaches in Petters et al. (2009) and Petters et al. (2007), respectively. However, the previously published approaches neither used regularization nor the formalism described here. \n",
"\n",
"Using the formalized approach, the model formulation and fitting procedure become simple and can be solved in few lines of code.\n",
"```julia\n",
"𝕟ᶜⁿ = rinv(𝕣ᶜⁿ.N, δ, λ₁= 1e-3, λ₂=1e1)\n",
"model(x,p) = (δ.𝐀*(𝕟ᶜⁿ.N.*Taf(δ.dp, p[1], p[2])))./(δ.𝐀*𝕟ᶜⁿ.N)\n",
"fit = curve_fit(model, δ.Dp, 𝕣ᶜᶜⁿ.N./𝕣ᶜⁿ.N, [65.0, 3.0])\n",
"```\n",
"Note that least square library is not setup to take the SizeDistribution data type, and thus the operation is performed on the number field of these objects. "
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"