Model Parameters

Temperature and Pressure Example

The two main parameters are temperature (T (K)) and pressure (num_density (molecules/cm³)). We can explore what happens when we change them:

using GasChem, EarthSciMLBase
using DifferentialEquations, ModelingToolkit
using DynamicQuantities, Plots
using ModelingToolkit:t

tspan = (0.0, 60.0*60*24*4) # 4 day simulation

# Run a simulation with constant temperature and pressure.
sys = structural_simplify(GEOSChemGasPhase())
vals = ModelingToolkit.get_defaults(sys)
for k in setdiff(unknowns(sys),keys(vals))
    vals[k] = 0 # Set variables with no default to zero.
end
prob = ODEProblem(sys, vals, tspan, vals)
sol1 = solve(prob, AutoTsit5(Rosenbrock23()))

# Now, convert parameters to variables so we can change them over time.
sys2 = param_to_var(GEOSChemGasPhase(), :T, :num_density)

# Vary temperature and pressure over time.
@unpack T, num_density = sys2
@constants T_0 = 300 [unit=u"K"]
@constants t_0 = 1 [unit=u"s"]
eqs = [
    T ~ T_0 + T_0 / 1.5 * sin(2π*t/t_0/(60*60*24)),
    num_density ~ 2.7e19 - 2.5e19*t/t_0/(60*60*24*4),
]
sys2 = extend(sys2,ODESystem(eqs, t; name=:var_T))

# Run the simulation again.
sys2 = structural_simplify(sys2)
vals = ModelingToolkit.get_defaults(sys2)
for k in setdiff(unknowns(sys2),keys(vals))
    vals[k] = 0 # Set variables with no default to zero.
end
prob = ODEProblem(sys2, vals, tspan, vals)
sol2 = solve(prob, AutoTsit5(Rosenbrock23()))

# Plot the results
p1 = plot(sol1.t, sol1[sys2.O3], xticks=:none, label="Constant T and P",
        ylabel = "Concentration (ppb)")
plot!(p1, sol2.t, sol2[sys2.O3], label="Varying T and P")

p2 = plot(sol2.t, sol2[sys2.T], label = "T (K)", xticks=:none)
p3 = plot(sol2.t, sol2[sys2.num_density], label = "num_density (molec/cm³)", xlabel = "Time (s)")

plot(p1, p2, p3, layout=grid(3, 1, heights=[0.7, 0.15, 0.15]))
Example block output

Model Parameter Information

Here is a list of all of the model parameters:

using GasChem, DataFrames, EarthSciMLBase, ModelingToolkit, DynamicQuantities
@variables t [unit = u"s", description = "Time"]
gc = structural_simplify(GEOSChemGasPhase())
vars = parameters(gc)
DataFrame(
        :Name => [string(Symbolics.tosymbol(v, escape=false)) for v ∈ vars],
        :Units => [ModelingToolkit.get_unit(v) for v ∈ vars],
        :Description => [ModelingToolkit.getdescription(v) for v ∈ vars],
        :Default => [ModelingToolkit.getdefault(v) for v ∈ vars])
171×4 DataFrame
RowNameUnitsDescriptionDefault
StringQuantity…StringReal
1j_1041.0 s⁻¹Photolysis rate constant0
2j_1351.0 s⁻¹Photolysis rate constant0
3j_801.0 s⁻¹Photolysis rate constant0
4j_871.0 s⁻¹Photolysis rate constant0
5j_741.0 s⁻¹Photolysis rate constant0
6j_21.0 s⁻¹Photolysis rate constant0
7j_641.0 s⁻¹Photolysis rate constant0
8k_cld61.0 s⁻¹HMS rate constant0
9j_1051.0 s⁻¹Photolysis rate constant0
10j_1541.0 s⁻¹Photolysis rate constant0
11j_1031.0 s⁻¹Photolysis rate constant0
12j_211.0 s⁻¹Photolysis rate constant0
13j_441.0 s⁻¹Photolysis rate constant0
14j_561.0 s⁻¹Photolysis rate constant0
15j_341.0 s⁻¹Photolysis rate constant0
16j_1121.0 s⁻¹Photolysis rate constant0
17j_1461.0 s⁻¹Photolysis rate constant0
18j_261.0 s⁻¹Photolysis rate constant0
19j_371.0 s⁻¹Photolysis rate constant0
20j_1171.0 s⁻¹Photolysis rate constant0
21j_391.0 s⁻¹Photolysis rate constant0
22k_mt11.0 s⁻¹Atmospheric molecular density (i.e. pressure)0
23j_1471.0 s⁻¹Photolysis rate constant0
24j_1201.0 s⁻¹Photolysis rate constant0
25j_111.0 s⁻¹Photolysis rate constant0
26j_491.0 s⁻¹Photolysis rate constant0
27j_1581.0 s⁻¹Photolysis rate constant0
28j_1411.0 s⁻¹Photolysis rate constant0
29j_251.0 s⁻¹Photolysis rate constant0
30j_1241.0 s⁻¹Photolysis rate constant0
31j_461.0 s⁻¹Photolysis rate constant0
32k_cld41.0 s⁻¹HMS rate constant0
33j_821.0 s⁻¹Photolysis rate constant0
34j_471.0 s⁻¹Photolysis rate constant0
35j_1081.0 s⁻¹Photolysis rate constant0
36j_811.0 s⁻¹Photolysis rate constant0
37j_301.0 s⁻¹Photolysis rate constant0
38j_361.0 s⁻¹Photolysis rate constant0
39k_mt21.0 s⁻¹Seasalt rate constant0
40j_331.0 s⁻¹Photolysis rate constant0
41j_411.0 s⁻¹Photolysis rate constant0
42j_171.0 s⁻¹Photolysis rate constant0
43j_1561.0 s⁻¹Photolysis rate constant0
44j_1001.0 s⁻¹Photolysis rate constant0
45j_1321.0 s⁻¹Photolysis rate constant0
46j_991.0 s⁻¹Photolysis rate constant0
47j_1061.0 s⁻¹Photolysis rate constant0
48j_421.0 s⁻¹Photolysis rate constant0
49j_131.0 s⁻¹Photolysis rate constant0
50j_91.0 s⁻¹Photolysis rate constant0
51j_661.0 s⁻¹Photolysis rate constant0
52j_1211.0 s⁻¹Photolysis rate constant0
53j_1441.0 s⁻¹Photolysis rate constant0
54j_771.0 s⁻¹Photolysis rate constant0
55j_281.0 s⁻¹Photolysis rate constant0
56j_921.0 s⁻¹Photolysis rate constant0
57j_101.0 s⁻¹Photolysis rate constant0
58j_71.0 s⁻¹Photolysis rate constant0
59j_541.0 s⁻¹Photolysis rate constant0
60k_mt51.0 s⁻¹Seasalt rate constant0
61j_911.0 s⁻¹Photolysis rate constant0
62k_cld21.0 s⁻¹Cloud rate constant0
63j_711.0 s⁻¹Photolysis rate constant0
64j_161.0 s⁻¹Photolysis rate constant0
65j_861.0 s⁻¹Photolysis rate constant0
66j_401.0 s⁻¹Photolysis rate constant0
67j_221.0 s⁻¹Photolysis rate constant0
68j_291.0 s⁻¹Photolysis rate constant0
69j_61.0 s⁻¹Photolysis rate constant0
70j_981.0 s⁻¹Photolysis rate constant0
71j_451.0 s⁻¹Photolysis rate constant0
72j_951.0 s⁻¹Photolysis rate constant0
73j_1231.0 s⁻¹Photolysis rate constant0
74j_1291.0 s⁻¹Photolysis rate constant0
75j_631.0 s⁻¹Photolysis rate constant0
76j_431.0 s⁻¹Photolysis rate constant0
77j_551.0 s⁻¹Photolysis rate constant0
78j_1191.0 s⁻¹Photolysis rate constant0
79j_1311.0 s⁻¹Photolysis rate constant0
80j_1641.0 s⁻¹Photolysis rate constant0
81j_941.0 s⁻¹Photolysis rate constant0
82j_1501.0 s⁻¹Photolysis rate constant0
83j_1371.0 s⁻¹Photolysis rate constant0
84j_1251.0 s⁻¹Photolysis rate constant0
85j_1481.0 s⁻¹Photolysis rate constant0
86j_1101.0 s⁻¹Photolysis rate constant0
87j_201.0 s⁻¹Photolysis rate constant0
88j_1111.0 s⁻¹Photolysis rate constant0
89j_511.0 s⁻¹Photolysis rate constant0
90j_11.0 s⁻¹Photolysis rate constant0
91j_691.0 s⁻¹Photolysis rate constant0
92j_701.0 s⁻¹Photolysis rate constant0
93j_891.0 s⁻¹Photolysis rate constant0
94j_591.0 s⁻¹Photolysis rate constant0
95j_1551.0 s⁻¹Photolysis rate constant0
96j_181.0 s⁻¹Photolysis rate constant0
97j_1601.0 s⁻¹Photolysis rate constant0
98j_1381.0 s⁻¹Photolysis rate constant0
99j_621.0 s⁻¹Photolysis rate constant0
100j_791.0 s⁻¹Photolysis rate constant0
101j_881.0 s⁻¹Photolysis rate constant0
102j_1431.0 s⁻¹Photolysis rate constant0
103j_1491.0 s⁻¹Photolysis rate constant0
104j_481.0 s⁻¹Photolysis rate constant0
105j_1301.0 s⁻¹Photolysis rate constant0
106j_651.0 s⁻¹Photolysis rate constant0
107j_751.0 s⁻¹Photolysis rate constant0
108j_1531.0 s⁻¹Photolysis rate constant0
109j_141.0 s⁻¹Photolysis rate constant0
110k_cld31.0 s⁻¹Cloud rate constant0
111j_231.0 s⁻¹Photolysis rate constant0
112j_1361.0 s⁻¹Photolysis rate constant0
113j_1571.0 s⁻¹Photolysis rate constant0
114j_1451.0 s⁻¹Photolysis rate constant0
115j_681.0 s⁻¹Photolysis rate constant0
116k_mt31.0 s⁻¹Seasalt rate constant0
117j_151.0 s⁻¹Photolysis rate constant0
118j_1131.0 s⁻¹Photolysis rate constant0
119k_mt61.0 s⁻¹Seasalt rate constant0
120j_1181.0 s⁻¹Photolysis rate constant0
121j_1521.0 s⁻¹Photolysis rate constant0
122j_121.0 s⁻¹Photolysis rate constant0
123j_1281.0 s⁻¹Photolysis rate constant0
124j_1141.0 s⁻¹Photolysis rate constant0
125k_cld51.0 s⁻¹HMS rate constant0
126j_1261.0 s⁻¹Photolysis rate constant0
127j_1071.0 s⁻¹Photolysis rate constant0
128j_961.0 s⁻¹Photolysis rate constant0
129j_191.0 s⁻¹Photolysis rate constant0
130j_851.0 s⁻¹Photolysis rate constant0
131j_81.0 s⁻¹Photolysis rate constant0
132j_1651.0 s⁻¹Photolysis rate constant0
133k_cld11.0 s⁻¹Cloud rate constant0
134j_31.0 s⁻¹Photolysis rate constant0
135j_761.0 s⁻¹Photolysis rate constant0
136j_271.0 s⁻¹Photolysis rate constant0
137j_381.0 s⁻¹Photolysis rate constant0
138j_831.0 s⁻¹Photolysis rate constant0
139j_1621.0 s⁻¹Photolysis rate constant0
140num_density1.0 Number density of air (The units should be molecules/cm^3 but the equations here treat it as unitless).2.7e19
141j_1271.0 s⁻¹Photolysis rate constant0
142T1.0 KTemperature298.15
143k_mt41.0 s⁻¹Seasalt rate constant0
144j_841.0 s⁻¹Photolysis rate constant0
145j_1611.0 s⁻¹Photolysis rate constant0
146j_731.0 s⁻¹Photolysis rate constant0
147j_971.0 s⁻¹Photolysis rate constant0
148j_501.0 s⁻¹Photolysis rate constant0
149j_611.0 s⁻¹Photolysis rate constant0
150j_1091.0 s⁻¹Photolysis rate constant0
151j_1401.0 s⁻¹Photolysis rate constant0
152j_931.0 s⁻¹Photolysis rate constant0
153j_1221.0 s⁻¹Photolysis rate constant0
154j_781.0 s⁻¹Photolysis rate constant0
155j_1591.0 s⁻¹Photolysis rate constant0
156j_311.0 s⁻¹Photolysis rate constant0
157j_1151.0 s⁻¹Photolysis rate constant0
158j_1391.0 s⁻¹Photolysis rate constant0
159j_1631.0 s⁻¹Photolysis rate constant0
160j_721.0 s⁻¹Photolysis rate constant0
161j_1161.0 s⁻¹Photolysis rate constant0
162j_1341.0 s⁻¹Photolysis rate constant0
163j_901.0 s⁻¹Photolysis rate constant0
164j_1511.0 s⁻¹Photolysis rate constant0
165j_1331.0 s⁻¹Photolysis rate constant0
166j_531.0 s⁻¹Photolysis rate constant0
167j_241.0 s⁻¹Photolysis rate constant0
168j_1011.0 s⁻¹Photolysis rate constant0
169j_1421.0 s⁻¹Photolysis rate constant0
170j_1661.0 s⁻¹Photolysis rate constant0
171j_321.0 s⁻¹Photolysis rate constant0