Skip to content
Open
Show file tree
Hide file tree
Changes from all 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: 1 addition & 0 deletions changelog-entries/702.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Changed the run script of solvers with DuMux to compile the case before running, also accept given path to DuMux and adpater.
6 changes: 2 additions & 4 deletions free-flow-over-porous-media/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ Both the participants are computed using the simulation code [DuMu<sup>x</sup>](

To solve the flows with the DuMux framework, the necessary DUNE modules need to be downloaded and set up. This is done by running `sh setup-dumux.sh` in the tutorial folder.

Note that if an existing installation of DUNE modules is detected in a default location, this may lead to problems in running the `setup-dumux.sh` script. The script suppresses the environment variable `DUNE_CONTROL_PATH`.

To only recompile the participants, run `sh compile-dumux-cases.sh` in the tutorial folder.
If an existing path, containing compiled DUNE modules, DuMu<sup>x</sup> and DuMu<sup>x</sup>-adapter, is to be used for compiling the solvers, the path can be specified by setting the arguments while running the script `run.sh` with `-l <path-to-DUNE-common>` in each solver folder. The environment variable `DUNE_CONTROL_PATH` is suppressed by the script. The `run.sh` scripts in the DuMu<sup>x</sup> solver folders will first compile the solver if not already compiled, and then run the simulation.

## Running the simulation

Expand All @@ -52,7 +50,7 @@ To run the porous-media participant, run:

```bash
cd porous-media-dumux
./run.sh
./run.sh -l <path-to-DUNE-common> # use -l to specify existing DUNE installation, no need if setup-dumux.sh was used for setup
```

Participants can be executed only in serial. Parallel execution is not supported. The case takes approximately two minutes to finish.
Expand Down
21 changes: 0 additions & 21 deletions free-flow-over-porous-media/compile-dumux-cases.sh

This file was deleted.

37 changes: 37 additions & 0 deletions free-flow-over-porous-media/free-flow-dumux/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,43 @@ set -e -u
. ../../tools/log.sh
exec > >(tee --append "$LOGFILE") 2>&1


usage() { echo "Usage: cmd [-l <path-to-DUNE-common>]" 1>&2; exit 1; }

DUNE_COMMON_PATH_SET=
DUNE_COMMON_PATH_ARG=

while getopts ":l:" opt; do
case ${opt} in
l)
DUNE_COMMON_PATH_SET=1
DUNE_COMMON_PATH_ARG="$OPTARG"
;;
*)
usage
;;
esac
done

if [ ! -d "build-cmake" ]; then
echo "Solver not built. Building now..."
CASE_DIR=$(pwd)/..

if [ -z "$DUNE_COMMON_PATH_SET" ]; then
../dune-common/bin/dunecontrol --opts=../dumux/cmake.opts --only=free_flow_dumux all
else
export DUNE_CONTROL_PATH=$DUNE_COMMON_PATH_ARG:$CASE_DIR
"$DUNE_COMMON_PATH_ARG"/dune-common/bin/dunecontrol --opts="$DUNE_COMMON_PATH_ARG"/dumux/cmake.opts --only=free_flow_dumux all
fi
else
echo "build-cmake folder found."
cd build-cmake
make free_flow_dumux
cd ..
fi
# Move free_flow_dumux executable to the participant folder level
mv build-cmake/solver-dumux/free_flow_dumux .

./free_flow_dumux params.input

close_log
37 changes: 37 additions & 0 deletions free-flow-over-porous-media/porous-media-dumux/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,43 @@ set -e -u
. ../../tools/log.sh
exec > >(tee --append "$LOGFILE") 2>&1


usage() { echo "Usage: cmd [-l <path-to-DUNE-common>]" 1>&2; exit 1; }

DUNE_COMMON_PATH_SET=
DUNE_COMMON_PATH_ARG=

while getopts ":l:" opt; do
case ${opt} in
l)
DUNE_COMMON_PATH_SET=1
DUNE_COMMON_PATH_ARG="$OPTARG"
;;
*)
usage
;;
esac
done

if [ ! -d "build-cmake" ]; then
echo "Solver not built. Building now..."
CASE_DIR=$(pwd)/..

if [ -z "$DUNE_COMMON_PATH_SET" ]; then
../dune-common/bin/dunecontrol --opts=../dumux/cmake.opts --only=porous_media_dumux all
else
export DUNE_CONTROL_PATH=$DUNE_COMMON_PATH_ARG:$CASE_DIR
"$DUNE_COMMON_PATH_ARG"/dune-common/bin/dunecontrol --opts="$DUNE_COMMON_PATH_ARG"/dumux/cmake.opts --only=porous_media_dumux all
fi
else
echo "build-cmake folder found."
cd build-cmake
make porous_media_dumux
cd ..
fi
# Move porous_media_dumux executable to the participant folder level
mv build-cmake/solver-dumux/porous_media_dumux .

./porous_media_dumux params.input

close_log
5 changes: 3 additions & 2 deletions free-flow-over-porous-media/setup-dumux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ DUNE_CONTROL_PATH=. python3 dumux/bin/installexternal.py spgrid
# Re-build environment
DUNE_CONTROL_PATH=. ./dune-common/bin/dunecontrol --opts=./dumux/cmake.opts all
Copy link
Member

Choose a reason for hiding this comment

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

Something I noticed now: this line still assumes that the DUNE modules folder structure is in the working directory. This assumption does not hold with the other changes in this PR.

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 line holds if the previous commands in this script is executed though.


# Compile and move macro-dumux and micro-dumux executables to the participant folder level
./compile-dumux-cases.sh
# Move solver executables to the participant folder level
mv free-flow-dumux/build-cmake/solver-dumux/free_flow_dumux free-flow-dumux/
mv porous-media-dumux/build-cmake/solver-dumux/porous_media_dumux porous-media-dumux/
9 changes: 7 additions & 2 deletions two-scale-heat-conduction/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ preCICE configuration (image generated using the [precice-config-visualizer](htt

To solve either the macro or micro simulations with the DuMu<sup>x</sup> framework, the necessary DUNE modules need to be downloaded and set up. This is done by running `sh setup-dumux.sh` in the tutorial folder.

Note that if an existing installation of DUNE modules is detected in a default location, this may lead to problems in running the `setup-dumux.sh` script. The environment variable `DUNE_CONTROL_PATH` is suppressed by the script.
If an existing path, containing compiled DUNE modules, DuMu<sup>x</sup> and DuMu<sup>x</sup>-adapter, is to be used for compiling the solvers, the path can be specified by setting the arguments while running the script `run.sh` with `-l <path-to-DUNE-common>` in each solver folder. The environment variable `DUNE_CONTROL_PATH` is suppressed by the script. The `run.sh` scripts in the DuMu<sup>x</sup> solver folders will first compile the solver if not already compiled, and then run the simulation.

## Running the simulation

Expand All @@ -55,7 +55,12 @@ cd micro-nutils
./run.sh -s
```

If you want to use DuMu<sup>x</sup>, use `cd macro-dumux` instead of `cd macro-nutils` and/or `cd micro-dumux` instead of `cd micro-nutils`.
If you want to use DuMu<sup>x</sup>, use `cd macro-dumux` instead of `cd macro-nutils` and/or `cd micro-dumux` instead of `cd micro-nutils`. For example, to run the macro simulation with DuMu<sup>x</sup>, run:

```bash
cd macro-dumux
./run.sh -s -l <path-to-DUNE-common> # to specify existing DUNE installation with -l and run the compiled simulation in serial
```

## Running the simulation in parallel

Expand Down
20 changes: 0 additions & 20 deletions two-scale-heat-conduction/compile-dumux-cases.sh

This file was deleted.

55 changes: 46 additions & 9 deletions two-scale-heat-conduction/macro-dumux/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,63 @@ set -e -u
. ../../tools/log.sh
exec > >(tee --append "$LOGFILE") 2>&1

usage() { echo "Usage: cmd [-s] [-p n]" 1>&2; exit 1; }
usage() { echo "Usage: cmd [-s] [-p n] [-l <path-to-DUNE-common>]" 1>&2; exit 1; }

# Check if no input argument was provided
if [ -z "$*" ] ; then
echo "No input argument provided. Macro solver is launched in serial"
./macro_dumux params.input
fi
SERIAL_RUN=
PARALLEL_RUN=
RANK_COUNT=
DUNE_COMMON_PATH_SET=
DUNE_COMMON_PATH_ARG=

while getopts ":sp" opt; do
while getopts ":sp:l:" opt; do
case ${opt} in
s)
./macro_dumux params.input
SERIAL_RUN=1
;;
p)
mpiexec -n "$2" macro_dumux params.input
RANK_COUNT="$OPTARG"
PARALLEL_RUN=1
;;
l)
DUNE_COMMON_PATH_SET=1
DUNE_COMMON_PATH_ARG="$OPTARG"
;;
*)
usage
;;
esac
done

if [ ! -d "build-cmake" ]; then
echo "Solver not built. Building now..."
CASE_DIR=$(pwd)/..

if [ -z "$DUNE_COMMON_PATH_SET" ]; then
../dune-common/bin/dunecontrol --opts=../dumux/cmake.opts --only=macro_dumux all
else
export DUNE_CONTROL_PATH=$DUNE_COMMON_PATH_ARG:$CASE_DIR
"$DUNE_COMMON_PATH_ARG"/dune-common/bin/dunecontrol --opts="$DUNE_COMMON_PATH_ARG"/dumux/cmake.opts --only=macro_dumux all
fi
else
echo "build-cmake folder found."
cd build-cmake
make macro_dumux
cd ..
fi
# Move macro-dumux executable to the participant folder level
mv ./build-cmake/appl/macro_dumux .

if [ -n "$SERIAL_RUN" ] && [ -n "$PARALLEL_RUN" ]; then
echo "Cannot run both serial and parallel. Choose one option."
usage
elif [ -z "$SERIAL_RUN" ] && [ -z "$PARALLEL_RUN" ]; then
echo "No run option provided. The macro solver is launched in serial."
fi

if [ -n "$PARALLEL_RUN" ]; then
mpiexec -n "$RANK_COUNT" macro_dumux params.input
else
./macro_dumux params.input
fi

close_log
55 changes: 46 additions & 9 deletions two-scale-heat-conduction/micro-dumux/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,63 @@ set -e -u
. ../../tools/log.sh
exec > >(tee --append "$LOGFILE") 2>&1

usage() { echo "Usage: cmd [-s] [-p n]" 1>&2; exit 1; }
usage() { echo "Usage: cmd [-s] [-p n] [-l <path-to-DUNE-common>]" 1>&2; exit 1; }

# Check if no input argument was provided
if [ -z "$*" ] ; then
echo "No input argument provided. Micro Manager is launched in serial"
micro-manager-precice micro-manager-config.json
fi
SERIAL_RUN=
PARALLEL_RUN=
RANK_COUNT=
DUNE_COMMON_PATH_SET=
DUNE_COMMON_PATH_ARG=

while getopts ":sp" opt; do
while getopts ":sp:l:" opt; do
case ${opt} in
s)
micro-manager-precice micro-manager-config.json
SERIAL_RUN=1
;;
p)
mpiexec -n "$2" micro-manager-precice micro-manager-config.json
RANK_COUNT="$OPTARG"
PARALLEL_RUN=1
;;
l)
DUNE_COMMON_PATH_SET=1
DUNE_COMMON_PATH_ARG="$OPTARG"
;;
*)
usage
;;
esac
done

if [ ! -d "build-cmake" ]; then
echo "Solver not built. Building now..."
CASE_DIR=$(pwd)/..

if [ -z "$DUNE_COMMON_PATH_SET" ]; then
../dune-common/bin/dunecontrol --opts=../dumux/cmake.opts --only=micro_sim all
else
export DUNE_CONTROL_PATH=$DUNE_COMMON_PATH_ARG:$CASE_DIR
"$DUNE_COMMON_PATH_ARG"/dune-common/bin/dunecontrol --opts="$DUNE_COMMON_PATH_ARG"/dumux/cmake.opts --only=micro_sim all
fi
else
echo "build-cmake folder found."
cd build-cmake
make micro_sim
cd ..
fi
# Move micro_sim executable to the participant folder level
mv ./build-cmake/appl/micro_sim*.so .

if [ -n "$SERIAL_RUN" ] && [ -n "$PARALLEL_RUN" ]; then
echo "Cannot run both serial and parallel. Choose one option."
usage
elif [ -z "$SERIAL_RUN" ] && [ -z "$PARALLEL_RUN" ]; then
echo "No run option provided. The macro solver is launched in serial."
fi

if [ -n "$PARALLEL_RUN" ]; then
mpiexec -n "$RANK_COUNT" micro-manager-precice micro-manager-config.json
else
micro-manager-precice micro-manager-config.json
fi

close_log
3 changes: 2 additions & 1 deletion two-scale-heat-conduction/setup-dumux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ DUNE_CONTROL_PATH=. python3 dumux/bin/installexternal.py spgrid
DUNE_CONTROL_PATH=. ./dune-common/bin/dunecontrol --opts=./dumux/cmake.opts all

# Compile and move macro-dumux and micro-dumux executables to the participant folder level
./compile-dumux-cases.sh
mv macro-dumux/build-cmake/appl/macro_dumux macro-dumux/
mv micro-dumux/build-cmake/appl/micro_sim*.so micro-dumux/