From 36528e37e94164579d26b638d47e4fa56c34cfdd Mon Sep 17 00:00:00 2001 From: Benjamin Uekermann Date: Mon, 18 Aug 2025 03:13:18 +0200 Subject: [PATCH 1/6] Make OpenFOAM use adaptive time stepping --- perpendicular-flap/fluid-openfoam/system/controlDict-template | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/perpendicular-flap/fluid-openfoam/system/controlDict-template b/perpendicular-flap/fluid-openfoam/system/controlDict-template index 9b524f1f..4035cba3 100644 --- a/perpendicular-flap/fluid-openfoam/system/controlDict-template +++ b/perpendicular-flap/fluid-openfoam/system/controlDict-template @@ -17,7 +17,8 @@ stopAt endTime; endTime 5; -deltaT {{ deltaT }}; +adjustTimeStep yes; +maxCo 0.5; writeControl adjustableRunTime; From 918589c23d36b5d8ee5a3e6da73aee9ea8ad2412 Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Sat, 23 Aug 2025 18:14:01 +0200 Subject: [PATCH 2/6] Build preCICE on top of OpenFOAM Dockerimage to bypass problem that OpenFOAM.com is down. --- .github/workflows/publish-docker.yml | 20 ++++++++++++++++++++ tools/docker/dealii-openfoam/Dockerfile | 14 ++++++++------ tools/docker/fenics-openfoam/Dockerfile | 13 +++++++------ tools/docker/precice-openfoam/Dockerfile | 20 ++++++++++++++++++++ 4 files changed, 55 insertions(+), 12 deletions(-) create mode 100644 tools/docker/precice-openfoam/Dockerfile diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index 82c27cf7..71d5a946 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -3,8 +3,28 @@ on: workflow_dispatch: jobs: + build_precice_openfoam: + name: "Build preCICE 3.2.0 on top of opencfd/openfoam-run:2412" + runs-on: ubuntu-latest + env: + docker_username: benjaminrodenberg + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ env.docker_username }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push Dockerfile + uses: docker/build-push-action@v6 + with: + push: true + file: "./tools/docker/precice-openfoam/Dockerfile" + tags: ${{ env.docker_username }}/precice-openfoam:3.2.0 build_fenics_openfoam: name: "Build FEniCS-OpenFOAM" + needs: build_precice_openfoam runs-on: ubuntu-latest env: docker_username: benjaminrodenberg diff --git a/tools/docker/dealii-openfoam/Dockerfile b/tools/docker/dealii-openfoam/Dockerfile index 36cce64a..68e323f2 100644 --- a/tools/docker/dealii-openfoam/Dockerfile +++ b/tools/docker/dealii-openfoam/Dockerfile @@ -1,4 +1,4 @@ -FROM precice/precice:3.2.0 +FROM benjaminrodenberg/precice-openfoam:3.2.0 USER root @@ -6,11 +6,13 @@ USER root RUN apt-get -qq update && \ apt-get -qq install --no-install-recommends wget software-properties-common -# Install OpenFOAM & add to bashrc -RUN wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | bash && \ - apt-get -qq install openfoam2412-dev && \ - rm -rf /var/lib/apt/lists/* && \ - echo '. /usr/lib/openfoam/openfoam2412/etc/bashrc' >> /root/.bashrc && \ +# OpenFOAM.com does not work; OpenFOAM installation already provided in benjaminrodenberg/precice-openfoam:3.2.0 +# # Install OpenFOAM +# RUN wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | bash && \ +# apt-get -qq install openfoam2412-dev && \ +# rm -rf /var/lib/apt/lists/* +# add to bashrc +RUN echo '. /usr/lib/openfoam/openfoam2412/etc/bashrc' >> /root/.bashrc && \ echo '. /usr/lib/openfoam/openfoam2412/etc/bashrc' >> /home/precice/.bashrc # Install deal.ii diff --git a/tools/docker/fenics-openfoam/Dockerfile b/tools/docker/fenics-openfoam/Dockerfile index c6904838..9b3f40bd 100644 --- a/tools/docker/fenics-openfoam/Dockerfile +++ b/tools/docker/fenics-openfoam/Dockerfile @@ -1,4 +1,4 @@ -FROM precice/precice:3.2.0 +FROM benjaminrodenberg/precice-openfoam:3.2.0 USER root @@ -6,11 +6,12 @@ USER root RUN apt-get -qq update && \ apt-get -qq install --no-install-recommends wget software-properties-common -# Install OpenFOAM & add to bashrc -RUN wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | bash && \ - apt-get -qq install openfoam2412-dev && \ - rm -rf /var/lib/apt/lists/* && \ - echo '. /usr/lib/openfoam/openfoam2412/etc/bashrc' >> /root/.bashrc && \ +# OpenFOAM.com does not work; OpenFOAM installation already provided in benjaminrodenberg/precice-openfoam:3.2.0 +# # Install OpenFOAM +# RUN wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | bash && \ +# apt-get -qq install openfoam2412-dev && \ +# rm -rf /var/lib/apt/lists/* +RUN echo '. /usr/lib/openfoam/openfoam2412/etc/bashrc' >> /root/.bashrc && \ echo '. /usr/lib/openfoam/openfoam2412/etc/bashrc' >> /home/precice/.bashrc # Install FEniCS diff --git a/tools/docker/precice-openfoam/Dockerfile b/tools/docker/precice-openfoam/Dockerfile new file mode 100644 index 00000000..ef1ce23b --- /dev/null +++ b/tools/docker/precice-openfoam/Dockerfile @@ -0,0 +1,20 @@ +# Based on https://github.com/precice/precice/blob/625092d2c2f23f021708e8d74228d523742d1e1f/tools/releasing/packaging/docker/release.dockerfile + +# Use OpenFOAM docker container as basis. +FROM opencfd/openfoam-run:2412 +# Remove OpenFOAM PPA +RUN rm /etc/apt/sources.list.d/openfoam.list +# Add the precice user +RUN useradd -m -s /bin/bash precice +# Fix the installation of tzdata for Ubuntu +ARG TIMEZONE=Europe/Berlin +RUN export TZ=$TIMEZONE && echo $TZ > /etc/timezone && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \ + apt-get -yy update && apt-get -yy install wget tzdata lsb-release && rm -rf /var/lib/apt/lists/* +# The version to fetch the package for: X.Y.Z +ARG version=3.2.0 +RUN echo "$version" | grep "[0-9]\+\.[0-9]\+\.[0-9]\+" > /dev/null # The version must follow the format X.Y.Z +RUN wget -q -O libprecice.deb https://github.com/precice/precice/releases/download/v${version}/libprecice`echo ${version} | sed 's/\([0-9]\+\)\.\([0-9]\+\.[0-9]\+\)/\1_\1.\2/'`_$(lsb_release -sc).deb && \ + apt-get update && apt-get -yy install ./libprecice.deb && \ + rm libprecice.deb && rm -rf /var/lib/apt/lists/* +# Make sure the installation is functional +RUN precice-tools version From cf5df5e9a30ab09b3432460c97628f5664f59d12 Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Sat, 23 Aug 2025 18:22:07 +0200 Subject: [PATCH 3/6] Use dev image since we need wmake. --- tools/docker/precice-openfoam/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/docker/precice-openfoam/Dockerfile b/tools/docker/precice-openfoam/Dockerfile index ef1ce23b..280152a0 100644 --- a/tools/docker/precice-openfoam/Dockerfile +++ b/tools/docker/precice-openfoam/Dockerfile @@ -1,7 +1,7 @@ # Based on https://github.com/precice/precice/blob/625092d2c2f23f021708e8d74228d523742d1e1f/tools/releasing/packaging/docker/release.dockerfile # Use OpenFOAM docker container as basis. -FROM opencfd/openfoam-run:2412 +FROM opencfd/openfoam-dev:2412 # Remove OpenFOAM PPA RUN rm /etc/apt/sources.list.d/openfoam.list # Add the precice user From db8471e2b37a6885fa27436f3278b23fafa5dc71 Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Sat, 23 Aug 2025 18:23:03 +0200 Subject: [PATCH 4/6] Fix name of stage. --- .github/workflows/publish-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index 71d5a946..3cf9375d 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -4,7 +4,7 @@ on: jobs: build_precice_openfoam: - name: "Build preCICE 3.2.0 on top of opencfd/openfoam-run:2412" + name: "Build preCICE 3.2.0 on top of opencfd/openfoam-dev:2412" runs-on: ubuntu-latest env: docker_username: benjaminrodenberg From bd90857a5dff48c63db1914c3c97779298266598 Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Sun, 24 Aug 2025 22:43:30 +0200 Subject: [PATCH 5/6] Add missing parameters. --- perpendicular-flap/fluid-openfoam/system/controlDict-template | 2 ++ 1 file changed, 2 insertions(+) diff --git a/perpendicular-flap/fluid-openfoam/system/controlDict-template b/perpendicular-flap/fluid-openfoam/system/controlDict-template index 4035cba3..05ab6368 100644 --- a/perpendicular-flap/fluid-openfoam/system/controlDict-template +++ b/perpendicular-flap/fluid-openfoam/system/controlDict-template @@ -17,6 +17,8 @@ stopAt endTime; endTime 5; +deltaT 0.00001; // initial dt +maxDeltaT 0.001; // maximum allowed dt, make a parameter and set to value similar to window size? adjustTimeStep yes; maxCo 0.5; From 3eff379882399ae61413bfb530853516e2da2781 Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Sat, 13 Sep 2025 16:25:10 +0200 Subject: [PATCH 6/6] Rename test cases to follow structure of paper. --- ...lap.yml => 4-1-partitioned-oscillator.yml} | 44 ++++++++----------- 1 file changed, 18 insertions(+), 26 deletions(-) rename .github/workflows/{oscillator-overlap.yml => 4-1-partitioned-oscillator.yml} (65%) diff --git a/.github/workflows/oscillator-overlap.yml b/.github/workflows/4-1-partitioned-oscillator.yml similarity index 65% rename from .github/workflows/oscillator-overlap.yml rename to .github/workflows/4-1-partitioned-oscillator.yml index 3b9c7e71..f1a54aa9 100644 --- a/.github/workflows/oscillator-overlap.yml +++ b/.github/workflows/4-1-partitioned-oscillator.yml @@ -1,4 +1,4 @@ -name: Run oscillator-overlap experiments +name: Section 4.1 partitioned oscillator on: release: types: [published] @@ -9,22 +9,22 @@ jobs: strategy: matrix: experiment: - - name: Optimal dt relationship (FP) - args: 'precice-config-template-FP.xml --silent --executor Github --config optimal_dt.csv -tss runge_kutta_4 generalized_alpha -wd 3 --exchange-substeps -o convergence-studies/optimal_dt_FP.csv' - - name: Optimal dt relationship (rQN) - args: 'precice-config-template-rQN.xml --silent --executor Github --config optimal_dt.csv -tss runge_kutta_4 generalized_alpha -wd 3 --exchange-substeps -o convergence-studies/optimal_dt_rQN.csv' - - name: Optimal dt relationship (fQN) - args: 'precice-config-template-fQN.xml --silent --executor Github --config optimal_dt.csv -tss runge_kutta_4 generalized_alpha -wd 3 --exchange-substeps -o convergence-studies/optimal_dt_fQN.csv' - - name: Fig 1a) Constant Interpolation - args: 'precice-config-template-FP.xml --silent --executor Github --config fig1_dts.csv -tss runge_kutta_4 generalized_alpha -wd 0 -o convergence-studies/fig1a.csv' - - name: Fig 1b) Linear Interpolation - args: 'precice-config-template-FP.xml --silent --executor Github --config fig1_dts.csv -tss runge_kutta_4 generalized_alpha -wd 1 -o convergence-studies/fig1b.csv' - - name: Fig 1c) Piecewise Linear Interpolation - args: 'precice-config-template-FP.xml --silent --executor Github --config fig1_dts.csv -tss runge_kutta_4 generalized_alpha -wd 1 --exchange-substeps -o convergence-studies/fig1c.csv' - - name: Fig 1d) B-spline Interpolation - args: 'precice-config-template-FP.xml --silent --executor Github --config fig1_dts.csv -tss runge_kutta_4 generalized_alpha -wd 3 --exchange-substeps -o convergence-studies/fig1d.csv' - - name: Figure 12 - args: 'precice-config-template-FP.xml --silent --executor Github --config fig12.csv -tss runge_kutta_4 generalized_alpha -wd 3 --exchange-substeps -o convergence-studies/contour_data.csv' + - name: Figure 10 constant + args: 'precice-config-template-FP.xml --silent --executor Github --config fig1_dts.csv -tss runge_kutta_4 generalized_alpha -wd 0 -o results/Fig10/data/constant.csv' + - name: Figure 10 linear + args: 'precice-config-template-FP.xml --silent --executor Github --config fig1_dts.csv -tss runge_kutta_4 generalized_alpha -wd 1 -o convergence-studies/Fig10/data/linear.csv' + - name: Figure 10 piecewise linear + args: 'precice-config-template-FP.xml --silent --executor Github --config fig1_dts.csv -tss runge_kutta_4 generalized_alpha -wd 1 --exchange-substeps -o convergence-studies/Fig10/data/piecewise_linear.csv' + - name: Figure 10 third-order B-spline + args: 'precice-config-template-FP.xml --silent --executor Github --config fig1_dts.csv -tss runge_kutta_4 generalized_alpha -wd 3 --exchange-substeps -o convergence-studies/Fig10/data/third_order_b-spline.csv' + - name: Figure 11 + args: 'precice-config-template-FP.xml --silent --executor Github --config fig12.csv -tss runge_kutta_4 generalized_alpha -wd 3 --exchange-substeps -o convergence-studies/Fig11/data/contour_data.csv' + - name: Table 1 fixed-point (shown) + args: 'precice-config-template-FP.xml --silent --executor Github --config optimal_dt.csv -tss runge_kutta_4 generalized_alpha -wd 3 --exchange-substeps -o convergence-studies/Tab1/data/FP.csv' + - name: Table 1 reduced quasi-Newton (not shown) + args: 'precice-config-template-rQN.xml --silent --executor Github --config optimal_dt.csv -tss runge_kutta_4 generalized_alpha -wd 3 --exchange-substeps -o convergence-studies/Tab1/data/rQN.csv' + - name: Table 1 full quasi-Newton (not shown) + args: 'precice-config-template-fQN.xml --silent --executor Github --config optimal_dt.csv -tss runge_kutta_4 generalized_alpha -wd 3 --exchange-substeps -o convergence-studies/Tab1/data/fQN.csv' runs-on: ubuntu-latest defaults: run: @@ -49,14 +49,6 @@ jobs: - name: Run tutorial run: | python3 doConvergenceStudy.py ${{matrix.experiment.args}} - - name: Store logs - if: always() - uses: actions/upload-artifact@v4 - with: - name: oscillator-overlap logs ${{ matrix.experiment.name }} - path: | - perpendicular-flap/fluid-openfoam/stdout-Fluid.log - perpendicular-flap/solid-fenics/stdout-Solid.log - name: Store results if: always() uses: actions/upload-artifact@v4 @@ -64,7 +56,7 @@ jobs: name: oscillator-overlap ${{ matrix.experiment.name }} path: | # working directory is ignored by actions/upload-artifact - ./oscillator-overlap/convergence-studies + ./oscillator-overlap/results merge: runs-on: ubuntu-latest needs: run_experiments