Skip to content

Commit

Permalink
Merge branch 'python_box_model' of https://github.com/NCAR/music-box
Browse files Browse the repository at this point in the history
…into python_box_model
  • Loading branch information
eadlg2 committed Mar 28, 2024
2 parents 7073097 + cccd3b0 commit 7848c9a
Show file tree
Hide file tree
Showing 9 changed files with 3,664 additions and 2,912 deletions.
22 changes: 13 additions & 9 deletions src/box_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,18 +366,22 @@ def solve(self, path_to_output = None):

output_array.append(headers)

#runs the simulation at each timestep


curr_time = 0
next_output_time = curr_time
#runs the simulation at each timestep
while(curr_time <= self.box_model_options.simulation_length):

row = []
row.append(curr_time)
row.append(curr_conditions.temperature)
row.append(curr_conditions.pressure)
for conc in curr_concentrations:
row.append(conc)
output_array.append(row)
#outputs to output_array if enough time has elapsed
if(next_output_time <= curr_time):
row = []
row.append(next_output_time)
row.append(curr_conditions.temperature)
row.append(curr_conditions.pressure)
for conc in curr_concentrations:
row.append(conc)
output_array.append(row)
next_output_time += self.box_model_options.output_step_time

#iterates evolvings conditons if enough time has elapsed
if(next_conditions != None and next_conditions_time <= curr_time):
Expand Down
2 changes: 1 addition & 1 deletion src/configs/test_config_2/camp_data/reactions.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"camp-data": [{"type": "MECHANISM", "name": "music box interactive configuration", "reactions": [{"type": "PHOTOLYSIS", "scaling_factor": 1, "MUSICA name": "O3_2", "reactants": {"O3": {}}, "products": {"O": {"yield": 1}, "O2": {"yield": 1}, "irr__0665f4f2-132e-4f99-a2d7-7b0cf35b1b5f": {"yield": 1}}}, {"type": "ARRHENIUS", "A": 3.3e-11, "Ea": -7.59e-22, "B": 0, "D": 300, "E": 0, "reactants": {"O1D": {"qty": 1}, "O2": {"qty": 1}}, "products": {"O": {"yield": 1}, "O2": {"yield": 1}, "irr__21732b9a-3601-4739-acdc-48466559aeee": {"yield": 1}}}, {"type": "ARRHENIUS", "A": 6e-34, "Ea": 0, "B": -2.4, "D": 300, "E": 0, "reactants": {"O": {"qty": 1}, "O2": {"qty": 1}, "M": {"qty": 1}}, "products": {"O3": {"yield": 1}, "M": {"yield": 1}, "irr__6b0bb4ae-f671-4f2a-92c9-e88992346583": {"yield": 1}}}, {"type": "ARRHENIUS", "A": 2.15e-11, "Ea": -1.518e-21, "B": 0, "D": 300, "E": 0, "reactants": {"O1D": {"qty": 1}, "N2": {"qty": 1}}, "products": {"O": {"yield": 1}, "N2": {"yield": 1}, "irr__8be08086-a796-4c88-b56f-a695a0c22ddd": {"yield": 1}}}, {"type": "PHOTOLYSIS", "scaling_factor": 1, "MUSICA name": "O3_1", "reactants": {"O3": {}}, "products": {"O1D": {"yield": 1}, "O2": {"yield": 1}, "irr__90a4d7ba-c694-424b-a0eb-1146f2afee8e": {"yield": 1}}}, {"type": "ARRHENIUS", "A": 8e-12, "Ea": 2.8428e-20, "B": 0, "D": 300, "E": 0, "reactants": {"O": {"qty": 1}, "O3": {"qty": 1}}, "products": {"O2": {"yield": 2}, "irr__b3c93679-40cf-419a-8914-818b5d40b117": {"yield": 1}}}, {"type": "PHOTOLYSIS", "scaling_factor": 1, "MUSICA name": "O2_1", "reactants": {"O2": {}}, "products": {"O": {"yield": 2}, "irr__ce5b7d7f-dd7e-4daa-8e49-f1db924b50f6": {"yield": 1}}}]}]}
{"camp-data": [{"type": "MECHANISM", "name": "music box interactive configuration", "reactions": [{"type": "ARRHENIUS", "A": 8.8e-17, "Ea": 0, "B": 0, "D": 300, "E": 0, "reactants": {"O3": {"qty": 1}, "a-pinene": {"qty": 1}}, "products": {"SOA1": {"yield": 0.18}, "SOA2": {"yield": 0.09}, "irr__bab3e78d-d1d7-4c6b-9f6f-bbbd303c0901": {"yield": 1}}}]}]}
2 changes: 1 addition & 1 deletion src/configs/test_config_2/camp_data/species.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"camp-data": [{"name": "M", "type": "CHEM_SPEC", "tracer type": "CONSTANT"}, {"name": "Ar", "type": "CHEM_SPEC", "absolute tolerance": 1e-12}, {"name": "CO2", "type": "CHEM_SPEC", "absolute tolerance": 1e-12}, {"name": "H2O", "type": "CHEM_SPEC", "absolute tolerance": 1e-12}, {"name": "O1D", "type": "CHEM_SPEC", "absolute tolerance": 1e-12}, {"name": "O", "type": "CHEM_SPEC", "absolute tolerance": 1e-12}, {"name": "O2", "type": "CHEM_SPEC", "absolute tolerance": 1e-12}, {"name": "O3", "type": "CHEM_SPEC", "absolute tolerance": 1e-12}, {"name": "N2", "type": "CHEM_SPEC", "absolute tolerance": 1e-12}, {"name": "irr__0665f4f2-132e-4f99-a2d7-7b0cf35b1b5f", "type": "CHEM_SPEC"}, {"name": "irr__21732b9a-3601-4739-acdc-48466559aeee", "type": "CHEM_SPEC"}, {"name": "irr__6b0bb4ae-f671-4f2a-92c9-e88992346583", "type": "CHEM_SPEC"}, {"name": "irr__8be08086-a796-4c88-b56f-a695a0c22ddd", "type": "CHEM_SPEC"}, {"name": "irr__90a4d7ba-c694-424b-a0eb-1146f2afee8e", "type": "CHEM_SPEC"}, {"name": "irr__b3c93679-40cf-419a-8914-818b5d40b117", "type": "CHEM_SPEC"}, {"name": "irr__ce5b7d7f-dd7e-4daa-8e49-f1db924b50f6", "type": "CHEM_SPEC"}]}
{"camp-data": [ {"name": "a-pinene", "type": "CHEM_SPEC"}, {"name": "O3", "type": "CHEM_SPEC"}, {"name": "SOA1", "type": "CHEM_SPEC"}, {"name": "SOA2", "type": "CHEM_SPEC"}, {"name": "irr__bab3e78d-d1d7-4c6b-9f6f-bbbd303c0901", "type": "CHEM_SPEC"}]}
Loading

0 comments on commit 7848c9a

Please sign in to comment.