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]))
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
Row | Name | Units | Description | Default |
---|---|---|---|---|
String | Quantity… | String | Real | |
1 | j_104 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
2 | j_135 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
3 | j_80 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
4 | j_87 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
5 | j_74 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
6 | j_2 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
7 | j_64 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
8 | k_cld6 | 1.0 s⁻¹ | HMS rate constant | 0 |
9 | j_105 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
10 | j_154 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
11 | j_103 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
12 | j_21 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
13 | j_44 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
14 | j_56 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
15 | j_34 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
16 | j_112 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
17 | j_146 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
18 | j_26 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
19 | j_37 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
20 | j_117 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
21 | j_39 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
22 | k_mt1 | 1.0 s⁻¹ | Atmospheric molecular density (i.e. pressure) | 0 |
23 | j_147 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
24 | j_120 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
25 | j_11 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
26 | j_49 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
27 | j_158 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
28 | j_141 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
29 | j_25 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
30 | j_124 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
31 | j_46 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
32 | k_cld4 | 1.0 s⁻¹ | HMS rate constant | 0 |
33 | j_82 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
34 | j_47 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
35 | j_108 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
36 | j_81 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
37 | j_30 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
38 | j_36 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
39 | k_mt2 | 1.0 s⁻¹ | Seasalt rate constant | 0 |
40 | j_33 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
41 | j_41 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
42 | j_17 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
43 | j_156 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
44 | j_100 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
45 | j_132 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
46 | j_99 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
47 | j_106 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
48 | j_42 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
49 | j_13 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
50 | j_9 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
51 | j_66 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
52 | j_121 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
53 | j_144 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
54 | j_77 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
55 | j_28 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
56 | j_92 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
57 | j_10 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
58 | j_7 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
59 | j_54 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
60 | k_mt5 | 1.0 s⁻¹ | Seasalt rate constant | 0 |
61 | j_91 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
62 | k_cld2 | 1.0 s⁻¹ | Cloud rate constant | 0 |
63 | j_71 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
64 | j_16 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
65 | j_86 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
66 | j_40 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
67 | j_22 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
68 | j_29 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
69 | j_6 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
70 | j_98 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
71 | j_45 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
72 | j_95 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
73 | j_123 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
74 | j_129 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
75 | j_63 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
76 | j_43 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
77 | j_55 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
78 | j_119 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
79 | j_131 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
80 | j_164 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
81 | j_94 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
82 | j_150 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
83 | j_137 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
84 | j_125 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
85 | j_148 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
86 | j_110 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
87 | j_20 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
88 | j_111 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
89 | j_51 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
90 | j_1 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
91 | j_69 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
92 | j_70 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
93 | j_89 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
94 | j_59 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
95 | j_155 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
96 | j_18 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
97 | j_160 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
98 | j_138 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
99 | j_62 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
100 | j_79 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
101 | j_88 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
102 | j_143 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
103 | j_149 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
104 | j_48 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
105 | j_130 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
106 | j_65 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
107 | j_75 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
108 | j_153 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
109 | j_14 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
110 | k_cld3 | 1.0 s⁻¹ | Cloud rate constant | 0 |
111 | j_23 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
112 | j_136 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
113 | j_157 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
114 | j_145 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
115 | j_68 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
116 | k_mt3 | 1.0 s⁻¹ | Seasalt rate constant | 0 |
117 | j_15 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
118 | j_113 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
119 | k_mt6 | 1.0 s⁻¹ | Seasalt rate constant | 0 |
120 | j_118 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
121 | j_152 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
122 | j_12 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
123 | j_128 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
124 | j_114 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
125 | k_cld5 | 1.0 s⁻¹ | HMS rate constant | 0 |
126 | j_126 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
127 | j_107 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
128 | j_96 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
129 | j_19 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
130 | j_85 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
131 | j_8 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
132 | j_165 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
133 | k_cld1 | 1.0 s⁻¹ | Cloud rate constant | 0 |
134 | j_3 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
135 | j_76 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
136 | j_27 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
137 | j_38 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
138 | j_83 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
139 | j_162 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
140 | num_density | 1.0 | Number density of air (The units should be molecules/cm^3 but the equations here treat it as unitless). | 2.7e19 |
141 | j_127 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
142 | T | 1.0 K | Temperature | 298.15 |
143 | k_mt4 | 1.0 s⁻¹ | Seasalt rate constant | 0 |
144 | j_84 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
145 | j_161 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
146 | j_73 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
147 | j_97 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
148 | j_50 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
149 | j_61 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
150 | j_109 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
151 | j_140 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
152 | j_93 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
153 | j_122 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
154 | j_78 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
155 | j_159 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
156 | j_31 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
157 | j_115 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
158 | j_139 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
159 | j_163 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
160 | j_72 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
161 | j_116 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
162 | j_134 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
163 | j_90 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
164 | j_151 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
165 | j_133 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
166 | j_53 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
167 | j_24 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
168 | j_101 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
169 | j_142 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
170 | j_166 | 1.0 s⁻¹ | Photolysis rate constant | 0 |
171 | j_32 | 1.0 s⁻¹ | Photolysis rate constant | 0 |