Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure runscripts and related resources #181

Merged
merged 19 commits into from
Apr 12, 2021
Merged
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion elastic-tube-3d/fluid-openfoam/clean.sh
Original file line number Diff line number Diff line change
@@ -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/
40 changes: 3 additions & 37 deletions elastic-tube-3d/fluid-openfoam/run.sh
Original file line number Diff line number Diff line change
@@ -1,41 +1,7 @@
#!/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/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs
../../tools/run-openfoam.sh "$@"
2 changes: 1 addition & 1 deletion elastic-tube-3d/fluid-openfoam/system/controlDict
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ timeFormat general;

timePrecision 8;

runTimeModifiable yes;
runTimeModifiable false;

adjustTimeStep no;

2 changes: 1 addition & 1 deletion elastic-tube-3d/solid-calculix/clean.sh
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ set -e -u

. ../../tools/cleaning-tools.sh

clean_calculix .
clean_calculix .
17 changes: 5 additions & 12 deletions elastic-tube-3d/solid-calculix/run.sh
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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/
39 changes: 3 additions & 36 deletions flow-over-heated-plate-nearest-projection/fluid-openfoam/run.sh
Original file line number Diff line number Diff line change
@@ -1,40 +1,7 @@
#!/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/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."
../../tools/run-openfoam.sh "$@"
Original file line number Diff line number Diff line change
@@ -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/
39 changes: 3 additions & 36 deletions flow-over-heated-plate-nearest-projection/solid-openfoam/run.sh
Original file line number Diff line number Diff line change
@@ -1,40 +1,7 @@
#!/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 solid-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/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."
../../tools/run-openfoam.sh "$@"
Original file line number Diff line number Diff line change
@@ -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/
40 changes: 3 additions & 37 deletions flow-over-heated-plate-steady-state/fluid-openfoam/run.sh
Original file line number Diff line number Diff line change
@@ -1,41 +1,7 @@
#!/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/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs
../../tools/run-openfoam.sh "$@"
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ set -e -u

. ../../tools/cleaning-tools.sh

clean_codeaster .
clean_codeaster .
14 changes: 10 additions & 4 deletions flow-over-heated-plate-steady-state/solid-codeaster/run.sh
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion flow-over-heated-plate/fluid-openfoam/clean.sh
Original file line number Diff line number Diff line change
@@ -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/
33 changes: 3 additions & 30 deletions flow-over-heated-plate/fluid-openfoam/run.sh
Original file line number Diff line number Diff line change
@@ -1,34 +1,7 @@
#!/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
../../tools/run-openfoam.sh "$@"
2 changes: 1 addition & 1 deletion flow-over-heated-plate/solid-fenics/clean.sh
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ set -e -u

. ../../tools/cleaning-tools.sh

clean_fenics .
clean_fenics .
11 changes: 2 additions & 9 deletions flow-over-heated-plate/solid-fenics/run.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion flow-over-heated-plate/solid-nutils/clean.sh
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ set -e -u

. ../../tools/cleaning-tools.sh

clean_nutils .
clean_nutils .
4 changes: 1 addition & 3 deletions flow-over-heated-plate/solid-nutils/run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/bash
set -e -u

# Solid participant

# Run
python3 solid.py

File renamed without changes.
1 change: 0 additions & 1 deletion flow-over-heated-plate/solid-openfoam/clean.sh
Original file line number Diff line number Diff line change
@@ -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/
33 changes: 3 additions & 30 deletions flow-over-heated-plate/solid-openfoam/run.sh
Original file line number Diff line number Diff line change
@@ -1,34 +1,7 @@
#!/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/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs
../../tools/run-openfoam.sh "$@"
4 changes: 2 additions & 2 deletions heat-exchanger/README.md
Original file line number Diff line number Diff line change
@@ -9,7 +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.
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).

{% 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." %}

@@ -32,7 +32,7 @@ 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.
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.

Original file line number Diff line number Diff line change
@@ -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."
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion heat-exchanger/fluid-inner-openfoam/clean.sh
Original file line number Diff line number Diff line change
@@ -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/
1 change: 1 addition & 0 deletions heat-exchanger/fluid-inner-openfoam/constant/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
polyMesh/
6 changes: 6 additions & 0 deletions heat-exchanger/fluid-inner-openfoam/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
set -e -u

touch fluid-inner-openfoam.foam

../../tools/run-openfoam.sh "$@"
4 changes: 2 additions & 2 deletions heat-exchanger/fluid-inner-openfoam/system/controlDict
Original file line number Diff line number Diff line change
@@ -4,15 +4,15 @@ FoamFile {
object controlDict;
format ascii;
}
application chtMultiRegionSimpleFoam;
application buoyantSimpleFoam;
startFrom startTime;
stopAt endTime;
writeFormat ascii;
writePrecision 12;
writeCompression on;
timeFormat general;
timePrecision 12;
runTimeModifiable yes;
runTimeModifiable false;
deltaT 1;
startTime 0.0;
writeInterval 50;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion heat-exchanger/fluid-outer-openfoam/clean.sh
Original file line number Diff line number Diff line change
@@ -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/
1 change: 1 addition & 0 deletions heat-exchanger/fluid-outer-openfoam/constant/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
polyMesh/
6 changes: 6 additions & 0 deletions heat-exchanger/fluid-outer-openfoam/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
set -e -u

touch fluid-outer-openfoam.foam

../../tools/run-openfoam.sh "$@"
4 changes: 2 additions & 2 deletions heat-exchanger/fluid-outer-openfoam/system/controlDict
Original file line number Diff line number Diff line change
@@ -4,15 +4,15 @@ FoamFile {
object controlDict;
format ascii;
}
application chtMultiRegionSimpleFoam;
application buoyantSimpleFoam;
startFrom startTime;
stopAt endTime;
writeFormat ascii;
writePrecision 12;
writeCompression on;
timeFormat general;
timePrecision 12;
runTimeModifiable yes;
runTimeModifiable false;
deltaT 1;
startTime 0.0;
writeInterval 50;
2 changes: 1 addition & 1 deletion heat-exchanger/precice-config.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" ?>
<?xml version="1.0" ?>
<precice-configuration>
<log>
<sink
10 changes: 10 additions & 0 deletions heat-exchanger/solid-calculix/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Files distributed separately, downloaded via download-meshes.sh
adiabatic.dfl
all.msh
inner-interface.flm
inner-interface.nam
inner-interface.sur
outer-interface.flm
outer-interface.nam
outer-interface.sur
solid.inp
2 changes: 1 addition & 1 deletion heat-exchanger/solid-calculix/clean.sh
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ set -e -u

. ../../tools/cleaning-tools.sh

clean_calculix .
clean_calculix .
16 changes: 3 additions & 13 deletions heat-exchanger/solid-calculix/run.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
#!/bin/bash
cd ${0%/*} || exit 1 # Run from this directory

# This script prepares and runs all the participants in one terminal,
# forwarding the solvers' output to log files.
# You need to first download the mesh files separately using the Download_meshes script.
# The script "Allclean" cleans-up the result and log files.
#!/bin/sh
set -e -u

if [ ! -f all.msh ]; then
echo "Mesh files not found. Use the Download_meshes script to download them."
exit
fi

Participant="Solid"
Solver="ccx_preCICE"

# Run and get the process id
echo "Starting the ${Participant} participant..."
export OMP_NUM_THREADS=1
export CCX_NPROC_EQUATION_SOLVER=1
${Solver} -i solid -precice-participant ${Participant}
ccx_preCICE -i solid -precice-participant Solid
1 change: 0 additions & 1 deletion multiple-perpendicular-flaps/fluid-openfoam/clean.sh
Original file line number Diff line number Diff line change
@@ -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/
44 changes: 4 additions & 40 deletions multiple-perpendicular-flaps/fluid-openfoam/run.sh
Original file line number Diff line number Diff line change
@@ -1,43 +1,7 @@
#!/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 runSolid1 and runSolid2 in separate terminals.
# These scripts present how the three 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
blockMesh
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/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."
../../tools/run-openfoam.sh "$@"
2 changes: 1 addition & 1 deletion multiple-perpendicular-flaps/solid-left-dealii/clean.sh
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ set -e -u

. ../../tools/cleaning-tools.sh

clean_dealii .
clean_dealii .
2 changes: 1 addition & 1 deletion multiple-perpendicular-flaps/solid-right-dealii/clean.sh
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ set -e -u

. ../../tools/cleaning-tools.sh

clean_dealii .
clean_dealii .
2 changes: 1 addition & 1 deletion partitioned-elastic-beam/dirichlet-calculix/clean.sh
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ set -e -u

. ../../tools/cleaning-tools.sh

clean_calculix .
clean_calculix .
17 changes: 5 additions & 12 deletions partitioned-elastic-beam/dirichlet-calculix/run.sh
Original file line number Diff line number Diff line change
@@ -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 beam1 -precice-participant Calculix1
export OMP_NUM_THREADS=1
export CCX_NPROC_EQUATION_SOLVER=1
ccx_preCICE -i beam1 -precice-participant Calculix1
2 changes: 1 addition & 1 deletion partitioned-elastic-beam/neumann-calculix/clean.sh
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ set -e -u

. ../../tools/cleaning-tools.sh

clean_calculix .
clean_calculix .
17 changes: 5 additions & 12 deletions partitioned-elastic-beam/neumann-calculix/run.sh
Original file line number Diff line number Diff line change
@@ -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 beam2 -precice-participant Calculix2
export OMP_NUM_THREADS=1
export CCX_NPROC_EQUATION_SOLVER=1
ccx_preCICE -i beam2 -precice-participant Calculix2
11 changes: 0 additions & 11 deletions partitioned-heat-conduction-complex/fenics/Allclean

This file was deleted.

6 changes: 6 additions & 0 deletions partitioned-heat-conduction-complex/fenics/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
set -e -u

. ../../tools/cleaning-tools.sh

clean_fenics .
16 changes: 16 additions & 0 deletions partitioned-heat-conduction-complex/fenics/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +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]"
;;
esac
done
5 changes: 0 additions & 5 deletions partitioned-heat-conduction/fenics/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
*.txt
venv
.idea
*.pyc
out
*.log
*events.json
4 changes: 1 addition & 3 deletions partitioned-heat-conduction/fenics/clean.sh
Original file line number Diff line number Diff line change
@@ -3,6 +3,4 @@ set -e -u

. ../../tools/cleaning-tools.sh

rm -rf out
rm -f *.log
rm -f *-events.json
clean_fenics .
19 changes: 12 additions & 7 deletions partitioned-heat-conduction/fenics/run.sh
Original file line number Diff line number Diff line change
@@ -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

5 changes: 1 addition & 4 deletions partitioned-heat-conduction/nutils/clean.sh
Original file line number Diff line number Diff line change
@@ -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
23 changes: 14 additions & 9 deletions partitioned-heat-conduction/nutils/run.sh
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion perpendicular-flap/fluid-nutils/clean.sh
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ set -e -u

. ../../tools/cleaning-tools.sh

clean_nutils .
clean_nutils .
7 changes: 2 additions & 5 deletions perpendicular-flap/fluid-nutils/run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/bin/bash
#!/bin/sh
set -e -u

# Solid participant

# Run
python3 nsale.py

File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion perpendicular-flap/fluid-openfoam/clean.sh
Original file line number Diff line number Diff line change
@@ -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/
39 changes: 3 additions & 36 deletions perpendicular-flap/fluid-openfoam/run.sh
Original file line number Diff line number Diff line change
@@ -1,40 +1,7 @@
#!/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/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."
../../tools/run-openfoam.sh "$@"
1 change: 0 additions & 1 deletion perpendicular-flap/fluid-su2/clean.sh
Original file line number Diff line number Diff line change
@@ -4,4 +4,3 @@ set -e -u
. ../../tools/cleaning-tools.sh

clean_su2 .
rm -fv fluid-su2.log
25 changes: 4 additions & 21 deletions perpendicular-flap/fluid-su2/run.sh
Original file line number Diff line number Diff line change
@@ -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
21 changes: 0 additions & 21 deletions perpendicular-flap/plotDisplacement.sh

This file was deleted.

1 change: 0 additions & 1 deletion perpendicular-flap/solid-calculix/clean.sh
Original file line number Diff line number Diff line change
@@ -4,4 +4,3 @@ set -e -u
. ../../tools/cleaning-tools.sh

clean_calculix .
rm -fv Solid.log
16 changes: 3 additions & 13 deletions perpendicular-flap/solid-calculix/run.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion perpendicular-flap/solid-dealii/clean.sh
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ set -e -u

. ../../tools/cleaning-tools.sh

clean_dealii .
clean_dealii .
2 changes: 1 addition & 1 deletion perpendicular-flap/solid-fenics/clean.sh
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ set -e -u

. ../../tools/cleaning-tools.sh

clean_fenics .
clean_fenics .
16 changes: 3 additions & 13 deletions perpendicular-flap/solid-fenics/run.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion tools/clean-tutorial-base.sh
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ set -e -u

. ../tools/cleaning-tools.sh

clean_tutorial .
clean_tutorial .
24 changes: 13 additions & 11 deletions tools/cleaning-tools.sh
Original file line number Diff line number Diff line change
@@ -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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This dummy is generated at least in the heat exchanger CalculiX case, I have no idea where it comes from.

clean_precice_logs .
)
}
@@ -71,7 +72,7 @@ clean_fenics() {
set -e -u
cd "$1"
echo "--- Cleaning up FEniCS case in $(pwd)"
rm -fv ./*.pvd spooles.out FSI-S/*
rm -fv ./*.pvd spooles.out out FSI-S/*
clean_precice_logs .
)
}
@@ -81,6 +82,7 @@ clean_nutils() {
set -e -u
cd "$1"
echo "--- Cleaning up Nutils case in $(pwd)"
rm -fv ./*.vtk
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we delete all the VTK files inside Nutils cases. I guess not much can go wrong.

clean_precice_logs .
)
}
@@ -107,4 +109,4 @@ clean_su2() {
rm -fv ./restart_flow_*.dat forces_breakdown.dat ./surface_flow_*.csv ./flow_*.vtk ./history_*.vtk
clean_precice_logs .
)
}
}
34 changes: 17 additions & 17 deletions tools/openfoam-remove-empty-dirs.sh
Original file line number Diff line number Diff line change
@@ -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
)
}
29 changes: 14 additions & 15 deletions tools/run-dealii.sh
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions tools/run-openfoam.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/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

. openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion turek-hron-fsi3/fluid-openfoam/clean.sh
Original file line number Diff line number Diff line change
@@ -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/
40 changes: 3 additions & 37 deletions turek-hron-fsi3/fluid-openfoam/run.sh
Original file line number Diff line number Diff line change
@@ -1,41 +1,7 @@
#!/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/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs
../../tools/run-openfoam.sh "$@"
2 changes: 1 addition & 1 deletion turek-hron-fsi3/solid-dealii/clean.sh
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ set -e -u

. ../../tools/cleaning-tools.sh

clean_dealii .
clean_dealii .
2 changes: 1 addition & 1 deletion turek-hron-fsi3/solid-fenics/clean.sh
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ set -e -u

. ../../tools/cleaning-tools.sh

clean_fenics .
clean_fenics .
4 changes: 4 additions & 0 deletions turek-hron-fsi3/solid-fenics/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
set -e -u

python3 cyl-flap.py