diff --git a/README.md b/README.md index 7d9a00a42..a9108cdff 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,18 @@ # preCICE Tutorials This repository contains ready-to-run tutorial cases for the coupling library [preCICE](http://www.precice.org/). +The purpose of these cases are not to teach you how to use preCICE, but to serve as starting points for setting up similar simulation cases. -You may find step-by-step instructions for each case in the [preCICE wiki](https://github.com/precice/precice/wiki). *More tutorials come with each adapter* and you can also find them in the wiki. +Each folder in this directory represents a stand-alone tutorial case containing: +* a `README.md` with general instructions on how to run the simulation. This is the same content you see on the [preCICE tutorials](https://www.precice.org/tutorials.html) documentation section. +* multiple participant folders with the format `-`. Pick a solver for each participant and start them to run the simulation. +* a `clean.sh` script to clean each individual participant case, a `clean-tutorial.sh` to clean all participants of a tutorial case, a `clean-all.sh` to clean all tutorial cases. +As a general rule, you can start each participant from inside their `-` using `./run.sh`. Look into these short scripts and copy the parts you need for your new case. -Each folder in this directory represents a stand-alone tutorial containing: -* a `README.md` with general instructions on how to run the simulation -* multiple participant folders with the format `_`. Pick a solver for each participant and start them to run the simulation. +## For contributors - -The website import relies on the following rules: +The [preCICE tutorials](https://www.precice.org/tutorials.html) documentation section displays material from this repository. This website import relies on the following rules: * tutorials use dashes to separate words `flow-over-heated-plate`. * a tutorial contains a `REAMDE.md` with a Jekyll front-matter and a `permalink: /tutorials-flow-over-heated-plate.html`. * a tutorial may contain a folder `images/` with images to be displayed in the `README.md`. diff --git a/elastic-tube-3d/fluid-openfoam/0.orig/U b/elastic-tube-3d/fluid-openfoam/0/U similarity index 100% rename from elastic-tube-3d/fluid-openfoam/0.orig/U rename to elastic-tube-3d/fluid-openfoam/0/U diff --git a/elastic-tube-3d/fluid-openfoam/0.orig/p b/elastic-tube-3d/fluid-openfoam/0/p similarity index 100% rename from elastic-tube-3d/fluid-openfoam/0.orig/p rename to elastic-tube-3d/fluid-openfoam/0/p diff --git a/elastic-tube-3d/fluid-openfoam/0.orig/pointDisplacement b/elastic-tube-3d/fluid-openfoam/0/pointDisplacement similarity index 100% rename from elastic-tube-3d/fluid-openfoam/0.orig/pointDisplacement rename to elastic-tube-3d/fluid-openfoam/0/pointDisplacement diff --git a/elastic-tube-3d/fluid-openfoam/clean.sh b/elastic-tube-3d/fluid-openfoam/clean.sh index 45da1f562..c31d9fc76 100755 --- a/elastic-tube-3d/fluid-openfoam/clean.sh +++ b/elastic-tube-3d/fluid-openfoam/clean.sh @@ -4,4 +4,3 @@ set -e -u . ../../tools/cleaning-tools.sh clean_openfoam . -rm -rfv ./0/ # in run.sh, 0.orig/ is copied to 0/ \ No newline at end of file diff --git a/elastic-tube-3d/fluid-openfoam/run.sh b/elastic-tube-3d/fluid-openfoam/run.sh index 29bf6721d..c305d6d9b 100755 --- a/elastic-tube-3d/fluid-openfoam/run.sh +++ b/elastic-tube-3d/fluid-openfoam/run.sh @@ -1,41 +1,8 @@ -#!/bin/bash -cd ${0%/*} || exit 1 # Run from this directory -. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions +#!/bin/sh +set -e -u -# Fluid participant - -# Run this script in one terminal and the execute the coupled_elasto_dynamics bindary -# in another terminal. -# These scripts present how the two participants would be started manually. - -# Run this script with "-parallel" for parallel simulations - -# The script "Allclean" cleans-up the result and log files. - -# 1 for true, 0 for false -parallel=0 -if [ "$1" = "-parallel" ]; then - parallel=1 -fi - -echo "Preparing and running the Fluid participant..." - -rm -rfv 0/ -cp -r 0.orig/ 0/ cp -r constant/polyMesh.orig constant/polyMesh -checkMesh touch fluid-openfoam.foam -# Run -solver=$(getApplication) -procs=$(getNumberOfProcessors) -if [ $parallel -eq 1 ]; then - decomposePar -force - mpirun -np $procs $solver -parallel - reconstructPar -else - $solver -fi - -# Workaround for issue #26 (OF-adapter, relevant for OF .com versions) +../../tools/run-openfoam.sh "$@" . ../../tools/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs diff --git a/elastic-tube-3d/fluid-openfoam/system/controlDict b/elastic-tube-3d/fluid-openfoam/system/controlDict index 62b6b599a..4247dc635 100755 --- a/elastic-tube-3d/fluid-openfoam/system/controlDict +++ b/elastic-tube-3d/fluid-openfoam/system/controlDict @@ -40,7 +40,7 @@ timeFormat general; timePrecision 8; -runTimeModifiable yes; +runTimeModifiable false; adjustTimeStep no; diff --git a/elastic-tube-3d/solid-calculix/clean.sh b/elastic-tube-3d/solid-calculix/clean.sh index 7586ddc5b..e93f04f3c 100755 --- a/elastic-tube-3d/solid-calculix/clean.sh +++ b/elastic-tube-3d/solid-calculix/clean.sh @@ -3,4 +3,4 @@ set -e -u . ../../tools/cleaning-tools.sh -clean_calculix . \ No newline at end of file +clean_calculix . diff --git a/elastic-tube-3d/solid-calculix/run.sh b/elastic-tube-3d/solid-calculix/run.sh index 936f6bbe7..5f1ff6813 100755 --- a/elastic-tube-3d/solid-calculix/run.sh +++ b/elastic-tube-3d/solid-calculix/run.sh @@ -1,13 +1,6 @@ -#!/bin/bash -cd ${0%/*} || exit 1 # Run from this directory +#!/bin/sh +set -e -u -# This script prepares and runs the CalculiX solver - -# =============== Participant: Solid =========================== -Solver="ccx_preCICE" - - # Run and get the process id - echo "Starting the CalculiX..." - export OMP_NUM_THREADS=1 - export CCX_NPROC_EQUATION_SOLVER=1 - ${Solver} -i tube -precice-participant Calculix +export OMP_NUM_THREADS=1 +export CCX_NPROC_EQUATION_SOLVER=1 +ccx_preCICE -i tube -precice-participant Calculix diff --git a/flow-over-heated-plate-nearest-projection/README.md b/flow-over-heated-plate-nearest-projection/README.md index 0dd77c0f4..29a010d9e 100644 --- a/flow-over-heated-plate-nearest-projection/README.md +++ b/flow-over-heated-plate-nearest-projection/README.md @@ -67,6 +67,6 @@ Visualizing these files (e.g. using ParaView) will show a triangular mesh, even ![triangulated](https://user-images.githubusercontent.com/33414590/55974257-96b07d80-5c87-11e9-9965-972b922c483d.png) -Note: Connectivity is defined on meshes associated with mesh nodes, which are named respectively e.g. `Fluid-Mesh-Nodes`. In this case, you could directly see the interface without applying filters by loading the `.vtk` files. In order to visualize additionally center based meshes, where no connectivity is provided, select a Glyph filter in ParaView. Furthermore, it makes a difference, on which participant the ` Open ParaView File` and select the `.foam` file. If you're asked to choose a reader, please select `OpenFOAMReader` and click `Apply` to visualize the result. +For visualizing the results of the fluid solver, go to `File -> Open ParaView File` and select the `fluid-openfoam.foam` file. If you're asked to choose a reader, please select `OpenFOAMReader` and click `Apply` to visualize the result. For visualizing the result of the solid solver, press again `Open ParaView File` and select the `output-..rmed` group. Again, click `Apply` to visualize the result. After setting the temperature scale for both domains to 300-310 K, the following result is given for timestep 200: ![post-processing](images/tutorials-flow-over-heated-plate-steady-state-post-processing.png) {% include disclaimer.html content="This offering is not approved or endorsed by OpenCFD Limited, producer and distributor of the OpenFOAM software via www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® trade marks." %} - -{% include disclaimer.html content="This offering is not approved or endorsed by Électricité de France (EDF), producer and distributor of the Code_Aster software via www.code-aster.org, and owner of the Code_Aster trademark." %} diff --git a/flow-over-heated-plate-steady-state/fluid-openfoam/0.orig/T b/flow-over-heated-plate-steady-state/fluid-openfoam/0/T similarity index 100% rename from flow-over-heated-plate-steady-state/fluid-openfoam/0.orig/T rename to flow-over-heated-plate-steady-state/fluid-openfoam/0/T diff --git a/flow-over-heated-plate-steady-state/fluid-openfoam/0.orig/U b/flow-over-heated-plate-steady-state/fluid-openfoam/0/U similarity index 100% rename from flow-over-heated-plate-steady-state/fluid-openfoam/0.orig/U rename to flow-over-heated-plate-steady-state/fluid-openfoam/0/U diff --git a/flow-over-heated-plate-steady-state/fluid-openfoam/0.orig/alphat b/flow-over-heated-plate-steady-state/fluid-openfoam/0/alphat similarity index 100% rename from flow-over-heated-plate-steady-state/fluid-openfoam/0.orig/alphat rename to flow-over-heated-plate-steady-state/fluid-openfoam/0/alphat diff --git a/flow-over-heated-plate-steady-state/fluid-openfoam/0.orig/epsilon b/flow-over-heated-plate-steady-state/fluid-openfoam/0/epsilon similarity index 100% rename from flow-over-heated-plate-steady-state/fluid-openfoam/0.orig/epsilon rename to flow-over-heated-plate-steady-state/fluid-openfoam/0/epsilon diff --git a/flow-over-heated-plate-steady-state/fluid-openfoam/0.orig/k b/flow-over-heated-plate-steady-state/fluid-openfoam/0/k similarity index 100% rename from flow-over-heated-plate-steady-state/fluid-openfoam/0.orig/k rename to flow-over-heated-plate-steady-state/fluid-openfoam/0/k diff --git a/flow-over-heated-plate-steady-state/fluid-openfoam/0.orig/nut b/flow-over-heated-plate-steady-state/fluid-openfoam/0/nut similarity index 100% rename from flow-over-heated-plate-steady-state/fluid-openfoam/0.orig/nut rename to flow-over-heated-plate-steady-state/fluid-openfoam/0/nut diff --git a/flow-over-heated-plate-steady-state/fluid-openfoam/0.orig/p b/flow-over-heated-plate-steady-state/fluid-openfoam/0/p similarity index 100% rename from flow-over-heated-plate-steady-state/fluid-openfoam/0.orig/p rename to flow-over-heated-plate-steady-state/fluid-openfoam/0/p diff --git a/flow-over-heated-plate-steady-state/fluid-openfoam/0.orig/p_rgh b/flow-over-heated-plate-steady-state/fluid-openfoam/0/p_rgh similarity index 100% rename from flow-over-heated-plate-steady-state/fluid-openfoam/0.orig/p_rgh rename to flow-over-heated-plate-steady-state/fluid-openfoam/0/p_rgh diff --git a/flow-over-heated-plate-steady-state/fluid-openfoam/clean.sh b/flow-over-heated-plate-steady-state/fluid-openfoam/clean.sh index 1305ae185..c31d9fc76 100755 --- a/flow-over-heated-plate-steady-state/fluid-openfoam/clean.sh +++ b/flow-over-heated-plate-steady-state/fluid-openfoam/clean.sh @@ -4,4 +4,3 @@ set -e -u . ../../tools/cleaning-tools.sh clean_openfoam . -rm -rfv ./0/ # in run.sh,0.orig/ is copied to 0/ \ No newline at end of file diff --git a/flow-over-heated-plate-steady-state/fluid-openfoam/run.sh b/flow-over-heated-plate-steady-state/fluid-openfoam/run.sh index e3c29e9e6..c191b9e48 100755 --- a/flow-over-heated-plate-steady-state/fluid-openfoam/run.sh +++ b/flow-over-heated-plate-steady-state/fluid-openfoam/run.sh @@ -1,41 +1,8 @@ -#!/bin/bash -cd ${0%/*} || exit 1 # Run from this directory -. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions +#!/bin/sh +set -e -u -# Fluid participant - -# Run this script in one terminal and the execute the coupled_elasto_dynamics bindary -# in another terminal. -# These scripts present how the two participants would be started manually. - -# Run this script with "-parallel" for parallel simulations - -# The script "Allclean" cleans-up the result and log files. - -# 1 for true, 0 for false -parallel=0 -if [ "$1" = "-parallel" ]; then - parallel=1 -fi - -echo "Preparing and running the Fluid participant..." - -rm -rfv 0/ -cp -r 0.orig/ 0/ blockMesh -checkMesh touch fluid-openfoam.foam -# Run -solver=$(getApplication) -procs=$(getNumberOfProcessors) -if [ $parallel -eq 1 ]; then - decomposePar -force - mpirun -np $procs $solver -parallel - reconstructPar -else - $solver -fi - -# Workaround for issue #26 (OF-adapter, relevant for OF .com versions) +../../tools/run-openfoam.sh "$@" . ../../tools/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs diff --git a/flow-over-heated-plate-steady-state/solid-codeaster/clean.sh b/flow-over-heated-plate-steady-state/solid-codeaster/clean.sh index a8be872d1..c5eddaea2 100755 --- a/flow-over-heated-plate-steady-state/solid-codeaster/clean.sh +++ b/flow-over-heated-plate-steady-state/solid-codeaster/clean.sh @@ -3,4 +3,4 @@ set -e -u . ../../tools/cleaning-tools.sh -clean_codeaster . \ No newline at end of file +clean_codeaster . diff --git a/flow-over-heated-plate-steady-state/solid-codeaster/run.sh b/flow-over-heated-plate-steady-state/solid-codeaster/run.sh index 9cf027fc9..a3ebd9d8a 100755 --- a/flow-over-heated-plate-steady-state/solid-codeaster/run.sh +++ b/flow-over-heated-plate-steady-state/solid-codeaster/run.sh @@ -1,4 +1,10 @@ -#!/bin/bash - export TUTORIAL_ROOT=${PWD} - export PRECICE_PARTICIPANT=Solid - as_run --run solid.export +#!/bin/sh +set -e -u + +echo "Warning: this case requires a manual preparation step for code_aster." +echo "See the tutorial and code_aster adapter documentation pages for more:" +echo "https://www.precice.org/adapter-code_aster.html\n" + +export TUTORIAL_ROOT=${PWD} +export PRECICE_PARTICIPANT=Solid +as_run --run solid.export diff --git a/flow-over-heated-plate/README.md b/flow-over-heated-plate/README.md index 5304b480e..b810d9150 100644 --- a/flow-over-heated-plate/README.md +++ b/flow-over-heated-plate/README.md @@ -10,13 +10,13 @@ summary: This tutorial describes how to run a conjugate heat transfer coupled si ## Setup -This scenario consists of one fluid and one solid participant and it is inspired by Vynnycky et al. [1]. A fluid enters a channel with temperature `T_\infty`, where it comes in contact with a solid plate. The plate is heated at its bottom and has a constant temperature of `T_hot`. +This scenario consists of one fluid and one solid participant and it is inspired by Vynnycky et al. [1]. A fluid enters a channel with temperature $$ T_\infty $$, where it comes in contact with a solid plate. The plate is heated at its bottom and has a constant temperature of $$ T_{hot} $$. ![img](images/tutorials-flow-over-heated-plate-example.png) The test case is two-dimensional and a serial-implicit coupling with Aitken underrelaxation is used for the coupling. -The inlet velocity is `u_\infty = 0.1 m/s`, the inlet temperature is `T_\infty = 300K`. The fluid and solid have the same thermal conductivities `k_S = k_F = 100 W/m/K`. Further material properties of the fluid are its viscosity `mu = 0.0002 kg/m/s` and specific heat capacity `c_p = 5000 J/kg/K`. The Prandtl number `Pr = 0.01` follows from thermal conductivity, viscosity and specific heat capacity. The solid has the thermal diffusivity `\alpha = 1 m^2/s`. The gravitational acceleration is `g = 9.81 m/s^2`. +The inlet velocity is $$ u_{\infty} = 0.1 m/s $$, the inlet temperature is $$ T_{\infty} = 300K $$. The fluid and solid have the same thermal conductivities $$ k_S = k_F = 100 W/m/K $$. Further material properties of the fluid are its viscosity $$ mu = 0.0002 kg/m/s $$ and specific heat capacity $$ c_p = 5000 J/kg/K $$. The Prandtl number $$ Pr = 0.01 $$ follows from thermal conductivity, viscosity and specific heat capacity. The solid has the thermal diffusivity $$ \alpha = 1 m^2/s $$. The gravitational acceleration is $$ g = 9.81 m/s^2 $$. ## Available solvers @@ -45,18 +45,18 @@ and cd solid-fenics ./run.sh ``` -in order to use OpenFOAM and FEniCS for this test case. +in order to use OpenFOAM and FEniCS for this test case. Feel free to try different combinations, they should all run and give approximately similar results. ## Post-processing -How to visualize the simulation results depends on the selected solvers. Most of the solvers generate `vtk` files which can visualized using, e.g., ParaView. +How to visualize the simulation results depends on the selected solvers. Most of the solvers generate VTK files which can visualized using ParaView or similar tools. An example of the visualized expected results looks as follows: ![result](images/tutorials-flow-over-heated-plate-result-openfoam.png) Observe that the temperature at the bottom of the plate is 310K and at the inlet 300K. On the interface, the temperature is between these values. An area of higher temperature is formed above the plate, which is shifted towards the front, driven by the flow. -You may use additional filters, such as the Calculator and the Plot Over Line, to obtain the distribution of the non-dimensional temperature (T-T_inlet)/(T_solid-T_inlet): +You may use additional filters, such as the Calculator and the Plot Over Line, to obtain the distribution of the non-dimensional temperature $$ (T-T_{inlet})/(T_{solid}-T_{inlet}) $$: ![graph](images/tutorials-flow-over-heated-plate-graph-result.png) diff --git a/flow-over-heated-plate/fluid-openfoam/0.orig/T b/flow-over-heated-plate/fluid-openfoam/0/T similarity index 100% rename from flow-over-heated-plate/fluid-openfoam/0.orig/T rename to flow-over-heated-plate/fluid-openfoam/0/T diff --git a/flow-over-heated-plate/fluid-openfoam/0.orig/U b/flow-over-heated-plate/fluid-openfoam/0/U similarity index 100% rename from flow-over-heated-plate/fluid-openfoam/0.orig/U rename to flow-over-heated-plate/fluid-openfoam/0/U diff --git a/flow-over-heated-plate/fluid-openfoam/0.orig/alphat b/flow-over-heated-plate/fluid-openfoam/0/alphat similarity index 100% rename from flow-over-heated-plate/fluid-openfoam/0.orig/alphat rename to flow-over-heated-plate/fluid-openfoam/0/alphat diff --git a/flow-over-heated-plate/fluid-openfoam/0.orig/epsilon b/flow-over-heated-plate/fluid-openfoam/0/epsilon similarity index 100% rename from flow-over-heated-plate/fluid-openfoam/0.orig/epsilon rename to flow-over-heated-plate/fluid-openfoam/0/epsilon diff --git a/flow-over-heated-plate/fluid-openfoam/0.orig/k b/flow-over-heated-plate/fluid-openfoam/0/k similarity index 100% rename from flow-over-heated-plate/fluid-openfoam/0.orig/k rename to flow-over-heated-plate/fluid-openfoam/0/k diff --git a/flow-over-heated-plate/fluid-openfoam/0.orig/nut b/flow-over-heated-plate/fluid-openfoam/0/nut similarity index 100% rename from flow-over-heated-plate/fluid-openfoam/0.orig/nut rename to flow-over-heated-plate/fluid-openfoam/0/nut diff --git a/flow-over-heated-plate/fluid-openfoam/0.orig/p b/flow-over-heated-plate/fluid-openfoam/0/p similarity index 100% rename from flow-over-heated-plate/fluid-openfoam/0.orig/p rename to flow-over-heated-plate/fluid-openfoam/0/p diff --git a/flow-over-heated-plate/fluid-openfoam/0.orig/p_rgh b/flow-over-heated-plate/fluid-openfoam/0/p_rgh similarity index 100% rename from flow-over-heated-plate/fluid-openfoam/0.orig/p_rgh rename to flow-over-heated-plate/fluid-openfoam/0/p_rgh diff --git a/flow-over-heated-plate/fluid-openfoam/clean.sh b/flow-over-heated-plate/fluid-openfoam/clean.sh index 1305ae185..c31d9fc76 100755 --- a/flow-over-heated-plate/fluid-openfoam/clean.sh +++ b/flow-over-heated-plate/fluid-openfoam/clean.sh @@ -4,4 +4,3 @@ set -e -u . ../../tools/cleaning-tools.sh clean_openfoam . -rm -rfv ./0/ # in run.sh,0.orig/ is copied to 0/ \ No newline at end of file diff --git a/flow-over-heated-plate/fluid-openfoam/run.sh b/flow-over-heated-plate/fluid-openfoam/run.sh index 0da6a7c58..c191b9e48 100755 --- a/flow-over-heated-plate/fluid-openfoam/run.sh +++ b/flow-over-heated-plate/fluid-openfoam/run.sh @@ -1,34 +1,8 @@ -#!/bin/bash -cd ${0%/*} || exit 1 # Run from this directory -. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions -# Fluid participant -# Run this script in one terminal and the "runSolid" script in another terminal. -# These scripts present how the two participants would be started manually. -# Alternatively, you may execute the "Allrun" script in one terminal. -# Run this script with "-parallel" for parallel simulations -# The script "Allclean" cleans-up the result and log files. -# 1 for true, 0 for false +#!/bin/sh +set -e -u -parallel=0 -if [ "$1" = "-parallel" ]; then - parallel=1 -fi - -echo "Preparing and running the Fluid participant..." -rm -rfv 0/ -cp -r 0.orig/ 0/ blockMesh -checkMesh touch fluid-openfoam.foam -solver=$(getApplication) -procs=$(getNumberOfProcessors) -if [ $parallel -eq 1 ]; then - decomposePar -force - mpirun -np $procs $solver -parallel - reconstructPar -else - $solver -fi - -. ../../tools/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs \ No newline at end of file +../../tools/run-openfoam.sh "$@" +. ../../tools/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs diff --git a/flow-over-heated-plate/solid-fenics/clean.sh b/flow-over-heated-plate/solid-fenics/clean.sh index 614c6f928..3a8b4619d 100755 --- a/flow-over-heated-plate/solid-fenics/clean.sh +++ b/flow-over-heated-plate/solid-fenics/clean.sh @@ -3,4 +3,4 @@ set -e -u . ../../tools/cleaning-tools.sh -clean_fenics . \ No newline at end of file +clean_fenics . diff --git a/flow-over-heated-plate/solid-fenics/run.sh b/flow-over-heated-plate/solid-fenics/run.sh index 9c6b96a51..15315c67d 100755 --- a/flow-over-heated-plate/solid-fenics/run.sh +++ b/flow-over-heated-plate/solid-fenics/run.sh @@ -1,11 +1,4 @@ -#!/bin/bash - -# Solid participant - -# Run this script in one terminal and the "runFluid" script in another terminal. -# These scripts present how the two participants would be started manually. -# Alternatively, you may execute the "Allrun" script in one terminal. - -# The script "Allclean" cleans-up the result and log files. +#!/bin/sh +set -e -u python3 solid.py diff --git a/flow-over-heated-plate/solid-nutils/clean.sh b/flow-over-heated-plate/solid-nutils/clean.sh index 49a202556..6893c1ea5 100755 --- a/flow-over-heated-plate/solid-nutils/clean.sh +++ b/flow-over-heated-plate/solid-nutils/clean.sh @@ -3,4 +3,4 @@ set -e -u . ../../tools/cleaning-tools.sh -clean_nutils . \ No newline at end of file +clean_nutils . diff --git a/flow-over-heated-plate/solid-nutils/run.sh b/flow-over-heated-plate/solid-nutils/run.sh index ca852ca51..21bd5c3b1 100755 --- a/flow-over-heated-plate/solid-nutils/run.sh +++ b/flow-over-heated-plate/solid-nutils/run.sh @@ -1,7 +1,5 @@ #!/bin/bash +set -e -u -# Solid participant - -# Run python3 solid.py diff --git a/flow-over-heated-plate/solid-openfoam/0.orig/T b/flow-over-heated-plate/solid-openfoam/0/T similarity index 100% rename from flow-over-heated-plate/solid-openfoam/0.orig/T rename to flow-over-heated-plate/solid-openfoam/0/T diff --git a/flow-over-heated-plate/solid-openfoam/clean.sh b/flow-over-heated-plate/solid-openfoam/clean.sh index 1305ae185..c31d9fc76 100755 --- a/flow-over-heated-plate/solid-openfoam/clean.sh +++ b/flow-over-heated-plate/solid-openfoam/clean.sh @@ -4,4 +4,3 @@ set -e -u . ../../tools/cleaning-tools.sh clean_openfoam . -rm -rfv ./0/ # in run.sh,0.orig/ is copied to 0/ \ No newline at end of file diff --git a/flow-over-heated-plate/solid-openfoam/run.sh b/flow-over-heated-plate/solid-openfoam/run.sh index fd2188105..57e9395ee 100755 --- a/flow-over-heated-plate/solid-openfoam/run.sh +++ b/flow-over-heated-plate/solid-openfoam/run.sh @@ -1,34 +1,8 @@ -#!/bin/bash -cd ${0%/*} || exit 1 # Run from this directory -. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions -# Fluid participant -# Run this script in one terminal and the "runSolid" script in another terminal. -# These scripts present how the two participants would be started manually. -# Alternatively, you may execute the "Allrun" script in one terminal. -# Run this script with "-parallel" for parallel simulations -# The script "Allclean" cleans-up the result and log files. -# 1 for true, 0 for false +#!/bin/sh +set -e -u -parallel=0 -if [ "$1" = "-parallel" ]; then - parallel=1 -fi - -echo "Preparing and running the Fluid participant..." -rm -rfv 0/ -cp -r 0.orig/ 0/ blockMesh -checkMesh touch solid-openfoam.foam -solver=$(getApplication) -procs=$(getNumberOfProcessors) -if [ $parallel -eq 1 ]; then - decomposePar -force - mpirun -np $procs $solver -parallel - reconstructPar -else - $solver -fi - +../../tools/run-openfoam.sh "$@" . ../../tools/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs diff --git a/heat-exchanger/README.md b/heat-exchanger/README.md index 59fdef9f4..f4d3a8e4a 100644 --- a/heat-exchanger/README.md +++ b/heat-exchanger/README.md @@ -9,9 +9,7 @@ summary: Tutorial for a shell-and-tube heat exchanger, using OpenFOAM and Calcul This tutorial describes how to run a conjugate heat transfer simulation with two separate OpenFOAM solvers and CalculiX. The files for this tutorial are located in this repository (directory CHT/heat_exchanger). -This tutorial is based on [a case](https://www.simscale.com/projects/cheunglucia/heat_exchanger_-_cht_simulation/) prepared with [SimScale](https://www.simscale.com/) by [Lucia Cheung Yau](https://github.com/ludcila) for her [Master's Thesis](https://www5.in.tum.de/pub/Cheung2016_Thesis.pdf). It works with OpenFOAM 5.0 and CalculiX 2.12, but newer minor versions should work as well. - -{% include note.html content="Since the already prepared case contains mesh files of approx. 50MB in size, we host these files outside of the repository and you can download and extract them automatically in the appropriate locations by running the Download_meshes script. We plan to integrate the preparation part in this tutorial in the future." %} +This tutorial is based on [a case](https://www.simscale.com/projects/cheunglucia/heat_exchanger_-_cht_simulation/) prepared with [SimScale](https://www.simscale.com/) by [Lucia Cheung Yau](https://github.com/ludcila) for her [Master's Thesis](https://www5.in.tum.de/pub/Cheung2016_Thesis.pdf). ## Setup @@ -32,15 +30,17 @@ We define the participants `Inner-Fluid`, `Solid`, and `Outer-Fluid` and two int ## Running the Simulation -Before starting the simulation for the first time you need to download the mesh files and copy them into the appropriate location. The shell script `./Download_meshes` will handle these things automatically. Afterwards, the simulation setup is ready to run. +{% include note.html content="Since the already prepared case contains mesh files of approx. 50MB in size, we currently host these files outside of the tutorials repository and you can download and extract them automatically in the appropriate locations by running the download-meshes.sh script." %} + +Before starting the simulation for the first time you need to download the mesh files and copy them into the appropriate location. The shell script `./download-meshes.sh` will handle these things automatically. Afterwards, the simulation setup is ready to run. -In order to run the coupled simulation, you can simply step into the participant directories and execute`./run.sh` for run (or `./run.sh -parallel`) for a parallel run. The simulation will need approximately one hour on a modern laptop to end (t=500). Before repeating the simulation, you can use the `clean.sh` script to clean-up any previous results and log files. +In order to run the coupled simulation, you can simply step into the participant directories and execute`./run.sh` (or `./run.sh -parallel` for running a fluid participant in parallel). The simulation will need several minutes or up to an hour on a laptop to end (t=500). Before repeating the simulation, you can use the `clean-tutorial.sh` script to clean-up any previous results and log files. ## Post-processing After the first results are written (a new time directory will be created), you may visualize the results. -For the OpenFOAM results, you can use ParaView and open the allready-provided `fluid-inner-openfoam.foam` and `fluid-outer-openfoam.foam` files. If it is installed you may better use `paraFoam -case fluid-inner-openfoam` and load the fluid-outer-openfoam.foam through the ParaView menu. You can then group the two cases and visualize them together. +For the OpenFOAM results, you can use ParaView and open the allready-provided `fluid-inner-openfoam.foam` and `fluid-outer-openfoam.foam` files. You can then group the two cases and visualize them together. Unfortunately, ParaView does not support CalculiX result files. You may see the results in CGX or convert them using 3rd-party tools. diff --git a/heat-exchanger/Download_meshes b/heat-exchanger/download-meshes.sh similarity index 83% rename from heat-exchanger/Download_meshes rename to heat-exchanger/download-meshes.sh index 2afc31177..00b205be0 100755 --- a/heat-exchanger/Download_meshes +++ b/heat-exchanger/download-meshes.sh @@ -1,5 +1,4 @@ #!/bin/sh -cd ${0%/*} || exit 1 # Run from this directory echo "This tutorial is based on a case prepared with SimScale." echo "Since the mesh files are several MB large, we don't store them in the Git repository." @@ -14,8 +13,10 @@ sed -i 's/Solid/\./g' solid-calculix/solid.inp echo "Downloading and extracting the Inner-Fluid mesh..." wget -nv -O - https://syncandshare.lrz.de/dl/fiNsYGC1DKzgio4jS5NhsXg7/polyMesh.org.tar.gz | tar -xzv -C fluid-inner-openfoam/constant +mv fluid-inner-openfoam/constant/polyMesh.org fluid-inner-openfoam/constant/polyMesh echo "Downloading and extracting the Outer-Fluid mesh..." wget -nv -O - https://syncandshare.lrz.de/dl/fiEZRQ8rcVWRkoyZvANim1R1/polyMesh.org.tar.gz | tar -xzv -C fluid-outer-openfoam/constant +mv fluid-outer-openfoam/constant/polyMesh.org fluid-outer-openfoam/constant/polyMesh echo "Completed." diff --git a/heat-exchanger/fluid-inner-openfoam/0.orig/T b/heat-exchanger/fluid-inner-openfoam/0/T similarity index 100% rename from heat-exchanger/fluid-inner-openfoam/0.orig/T rename to heat-exchanger/fluid-inner-openfoam/0/T diff --git a/heat-exchanger/fluid-inner-openfoam/0.orig/U b/heat-exchanger/fluid-inner-openfoam/0/U similarity index 100% rename from heat-exchanger/fluid-inner-openfoam/0.orig/U rename to heat-exchanger/fluid-inner-openfoam/0/U diff --git a/heat-exchanger/fluid-inner-openfoam/0.orig/alphat b/heat-exchanger/fluid-inner-openfoam/0/alphat similarity index 100% rename from heat-exchanger/fluid-inner-openfoam/0.orig/alphat rename to heat-exchanger/fluid-inner-openfoam/0/alphat diff --git a/heat-exchanger/fluid-inner-openfoam/0.orig/epsilon b/heat-exchanger/fluid-inner-openfoam/0/epsilon similarity index 100% rename from heat-exchanger/fluid-inner-openfoam/0.orig/epsilon rename to heat-exchanger/fluid-inner-openfoam/0/epsilon diff --git a/heat-exchanger/fluid-inner-openfoam/0.orig/k b/heat-exchanger/fluid-inner-openfoam/0/k similarity index 100% rename from heat-exchanger/fluid-inner-openfoam/0.orig/k rename to heat-exchanger/fluid-inner-openfoam/0/k diff --git a/heat-exchanger/fluid-inner-openfoam/0.orig/nut b/heat-exchanger/fluid-inner-openfoam/0/nut similarity index 100% rename from heat-exchanger/fluid-inner-openfoam/0.orig/nut rename to heat-exchanger/fluid-inner-openfoam/0/nut diff --git a/heat-exchanger/fluid-inner-openfoam/0.orig/p b/heat-exchanger/fluid-inner-openfoam/0/p similarity index 100% rename from heat-exchanger/fluid-inner-openfoam/0.orig/p rename to heat-exchanger/fluid-inner-openfoam/0/p diff --git a/heat-exchanger/fluid-inner-openfoam/0.orig/p_rgh b/heat-exchanger/fluid-inner-openfoam/0/p_rgh similarity index 100% rename from heat-exchanger/fluid-inner-openfoam/0.orig/p_rgh rename to heat-exchanger/fluid-inner-openfoam/0/p_rgh diff --git a/heat-exchanger/fluid-inner-openfoam/clean.sh b/heat-exchanger/fluid-inner-openfoam/clean.sh index 1305ae185..c31d9fc76 100755 --- a/heat-exchanger/fluid-inner-openfoam/clean.sh +++ b/heat-exchanger/fluid-inner-openfoam/clean.sh @@ -4,4 +4,3 @@ set -e -u . ../../tools/cleaning-tools.sh clean_openfoam . -rm -rfv ./0/ # in run.sh,0.orig/ is copied to 0/ \ No newline at end of file diff --git a/heat-exchanger/fluid-inner-openfoam/constant/.gitignore b/heat-exchanger/fluid-inner-openfoam/constant/.gitignore new file mode 100644 index 000000000..825968042 --- /dev/null +++ b/heat-exchanger/fluid-inner-openfoam/constant/.gitignore @@ -0,0 +1 @@ +polyMesh/ diff --git a/heat-exchanger/fluid-inner-openfoam/run.sh b/heat-exchanger/fluid-inner-openfoam/run.sh new file mode 100755 index 000000000..6f176ba93 --- /dev/null +++ b/heat-exchanger/fluid-inner-openfoam/run.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e -u + +touch fluid-inner-openfoam.foam + +../../tools/run-openfoam.sh "$@" +. ../../tools/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs diff --git a/heat-exchanger/fluid-inner-openfoam/system/controlDict b/heat-exchanger/fluid-inner-openfoam/system/controlDict index 9545a03ce..fde22f262 100644 --- a/heat-exchanger/fluid-inner-openfoam/system/controlDict +++ b/heat-exchanger/fluid-inner-openfoam/system/controlDict @@ -4,7 +4,7 @@ FoamFile { object controlDict; format ascii; } -application chtMultiRegionSimpleFoam; +application buoyantSimpleFoam; startFrom startTime; stopAt endTime; writeFormat ascii; @@ -12,7 +12,7 @@ writePrecision 12; writeCompression on; timeFormat general; timePrecision 12; -runTimeModifiable yes; +runTimeModifiable false; deltaT 1; startTime 0.0; writeInterval 50; diff --git a/heat-exchanger/fluid-outer-openfoam/0.orig/T b/heat-exchanger/fluid-outer-openfoam/0/T similarity index 100% rename from heat-exchanger/fluid-outer-openfoam/0.orig/T rename to heat-exchanger/fluid-outer-openfoam/0/T diff --git a/heat-exchanger/fluid-outer-openfoam/0.orig/U b/heat-exchanger/fluid-outer-openfoam/0/U similarity index 100% rename from heat-exchanger/fluid-outer-openfoam/0.orig/U rename to heat-exchanger/fluid-outer-openfoam/0/U diff --git a/heat-exchanger/fluid-outer-openfoam/0.orig/alphat b/heat-exchanger/fluid-outer-openfoam/0/alphat similarity index 100% rename from heat-exchanger/fluid-outer-openfoam/0.orig/alphat rename to heat-exchanger/fluid-outer-openfoam/0/alphat diff --git a/heat-exchanger/fluid-outer-openfoam/0.orig/epsilon b/heat-exchanger/fluid-outer-openfoam/0/epsilon similarity index 100% rename from heat-exchanger/fluid-outer-openfoam/0.orig/epsilon rename to heat-exchanger/fluid-outer-openfoam/0/epsilon diff --git a/heat-exchanger/fluid-outer-openfoam/0.orig/k b/heat-exchanger/fluid-outer-openfoam/0/k similarity index 100% rename from heat-exchanger/fluid-outer-openfoam/0.orig/k rename to heat-exchanger/fluid-outer-openfoam/0/k diff --git a/heat-exchanger/fluid-outer-openfoam/0.orig/nut b/heat-exchanger/fluid-outer-openfoam/0/nut similarity index 100% rename from heat-exchanger/fluid-outer-openfoam/0.orig/nut rename to heat-exchanger/fluid-outer-openfoam/0/nut diff --git a/heat-exchanger/fluid-outer-openfoam/0.orig/p b/heat-exchanger/fluid-outer-openfoam/0/p similarity index 100% rename from heat-exchanger/fluid-outer-openfoam/0.orig/p rename to heat-exchanger/fluid-outer-openfoam/0/p diff --git a/heat-exchanger/fluid-outer-openfoam/0.orig/p_rgh b/heat-exchanger/fluid-outer-openfoam/0/p_rgh similarity index 100% rename from heat-exchanger/fluid-outer-openfoam/0.orig/p_rgh rename to heat-exchanger/fluid-outer-openfoam/0/p_rgh diff --git a/heat-exchanger/fluid-outer-openfoam/clean.sh b/heat-exchanger/fluid-outer-openfoam/clean.sh index 1305ae185..c31d9fc76 100755 --- a/heat-exchanger/fluid-outer-openfoam/clean.sh +++ b/heat-exchanger/fluid-outer-openfoam/clean.sh @@ -4,4 +4,3 @@ set -e -u . ../../tools/cleaning-tools.sh clean_openfoam . -rm -rfv ./0/ # in run.sh,0.orig/ is copied to 0/ \ No newline at end of file diff --git a/heat-exchanger/fluid-outer-openfoam/constant/.gitignore b/heat-exchanger/fluid-outer-openfoam/constant/.gitignore new file mode 100644 index 000000000..825968042 --- /dev/null +++ b/heat-exchanger/fluid-outer-openfoam/constant/.gitignore @@ -0,0 +1 @@ +polyMesh/ diff --git a/heat-exchanger/fluid-outer-openfoam/run.sh b/heat-exchanger/fluid-outer-openfoam/run.sh new file mode 100755 index 000000000..8816441f2 --- /dev/null +++ b/heat-exchanger/fluid-outer-openfoam/run.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e -u + +touch fluid-outer-openfoam.foam + +../../tools/run-openfoam.sh "$@" +. ../../tools/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs diff --git a/heat-exchanger/fluid-outer-openfoam/system/controlDict b/heat-exchanger/fluid-outer-openfoam/system/controlDict index 9545a03ce..fde22f262 100644 --- a/heat-exchanger/fluid-outer-openfoam/system/controlDict +++ b/heat-exchanger/fluid-outer-openfoam/system/controlDict @@ -4,7 +4,7 @@ FoamFile { object controlDict; format ascii; } -application chtMultiRegionSimpleFoam; +application buoyantSimpleFoam; startFrom startTime; stopAt endTime; writeFormat ascii; @@ -12,7 +12,7 @@ writePrecision 12; writeCompression on; timeFormat general; timePrecision 12; -runTimeModifiable yes; +runTimeModifiable false; deltaT 1; startTime 0.0; writeInterval 50; diff --git a/heat-exchanger/precice-config.xml b/heat-exchanger/precice-config.xml index e1259bdcf..918284b23 100644 --- a/heat-exchanger/precice-config.xml +++ b/heat-exchanger/precice-config.xml @@ -1,4 +1,4 @@ - + python3 heat.py -d +mpirun -n heat.py -d ``` ### Note on the combination of Nutils & FEniCS diff --git a/partitioned-heat-conduction/fenics/.gitignore b/partitioned-heat-conduction/fenics/.gitignore index 3cf3e6819..7c6571e48 100644 --- a/partitioned-heat-conduction/fenics/.gitignore +++ b/partitioned-heat-conduction/fenics/.gitignore @@ -1,7 +1,2 @@ -*.txt venv -.idea *.pyc -out -*.log -*events.json diff --git a/partitioned-heat-conduction/fenics/clean.sh b/partitioned-heat-conduction/fenics/clean.sh index 6938583b3..3a8b4619d 100755 --- a/partitioned-heat-conduction/fenics/clean.sh +++ b/partitioned-heat-conduction/fenics/clean.sh @@ -3,6 +3,4 @@ set -e -u . ../../tools/cleaning-tools.sh -rm -rf out -rm -f *.log -rm -f *-events.json +clean_fenics . diff --git a/partitioned-heat-conduction/fenics/run.sh b/partitioned-heat-conduction/fenics/run.sh index 0075dfac2..e31f07a10 100755 --- a/partitioned-heat-conduction/fenics/run.sh +++ b/partitioned-heat-conduction/fenics/run.sh @@ -1,11 +1,16 @@ +#!/bin/sh +set -e -u + while getopts ":dn" opt; do case ${opt} in - d ) python3 heat.py -d --error-tol 10e-3 - ;; - n ) python3 heat.py -n --error-tol 10e-3 - ;; - \? ) echo "Usage: cmd [-d] [-n]" - ;; + d) + python3 heat.py -d --error-tol 10e-3 + ;; + n) + python3 heat.py -n --error-tol 10e-3 + ;; + \?) + echo "Usage: cmd [-d] [-n]" + ;; esac done - diff --git a/partitioned-heat-conduction/nutils/clean.sh b/partitioned-heat-conduction/nutils/clean.sh index b1450fa8e..6684cc729 100755 --- a/partitioned-heat-conduction/nutils/clean.sh +++ b/partitioned-heat-conduction/nutils/clean.sh @@ -3,7 +3,4 @@ set -e -u . ../../tools/cleaning-tools.sh -rm -f Dirichlet-*.vtk -rm -f Neumann-*.vtk -rm -f *.log -rm -f *-events.json +clean_nutils diff --git a/partitioned-heat-conduction/nutils/run.sh b/partitioned-heat-conduction/nutils/run.sh index defb2b9d1..43e97b70f 100755 --- a/partitioned-heat-conduction/nutils/run.sh +++ b/partitioned-heat-conduction/nutils/run.sh @@ -1,13 +1,18 @@ +#!/bin/sh +set -e -u + while getopts ":dn" opt; do case ${opt} in - d ) rm -rf Dirichlet-*.vtk - python3 heat.py --side=Dirichlet - ;; - n ) rm -rf Neumann-*.vtk - python3 heat.py --side=Neumann - ;; - \? ) echo "Usage: cmd [-d] [-n]" - ;; + d) + rm -rf Dirichlet-*.vtk + python3 heat.py --side=Dirichlet + ;; + n) + rm -rf Neumann-*.vtk + python3 heat.py --side=Neumann + ;; + \?) + echo "Usage: cmd [-d] [-n]" + ;; esac done - diff --git a/perpendicular-flap/README.md b/perpendicular-flap/README.md index e682d2940..69a21851e 100644 --- a/perpendicular-flap/README.md +++ b/perpendicular-flap/README.md @@ -13,7 +13,7 @@ We model a two-dimensional fluid flowing through a channel. A solid, elastic fla ![Flap setup](images/tutorials-perpendicular-flap-setup-drawing.png) -The simulated flow domain is 6 units long (x) and 4 units tall (y). The flap is located at the center of the bottom (x=0) and is 1 unit long (y) and 0.1 units thick (x). We set the fluid density $\{rho}_F= 1.0kg/m^{3}$, the kinematic viscosity $\{nu}_f= 1.0m^{2}/s$, the solid density $\{rho}_s= 3.0·10^{3}kg/m^{3}$, the Young’s modulus to $E= 4.0·10^{6} kg/ms^{2}$and the Poisson ratio $\{nu}_s = 0.3$. On the left boundary a constant inflow profile in x-direction of 10m/s is prescribed. The right boundary is an outflow and the top and bottom of the channel as well as the surface of the flap are no-slip walls. +The simulated flow domain is 6 units long (x) and 4 units tall (y). The flap is located at the center of the bottom (x=0) and is 1 unit long (y) and 0.1 units thick (x). We set the fluid density $$ \{rho}_F= 1.0kg/m^{3} $$, the kinematic viscosity $$ \{nu}_f= 1.0m^{2}/s $$, the solid density $$ \{rho}_s= 3.0·10^{3}kg/m^{3} $$, the Young’s modulus to $$ E= 4.0·10^{6} kg/ms^{2} $$ and the Poisson ratio $$ \{nu}_s = 0.3 $$. On the left boundary a constant inflow profile in x-direction of 10m/s is prescribed. The right boundary is an outflow and the top and bottom of the channel as well as the surface of the flap are no-slip walls. ## Available solvers diff --git a/perpendicular-flap/fluid-nutils/clean.sh b/perpendicular-flap/fluid-nutils/clean.sh index 49a202556..6893c1ea5 100755 --- a/perpendicular-flap/fluid-nutils/clean.sh +++ b/perpendicular-flap/fluid-nutils/clean.sh @@ -3,4 +3,4 @@ set -e -u . ../../tools/cleaning-tools.sh -clean_nutils . \ No newline at end of file +clean_nutils . diff --git a/perpendicular-flap/fluid-nutils/run.sh b/perpendicular-flap/fluid-nutils/run.sh index d9d30595d..a3adfa5f8 100755 --- a/perpendicular-flap/fluid-nutils/run.sh +++ b/perpendicular-flap/fluid-nutils/run.sh @@ -1,7 +1,4 @@ -#!/bin/bash +#!/bin/sh +set -e -u -# Solid participant - -# Run python3 nsale.py - diff --git a/perpendicular-flap/fluid-openfoam/0.orig/U b/perpendicular-flap/fluid-openfoam/0/U similarity index 100% rename from perpendicular-flap/fluid-openfoam/0.orig/U rename to perpendicular-flap/fluid-openfoam/0/U diff --git a/perpendicular-flap/fluid-openfoam/0.orig/p b/perpendicular-flap/fluid-openfoam/0/p similarity index 100% rename from perpendicular-flap/fluid-openfoam/0.orig/p rename to perpendicular-flap/fluid-openfoam/0/p diff --git a/perpendicular-flap/fluid-openfoam/0.orig/phi b/perpendicular-flap/fluid-openfoam/0/phi similarity index 100% rename from perpendicular-flap/fluid-openfoam/0.orig/phi rename to perpendicular-flap/fluid-openfoam/0/phi diff --git a/perpendicular-flap/fluid-openfoam/0.orig/pointDisplacement b/perpendicular-flap/fluid-openfoam/0/pointDisplacement similarity index 100% rename from perpendicular-flap/fluid-openfoam/0.orig/pointDisplacement rename to perpendicular-flap/fluid-openfoam/0/pointDisplacement diff --git a/perpendicular-flap/fluid-openfoam/clean.sh b/perpendicular-flap/fluid-openfoam/clean.sh index 1305ae185..c31d9fc76 100755 --- a/perpendicular-flap/fluid-openfoam/clean.sh +++ b/perpendicular-flap/fluid-openfoam/clean.sh @@ -4,4 +4,3 @@ set -e -u . ../../tools/cleaning-tools.sh clean_openfoam . -rm -rfv ./0/ # in run.sh,0.orig/ is copied to 0/ \ No newline at end of file diff --git a/perpendicular-flap/fluid-openfoam/run.sh b/perpendicular-flap/fluid-openfoam/run.sh index aa6eff74b..c191b9e48 100755 --- a/perpendicular-flap/fluid-openfoam/run.sh +++ b/perpendicular-flap/fluid-openfoam/run.sh @@ -1,40 +1,8 @@ -#!/bin/bash -cd ${0%/*} || exit 1 # Run from this directory -. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions +#!/bin/sh +set -e -u -# Fluid participant - -# Run this script in one terminal in order to start this participant. -# Run this script with "-parallel" for parallel simulations - -# 1 for true, 0 for false -parallel=0 -if [ "$1" = "-parallel" ]; then - parallel=1 -fi - -echo "Preparing and running the Fluid participant..." - -rm -rfv 0/ -cp -r 0.orig/ 0/ blockMesh -checkMesh touch fluid-openfoam.foam -# Run -solver=$(getApplication) -procs=$(getNumberOfProcessors) - -if [ $parallel -eq 1 ]; then - decomposePar -force - mpirun -np $procs $solver -parallel - reconstructPar -else - $solver -fi - -# Workaround for issue #26 +../../tools/run-openfoam.sh "$@" . ../../tools/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs - -echo "" -echo "### NOTE ### Make sure to use the correct solver for your OpenFOAM version! (pimpleFoam for OpenFOAM v1806, OpenFOAM 6, or newer, vs pimpleDyMFoam for older) You may change this in your Fluid/system/controlDict file, if needed." diff --git a/perpendicular-flap/fluid-su2/clean.sh b/perpendicular-flap/fluid-su2/clean.sh index 231d56948..54a3623e3 100755 --- a/perpendicular-flap/fluid-su2/clean.sh +++ b/perpendicular-flap/fluid-su2/clean.sh @@ -4,4 +4,3 @@ set -e -u . ../../tools/cleaning-tools.sh clean_su2 . -rm -fv fluid-su2.log diff --git a/perpendicular-flap/fluid-su2/run.sh b/perpendicular-flap/fluid-su2/run.sh index c62c49063..4ac37320a 100755 --- a/perpendicular-flap/fluid-su2/run.sh +++ b/perpendicular-flap/fluid-su2/run.sh @@ -1,25 +1,8 @@ -#!/bin/bash +#!/bin/sh +set -e -u -# Fluid participant - -# Run this script in one terminal and the "runSolid" script in another terminal. -# These scripts present how the two participants would be started manually. -# Alternatively, you may execute the "Allrun" script in one terminal. - -# Run this script with "-parallel" for parallel simulations - -# The script "Allclean" cleans-up the result and log files. - -# 1 for true, 0 for false -parallel=0 if [ "$1" = "-parallel" ]; then - parallel=1 -fi - -echo "Preparing and running the Fluid participant..." - -if [ $parallel -eq 1 ]; then - mpirun -n 2 SU2_CFD euler_config_coupled.cfg 2>&1 | tee fluid-su2.log + mpirun -n 2 SU2_CFD euler_config_coupled.cfg else - SU2_CFD euler_config_coupled.cfg 2>&1 | tee fluid-su2.log + SU2_CFD euler_config_coupled.cfg fi diff --git a/perpendicular-flap/plotDisplacement.sh b/perpendicular-flap/plotDisplacement.sh deleted file mode 100644 index c34258961..000000000 --- a/perpendicular-flap/plotDisplacement.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -if [ "$1" = "" ]; then - echo "No target directory specified. Please specify the directory of the solid participant containing the watchpoint, e.g. ./plot-displacement.sh solid-fenics." - exit 1 -fi - -FILE="$1/precice-Solid-watchpoint-Flap-Tip.log" - -if [ ! -f "$FILE" ]; then - echo "Unable to locate the watchpoint file (precice-Solid-watchpoint-Flap-Tip.log) in the specified solid directory '${1}'. Make sure the specified directory matches the solid participant you used for the calculations." - exit 1 -fi - -gnuplot -p << EOF - set grid - set title 'x-displacement of the flap tip' - set xlabel 'time [s]' - set ylabel 'x-displacement [m]' - plot "$1/precice-Solid-watchpoint-Flap-Tip.log" using 1:4 with lines title "$1" -EOF diff --git a/perpendicular-flap/solid-calculix/clean.sh b/perpendicular-flap/solid-calculix/clean.sh index 3ac647dea..e93f04f3c 100755 --- a/perpendicular-flap/solid-calculix/clean.sh +++ b/perpendicular-flap/solid-calculix/clean.sh @@ -4,4 +4,3 @@ set -e -u . ../../tools/cleaning-tools.sh clean_calculix . -rm -fv Solid.log \ No newline at end of file diff --git a/perpendicular-flap/solid-calculix/run.sh b/perpendicular-flap/solid-calculix/run.sh index 34720eada..0cc701cc5 100755 --- a/perpendicular-flap/solid-calculix/run.sh +++ b/perpendicular-flap/solid-calculix/run.sh @@ -1,14 +1,4 @@ -#!/bin/bash +#!/bin/sh +set -e -u -# Solid participant - -# Run this script in one terminal and the "runFluid" script in another terminal. -# These scripts present how the two participants would be started manually. -# Alternatively, you may execute the "Allrun" script in one terminal. - -# The script "Allclean" cleans-up the result and log files. - -echo "Running the Solid participant..." - -# Run -ccx_preCICE -i flap -precice-participant Solid 2>&1 | tee Solid.log +ccx_preCICE -i flap -precice-participant Solid diff --git a/perpendicular-flap/solid-dealii/clean.sh b/perpendicular-flap/solid-dealii/clean.sh index 897f5d1b3..9ad81b8fb 100755 --- a/perpendicular-flap/solid-dealii/clean.sh +++ b/perpendicular-flap/solid-dealii/clean.sh @@ -3,4 +3,4 @@ set -e -u . ../../tools/cleaning-tools.sh -clean_dealii . \ No newline at end of file +clean_dealii . diff --git a/perpendicular-flap/solid-fenics/clean.sh b/perpendicular-flap/solid-fenics/clean.sh index 614c6f928..3a8b4619d 100755 --- a/perpendicular-flap/solid-fenics/clean.sh +++ b/perpendicular-flap/solid-fenics/clean.sh @@ -3,4 +3,4 @@ set -e -u . ../../tools/cleaning-tools.sh -clean_fenics . \ No newline at end of file +clean_fenics . diff --git a/perpendicular-flap/solid-fenics/run.sh b/perpendicular-flap/solid-fenics/run.sh index 74e2547aa..de18f9e63 100755 --- a/perpendicular-flap/solid-fenics/run.sh +++ b/perpendicular-flap/solid-fenics/run.sh @@ -1,14 +1,4 @@ -#!/bin/bash +#!/bin/sh +set -e -u -# Solid participant - -# Run this script in one terminal and the "runFluid" script in another terminal. -# These scripts present how the two participants would be started manually. -# Alternatively, you may execute the "Allrun" script in one terminal. - -# The script "Allclean" cleans-up the result and log files. - -echo "Running the Solid participant..." - -# Run -python3 perp-flap.py 2>&1 | tee solid-fenics.log +python3 perp-flap.py diff --git a/tools/clean-tutorial-base.sh b/tools/clean-tutorial-base.sh index c1c0a2697..dd6fc4f26 100755 --- a/tools/clean-tutorial-base.sh +++ b/tools/clean-tutorial-base.sh @@ -3,4 +3,4 @@ set -e -u . ../tools/cleaning-tools.sh -clean_tutorial . \ No newline at end of file +clean_tutorial . diff --git a/tools/cleaning-tools.sh b/tools/cleaning-tools.sh index f3a35dcdd..d85505fff 100755 --- a/tools/cleaning-tools.sh +++ b/tools/cleaning-tools.sh @@ -1,7 +1,8 @@ #!/bin/sh error() { - echo "Error: $1" >&2; exit 1; + echo "Error: $1" >&2 + exit 1 } clean_tutorial() { @@ -14,7 +15,7 @@ clean_tutorial() { for case in */; do if [ "${case}" = images/ ]; then continue - fi; + fi (cd "${case}" && ./clean.sh) done ) @@ -26,12 +27,12 @@ clean_precice_logs() { cd "$1" echo "---- Cleaning up preCICE logs in $(pwd)" rm -fv ./precice-*-iterations.log \ - ./precice-*-convergence.log \ - ./precice-*-events.json \ - ./precice-*-events-summary.log \ - ./precice-postProcessingInfo.log \ - ./precice-*-watchpoint-*.log \ - ./precice-*-watchintegral-*.log + ./precice-*-convergence.log \ + ./precice-*-events.json \ + ./precice-*-events-summary.log \ + ./precice-postProcessingInfo.log \ + ./precice-*-watchpoint-*.log \ + ./precice-*-watchintegral-*.log ) } @@ -40,7 +41,7 @@ clean_calculix() { set -e -u cd "$1" echo "--- Cleaning up CalculiX case in $(pwd)" - rm -fv ./*.cvg ./*.dat ./*.frd ./*.sta ./*.12d spooles.out + rm -fv ./*.cvg ./*.dat ./*.frd ./*.sta ./*.12d spooles.out dummy clean_precice_logs . ) } @@ -72,6 +73,7 @@ clean_fenics() { cd "$1" echo "--- Cleaning up FEniCS case in $(pwd)" rm -fv ./*.pvd spooles.out FSI-S/* + rm -rfv ./out/ clean_precice_logs . ) } @@ -81,6 +83,7 @@ clean_nutils() { set -e -u cd "$1" echo "--- Cleaning up Nutils case in $(pwd)" + rm -fv ./*.vtk clean_precice_logs . ) } @@ -107,4 +110,4 @@ clean_su2() { rm -fv ./restart_flow_*.dat forces_breakdown.dat ./surface_flow_*.csv ./flow_*.vtk ./history_*.vtk clean_precice_logs . ) -} \ No newline at end of file +} diff --git a/tools/openfoam-remove-empty-dirs.sh b/tools/openfoam-remove-empty-dirs.sh index 16a9fb640..44427cf8c 100755 --- a/tools/openfoam-remove-empty-dirs.sh +++ b/tools/openfoam-remove-empty-dirs.sh @@ -2,24 +2,24 @@ openfoam_remove_empty_dirs() { ( - set -e -u - echo "Looking for any time directories without results (e.g. stray functionObjectProperties files, see openfoam-adapter issue #26 on GitHub)..." + set -e -u + echo "Looking for any time directories without results (e.g. stray functionObjectProperties files, see openfoam-adapter issue #26 on GitHub)..." - for f in [0-9]* [0-9]*.[0-9]*; do - if ! [ -f "${f}/U" ] && ! [ -f "${f}/T" ]; then - rm -rfv "${f}" - fi - done - if [ -d processor0 ]; then - for d in processor*; do - cd "${d}" - for f in [0-9]* [0-9]*.[0-9]*; do - if ! [ -f "${f}"/U ] && ! [ -f "${f}"/T ]; then - rm -rfv "${f}" - fi - done - cd .. + for f in [0-9]* [0-9]*.[0-9]*; do + if ! [ -f "${f}/U" ] && ! [ -f "${f}/T" ]; then + rm -rfv "${f}" + fi done - fi + if [ -d processor0 ]; then + for d in processor*; do + cd "${d}" + for f in [0-9]* [0-9]*.[0-9]*; do + if ! [ -f "${f}"/U ] && ! [ -f "${f}"/T ]; then + rm -rfv "${f}" + fi + done + cd .. + done + fi ) } diff --git a/tools/run-dealii.sh b/tools/run-dealii.sh index 69ef1b02d..318bb5143 100755 --- a/tools/run-dealii.sh +++ b/tools/run-dealii.sh @@ -3,35 +3,34 @@ set -e -u EXE="" -for i in "$@" -do -case $i in - -e=*|--exec=*) - EXE="${i#*=}" - shift # past argument=value - ;; +for i in "$@"; do + case $i in + -e=* | --exec=*) + EXE="${i#*=}" + shift # past argument=value + ;; *) - # unknown option - ;; -esac + # unknown option + ;; + esac done # If the executable has been defined -if [ -n "${EXE}" ]; then +if [ -n "${EXE}" ]; then "${EXE}" parameters.prm - exit 0; + exit 0 fi EXE="elasticity" # If it is in the global path if [ -n "$(command -v "${EXE}")" ]; then - "${EXE}" parameters.prm - exit 0; + "${EXE}" parameters.prm + exit 0 fi # If it has been copied to the local directory if test -f "elasticity"; then ./"${EXE}" parameters.prm - else +else echo "Unable to find the executable ${EXE}. Either specify the executable explicitly (-e=/path/to/elasticity) or make it discoverable at runtime (e.g. export PATH)" fi diff --git a/tools/run-openfoam.sh b/tools/run-openfoam.sh new file mode 100755 index 000000000..e0667aa16 --- /dev/null +++ b/tools/run-openfoam.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -e # Not setting -u as it gets triggered by the OpenFOAM RunFunctions + +# OpenFOAM run functions: getApplication, getNumberOfProcessors +# shellcheck disable=SC1090 # This is an OpenFOAM file which we don't need to check +. "${WM_PROJECT_DIR}/bin/tools/RunFunctions" +solver=$(getApplication) +if [ "${1:-}" = "-parallel" ]; then + procs=$(getNumberOfProcessors) + decomposePar -force + mpirun -np "${procs}" "${solver}" -parallel + reconstructPar +else + ${solver} +fi diff --git a/turek-hron-fsi3/README.md b/turek-hron-fsi3/README.md index e774c1a06..b1ea09281 100644 --- a/turek-hron-fsi3/README.md +++ b/turek-hron-fsi3/README.md @@ -26,7 +26,9 @@ Fluid participant: Solid participant: * deal.II. For more information, have a look at the [deal.II adapter documentation](adapter-dealii-overview.html). This tutorial requires the nonlinear solid solver. Please copy the nonlinear solver executable to the `solid-dealii` folder or make it discoverable at runtime and update the `solid-dealii/run.sh` script. -* FEniCS. +* FEniCS. For more information, have a look at the [FEniCS adapter documentation](adapter-fenics.html). + +As this is a benchmark case, note that we currently only consider the OpenFOAM-deal.II results as valid. ## Running the Simulation @@ -41,11 +43,6 @@ and cd solid-dealii ./run.sh ``` -or -``` -cd solid-fenics -./run.sh -``` You can also run OpenFOAM in parallel by `./run.sh -parallel`. The default setting here uses 25 MPI ranks. You can change this setting in `fluid-openfoam/system/decomposeParDict`. For older OpenFOAM versions, the solver name will differ. If you are using OpenFOAM v1712 / 5.x or older have a look in the `fluid-openfoam/system/controlDict` file and set the appropriate solver name. @@ -57,7 +54,7 @@ In the first few timesteps, many coupling iterations are required for convergenc ## Post-processing -You can visualize the results of the coupled simulation using e.g. ParaView. Fluid results are in the OpenFOAM format and you may load the `Fluid.foam` file. Solid results are in VTK format. +You can visualize the results of the coupled simulation using e.g. ParaView. Fluid results are in the OpenFOAM format and you may load the `fluid-openfoam.foam` file. Solid results are in VTK format. If you want to visualize both domains with ParaView, keep in mind that the deal.II solver writes results every few timesteps, while the OpenFOAM solver writes in reference to simulated time. For this reason, make sure that you use compatible write intervals. You may also need to convert the OpenFOAM results to VTK (with the command `foamToVTK`). @@ -68,7 +65,7 @@ Moreover, as we defined a watchpoint at the flap tip (see `precice-config.xml`), ![FSI3 watchpoint](images/tutorials-turek-hron-fsi3-tip-plot.png) -Before running the simulation again, you may want to cleanup any result files using the script `Allclean`. +Before running the simulation again, you may want to cleanup any result files using the script `clean-tutorial.sh`. ## Mesh refinement diff --git a/turek-hron-fsi3/fluid-openfoam/0.orig/U b/turek-hron-fsi3/fluid-openfoam/0/U similarity index 100% rename from turek-hron-fsi3/fluid-openfoam/0.orig/U rename to turek-hron-fsi3/fluid-openfoam/0/U diff --git a/turek-hron-fsi3/fluid-openfoam/0.orig/p b/turek-hron-fsi3/fluid-openfoam/0/p similarity index 100% rename from turek-hron-fsi3/fluid-openfoam/0.orig/p rename to turek-hron-fsi3/fluid-openfoam/0/p diff --git a/turek-hron-fsi3/fluid-openfoam/0.orig/pointDisplacement b/turek-hron-fsi3/fluid-openfoam/0/pointDisplacement similarity index 100% rename from turek-hron-fsi3/fluid-openfoam/0.orig/pointDisplacement rename to turek-hron-fsi3/fluid-openfoam/0/pointDisplacement diff --git a/turek-hron-fsi3/fluid-openfoam/0.orig/vorticity b/turek-hron-fsi3/fluid-openfoam/0/vorticity similarity index 100% rename from turek-hron-fsi3/fluid-openfoam/0.orig/vorticity rename to turek-hron-fsi3/fluid-openfoam/0/vorticity diff --git a/turek-hron-fsi3/fluid-openfoam/clean.sh b/turek-hron-fsi3/fluid-openfoam/clean.sh index 1305ae185..c31d9fc76 100755 --- a/turek-hron-fsi3/fluid-openfoam/clean.sh +++ b/turek-hron-fsi3/fluid-openfoam/clean.sh @@ -4,4 +4,3 @@ set -e -u . ../../tools/cleaning-tools.sh clean_openfoam . -rm -rfv ./0/ # in run.sh,0.orig/ is copied to 0/ \ No newline at end of file diff --git a/turek-hron-fsi3/fluid-openfoam/run.sh b/turek-hron-fsi3/fluid-openfoam/run.sh index e3c29e9e6..c191b9e48 100755 --- a/turek-hron-fsi3/fluid-openfoam/run.sh +++ b/turek-hron-fsi3/fluid-openfoam/run.sh @@ -1,41 +1,8 @@ -#!/bin/bash -cd ${0%/*} || exit 1 # Run from this directory -. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions +#!/bin/sh +set -e -u -# Fluid participant - -# Run this script in one terminal and the execute the coupled_elasto_dynamics bindary -# in another terminal. -# These scripts present how the two participants would be started manually. - -# Run this script with "-parallel" for parallel simulations - -# The script "Allclean" cleans-up the result and log files. - -# 1 for true, 0 for false -parallel=0 -if [ "$1" = "-parallel" ]; then - parallel=1 -fi - -echo "Preparing and running the Fluid participant..." - -rm -rfv 0/ -cp -r 0.orig/ 0/ blockMesh -checkMesh touch fluid-openfoam.foam -# Run -solver=$(getApplication) -procs=$(getNumberOfProcessors) -if [ $parallel -eq 1 ]; then - decomposePar -force - mpirun -np $procs $solver -parallel - reconstructPar -else - $solver -fi - -# Workaround for issue #26 (OF-adapter, relevant for OF .com versions) +../../tools/run-openfoam.sh "$@" . ../../tools/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs diff --git a/turek-hron-fsi3/solid-dealii/clean.sh b/turek-hron-fsi3/solid-dealii/clean.sh index 897f5d1b3..9ad81b8fb 100755 --- a/turek-hron-fsi3/solid-dealii/clean.sh +++ b/turek-hron-fsi3/solid-dealii/clean.sh @@ -3,4 +3,4 @@ set -e -u . ../../tools/cleaning-tools.sh -clean_dealii . \ No newline at end of file +clean_dealii . diff --git a/turek-hron-fsi3/solid-fenics/clean.sh b/turek-hron-fsi3/solid-fenics/clean.sh index 614c6f928..3a8b4619d 100755 --- a/turek-hron-fsi3/solid-fenics/clean.sh +++ b/turek-hron-fsi3/solid-fenics/clean.sh @@ -3,4 +3,4 @@ set -e -u . ../../tools/cleaning-tools.sh -clean_fenics . \ No newline at end of file +clean_fenics . diff --git a/turek-hron-fsi3/solid-fenics/run.sh b/turek-hron-fsi3/solid-fenics/run.sh new file mode 100755 index 000000000..452b2b9d9 --- /dev/null +++ b/turek-hron-fsi3/solid-fenics/run.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -e -u + +python3 cyl-flap.py