Skip to content

Commit

Permalink
README clarification + fix typo (#69)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
mrogowski and IshaanDesai authored Oct 29, 2023
1 parent fcd2b29 commit f45efbd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
22 changes: 18 additions & 4 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -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`:
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions micro_manager/micro_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit f45efbd

Please sign in to comment.