Skip to content

Commit 340b447

Browse files
Fix the setup-dumux.sh script in two-scale-heat-conduction (#518)
* [two-scale-heat-conduction] adapt to micro-manager-v0.4.0 * [two-scale-heat-conduction] use dumux install script from release 3.7 * [two-scale-heat-conduction] make setup-dumux.sh more robust * Add comment about running setup-dumux.sh in the README * [two-scale-heat-conduction] suppress DUNE_CONTROL_PATH in setup --------- Co-authored-by: Ishaan Desai <[email protected]>
1 parent b21f4b5 commit 340b447

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

two-scale-heat-conduction/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ preCICE configuration (image generated using the [precice-config-visualizer](htt
3030
* Both the macro and micro simulations can be solved using the finite element library [Nutils](https://nutils.org/install.html) v7 or the simulation framework [DuMu<sup>x</sup>](https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/).
3131
* While using Nutils, the macro simulation is written in Python, so it requires the [Python bindings of preCICE](https://precice.org/installation-bindings-python.html).
3232
* The [Micro Manager](https://precice.org/tooling-micro-manager-installation.html) controls all micro-simulations and facilitates coupling via preCICE. Use the [develop](https://github.com/precice/micro-manager/tree/develop) branch of the Micro Manager.
33-
* 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. Run `sh setup-dumux.sh` in the tutorial folder to set up the DUNE modules.
33+
34+
### DuMu<sup>x</sup> setup
35+
36+
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.
37+
38+
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.
3439

3540
## Running the simulation
3641

two-scale-heat-conduction/micro-dumux/appl/micro_sim.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ PYBIND11_MODULE(micro_sim, m)
311311
m.doc() = "pybind11 example plugin"; // optional module docstring
312312

313313
py::class_<MicroSimulation>(m, "MicroSimulation")
314-
.def(py::init())
314+
.def(py::init<int>())
315315
.def("initialize", &MicroSimulation::initialize)
316316
.def("solve", &MicroSimulation::solve)
317317
//.def("save_checkpoint", &MicroSimulation::save_checkpoint)
@@ -328,7 +328,7 @@ PYBIND11_MODULE(micro_sim, m)
328328
throw std::runtime_error("Invalid state!");
329329

330330
/* Create a new C++ instance */
331-
MicroSimulation ms;
331+
MicroSimulation ms(0);
332332
ms.initialize();
333333
ms.setState(t);
334334

two-scale-heat-conduction/setup-dumux.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ rm -rfv dune-*/
99
rm -rfv install*
1010

1111
# Get the DuMuX install script and install it
12-
wget https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/raw/master/bin/installdumux.py
13-
python3 installdumux.py
12+
wget https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/raw/releases/3.7/bin/installdumux.py
13+
DUNE_CONTROL_PATH=. python3 installdumux.py
14+
# clear build directories
15+
cd dumux
16+
rm -r dune-common/build-cmake/dune-env/lib/dunecontrol || true
17+
DUNE_CONTROL_PATH=. ./dune-common/bin/dunecontrol exec rm -r build-cmake
18+
cd ..
1419

1520
# Take out all the module folders from the dumux/ folder and remove the dumux/ folder
1621
mv dumux dumux-install
@@ -23,11 +28,10 @@ git clone https://github.com/precice/dumux-adapter.git
2328
# DuMux phasefield implementation
2429
git clone -b cell_problems https://git.iws.uni-stuttgart.de/dumux-appl/dumux-phasefield.git
2530
# DUNE SPGrid for periodic boundary conditions
26-
python3 dumux/bin/installexternal.py spgrid
31+
DUNE_CONTROL_PATH=. python3 dumux/bin/installexternal.py spgrid
2732

28-
# Clear CMake caches and re-build environment
29-
./dune-common/bin/dunecontrol bexec rm -r CMakeFiles CMakeCache.txt
30-
./dune-common/bin/dunecontrol --opts=./dumux/cmake.opts all
33+
# Re-build environment
34+
DUNE_CONTROL_PATH=. ./dune-common/bin/dunecontrol --opts=./dumux/cmake.opts all
3135

3236
# Compile and move macro-dumux and micro-dumux executables to the participant folder level
3337
./compile-dumux-cases.sh

0 commit comments

Comments
 (0)