Skip to content

Commit

Permalink
fix timestepping
Browse files Browse the repository at this point in the history
  • Loading branch information
mattldawson committed Aug 28, 2024
1 parent 4ec7aef commit 69e0dd2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions src/acom_music_box/music_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,12 +543,10 @@ def solve(self, output_path=None):
# ensure the time step is not greater than the next update to the
# evolving conditions or the next output time
time_step = self.box_model_options.chem_step_time
if (next_conditions is not None and next_conditions_time > (curr_time + self.box_model_options.chem_step_time)):
time_step = min(time_step,
next_conditions_time - (curr_time + self.box_model_options.chem_step_time))
if (next_output_time > (curr_time + self.box_model_options.chem_step_time)):
time_step = min(time_step,
next_output_time - (curr_time + self.box_model_options.chem_step_time))
if (next_conditions is not None and next_conditions_time > curr_time):
time_step = min(time_step, next_conditions_time - curr_time)
if (next_output_time > curr_time):
time_step = min(time_step, next_output_time - curr_time)

# solves and updates concentration values in concentration array
if (not ordered_concentrations):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapman.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_run(self):
assert math.isclose(
float(model_output_concs[i][j]),
float(test_output_concs[i][j]),
rel_tol=1e-8,
rel_tol=1e-7,
abs_tol=1e-15,
), f"Arrays differ at index ({i}, {j}) for species {concs_to_test[j]}"

Expand Down

0 comments on commit 69e0dd2

Please sign in to comment.