Skip to content

Commit

Permalink
Fix the setup-dumux.sh script in two-scale-heat-conduction (#518)
Browse files Browse the repository at this point in the history
* [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]>
  • Loading branch information
mathiskelm and IshaanDesai authored Apr 12, 2024
1 parent b21f4b5 commit 340b447
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
7 changes: 6 additions & 1 deletion two-scale-heat-conduction/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ preCICE configuration (image generated using the [precice-config-visualizer](htt
* 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/).
* 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).
* 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.
* 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.

### DuMu<sup>x</sup> setup

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.

## Running the simulation

Expand Down
4 changes: 2 additions & 2 deletions two-scale-heat-conduction/micro-dumux/appl/micro_sim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ PYBIND11_MODULE(micro_sim, m)
m.doc() = "pybind11 example plugin"; // optional module docstring

py::class_<MicroSimulation>(m, "MicroSimulation")
.def(py::init())
.def(py::init<int>())
.def("initialize", &MicroSimulation::initialize)
.def("solve", &MicroSimulation::solve)
//.def("save_checkpoint", &MicroSimulation::save_checkpoint)
Expand All @@ -328,7 +328,7 @@ PYBIND11_MODULE(micro_sim, m)
throw std::runtime_error("Invalid state!");

/* Create a new C++ instance */
MicroSimulation ms;
MicroSimulation ms(0);
ms.initialize();
ms.setState(t);

Expand Down
16 changes: 10 additions & 6 deletions two-scale-heat-conduction/setup-dumux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ rm -rfv dune-*/
rm -rfv install*

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

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

# Clear CMake caches and re-build environment
./dune-common/bin/dunecontrol bexec rm -r CMakeFiles CMakeCache.txt
./dune-common/bin/dunecontrol --opts=./dumux/cmake.opts all
# Re-build environment
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

0 comments on commit 340b447

Please sign in to comment.