From f45efbd0f3b051cadcd2a464e587023788521262 Mon Sep 17 00:00:00 2001 From: Marcin Rogowski Date: Mon, 30 Oct 2023 00:13:03 +0300 Subject: [PATCH] README clarification + fix typo (#69) * Fix typo * Add --config parameter to the run-micro-manager.py execution command * Add assertion to check if a rank has no vertices --------- Co-authored-by: Ishaan Desai --- examples/README.md | 22 ++++++++++++++++++---- micro_manager/micro_manager.py | 2 ++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/examples/README.md b/examples/README.md index 904104fc..7aea421b 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,18 +1,25 @@ # Solverdummies -The `solverdummies` are minimal working examples for using the preCICE Micro Manager with different languages. At the moment, there are examples for Python, and C++. They can be coupled with any other solver, for example the `macro-dummy.py` in this directory. +The `solverdummies` are minimal working examples for using the preCICE Micro Manager with different languages. At the moment, there are examples for Python, and C++. They can be coupled with any other solver, for example the `macro_dummy.py` in this directory. ## Python To run the Python solverdummies, run the following commands in the `examples/` directory in **two different terminals**: ```bash -python macro-dummy.py -python python-dummy/run_micro_manager.py +python macro_dummy.py +python python-dummy/run_micro_manager.py --config micro-manager-config.json ``` Note that running `micro_manager micro-manager-config.json` from the terminal will not work, as the path in the configuration file is relative to the current working directory. See [#36](https://github.com/precice/micro-manager/issues/36) for more information. +To run the Python solverdummies with adaptivity run the following commands in the `examples/` directory in **two different terminals**: + +```bash +python macro_dummy.py +python python-dummy/run_micro_manager.py --config micro-manager-adaptivity-config.json +``` + ## C++ The C++ solverdummies have to be compiled first using [`pybind11`](https://pybind11.readthedocs.io/en/stable/index.html). To do so, install `pybind11` using `pip`: @@ -42,7 +49,14 @@ Then, run the following commands in the `examples/` directory, in **two differen ```bash python macro_dummy.py -python cpp-dummy/run_micro_manager.py +python cpp-dummy/run_micro_manager.py --config micro-manager-config.json +``` + +To run the C++ solverdummies with adaptivity run the following commands in the `examples/` directory in **two different terminals**: + +```bash +python macro_dummy.py +python cpp-dummy/run_micro_manager.py --config micro-manager-adaptivity-config.json ``` When changing the C++ solverdummy to your own solver, make sure to change the `PYBIND11_MODULE` in `micro_cpp_dummy.cpp` to the name that you want to compile to. diff --git a/micro_manager/micro_manager.py b/micro_manager/micro_manager.py index 53340c79..3b9ec38e 100644 --- a/micro_manager/micro_manager.py +++ b/micro_manager/micro_manager.py @@ -149,6 +149,8 @@ def initialize(self) -> None: self._mesh_vertex_ids, mesh_vertex_coords = self._participant.get_mesh_vertex_ids_and_coordinates( self._macro_mesh_name) + assert (mesh_vertex_coords.size != 0), "Macro mesh has no vertices." + self._local_number_of_sims, _ = mesh_vertex_coords.shape self._logger.info("Number of local micro simulations = {}".format(self._local_number_of_sims))