Micro Manager: a Python package for adaptive and flexible two-scale coupling

The Micro Manager facilitates coupling between simulation software packages, which solve problems at different physical scales. Broadly speaking, simulation-based analysis is an effective tool to gain insights in real-world scenarios without incurring the high cost of prototyping and testing. Complex simulations are oftentimes broken down into simpler components, which are resolved by tailor-made software. Such complex simulations can be of multiphysics nature, meaning different physics are solved in different parts of the domain. To do such multiphysics simulations, we can couple different software packages together. preCICE (Chourdakis et al., 2022) is an open-source coupling library for partitioned multiphysics simulations. However, sometimes the coupling is not just between different physics but also different physical scales, which is frequently referred to as multiscale coupling. To understand how the scales affect each other, both scales need to be solved simultaneously while being coupled in a bi-directional manner. The Micro Manager, together with preCICE, is capable of handling a multiphysics and multiscale coupling. We refer to the coarse scale as the macro scale, and the fine scale as the micro scale. The name Micro Manager is derived from its core functionality of controlling a set of micro-scale simulations and coupling them to one macro-scale simulation via preCICE.


Statement of need
Two-scale coupled simulations have already been done in several application areas, such as porous media (e.g., Bastidas et al., 2021;Gärttner et al., 2020), computational mechanics (e.g., Fritzen et al., 2019) and biomechanics (e.g., Lambers et al., 2021).For each of these publications, the coupling software is implemented from scratch.Such implementations typically involve communication between the scales, coupling schemes, and other case-specific technical solutions.For coupled problems on a single scale, preCICE handles these coupling aspects.The Micro Manager is a thin layer on top of preCICE, which enables preCICE to couple problems across two scales.Compared to existing multiscale coupling software such as MUSCLE3 (Veen & Hoekstra, 2020), MUI (Tang et al., 2015), and AMUSE (Pelupessy, F. I. et al., 2013), the Micro Manager is an add-on package to the general coupling library preCICE and not a stand-alone coupling solution.
For single-scale simulations, many widely-used solvers such as OpenFOAM, FEniCS, deal.II, and more are already coupled using preCICE.Additionally, preCICE has a steadily growing community (Chourdakis et al., 2022).Using the Micro Manager, we expose these advantages of using preCICE for multiscale scenarios.According to Alowayyed et al. (2017), our solution falls into the heterogeneous multiscale computing pattern.For this pattern, high-performance computing (HPC) software is still rare (Alowayyed et al., 2017).Application-tailored software packages for multiscale simulations with massively parallel capabilities, such as the one by Di Natale et al. ( 2019), exist, but they do not propose a general software solution.preCICE scales on tens of thousands of MPI ranks (Bungartz et al., 2016) and the Micro Manager is capable of adaptively (Figure 1) running micro simulations in parallel.We are proposing a software solution that could potentially solve large two-scale coupled problems efficiently, while building on existing single-scale know-how.

Functionality & Use
In Desai et al. (2022), we use the Micro Manager to solve a two-scale heat conduction problem, where both the macro and micro scales are solved using the finite element library Nutils (Zwieten et al., 2022).Kschidock (2023) shows the flexibility of preCICE and the Micro Manager by solving the same problem using DuMu x (Koch et al., 2021).The micro-scale simulation needs to be converted to a callable library so that the Micro Manager can control it.In the documentation, we demonstrate how to convert a Python or a C++ program into a callable library.The macro-scale simulation is coupled directly to preCICE.This coupling is black-box; hence, the macro-scale simulation has no knowledge of the macro-micro coupling or the Micro Manager.
The Micro Manager is configured via a JSON file.It can run micro simulations in parallel using MPI (Dalcin & Fang, 2021).For realistic multiscale scenarios, the number of micro simulations can be very high, and each micro simulation can be computationally expensive.The Micro Manager is able to adaptively activate and deactivate micro simulations depending on whether their similar counterparts exist (Redeker & Eck, 2013).
In addition to the two-scale heat conduction problem in Desai et al. (2022), the Micro Manager has already been used in multiscale models of the human liver in which a lobule-scale continuum-biomechanical model is coupled to many cell-scale models (Otlinghaus, 2022).
The Micro Manager is written in Python and hosted on GitHub.New versions are released and packaged for PyPI.We recommend installing the Micro Manager via pip and running it directly on the command line or by calling its public methods.It is designed to work on all major Linux distributions that have Python 3.x support.

Figure 1 :
Figure 1: Macro simulation with an averaged view of the materials (illustrated by stripes) is coupled via preCICE to a set of micro simulations controlled by the Micro Manager.The enlarged micro simulation shows a representative micro structure with the different materials.Micro simulations are run adaptively: highlighted ones are active, rest are inactive.