|
1 | | -import model |
| 1 | +import src.sparging.model as model |
2 | 2 | import sys |
3 | 3 | import os |
4 | | -from animation import create_animation |
5 | | -from helpers import get_input |
| 4 | +from sparging.animation import create_animation |
| 5 | +from sparging.helpers import get_input |
| 6 | + |
6 | 7 |
|
7 | 8 | ANIMATE = True |
8 | 9 | SHOW_ACTIVITY = True |
9 | | -INPUT_PATH = os.path.join(os.getcwd(), sys.argv[1]) |
10 | | -OUTPUT_PATH = os.path.join( |
11 | | - os.getcwd(), sys.argv[1] + "_out" if len(sys.argv) < 3 else sys.argv[2] |
| 10 | +YAML_INPUT_PATH = os.path.join(os.getcwd(), sys.argv[1]) |
| 11 | +OUTPUT_FOLDER = os.path.join( |
| 12 | + os.getcwd(), sys.argv[1].split(".")[0].replace("_input", "") |
12 | 13 | ) |
13 | 14 |
|
14 | | - |
15 | 15 | if __name__ == "__main__": |
16 | | - params = get_input(INPUT_PATH + ".yaml") |
17 | | - properties = model.compute_properties(params) |
| 16 | + params = get_input(YAML_INPUT_PATH) |
| 17 | + sim_input = model.SimulationInput(params) |
18 | 18 |
|
19 | | - # breakpoint() |
20 | | - merged_dict = {} |
21 | | - merged_dict.update(params) |
22 | | - merged_dict.update(properties) |
23 | | - |
24 | | - t_sparging_hr = [0, 1e20] # time interval when sparger is ON |
| 19 | + # TODO integrate to input file |
| 20 | + t_sparging_hr = [24, 1e20] # time interval when sparger is ON |
25 | 21 | t_irr_hr = [0, 96] # time interval when irradiation is ON |
26 | | - t_final = 10 * model.days_to_seconds |
| 22 | + t_final = 6 * model.days_to_seconds |
27 | 23 |
|
28 | 24 | results = model.solve( |
29 | | - merged_dict, |
| 25 | + sim_input, |
30 | 26 | t_final=t_final, |
31 | 27 | t_irr=[t * model.hours_to_seconds for t in t_irr_hr], |
32 | 28 | t_sparging=[t * model.hours_to_seconds for t in t_sparging_hr], |
33 | 29 | ) |
34 | | - # save_to_csv(c_T_volume) |
35 | 30 |
|
36 | | - results.to_yaml(OUTPUT_PATH + ".yaml", inputs=params, properties=properties) |
37 | | - results.to_json(OUTPUT_PATH + ".json", inputs=params, properties=properties) |
38 | | - results.profiles_to_csv(OUTPUT_PATH + "_profiles") |
39 | | - # breakpoint() |
| 31 | + os.makedirs(OUTPUT_FOLDER, exist_ok=True) |
| 32 | + results.to_yaml(os.path.join(OUTPUT_FOLDER, "restart.yaml")) |
| 33 | + results.to_json(os.path.join(OUTPUT_FOLDER, "output.json")) |
| 34 | + # results.profiles_to_csv(os.path.join(OUTPUT_FOLDER, "profiles")) |
| 35 | + |
40 | 36 | if ANIMATE is True: |
41 | 37 | # Create interactive animation |
42 | 38 | try: |
|
0 commit comments