Skip to content

Commit 736932f

Browse files
committed
make the output depending on the tool as a wildcard, only the simulation is then performed with a different script, but all tools can be integrated into the same workflow
1 parent c2e395a commit 736932f

File tree

1 file changed

+12
-12
lines changed
  • benchmarks/linear-elastic-plate-with-hole/FEniCS

1 file changed

+12
-12
lines changed

benchmarks/linear-elastic-plate-with-hole/FEniCS/Snakefile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ def get_configuration(file):
2323

2424
# Create a dictionary of configurations (key is the name of the parameter file)
2525
# configurations: {Path("parameters_1.json"): "1", ...}
26-
# Reverse mapping for easy lookup by configuration name
2726
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
3028
configuration_to_parameter_file = {v: str(k) for k, v in configurations.items()}
3129

30+
tools = ["fenics"]
31+
3232
rule all:
3333
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),
3636

3737
rule create_mesh:
3838
input:
@@ -48,12 +48,12 @@ rule create_mesh:
4848

4949
rule run_simulation:
5050
input:
51-
script = "run_simulation.py",
51+
script = "run_simulation_{tool}.py",
5252
parameters = lambda wildcards: configuration_to_parameter_file[wildcards.configuration],
5353
mesh = "data/mesh_{configuration}.msh",
5454
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",
5757
conda:
5858
"environment_simulation.yml",
5959
shell:
@@ -65,11 +65,11 @@ rule summary:
6565
input:
6666
parameters = expand("{param}", param=[configuration_to_parameter_file[c] for c in configurations.values()]),
6767
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()),
7070
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",
7373
conda: "environment_postprocessing.yml",
7474
run:
7575
import json

0 commit comments

Comments
 (0)