Skip to content

Commit

Permalink
initial reaction rates added to generate config
Browse files Browse the repository at this point in the history
  • Loading branch information
eadlg2 committed Mar 28, 2024
1 parent 7848c9a commit 25d103b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/box_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ def generateConfig(self, directory):

data["initial conditions"] = {}

for reaction_rate in self.initial_conditions.reaction_rates:
name = "PHOT." + reaction_rate.reaction.name + ".s-1"
data["initial conditions"][name] = reaction_rate.rate

data["model components"] = [
{
"type": "CAMP",
Expand Down Expand Up @@ -421,7 +425,7 @@ def readFromUIJson(self, path_to_json):
"""
# TODO: Implement the logic to update the box model config using a json.

with open(path_to_json, 'r', encoding='UTF-16') as json_file:
with open(path_to_json, 'r') as json_file:
data = json.load(json_file)

# Set box model options
Expand Down Expand Up @@ -459,10 +463,10 @@ def __main__():
box_model = BoxModel()

# Read the box model configuration from a json file.
box_model.readFromUIJson("./pretty_json.json")
box_model.readFromUIJson("../initial.json")

# Generate configuration JSON for the box model simulation.
box_model.generateConfig("reactions_config_test")
box_model.generateConfig("UI_test")



Expand Down

0 comments on commit 25d103b

Please sign in to comment.