From f96496210cb5d752b599358e4ecc12634f081728 Mon Sep 17 00:00:00 2001 From: jialinl6 Date: Fri, 29 Mar 2024 00:51:42 -0500 Subject: [PATCH 1/6] Add VBS function and test --- Project.toml | 4 +++- src/Aerosol.jl | 9 +++++---- src/VBS.jl | 29 +++++++++++++++++++++++++++++ test/VBS_test.jl | 14 ++++++++++++++ test/runtests.jl | 5 ++++- 5 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 src/VBS.jl create mode 100644 test/VBS_test.jl diff --git a/Project.toml b/Project.toml index f5418fb2..e47fb8ae 100644 --- a/Project.toml +++ b/Project.toml @@ -35,6 +35,8 @@ julia = "1" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec" [targets] -test = ["Test"] +test = ["Test","NonlinearSolve"] + diff --git a/src/Aerosol.jl b/src/Aerosol.jl index 009db0fa..0cdac450 100644 --- a/src/Aerosol.jl +++ b/src/Aerosol.jl @@ -1,9 +1,10 @@ module Aerosol -using Reexport +#using Reexport -include("isorropia/isorropia.jl") -@reexport using .ISORROPIA -@reexport using .ISORROPIA.MyUnits +include("VBS.jl") +# include("isorropia/isorropia.jl") +# @reexport using .ISORROPIA +# @reexport using .ISORROPIA.MyUnits end diff --git a/src/VBS.jl b/src/VBS.jl new file mode 100644 index 00000000..cabd5a72 --- /dev/null +++ b/src/VBS.jl @@ -0,0 +1,29 @@ +using ModelingToolkit, Unitful +export VBS + +function calc_Ci_star(T, Ci_star_standard) + T1 = 300 #[unit = u"K"]# K + ΔH = 100000 #[unit = u"J/mol"] # J/mol + R = 8.314 #[unit = u"J/K/mol"] # J/K/mol + return Ci_star_standard / exp(ΔH/R*(1/(T)-1/T1)) +end +@register_symbolic calc_Ci_star(T, Ci_star_standard) + +function VBS(Ci) + @parameters T = 300 [unit = u"K", description = "temperature"] + @parameters T_unit = 1 [unit = u"K"] + @variables Ci_star[1:8] [description = "saturation concentrations"] + + #Ci = [2.5, 1.8, 4.0, 4.0, 5.8, 4.8, 6.3, 8.0] + Ci_star_standard = [0.01,0.1,1,10,100,1000,10000,100000] #[description = "standard saturation concentrations"] + @parameters C_OA_unit = 1 [unit = u"m^3/μg", description = "make C_OA unitless"] + @variables C_OA [unit = u"μg/(m^3)", description = "organic compound in aerosol phase"] + @variables ξ[1:8] [description = "partitioning coefficient at corresponding Ci_star"] + + eqs = [ + [ξ[i] ~ 1/(1+calc_Ci_star(T/T_unit,Ci_star_standard[i])/(C_OA*C_OA_unit)) for i ∈ 1:8] + C_OA*C_OA_unit ~ sum(ξ.*Ci) + ] + + NonlinearSystem(eqs, [C_OA, collect(ξ)...], [T,C_OA_unit,T_unit]; name=:VBS) +end diff --git a/test/VBS_test.jl b/test/VBS_test.jl new file mode 100644 index 00000000..5a29431b --- /dev/null +++ b/test/VBS_test.jl @@ -0,0 +1,14 @@ +using Aerosol +using NonlinearSolve, ModelingToolkit + +@testset "VBS" begin + Ci = [2.5, 1.8, 4.0, 4.0, 5.8, 4.8, 6.3, 8.0] + ns = VBS(Ci) + simplens = structural_simplify(ns) + @unpack C_OA = simplens + guess = [29] + params = [] + prob = NonlinearProblem(simplens, guess, params) + sol = solve(prob, TrustRegion()) + @test sol[C_OA] ≈ 10.6 atol=1e-2 +end \ No newline at end of file diff --git a/test/runtests.jl b/test/runtests.jl index 2e7daad2..962d6f1e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,5 +3,8 @@ using Test using SafeTestsets @testset "Aerosol.jl" begin - @safetestset "isorropia" begin include(joinpath(@__DIR__, "isorropia", "runtests.jl")) end + #@safetestset "isorropia" begin include(joinpath(@__DIR__, "isorropia", "runtests.jl")) end + @safetestset "VBS" begin + include("VBS_test.jl") + end end From 554412074fe87dd90126fd2889273d3ae87e061e Mon Sep 17 00:00:00 2001 From: jialinl6 Date: Fri, 29 Mar 2024 00:55:38 -0500 Subject: [PATCH 2/6] Uncomment isorropia --- src/Aerosol.jl | 8 ++++---- test/runtests.jl | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Aerosol.jl b/src/Aerosol.jl index 0cdac450..02701182 100644 --- a/src/Aerosol.jl +++ b/src/Aerosol.jl @@ -1,10 +1,10 @@ module Aerosol -#using Reexport +using Reexport include("VBS.jl") -# include("isorropia/isorropia.jl") -# @reexport using .ISORROPIA -# @reexport using .ISORROPIA.MyUnits +include("isorropia/isorropia.jl") +@reexport using .ISORROPIA +@reexport using .ISORROPIA.MyUnits end diff --git a/test/runtests.jl b/test/runtests.jl index 962d6f1e..b564be56 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,7 +3,7 @@ using Test using SafeTestsets @testset "Aerosol.jl" begin - #@safetestset "isorropia" begin include(joinpath(@__DIR__, "isorropia", "runtests.jl")) end + @safetestset "isorropia" begin include(joinpath(@__DIR__, "isorropia", "runtests.jl")) end @safetestset "VBS" begin include("VBS_test.jl") end From 4422e0621a5f5ce961808560fd55310b9d5060f8 Mon Sep 17 00:00:00 2001 From: jialinl6 Date: Fri, 29 Mar 2024 12:33:42 -0500 Subject: [PATCH 3/6] Add unit test for different temeprature --- src/VBS.jl | 1 - test/VBS_test.jl | 14 +++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/VBS.jl b/src/VBS.jl index cabd5a72..4c500d52 100644 --- a/src/VBS.jl +++ b/src/VBS.jl @@ -14,7 +14,6 @@ function VBS(Ci) @parameters T_unit = 1 [unit = u"K"] @variables Ci_star[1:8] [description = "saturation concentrations"] - #Ci = [2.5, 1.8, 4.0, 4.0, 5.8, 4.8, 6.3, 8.0] Ci_star_standard = [0.01,0.1,1,10,100,1000,10000,100000] #[description = "standard saturation concentrations"] @parameters C_OA_unit = 1 [unit = u"m^3/μg", description = "make C_OA unitless"] @variables C_OA [unit = u"μg/(m^3)", description = "organic compound in aerosol phase"] diff --git a/test/VBS_test.jl b/test/VBS_test.jl index 5a29431b..1a218032 100644 --- a/test/VBS_test.jl +++ b/test/VBS_test.jl @@ -1,7 +1,7 @@ using Aerosol using NonlinearSolve, ModelingToolkit -@testset "VBS" begin +@testset "VBS_typical" begin Ci = [2.5, 1.8, 4.0, 4.0, 5.8, 4.8, 6.3, 8.0] ns = VBS(Ci) simplens = structural_simplify(ns) @@ -11,4 +11,16 @@ using NonlinearSolve, ModelingToolkit prob = NonlinearProblem(simplens, guess, params) sol = solve(prob, TrustRegion()) @test sol[C_OA] ≈ 10.6 atol=1e-2 +end + +@testset "different_temperature" begin + Ci = [2.5, 1.8, 4.0, 4.0, 5.8, 4.8, 6.3, 8.0] + ns = VBS(Ci) + simplens = structural_simplify(ns) + @unpack C_OA,T = simplens + guess = [29] + params = [T=>285] + prob = NonlinearProblem(simplens, guess, params) + sol = solve(prob, TrustRegion()) + @test sol[C_OA] ≈ 15.93 atol=1e-2 end \ No newline at end of file From e5b760ecce93521fbd6a55553c22d2ba909167fb Mon Sep 17 00:00:00 2001 From: jialinl6 Date: Thu, 4 Apr 2024 13:57:46 -0500 Subject: [PATCH 4/6] Add documentation for VBS and update VBS function --- docs/make.jl | 1 + docs/src/VBS.md | 108 ++++++++++++++++++++++++++++++++++++++++++++++++ src/VBS.jl | 27 ++++++++++-- 3 files changed, 132 insertions(+), 4 deletions(-) create mode 100644 docs/src/VBS.md diff --git a/docs/make.jl b/docs/make.jl index 2fcca8fa..c74990de 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -16,6 +16,7 @@ makedocs(; repo = Remotes.GitHub("EarthSciML", "Aerosol.jl"), pages=[ "Home" => "index.md", + "VBS" => "VBS.md", "Thermodynamics" => [ "Isorropia" => [ "Overview" => "isorropia/overview.md", diff --git a/docs/src/VBS.md b/docs/src/VBS.md new file mode 100644 index 00000000..f34e9da5 --- /dev/null +++ b/docs/src/VBS.md @@ -0,0 +1,108 @@ +# VBS: Volatility Basis Set (VBS) model that deals with the partitioning of Secondary Organic Aerosol (SOA) + +## Model + +This is an implementation of the model to simulate the behavior of semivolatile organic compounds in the atmosphere, as described in Donahue et al. (2006): + +> [Donahue, N. M., Robinson, A. L., Stanier, C. O., & Pandis, S. N. (2006). Coupled partitioning, dilution, and chemical aging of semivolatile organics. *Environmental science & technology*, 40(8), 2635-2643.](https://pubs.acs.org/doi/10.1021/es052297c) + +We can create an instance of the model in the following manner. ```Ci``` is the input of the function, which is the organic compound concentration in all phases (air and aerosol phase), values were read from the original Figure 1.(a): + +```@example 2 +using Aerosol +using NonlinearSolve, ModelingToolkit + +Ci = [2.5, 1.8, 4.0, 4.0, 5.8, 4.8, 6.3, 8.0] +ns = VBS(Ci) +nothing # hide +``` +We could solve and visualize the results with the following codes, Let's try reproducing Figure 1.(a): +```@example 2 +simplens = structural_simplify(ns) +@unpack C_OA,ξ = simplens +guess = [29] # initial guess of the C_OA, the total organic compound in aerosol phase +params = [] +prob = NonlinearProblem(simplens, guess, params) +sol = solve(prob, TrustRegion()) +nothing # hide +``` +Figure 1.(a) shows a partitioning in ideal situations that compounds are distributed without any potential effects. The green part is the concentration of organic compounds in aerosol phase and white part is the concentration in gas phase. +```@example 2 +using Plots +p1 = begin + x = log10.([0.01,0.1,1,10,100,1000,10000,100000]) + p = bar(x,Ci,label="total",color=:white) + bar!(x,sol[ξ].*Ci,label="condensed-phase",color=:green) + ylabel!("Organic Mass, μg/m³") + xlabel!("log10(C*)") + title!("Typical Ambient Partitioning") +end +``` +Let's try reproducing Figure 1.(b): Semi-volatile emissions as they might appear near the output of a primarysource, before substantial dilution into the background atmosphere (only enough dilution to cool the emissions to ambient temperatureis assumed). The high loading leads to partitioning well into the highC* end of the distribution, as shown in brown. Note the scale oftheyaxis (mg/m³). +```@example 2 +Ci_2 = [0.4, 0.8, 1.25, 1.7, 2.1, 2.5, 3, 3.4].*1000 # The unit of Ci is μg/m³, and the values read from the original Figure 1(b) are in units of mg/m³ +ns2 = VBS(Ci_2) +@unpack C_OA,ξ = structural_simplify(ns2) +prob2 = NonlinearProblem(structural_simplify(ns2), [10000], []) +sol2 = solve(prob2, TrustRegion()) +p2 = begin + x = log10.([0.01,0.1,1,10,100,1000,10000,100000]) + p = bar(x,Ci_2,label="total",color=:white) + bar!(x,sol2[ξ].*Ci_2,label="condensed-phase",color=:red) + ylabel!("Organic Mass, mg/m³") + xlabel!("log10(C*)") + title!("Cooled Fresh Emissions") +end +``` +Let's try reproducing Figure 1.(c): The effect of dilution by pure air on the emissionsdepicted above. The dilution factor of 1000 is indicated with a horizontal black arrow. Dilution by a factor of 1000 reduces the aerosolmass by a factor of 4000 because of repartitioning into the vapor phase +```@example 2 +Ci_3 = [0.4, 0.8, 1.25, 1.7, 2.1, 2.5, 3, 3.4] +@unpack C_OA,ξ = structural_simplify(VBS(Ci_3)) +sol3 = solve(NonlinearProblem(structural_simplify(VBS(Ci_3)), [10], []), TrustRegion()) +p3 = begin + x = log10.([0.01,0.1,1,10,100,1000,10000,100000]) + p = bar(x,Ci_3,label="total",color=:white) + bar!(x,sol3[ξ].*Ci_3,label="condensed-phase",color=:red) + ylabel!("Organic Mass, μg/m³") + xlabel!("log10(C*)") + title!("Diluted Emissions (dilution factor = 1000)") +end +``` +Let's try reproducing Figure 1.(d): The effect of dilution, as depicted in panel b above but nowinto background air represented in panel a above. The partitioning of the background organic material and the fresh emissions are keptseparate, in green and brown, only for illustrative purposes. The vapor portions of the background and the fresh emissions are alsoseparated, though each is shown with a white bar. +```@example 2 +p4 = begin + x = log10.([0.4, 0.8, 1.25, 1.7, 2.1, 2.5, 3, 3.4]) + Ci_sum = Ci .+ Ci_3 + p = bar(x,Ci_sum,label="total",color=:white) + both = sol[ξ].*Ci .+ sol3[ξ].*Ci_3 + bar!(x,both,label="diluted emission",color=:red) + bar!(x,sol[ξ].*Ci,label="background",color=:green) + ylabel!("Organic Mass, μg/m³") + xlabel!("log10(C*)") + title!("Emission & Background Mixed") +end +``` +## Temperature dependence +Temperature dependece was taken into consideration. A basis set of saturationconcentrations (ranging from 1 ng to 100 mg at 300 K) changes withtemperature according to the Clausius Clapeyron equation. Let's try reproducing Figure 2: +```@example 2 +Ci_t = [0.4,0.55,0.7,1.1,1.25,1.45,1.7,1.8,2] # values were read from the original Figure +ns_t = VBS(Ci_t,[0.001,0.01,0.1,1,10,100,1000,10000,100000]) # The second input of the VBS function is different basic set at standard temperatures, ranging from 1 ng to 100 mg at 300 K +@unpack C_OA,ξ,T = structural_simplify(ns_t) +params1 = [T=>310] # Temperature is an adjustable parameter in the model. +params2 = [T=>285] +prob_310 = NonlinearProblem(structural_simplify(ns_t), [29], params1) +prob_285 = NonlinearProblem(structural_simplify(ns_t), [29], params2) +sol_310 = solve(prob_310, TrustRegion()) +sol_285 = solve(prob_285, TrustRegion()) + +# Helpful visualize function +function pl_t(sol,string::String) + x = log10.([0.001,0.01,0.1,1,10,100,1000,10000,100000]) + p = bar(x,Ci_t,label="total",color=:white) + bar!(x,sol[ξ].*Ci_t,label="condensed-phase",color=:green) + ylabel!("Organic Mass, μg/m³") + xlabel!("log10(C*)") + title!(string) +end +plot(pl_t(sol_310,"310K"), pl_t(sol_285,"285K"), layout=(1, 2)) +``` \ No newline at end of file diff --git a/src/VBS.jl b/src/VBS.jl index 4c500d52..d6eb75a1 100644 --- a/src/VBS.jl +++ b/src/VBS.jl @@ -1,10 +1,11 @@ using ModelingToolkit, Unitful export VBS +# The function to calculate Ci_star at different temperatures function calc_Ci_star(T, Ci_star_standard) - T1 = 300 #[unit = u"K"]# K - ΔH = 100000 #[unit = u"J/mol"] # J/mol - R = 8.314 #[unit = u"J/K/mol"] # J/K/mol + T1 = 300 # K + ΔH = 100000 # J/mol + R = 8.314 # J/K/mol return Ci_star_standard / exp(ΔH/R*(1/(T)-1/T1)) end @register_symbolic calc_Ci_star(T, Ci_star_standard) @@ -14,7 +15,7 @@ function VBS(Ci) @parameters T_unit = 1 [unit = u"K"] @variables Ci_star[1:8] [description = "saturation concentrations"] - Ci_star_standard = [0.01,0.1,1,10,100,1000,10000,100000] #[description = "standard saturation concentrations"] + Ci_star_standard = [0.01,0.1,1,10,100,1000,10000,100000] # standard saturation concentrations @parameters C_OA_unit = 1 [unit = u"m^3/μg", description = "make C_OA unitless"] @variables C_OA [unit = u"μg/(m^3)", description = "organic compound in aerosol phase"] @variables ξ[1:8] [description = "partitioning coefficient at corresponding Ci_star"] @@ -26,3 +27,21 @@ function VBS(Ci) NonlinearSystem(eqs, [C_OA, collect(ξ)...], [T,C_OA_unit,T_unit]; name=:VBS) end + +function VBS(Ci,Ci_star_standard) + @parameters T = 300 [unit = u"K", description = "temperature"] + @parameters T_unit = 1 [unit = u"K"] + n = length(Ci_star_standard) + @variables Ci_star[1:n] [description = "saturation concentrations"] + + @parameters C_OA_unit = 1 [unit = u"m^3/μg", description = "make C_OA unitless"] + @variables C_OA [unit = u"μg/(m^3)", description = "organic compound in aerosol phase"] + @variables ξ[1:n] [description = "partitioning coefficient at corresponding Ci_star"] + + eqs = [ + [ξ[i] ~ 1/(1+calc_Ci_star(T/T_unit,Ci_star_standard[i])/(C_OA*C_OA_unit)) for i ∈ 1:n] + C_OA*C_OA_unit ~ sum(ξ.*Ci) + ] + + NonlinearSystem(eqs, [C_OA, collect(ξ)...], [T,C_OA_unit,T_unit]; name=:VBS) +end From a24d8583c1e01431cea354f958e71b79c1363466 Mon Sep 17 00:00:00 2001 From: jialinl6 Date: Thu, 4 Apr 2024 14:00:28 -0500 Subject: [PATCH 5/6] Delete Low VOC --- src/Low VOC | 107 ---------------------------------------------------- 1 file changed, 107 deletions(-) delete mode 100644 src/Low VOC diff --git a/src/Low VOC b/src/Low VOC deleted file mode 100644 index fcc47d5b..00000000 --- a/src/Low VOC +++ /dev/null @@ -1,107 +0,0 @@ - module LowVOC - - using PlutoUI - using ModelingToolkit - using Unitful - using Plots - using Statistics - using CSV - using DataFrames - using Markdown - -# Absorptive partitioning. - -md""" -Kₒₘ is an equilibrium partition coefficient, which describes the partition between gas and aerosol phase for the compounds which can occurr in the form of particles and gases. -Naphtalene falls in the group of intermidiate volatile compounds in most of the cases which are more volatile than semivolatile intermidiate compounds. The partitioning between gas and aerosol phase can be calculated assuming pseudo-ideal solution and absorptive partitioning theory, which represents with the following equation: - -Here we calculate Kₒₘ for semivolatile and intermediate volatile organic compounds, which represent by the following compounds: naphtalene, dibutyl phtalate, nanodecane. It corresponds to the equation #1 in the Pye et al. (2010). -""" - -#naphtalene partial partition coefficient - -#naphtalene partition coefficient (IVOC) - - - R = 8.314 #unit = u"kg*m^2/(s^2*K*mol)" # gas constant - #T is the temperature, unit = K - Mᵢ = [128.1705; 78.11] #unit = ug/mol" #Molecular weight - γᵢ = [2.3300; 4.54] #[unit = u"N*s^2/m^2"] # activity coefficient of compound i in aerosol phase - T = [263.61, 267.98, 273.16, 278.22, 283.14, 288.01, 293.24, 293.25, 298.26, 303.29, 308.17, 313.24, 318.21, 323.14, 328.24, 333.39, 338.10, 343.06] #temperature range in K - p = [0.23, 0.40, 0.74, 1.38, 2.41, 4.13, 6.93, 6.95, 11.35, 18.45, 28.95, 44.73, 68.82, 104.14, 158.41, 237.54, 340.76, 488.58] #vapor pressure in Pa - Tp = hcat(T, p) - C_sat = [1646.0, 20.0, 16.46, 0.2, 100000, 1.69, 270.0, 0.0001] #units saturation concentration - species = ["SVOC1"; "SVOC2"; "O-SVOC1"; "O-SVOC2"; "IVOC"; "O-IVOC N1"; "O-IVOC N2"; "O-IVOC H1"] - - Kₒₘ = zeros(18) - for n in 1:size(Tp,1), j in 1:size(Tp,2) - Kₒₘ[n] = (R * Tp[n,1]) / (Mᵢ[1] * γᵢ[1] * Tp[j,2]*1000) - end - Kₒₘ #m3/ug - -md """ -Kₒₘ in m^3/ug is proportional to the gas constant, temperature, and reversely proportional to the molar mass, activity coefficient of the compound in aerosol phase, and partial vapor pressure. Here we calculate it using for loop for different temperatures. We can also plot it to see the relationship with the change of the temperature since the vapor pressure also changes with the temperature, the relationship is not that apparent. Now we can plot the equilibrium partition coefficient with the change of the temperature. -""" - -plot(Kₒₘ, T, c=:blue, lab = :none, xlabel="Kₒₘ", ylabel="Temperature") - -md """ -Since the partitioning in under the highly dilute conditions found in the atmosphere, is strongly influenced by the ambient temperature. The plot gives the dependance of equilibrium air partitioning coefficient with the temperature. - -SVOCs from all sources are assumed to be emitted as two semivolatile surrogate species, SVOC1 and SVOC2, in roughly equal fractions of 0.49 and 0.51. Under most atmospherically relevant conditions, only the lower volatility component is expected to partition appreciably to the aerosol phase. -""" - -#dibutyl phtalate partition coefficient - - Mdbp = 278.348 #unit = g/mol" #Molecular weight - ΔᵥₐₚH = 91.7 #kJ/mol - p_dbp = exp.(ΔᵥₐₚH * 1000 / R .* (1 / 298.15 .- 1 ./ T)) #vapor pressure in P - - Kₒₘ_dbp = zeros(18) - for w in 1:length(T), e in 1:length(p_dbp) - Kₒₘ_dbp[w] = R * T[w] / (Mdbp * 1 * p_dbp[e] * 1000000) - end - Kₒₘ_dbp #m3/ug - -#nonadecane - - #nonadecane - - Mnd = 268.5 #unit = g/mol" #Molecular weight - ΔᵥₐₚH₂ = 95.8 #kJ/mol - p_nd = zeros(18) - p_nd = exp.(ΔᵥₐₚH₂*1000/R .* (1/298.15 .- 1 ./ T)) #vapor pressure in Pa - p_nd - - Kₒₘ_nd = zeros(18) - for n in 1:length(T), j in 1:length(p_nd) - Kₒₘ_nd[n] = R * T[n] / (Mnd * 1 * p_nd[j] * 1000000) - end - Kₒₘ_nd #m3/ug - -plot(T, Kₒₘ, c=:blue, lab = :none, xlabel="Kₒₘ", ylabel="Temperature") - plot!(T, Kₒₘ_dbp, c=:red, lab = :none, xlabel="Kₒₘ", ylabel="Temperature") - plot!(T, Kₒₘ_nd, c=:orange, lab = :none, xlabel="Kₒₘ", ylabel="Temperature") - -md """ -As we see by the plot the trends of Kₒₘ is pretty similar for all three species, with the bigger values for semivolatile organic compounds, which is consistent with the results of the paper. For the oxidation forms of the intermidiate volatile organic compounds (naphtalene used as a IVOC in the paper) increases significantly over the 10^9 times. - -If we try to reproduce the same process with the saturation concentration C', which recalls the equation 2 from Pye et al. (2010), we will get following plot: -""" - -Kₒₘₛₐₜ = 1 ./C_sat - -plot(species,Kₒₘₛₐₜ, seriestype = :scatter, c=:blue, lab = :none, xlabel="Kₒₘ") - -#I included the suggestion to see the correlation of the values obtained for each combination of temperature and pressure, and created a heatmap, but I considered it makes more sense to keep for loop since the vapor pressure is different and unique for each temperature. - -Kₒₘ2 = R .* Tp[:,1] ./ (Mᵢ[1] .* γᵢ[1] .* Tp[:,2]' * 1000) - -heatmap(Kₒₘ2, - xlabel="Temperature", ylabel="Vapor pressure", - colorbar_title="Equilibrium partition coefficient", - title="Kₒₘ dependance on Temperature and vapor pressure") - -#The calculations provided help to understand the processes occurring in ambient atmosphere, equilibrium partitioning coefficient was calculated for different species with the dependence on temperature. It can be further used for modeling partition of low volatile compounds based on the data of the emissions of the low volatile compounds. However, GEOSChem model is already existing and was used in the Pye et al.(2010), but the estimates of the emissions and the contribution of each species is still not accurate enough, so more precise modeling could be conducted. - -end From 5aa4c11847392868f13cce1a542e91b8c76eaf17 Mon Sep 17 00:00:00 2001 From: jialinl6 Date: Thu, 4 Apr 2024 14:06:09 -0500 Subject: [PATCH 6/6] Add string documentation for function VBS --- src/VBS.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/VBS.jl b/src/VBS.jl index d6eb75a1..863f0a6a 100644 --- a/src/VBS.jl +++ b/src/VBS.jl @@ -10,6 +10,7 @@ function calc_Ci_star(T, Ci_star_standard) end @register_symbolic calc_Ci_star(T, Ci_star_standard) +# The function create a nonlinear system with input Ci (the organic compound concentration in all phases) function VBS(Ci) @parameters T = 300 [unit = u"K", description = "temperature"] @parameters T_unit = 1 [unit = u"K"] @@ -28,6 +29,7 @@ function VBS(Ci) NonlinearSystem(eqs, [C_OA, collect(ξ)...], [T,C_OA_unit,T_unit]; name=:VBS) end +# The function create a nonlinear system with input Ci (the organic compound concentration in all phases) and Ci_star_standard(basic set at standard temperatures) function VBS(Ci,Ci_star_standard) @parameters T = 300 [unit = u"K", description = "temperature"] @parameters T_unit = 1 [unit = u"K"]