@@ -23,16 +23,16 @@ def get_configuration(file):
23
23
24
24
# Create a dictionary of configurations (key is the name of the parameter file)
25
25
# configurations: {Path("parameters_1.json"): "1", ...}
26
- # Reverse mapping for easy lookup by configuration name
27
26
configurations = {file : get_configuration (file ) for file in files if file .is_file ()}
28
- # for testing only use the first two entries
29
- # configurations = dict(list(configurations.items())[:2])
27
+ # Reverse mapping for easy lookup by configuration name
30
28
configuration_to_parameter_file = {v : str (k ) for k , v in configurations .items ()}
31
29
30
+ tools = ["fenics" ]
31
+
32
32
rule all :
33
33
input :
34
- "data/summary .json" ,
35
- "data/summary .h5" ,
34
+ expand ( "data/summary_{tool} .json" , tool = tools ) ,
35
+ expand ( "data/summary_{tool} .h5" , tool = tools ) ,
36
36
37
37
rule create_mesh :
38
38
input :
@@ -48,12 +48,12 @@ rule create_mesh:
48
48
49
49
rule run_simulation :
50
50
input :
51
- script = "run_simulation .py" ,
51
+ script = "run_simulation_{tool} .py" ,
52
52
parameters = lambda wildcards : configuration_to_parameter_file [wildcards .configuration ],
53
53
mesh = "data/mesh_{configuration}.msh" ,
54
54
output :
55
- hdf5 = "data/solution_field_data_{configuration}.h5" ,
56
- metrics = "data/solution_metrics_{configuration}.json" ,
55
+ hdf5 = "data/solution_field_data_{tool}_{ configuration}.h5" ,
56
+ metrics = "data/solution_metrics_{tool}_{ configuration}.json" ,
57
57
conda :
58
58
"environment_simulation.yml" ,
59
59
shell :
@@ -65,11 +65,11 @@ rule summary:
65
65
input :
66
66
parameters = expand ("{param}" , param = [configuration_to_parameter_file [c ] for c in configurations .values ()]),
67
67
mesh = expand ("data/mesh_{configuration}.msh" , configuration = configurations .values ()),
68
- metrics = expand ("data/solution_metrics_{configuration}.json" , configuration = configurations .values ()),
69
- solution_field_data = expand ("data/solution_field_data_{configuration}.h5" , configuration = configurations .values ()),
68
+ metrics = lambda wildcards : expand ("data/solution_metrics_{tool}_{ configuration}.json" , tool = [ wildcards . tool ] , configuration = configurations .values ()),
69
+ solution_field_data = lambda wildcards : expand ("data/solution_field_data_{tool}_{ configuration}.h5" , tool = [ wildcards . tool ] , configuration = configurations .values ()),
70
70
output :
71
- summary_json = "data/summary .json" ,
72
- summary_h5 = "data/summary .h5" ,
71
+ summary_json = "data/summary_{tool} .json" ,
72
+ summary_h5 = "data/summary_{tool} .h5" ,
73
73
conda : "environment_postprocessing.yml" ,
74
74
run :
75
75
import json
0 commit comments