Skip to content

Commit 47f5fb8

Browse files
committed
run OpenFOAM with snakemake
1 parent 30deb03 commit 47f5fb8

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

.github/workflows/run-benchmark.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ env:
1919
jobs:
2020
tests:
2121
runs-on: ubuntu-latest
22+
container:
23+
image: opencfd/openfoam-run:2412
2224

2325
steps:
2426
- name: checkout repo content
@@ -35,11 +37,18 @@ jobs:
3537
run: mamba env update -n model-validation -f environment_benchmarks.yml
3638
if: steps.cache.outputs.cache-hit != 'true'
3739

40+
- name: Ensure log directory exists
41+
run: mkdir -p benchmarks/rotating-cylinder-OpenFOAM/.snakemake/log
42+
3843
- name: run-OpenFOAM-benchmarks
3944
shell: bash -l {0}
4045
run: |
4146
cd $GITHUB_WORKSPACE/benchmarks/rotating-cylinder-OpenFOAM/
42-
snakemake --force --cores 'all'
47+
mkdir -p ./.snakemake/log || true # bc. snakemake is not able to create this directory itself
48+
chmod +x Allrun
49+
echo "Starting snakemake"
50+
snakemake --cores 1
51+
echo "Finished job."
4352
4453
- name: run-fenics-benchmarks
4554
shell: bash -l {0}
@@ -100,7 +109,7 @@ jobs:
100109
shell: bash -l {0}
101110
run: |
102111
cd $GITHUB_WORKSPACE/benchmarks/rotating-cylinder-OpenFOAM/
103-
sudo apt-get update && sudo apt-get install -y gnuplot
112+
# sudo apt-get update && sudo apt-get install -y gnuplot
104113
chmod +x ./plot
105114
bash ./Allrun
106115
echo "Finished job"

benchmarks/rotating-cylinder-OpenFOAM/Allrun

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ cd "${0%/*}" || exit # Run from this directory
55

66
runApplication blockMesh
77
runApplication $(getApplication)
8-
./plot
8+
9+
echo "Simulation completed. You could now post-process (e.g. visualize) the results."
10+
# ./plot # disabled for benchmark/snakemake-setup
911

1012
#------------------------------------------------------------------------------
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11

22
rule run_simulation_container:
33
input:
4-
".",
5-
output:
6-
directory("."),
4+
mesh="system/blockMeshDict",
5+
config="system/controlDict",
6+
initial_conditions="0/",
7+
scripts="Allrun"
8+
output:
9+
directory("1000"),
710
container: "docker://opencfd/openfoam-run:2412"
8-
shell: "./Allrun"
11+
shell:
12+
"""
13+
set -euo pipefail
14+
echo "Starting simulation."
15+
./Allrun
16+
ls -la
17+
"""

0 commit comments

Comments
 (0)