Skip to content

Commit

Permalink
Two scale heat conduction: Enable running DuMux participants in paral…
Browse files Browse the repository at this point in the history
…lel (precice#528)

* [two-scale-heat-conduction] run micro-dumux in parallel

* [two-scale-heat-conduction] run macro-dumux in parallel

* [two-scale-heat-conduction] dumux can be run in parallel

* [two-scale-heat-conduction] remove unnecessary <numbers> include
  • Loading branch information
mathiskelm authored Apr 23, 2024
1 parent 15338de commit a82eb16
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
4 changes: 2 additions & 2 deletions two-scale-heat-conduction/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ If you want to use DuMu<sup>x</sup>, use `cd macro-dumux` instead of `cd macro-n

## Running the simulation in parallel

Only the `micro-nutils` participant can be run in parallel. To run it in parallel, run:
All but the `macro-nutils` participant can be run in parallel. To run a participant in parallel, e.g. `micro-nutils`, run:

```bash
cd micro-nutils
Expand All @@ -78,7 +78,7 @@ Here are the results from Nutils-Nutils and DuMu<sup>x</sup>-DuMu<sup>x</sup> co

<img class="img-responsive" src="images/tutorials-two-scale-heat-conduction-results.png" alt="Macro and micro data of macro-nutils - micro-nutils simulation" width=50% height=30%/>

<img class="img-responsive" src="images/tutorials-two-scale-heat-conduction-results-du-du.png" alt="Macro and micro data of macro-nutils - micro-nutils simulation" width=50% height=30%/>
<img class="img-responsive" src="images/tutorials-two-scale-heat-conduction-results-du-du.png" alt="Macro and micro data of macro-dumux - micro-dumux simulation" width=50% height=30%/>

The differences of the fields are mainly introduced in by the different numerical schemes in the two solvers.

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

./macro_dumux params.input
usage() { echo "Usage: cmd [-s] [-p n]" 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

while getopts ":sp" opt; do
case ${opt} in
s)
./macro_dumux params.input
;;
p)
mpiexec -n "$2" macro_dumux params.input
;;
*)
usage
;;
esac
done

close_log
1 change: 1 addition & 0 deletions two-scale-heat-conduction/micro-dumux/appl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set(pybind11_DIR "${SITE_PACKAGES_DIR}/pybind11/share/cmake/pybind11/")

find_package(pybind11 CONFIG REQUIRED)
pybind11_add_module(micro_sim micro_sim.cpp)
target_compile_options(micro_sim PUBLIC -DENABLE_MPI=0)

#copy all source code to build directory to make available to pybind
add_custom_target(copy_micro_heat_all ALL
Expand Down
1 change: 0 additions & 1 deletion two-scale-heat-conduction/micro-dumux/appl/micro_sim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <ctime>
#include <fstream>
#include <iostream>
#include <numbers>
#include <vector>

#include <dune/common/timer.hh>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"simulation_params": {
"macro_domain_bounds": [0.0, 1.0, 0.0, 0.5],
"decomposition": [2, 1],
"adaptivity": {
"type": "global",
"data": ["k_00", "k_11", "porosity", "concentration"],
Expand Down

0 comments on commit a82eb16

Please sign in to comment.