musica 0.11.1.4__cp312-cp312-win_amd64.whl → 0.12.1__cp312-cp312-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of musica might be problematic. Click here for more details.
- musica/CMakeLists.txt +28 -2
- musica/__init__.py +9 -49
- musica/_musica.cp312-win_amd64.pyd +0 -0
- musica/_version.py +1 -1
- musica/backend.py +41 -0
- musica/binding_common.cpp +23 -6
- musica/carma.cpp +911 -0
- musica/carma.py +1729 -0
- musica/constants.py +3 -0
- musica/cpu_binding.cpp +2 -1
- musica/cuda.py +4 -1
- musica/examples/__init__.py +1 -0
- musica/examples/carma_aluminum.py +123 -0
- musica/examples/carma_sulfate.py +245 -0
- musica/examples/examples.py +165 -0
- musica/examples/sulfate_box_model.py +439 -0
- musica/examples/ts1_latin_hypercube.py +245 -0
- musica/gpu_binding.cpp +2 -1
- musica/main.py +89 -0
- musica/mechanism_configuration/__init__.py +1 -0
- musica/mechanism_configuration/aqueous_equilibrium.py +274 -0
- musica/mechanism_configuration/arrhenius.py +307 -0
- musica/mechanism_configuration/branched.py +299 -0
- musica/mechanism_configuration/condensed_phase_arrhenius.py +309 -0
- musica/mechanism_configuration/condensed_phase_photolysis.py +88 -0
- musica/mechanism_configuration/emission.py +71 -0
- musica/mechanism_configuration/first_order_loss.py +174 -0
- musica/mechanism_configuration/henrys_law.py +44 -0
- musica/mechanism_configuration/mechanism_configuration.py +234 -0
- musica/mechanism_configuration/phase.py +47 -0
- musica/mechanism_configuration/photolysis.py +88 -0
- musica/mechanism_configuration/reactions.py +73 -0
- musica/mechanism_configuration/simpol_phase_transfer.py +217 -0
- musica/mechanism_configuration/species.py +91 -0
- musica/mechanism_configuration/surface.py +94 -0
- musica/mechanism_configuration/ternary_chemical_activation.py +352 -0
- musica/mechanism_configuration/troe.py +352 -0
- musica/mechanism_configuration/tunneling.py +250 -0
- musica/mechanism_configuration/user_defined.py +88 -0
- musica/mechanism_configuration/utils.py +10 -0
- musica/mechanism_configuration/wet_deposition.py +52 -0
- musica/mechanism_configuration.cpp +184 -96
- musica/musica.cpp +48 -61
- musica/test/examples/v1/full_configuration/full_configuration.json +67 -35
- musica/test/examples/v1/full_configuration/full_configuration.yaml +44 -20
- musica/test/{test_analytical.py → integration/test_analytical.py} +1 -2
- musica/test/integration/test_carma.py +227 -0
- musica/test/integration/test_carma_aluminum.py +11 -0
- musica/test/integration/test_carma_sulfate.py +16 -0
- musica/test/integration/test_sulfate_box_model.py +34 -0
- musica/test/integration/test_tuvx.py +62 -0
- musica/test/unit/test_parser.py +64 -0
- musica/test/unit/test_serializer.py +69 -0
- musica/test/{test_parser.py → unit/test_util_full_mechanism.py} +409 -404
- musica/tools/prepare_build_environment_linux.sh +39 -32
- musica/tools/prepare_build_environment_macos.sh +1 -0
- musica/tuvx.cpp +93 -0
- musica/tuvx.py +199 -0
- musica/types.py +104 -63
- {musica-0.11.1.4.dist-info → musica-0.12.1.dist-info}/METADATA +100 -84
- musica-0.12.1.dist-info/RECORD +69 -0
- {musica-0.11.1.4.dist-info → musica-0.12.1.dist-info}/WHEEL +1 -1
- musica-0.12.1.dist-info/entry_points.txt +3 -0
- musica-0.12.1.dist-info/licenses/AUTHORS.md +59 -0
- musica/mechanism_configuration.py +0 -1291
- musica/test/examples/v0/config.json +0 -7
- musica/test/examples/v0/config.yaml +0 -3
- musica/test/examples/v0/reactions.json +0 -193
- musica/test/examples/v0/reactions.yaml +0 -142
- musica/test/examples/v0/species.json +0 -40
- musica/test/examples/v0/species.yaml +0 -19
- musica/test/tuvx.py +0 -10
- musica/tools/prepare_build_environment_windows.sh +0 -22
- musica-0.11.1.4.dist-info/RECORD +0 -33
- /musica/test/{test_chapman.py → integration/test_chapman.py} +0 -0
- {musica-0.11.1.4.dist-info → musica-0.12.1.dist-info}/licenses/LICENSE +0 -0
musica/musica.cpp
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// Copyright (C) 2023-2025 University Corporation for Atmospheric Research
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
#include <musica/micm/cuda_availability.hpp>
|
|
3
4
|
#include <musica/micm/micm.hpp>
|
|
4
5
|
#include <musica/micm/micm_c_interface.hpp>
|
|
5
|
-
#include <musica/micm/state_c_interface.hpp>
|
|
6
6
|
#include <musica/micm/state.hpp>
|
|
7
|
-
#include <
|
|
8
|
-
#include <musica/micm/cuda_availability.hpp>
|
|
7
|
+
#include <musica/micm/state_c_interface.hpp>
|
|
9
8
|
|
|
9
|
+
#include <mechanism_configuration/v1/types.hpp>
|
|
10
10
|
#include <pybind11/pybind11.h>
|
|
11
11
|
#include <pybind11/stl.h>
|
|
12
12
|
#include <pybind11/stl_bind.h>
|
|
@@ -21,7 +21,7 @@ void bind_musica(py::module_ &core)
|
|
|
21
21
|
{
|
|
22
22
|
py::bind_vector<std::vector<double>>(core, "VectorDouble");
|
|
23
23
|
py::bind_vector<std::vector<micm::Conditions>>(core, "VectorConditions");
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
py::class_<micm::Conditions>(core, "_Conditions")
|
|
26
26
|
.def(py::init<>())
|
|
27
27
|
.def_readwrite("temperature", &micm::Conditions::temperature_)
|
|
@@ -30,40 +30,27 @@ void bind_musica(py::module_ &core)
|
|
|
30
30
|
|
|
31
31
|
py::class_<musica::State>(core, "_State")
|
|
32
32
|
.def(py::init<>())
|
|
33
|
-
.def("__del__", [](musica::State &state) {
|
|
34
|
-
.def("number_of_grid_cells",
|
|
35
|
-
[](musica::State &state) {
|
|
36
|
-
return state.NumberOfGridCells();
|
|
37
|
-
})
|
|
33
|
+
.def("__del__", [](musica::State &state) {})
|
|
34
|
+
.def("number_of_grid_cells", [](musica::State &state) { return state.NumberOfGridCells(); })
|
|
38
35
|
.def_property(
|
|
39
36
|
"conditions",
|
|
40
|
-
[](musica::State &state) -> std::vector<micm::Conditions
|
|
41
|
-
return state.GetConditions();
|
|
42
|
-
},
|
|
37
|
+
[](musica::State &state) -> std::vector<micm::Conditions> & { return state.GetConditions(); },
|
|
43
38
|
nullptr,
|
|
44
39
|
"list of conditions structs for each grid cell")
|
|
45
40
|
.def_property(
|
|
46
41
|
"concentrations",
|
|
47
|
-
[](musica::State &state) -> std::vector<double
|
|
48
|
-
return state.GetOrderedConcentrations();
|
|
49
|
-
},
|
|
42
|
+
[](musica::State &state) -> std::vector<double> & { return state.GetOrderedConcentrations(); },
|
|
50
43
|
nullptr,
|
|
51
44
|
"native 1D list of concentrations, ordered by species and grid cell according to matrix type")
|
|
52
45
|
.def_property(
|
|
53
46
|
"user_defined_rate_parameters",
|
|
54
|
-
[](musica::State &state) -> std::vector<double
|
|
55
|
-
return state.GetOrderedRateParameters();
|
|
56
|
-
},
|
|
47
|
+
[](musica::State &state) -> std::vector<double> & { return state.GetOrderedRateParameters(); },
|
|
57
48
|
nullptr,
|
|
58
49
|
"native 1D list of user-defined rate parameters, ordered by parameter and grid cell according to matrix type")
|
|
59
|
-
.def("concentration_strides",
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
})
|
|
63
|
-
.def("user_defined_rate_parameter_strides",
|
|
64
|
-
[](musica::State &state) {
|
|
65
|
-
return state.GetUserDefinedRateParametersStrides();
|
|
66
|
-
});
|
|
50
|
+
.def("concentration_strides", [](musica::State &state) { return state.GetConcentrationsStrides(); })
|
|
51
|
+
.def(
|
|
52
|
+
"user_defined_rate_parameter_strides",
|
|
53
|
+
[](musica::State &state) { return state.GetUserDefinedRateParametersStrides(); });
|
|
67
54
|
|
|
68
55
|
py::enum_<musica::MICMSolver>(core, "_SolverType")
|
|
69
56
|
.value("rosenbrock", musica::MICMSolver::Rosenbrock)
|
|
@@ -74,20 +61,18 @@ void bind_musica(py::module_ &core)
|
|
|
74
61
|
|
|
75
62
|
py::class_<musica::MICM>(core, "_Solver");
|
|
76
63
|
|
|
77
|
-
core.def(
|
|
64
|
+
core.def(
|
|
65
|
+
"_vector_size",
|
|
78
66
|
[](const musica::MICMSolver solver_type)
|
|
79
67
|
{
|
|
80
68
|
switch (solver_type)
|
|
81
69
|
{
|
|
82
70
|
case musica::MICMSolver::Rosenbrock:
|
|
83
71
|
case musica::MICMSolver::BackwardEuler:
|
|
84
|
-
case musica::MICMSolver::CudaRosenbrock:
|
|
85
|
-
return musica::MUSICA_VECTOR_SIZE;
|
|
72
|
+
case musica::MICMSolver::CudaRosenbrock: return musica::MUSICA_VECTOR_SIZE;
|
|
86
73
|
case musica::MICMSolver::RosenbrockStandardOrder:
|
|
87
|
-
case musica::MICMSolver::BackwardEulerStandardOrder:
|
|
88
|
-
|
|
89
|
-
default:
|
|
90
|
-
throw py::value_error("Invalid MICM solver type.");
|
|
74
|
+
case musica::MICMSolver::BackwardEulerStandardOrder: return static_cast<std::size_t>(0);
|
|
75
|
+
default: throw py::value_error("Invalid MICM solver type.");
|
|
91
76
|
}
|
|
92
77
|
},
|
|
93
78
|
"Returns the vector dimension for vector-ordered solvers, 0 otherwise.");
|
|
@@ -111,10 +96,10 @@ void bind_musica(py::module_ &core)
|
|
|
111
96
|
|
|
112
97
|
core.def(
|
|
113
98
|
"_create_solver_from_mechanism",
|
|
114
|
-
[](const v1::Mechanism &mechanism, musica::MICMSolver solver_type)
|
|
99
|
+
[](const v1::Mechanism &mechanism, musica::MICMSolver solver_type, bool ignore_non_gas_phases)
|
|
115
100
|
{
|
|
116
101
|
musica::Error error;
|
|
117
|
-
musica::Chemistry chemistry = musica::ConvertV1Mechanism(mechanism);
|
|
102
|
+
musica::Chemistry chemistry = musica::ConvertV1Mechanism(mechanism, ignore_non_gas_phases);
|
|
118
103
|
musica::MICM *micm = musica::CreateMicmFromChemistryMechanism(&chemistry, solver_type, &error);
|
|
119
104
|
if (!musica::IsSuccess(error))
|
|
120
105
|
{
|
|
@@ -124,7 +109,7 @@ void bind_musica(py::module_ &core)
|
|
|
124
109
|
}
|
|
125
110
|
return micm;
|
|
126
111
|
});
|
|
127
|
-
|
|
112
|
+
|
|
128
113
|
core.def(
|
|
129
114
|
"_create_state",
|
|
130
115
|
[](musica::MICM *micm, std::size_t number_of_grid_cells)
|
|
@@ -184,31 +169,33 @@ void bind_musica(py::module_ &core)
|
|
|
184
169
|
"_print_state",
|
|
185
170
|
[](musica::State *state, const double current_time)
|
|
186
171
|
{
|
|
187
|
-
std::visit(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
172
|
+
std::visit(
|
|
173
|
+
[¤t_time](auto &state)
|
|
174
|
+
{
|
|
175
|
+
std::cout << "Current time: " << current_time << std::endl;
|
|
176
|
+
std::cout << "State variables: " << std::endl;
|
|
177
|
+
std::vector<std::string> species_names(state.variable_map_.size());
|
|
178
|
+
for (const auto &species : state.variable_map_)
|
|
179
|
+
species_names[species.second] = species.first;
|
|
180
|
+
for (const auto &name : species_names)
|
|
181
|
+
std::cout << name << ",";
|
|
182
|
+
std::cout << std::endl << state.variables_ << std::endl;
|
|
183
|
+
std::cout << "User-defined rate parameters: " << std::endl;
|
|
184
|
+
std::vector<std::string> rate_param_names(state.custom_rate_parameter_map_.size());
|
|
185
|
+
for (const auto &rate : state.custom_rate_parameter_map_)
|
|
186
|
+
rate_param_names[rate.second] = rate.first;
|
|
187
|
+
for (const auto &name : rate_param_names)
|
|
188
|
+
std::cout << name << ",";
|
|
189
|
+
std::cout << std::endl << state.custom_rate_parameters_ << std::endl;
|
|
190
|
+
std::cout << "Conditions: " << std::endl;
|
|
191
|
+
std::cout << "Temperature,Pressure,Air density" << std::endl;
|
|
192
|
+
for (const auto &condition : state.conditions_)
|
|
193
|
+
{
|
|
194
|
+
std::cout << condition.temperature_ << "," << condition.pressure_ << "," << condition.air_density_
|
|
195
|
+
<< std::endl;
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
state->state_variant_);
|
|
212
199
|
},
|
|
213
200
|
"Print the state to stdout with the current time");
|
|
214
201
|
}
|
|
@@ -101,33 +101,25 @@
|
|
|
101
101
|
}
|
|
102
102
|
],
|
|
103
103
|
"reactions": [
|
|
104
|
-
{
|
|
105
|
-
"type": "HL_PHASE_TRANSFER",
|
|
106
|
-
"gas phase": "gas",
|
|
107
|
-
"gas-phase species": "H2O2",
|
|
108
|
-
"aerosol phase": "aqueous aerosol",
|
|
109
|
-
"aerosol-phase species": "H2O2_aq",
|
|
110
|
-
"aerosol-phase water": "H2O_aq",
|
|
111
|
-
"name": "my henry's law"
|
|
112
|
-
},
|
|
113
104
|
{
|
|
114
105
|
"type": "SIMPOL_PHASE_TRANSFER",
|
|
115
106
|
"gas phase": "gas",
|
|
116
107
|
"gas-phase species": "ethanol",
|
|
117
|
-
"
|
|
118
|
-
"
|
|
108
|
+
"condensed phase": "aqueous aerosol",
|
|
109
|
+
"condensed-phase species": "ethanol_aq",
|
|
119
110
|
"B": [
|
|
120
111
|
-1.97E+03,
|
|
121
112
|
2.91E+00,
|
|
122
113
|
1.96E-03,
|
|
123
114
|
-4.96E-01
|
|
124
115
|
],
|
|
125
|
-
"name": "my simpol"
|
|
116
|
+
"name": "my simpol",
|
|
117
|
+
"__irrelevant": "2"
|
|
126
118
|
},
|
|
127
119
|
{
|
|
128
120
|
"type": "AQUEOUS_EQUILIBRIUM",
|
|
129
|
-
"
|
|
130
|
-
"
|
|
121
|
+
"condensed phase": "aqueous aerosol",
|
|
122
|
+
"condensed-phase water": "H2O_aq",
|
|
131
123
|
"A": 1.14e-2,
|
|
132
124
|
"C": 2300.0,
|
|
133
125
|
"k_reverse": 0.32,
|
|
@@ -147,12 +139,12 @@
|
|
|
147
139
|
"coefficient": 1
|
|
148
140
|
}
|
|
149
141
|
],
|
|
150
|
-
"name": "my aqueous eq"
|
|
142
|
+
"name": "my aqueous eq",
|
|
143
|
+
"__irrelevant": "2"
|
|
151
144
|
},
|
|
152
145
|
{
|
|
153
146
|
"type": "CONDENSED_PHASE_ARRHENIUS",
|
|
154
|
-
"
|
|
155
|
-
"aerosol-phase water": "H2O_aq",
|
|
147
|
+
"condensed phase": "aqueous aerosol",
|
|
156
148
|
"A": 123.45,
|
|
157
149
|
"Ea": 123.45,
|
|
158
150
|
"B": 1.3,
|
|
@@ -174,12 +166,12 @@
|
|
|
174
166
|
"coefficient": 1
|
|
175
167
|
}
|
|
176
168
|
],
|
|
177
|
-
"name": "my condensed arrhenius"
|
|
169
|
+
"name": "my condensed arrhenius",
|
|
170
|
+
"__irrelevant": "2"
|
|
178
171
|
},
|
|
179
172
|
{
|
|
180
173
|
"type": "CONDENSED_PHASE_ARRHENIUS",
|
|
181
|
-
"
|
|
182
|
-
"aerosol-phase water": "H2O_aq",
|
|
174
|
+
"condensed phase": "aqueous aerosol",
|
|
183
175
|
"A": 123.45,
|
|
184
176
|
"C": 123.45,
|
|
185
177
|
"B": 1.3,
|
|
@@ -205,8 +197,7 @@
|
|
|
205
197
|
},
|
|
206
198
|
{
|
|
207
199
|
"type": "CONDENSED_PHASE_PHOTOLYSIS",
|
|
208
|
-
"
|
|
209
|
-
"aerosol-phase water": "H2O_aq",
|
|
200
|
+
"condensed phase": "aqueous aerosol",
|
|
210
201
|
"reactants": [
|
|
211
202
|
{
|
|
212
203
|
"species name": "H2O2_aq",
|
|
@@ -220,7 +211,8 @@
|
|
|
220
211
|
}
|
|
221
212
|
],
|
|
222
213
|
"scaling factor": 12.3,
|
|
223
|
-
"name": "condensed photo B"
|
|
214
|
+
"name": "condensed photo B",
|
|
215
|
+
"__irrelevant": "2"
|
|
224
216
|
},
|
|
225
217
|
{
|
|
226
218
|
"type": "EMISSION",
|
|
@@ -232,7 +224,8 @@
|
|
|
232
224
|
}
|
|
233
225
|
],
|
|
234
226
|
"name": "my emission",
|
|
235
|
-
"scaling factor": 12.3
|
|
227
|
+
"scaling factor": 12.3,
|
|
228
|
+
"__irrelevant": "2"
|
|
236
229
|
},
|
|
237
230
|
{
|
|
238
231
|
"type": "FIRST_ORDER_LOSS",
|
|
@@ -244,7 +237,8 @@
|
|
|
244
237
|
}
|
|
245
238
|
],
|
|
246
239
|
"name": "my first order loss",
|
|
247
|
-
"scaling factor": 12.3
|
|
240
|
+
"scaling factor": 12.3,
|
|
241
|
+
"__irrelevant": "2"
|
|
248
242
|
},
|
|
249
243
|
{
|
|
250
244
|
"type": "PHOTOLYSIS",
|
|
@@ -262,7 +256,8 @@
|
|
|
262
256
|
}
|
|
263
257
|
],
|
|
264
258
|
"name": "photo B",
|
|
265
|
-
"scaling factor": 12.3
|
|
259
|
+
"scaling factor": 12.3,
|
|
260
|
+
"__irrelevant": "2"
|
|
266
261
|
},
|
|
267
262
|
{
|
|
268
263
|
"type": "SURFACE",
|
|
@@ -279,8 +274,9 @@
|
|
|
279
274
|
"coefficient": 1
|
|
280
275
|
}
|
|
281
276
|
],
|
|
282
|
-
"
|
|
283
|
-
"name": "my surface"
|
|
277
|
+
"condensed phase": "surface reacting phase",
|
|
278
|
+
"name": "my surface",
|
|
279
|
+
"__irrelevant": "2"
|
|
284
280
|
},
|
|
285
281
|
{
|
|
286
282
|
"type": "TROE",
|
|
@@ -309,7 +305,38 @@
|
|
|
309
305
|
"kinf_C": 24,
|
|
310
306
|
"Fc": 0.9,
|
|
311
307
|
"N": 0.8,
|
|
312
|
-
"name": "my troe"
|
|
308
|
+
"name": "my troe",
|
|
309
|
+
"__irrelevant": "2"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"type": "TERNARY_CHEMICAL_ACTIVATION",
|
|
313
|
+
"gas phase": "gas",
|
|
314
|
+
"name": "my ternary chemical activation",
|
|
315
|
+
"reactants": [
|
|
316
|
+
{
|
|
317
|
+
"species name": "B",
|
|
318
|
+
"coefficient": 1
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"species name": "M",
|
|
322
|
+
"coefficient": 1
|
|
323
|
+
}
|
|
324
|
+
],
|
|
325
|
+
"products": [
|
|
326
|
+
{
|
|
327
|
+
"species name": "C",
|
|
328
|
+
"coefficient": 1
|
|
329
|
+
}
|
|
330
|
+
],
|
|
331
|
+
"k0_A": 32.1,
|
|
332
|
+
"k0_B": -2.3,
|
|
333
|
+
"k0_C": 102.3,
|
|
334
|
+
"kinf_A": 63.4,
|
|
335
|
+
"kinf_B": -1.3,
|
|
336
|
+
"kinf_C": 908.5,
|
|
337
|
+
"Fc": 1.3,
|
|
338
|
+
"N": 32.1,
|
|
339
|
+
"__irrelevant": "2"
|
|
313
340
|
},
|
|
314
341
|
{
|
|
315
342
|
"type": "BRANCHED_NO_RO2",
|
|
@@ -336,7 +363,8 @@
|
|
|
336
363
|
"Y": 167,
|
|
337
364
|
"a0": 0.15,
|
|
338
365
|
"n": 9,
|
|
339
|
-
"name": "my branched"
|
|
366
|
+
"name": "my branched",
|
|
367
|
+
"__irrelevant": "2"
|
|
340
368
|
},
|
|
341
369
|
{
|
|
342
370
|
"gas phase": "gas",
|
|
@@ -356,13 +384,15 @@
|
|
|
356
384
|
"species name": "C",
|
|
357
385
|
"coefficient": 1
|
|
358
386
|
}
|
|
359
|
-
]
|
|
387
|
+
],
|
|
388
|
+
"__irrelevant": "2"
|
|
360
389
|
},
|
|
361
390
|
{
|
|
362
391
|
"type": "WET_DEPOSITION",
|
|
363
|
-
"
|
|
392
|
+
"condensed phase": "cloud",
|
|
364
393
|
"name": "rxn cloud",
|
|
365
|
-
"scaling factor": 12.3
|
|
394
|
+
"scaling factor": 12.3,
|
|
395
|
+
"__irrelevant": "2"
|
|
366
396
|
},
|
|
367
397
|
{
|
|
368
398
|
"type": "ARRHENIUS",
|
|
@@ -384,7 +414,8 @@
|
|
|
384
414
|
"C": 102.3,
|
|
385
415
|
"D": 63.4,
|
|
386
416
|
"E": -1.3,
|
|
387
|
-
"name": "my arrhenius"
|
|
417
|
+
"name": "my arrhenius",
|
|
418
|
+
"__irrelevant": "2"
|
|
388
419
|
},
|
|
389
420
|
{
|
|
390
421
|
"type": "ARRHENIUS",
|
|
@@ -428,7 +459,8 @@
|
|
|
428
459
|
}
|
|
429
460
|
],
|
|
430
461
|
"name": "my user defined",
|
|
431
|
-
"scaling factor": 12.3
|
|
462
|
+
"scaling factor": 12.3,
|
|
463
|
+
"__irrelevant": "2"
|
|
432
464
|
}
|
|
433
465
|
]
|
|
434
466
|
}
|
|
@@ -65,27 +65,21 @@ phases:
|
|
|
65
65
|
- B
|
|
66
66
|
- C
|
|
67
67
|
reactions:
|
|
68
|
-
- type: HL_PHASE_TRANSFER
|
|
69
|
-
gas phase: gas
|
|
70
|
-
gas-phase species: H2O2
|
|
71
|
-
aerosol phase: aqueous aerosol
|
|
72
|
-
aerosol-phase species: H2O2_aq
|
|
73
|
-
aerosol-phase water: H2O_aq
|
|
74
|
-
name: my henry's law
|
|
75
68
|
- type: SIMPOL_PHASE_TRANSFER
|
|
76
69
|
gas phase: gas
|
|
77
70
|
gas-phase species: ethanol
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
condensed phase: aqueous aerosol
|
|
72
|
+
condensed-phase species: ethanol_aq
|
|
80
73
|
B:
|
|
81
74
|
- -1970
|
|
82
75
|
- 2.91
|
|
83
76
|
- 0.00196
|
|
84
77
|
- -0.496
|
|
85
78
|
name: my simpol
|
|
79
|
+
__irrelevant: "2"
|
|
86
80
|
- type: AQUEOUS_EQUILIBRIUM
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
condensed phase: aqueous aerosol
|
|
82
|
+
condensed-phase water: H2O_aq
|
|
89
83
|
A: 0.0114
|
|
90
84
|
C: 2300
|
|
91
85
|
k_reverse: 0.32
|
|
@@ -98,9 +92,9 @@ reactions:
|
|
|
98
92
|
- species name: C
|
|
99
93
|
coefficient: 1
|
|
100
94
|
name: my aqueous eq
|
|
95
|
+
__irrelevant: "2"
|
|
101
96
|
- type: CONDENSED_PHASE_ARRHENIUS
|
|
102
|
-
|
|
103
|
-
aerosol-phase water: H2O_aq
|
|
97
|
+
condensed phase: aqueous aerosol
|
|
104
98
|
A: 123.45
|
|
105
99
|
Ea: 123.45
|
|
106
100
|
B: 1.3
|
|
@@ -115,9 +109,9 @@ reactions:
|
|
|
115
109
|
- species name: ethanol_aq
|
|
116
110
|
coefficient: 1
|
|
117
111
|
name: my condensed arrhenius
|
|
112
|
+
__irrelevant: "2"
|
|
118
113
|
- type: CONDENSED_PHASE_ARRHENIUS
|
|
119
|
-
|
|
120
|
-
aerosol-phase water: H2O_aq
|
|
114
|
+
condensed phase: aqueous aerosol
|
|
121
115
|
A: 123.45
|
|
122
116
|
C: 123.45
|
|
123
117
|
B: 1.3
|
|
@@ -133,8 +127,7 @@ reactions:
|
|
|
133
127
|
coefficient: 1
|
|
134
128
|
name: my other condensed arrhenius
|
|
135
129
|
- type: CONDENSED_PHASE_PHOTOLYSIS
|
|
136
|
-
|
|
137
|
-
aerosol-phase water: H2O_aq
|
|
130
|
+
condensed phase: aqueous aerosol
|
|
138
131
|
reactants:
|
|
139
132
|
- species name: H2O2_aq
|
|
140
133
|
coefficient: 1
|
|
@@ -143,6 +136,7 @@ reactions:
|
|
|
143
136
|
coefficient: 1
|
|
144
137
|
scaling factor: 12.3
|
|
145
138
|
name: condensed photo B
|
|
139
|
+
__irrelevant: "2"
|
|
146
140
|
- type: EMISSION
|
|
147
141
|
gas phase: gas
|
|
148
142
|
products:
|
|
@@ -150,6 +144,7 @@ reactions:
|
|
|
150
144
|
coefficient: 1
|
|
151
145
|
name: my emission
|
|
152
146
|
scaling factor: 12.3
|
|
147
|
+
__irrelevant: "2"
|
|
153
148
|
- type: FIRST_ORDER_LOSS
|
|
154
149
|
gas phase: gas
|
|
155
150
|
reactants:
|
|
@@ -157,6 +152,7 @@ reactions:
|
|
|
157
152
|
coefficient: 1
|
|
158
153
|
name: my first order loss
|
|
159
154
|
scaling factor: 12.3
|
|
155
|
+
__irrelevant: "2"
|
|
160
156
|
- type: PHOTOLYSIS
|
|
161
157
|
gas phase: gas
|
|
162
158
|
reactants:
|
|
@@ -167,6 +163,7 @@ reactions:
|
|
|
167
163
|
coefficient: 1
|
|
168
164
|
name: photo B
|
|
169
165
|
scaling factor: 12.3
|
|
166
|
+
__irrelevant: "2"
|
|
170
167
|
- type: SURFACE
|
|
171
168
|
gas phase: gas
|
|
172
169
|
gas-phase species: A
|
|
@@ -176,8 +173,9 @@ reactions:
|
|
|
176
173
|
coefficient: 1
|
|
177
174
|
- species name: C
|
|
178
175
|
coefficient: 1
|
|
179
|
-
|
|
176
|
+
condensed phase: surface reacting phase
|
|
180
177
|
name: my surface
|
|
178
|
+
__irrelevant: "2"
|
|
181
179
|
- type: TROE
|
|
182
180
|
gas phase: gas
|
|
183
181
|
reactants:
|
|
@@ -197,6 +195,27 @@ reactions:
|
|
|
197
195
|
Fc: 0.9
|
|
198
196
|
N: 0.8
|
|
199
197
|
name: my troe
|
|
198
|
+
__irrelevant: "2"
|
|
199
|
+
- type: TERNARY_CHEMICAL_ACTIVATION
|
|
200
|
+
gas phase: gas
|
|
201
|
+
name: my ternary chemical activation
|
|
202
|
+
reactants:
|
|
203
|
+
- species name: B
|
|
204
|
+
coefficient: 1
|
|
205
|
+
- species name: M
|
|
206
|
+
coefficient: 1
|
|
207
|
+
products:
|
|
208
|
+
- species name: C
|
|
209
|
+
coefficient: 1
|
|
210
|
+
k0_A: 32.1
|
|
211
|
+
k0_B: -2.3
|
|
212
|
+
k0_C: 102.3
|
|
213
|
+
kinf_A: 63.4
|
|
214
|
+
kinf_B: -1.3
|
|
215
|
+
kinf_C: 908.5
|
|
216
|
+
Fc: 1.3
|
|
217
|
+
"N": 32.1
|
|
218
|
+
__irrelevant: "2"
|
|
200
219
|
- type: BRANCHED_NO_RO2
|
|
201
220
|
gas phase: gas
|
|
202
221
|
reactants:
|
|
@@ -213,6 +232,7 @@ reactions:
|
|
|
213
232
|
a0: 0.15
|
|
214
233
|
"n": 9
|
|
215
234
|
name: my branched
|
|
235
|
+
__irrelevant: "2"
|
|
216
236
|
- gas phase: gas
|
|
217
237
|
type: TUNNELING
|
|
218
238
|
name: "my tunneling"
|
|
@@ -225,10 +245,12 @@ reactions:
|
|
|
225
245
|
products:
|
|
226
246
|
- species name: C
|
|
227
247
|
coefficient: 1
|
|
248
|
+
__irrelevant: "2"
|
|
228
249
|
- type: WET_DEPOSITION
|
|
229
|
-
|
|
250
|
+
condensed phase: cloud
|
|
230
251
|
name: rxn cloud
|
|
231
252
|
scaling factor: 12.3
|
|
253
|
+
__irrelevant: "2"
|
|
232
254
|
- type: ARRHENIUS
|
|
233
255
|
gas phase: gas
|
|
234
256
|
reactants:
|
|
@@ -243,6 +265,7 @@ reactions:
|
|
|
243
265
|
D: 63.4
|
|
244
266
|
E: -1.3
|
|
245
267
|
name: my arrhenius
|
|
268
|
+
__irrelevant: "2"
|
|
246
269
|
- type: ARRHENIUS
|
|
247
270
|
gas phase: gas
|
|
248
271
|
reactants:
|
|
@@ -268,4 +291,5 @@ reactions:
|
|
|
268
291
|
- species name: C
|
|
269
292
|
coefficient: 1.3
|
|
270
293
|
name: my user defined
|
|
271
|
-
scaling factor: 12.3
|
|
294
|
+
scaling factor: 12.3
|
|
295
|
+
__irrelevant: "2"
|
|
@@ -4,12 +4,12 @@ import musica
|
|
|
4
4
|
import random
|
|
5
5
|
import musica.mechanism_configuration as mc
|
|
6
6
|
from musica.cuda import is_cuda_available
|
|
7
|
+
from musica.constants import GAS_CONSTANT
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
def TestSingleGridCell(solver, state, time_step, places=5):
|
|
10
11
|
temperature = 272.5
|
|
11
12
|
pressure = 101253.3
|
|
12
|
-
GAS_CONSTANT = 8.31446261815324
|
|
13
13
|
air_density = pressure / (GAS_CONSTANT * temperature)
|
|
14
14
|
|
|
15
15
|
rate_constants = {
|
|
@@ -118,7 +118,6 @@ def TestMultipleGridCell(solver, state, num_grid_cells, time_step, places=5):
|
|
|
118
118
|
rate_constants["USER.reaction 2"].append(
|
|
119
119
|
0.002 + random.uniform(-0.0001, 0.0001))
|
|
120
120
|
|
|
121
|
-
|
|
122
121
|
state.set_conditions(temperatures, pressures) # Air density should be calculated in the state
|
|
123
122
|
state.set_concentrations(concentrations)
|
|
124
123
|
state.set_user_defined_rate_parameters(rate_constants)
|