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
Show file tree
Hide file tree
Changes from 15 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
1 change: 0 additions & 1 deletion elastic-tube-3d/fluid-openfoam/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -40,7 +40,7 @@ timeFormat general;

timePrecision 8;

runTimeModifiable yes;
runTimeModifiable false;

adjustTimeStep no;

Expand Down
2 changes: 1 addition & 1 deletion elastic-tube-3d/solid-calculix/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -3,4 +3,4 @@ set -e -u

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

clean_codeaster .
clean_codeaster .
10 changes: 6 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,6 @@
#!/bin/bash
export TUTORIAL_ROOT=${PWD}
export PRECICE_PARTICIPANT=Solid
as_run --run solid.export
#!/bin/sh
set -e -u

export TUTORIAL_ROOT=${PWD}
export PRECICE_PARTICIPANT=Solid
as_run --run solid.export
1 change: 0 additions & 1 deletion flow-over-heated-plate/fluid-openfoam/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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

1 change: 0 additions & 1 deletion flow-over-heated-plate/solid-openfoam/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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." %}

Expand All @@ -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.

Expand Down
Loading