Skip to content

Commit 00a0756

Browse files
committed
partitioned-heat-conduction: Build OpenFOAM solver in a local build directory
Avoid race conditions in building, accept an overwrite of the final binary.
1 parent 706d3ad commit 00a0756

2 files changed

Lines changed: 8 additions & 26 deletions

File tree

  • partitioned-heat-conduction

partitioned-heat-conduction/dirichlet-openfoam/run.sh

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,11 @@ set -e -u
55
exec > >(tee --append "$LOGFILE") 2>&1
66

77
# Build the heatTransfer solver, if not found.
8-
# Race condition: when running both participants with OpenFOAM,
9-
# they both need the same solver to be built.
10-
# The first one builds it, the second one waits.
118
if ! command -v heatTransfer > /dev/null 2>&1; then
12-
if [ ! -d "../solver-openfoam/Make/${WM_OPTIONS}" ]; then
13-
echo "Building the heatTransfer OpenFOAM solver"
14-
wmake ../solver-openfoam/
15-
else
16-
echo "The executable heatTransfer is not found, but the build directory ../solver-openfoam/Make/${WM_OPTIONS} was detected. A build is probably in progress, waiting 90s..."
17-
sleep 90
18-
if ! command -v heatTransfer > /dev/null 2>&1; then
19-
exit 1
20-
fi
21-
fi
9+
echo "Building ../solver-openfoam in a temporary build directory and installing to ${FOAM_USER_APPBIN}/heatTransfer..."
10+
cp -r ../solver-openfoam ./_solver-openfoam-copy
11+
wmake ./_solver-openfoam-copy
12+
rm -r ./_solver-openfoam-copy
2213
fi
2314

2415
blockMesh

partitioned-heat-conduction/neumann-openfoam/run.sh

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,11 @@ set -e -u
55
exec > >(tee --append "$LOGFILE") 2>&1
66

77
# Build the heatTransfer solver, if not found.
8-
# Race condition: when running both participants with OpenFOAM,
9-
# they both need the same solver to be built.
10-
# The first one builds it, the second one waits.
118
if ! command -v heatTransfer > /dev/null 2>&1; then
12-
if [ ! -d "../solver-openfoam/Make/${WM_OPTIONS}" ]; then
13-
echo "Building the heatTransfer OpenFOAM solver"
14-
wmake ../solver-openfoam/
15-
else
16-
echo "The executable heatTransfer is not found, but the build directory ../solver-openfoam/Make/${WM_OPTIONS} was detected. A build is probably in progress, waiting 90s..."
17-
sleep 90
18-
if ! command -v heatTransfer > /dev/null 2>&1; then
19-
exit 1
20-
fi
21-
fi
9+
echo "Building ../solver-openfoam in a temporary build directory and installing to ${FOAM_USER_APPBIN}/heatTransfer..."
10+
cp -r ../solver-openfoam ./_solver-openfoam-copy
11+
wmake ./_solver-openfoam-copy
12+
rm -r ./_solver-openfoam-copy
2213
fi
2314

2415
blockMesh

0 commit comments

Comments
 (0)