# Micro Manager set up

**URL:** <https://precice.discourse.group/t/micro-manager-set-up/2458>\
**Category:** Official adapters and tutorials\
**Tags:** openfoam, adapters\
**Created:** [April 25, 2025, 9:56am UTC](https://precice.discourse.group/t/micro-manager-set-up/2458 "2025-04-25T09:56:29Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![dennis](https://avatars.discourse-cdn.com/v4/letter/d/e56c9b/32.png) [@dennis](https://precice.discourse.group/u/dennis)\
**Post date:** [April 25, 2025, 9:56am UTC](https://precice.discourse.group/t/micro-manager-set-up/2458/1 "2025-04-25T09:56:29Z")

</div>

Hello everybody,

I am coupling a microscopic and macroscopic CFD simulation to each other and have a question relating to the Micro-Manager. I would like to have a micro simulation for each cell in my macroscopic mesh. However, I am unsure where I define this. Do I need to define a variable in the CFD adapter and pass it to the Micro-Manager and if so, where do I do this?

Thanks in advance.

All the best,  
Dennis

---

<div class="post-metadata">

**Author:** ![IshaanDesai](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/ishaandesai/32/1048_2.png) [@IshaanDesai](https://precice.discourse.group/u/IshaanDesai)\
**Post date:** [April 25, 2025, 11:03am UTC](https://precice.discourse.group/t/micro-manager-set-up/2458/2 "2025-04-25T11:03:13Z")

</div>

Hello @dennis

The Micro Manager creates one micro simulation for every macro coordinate. So in your CFD adapter you do not have to do anything special. You simply define the coordinates and set the mesh in preCICE. The Micro Manager will then access this mesh and create micro simulations corresponding to each coordinate.

---

<div class="post-metadata">

**Author:** ![dennis](https://avatars.discourse-cdn.com/v4/letter/d/e56c9b/32.png) [@dennis](https://precice.discourse.group/u/dennis)\
**Post date:** [April 25, 2025, 11:27am UTC](https://precice.discourse.group/t/micro-manager-set-up/2458/3 "2025-04-25T11:27:14Z")

</div>

Hello @IshaanDesai,

thank you for your swift reply. My issue arises after starting both the micro and macro participant of my simulation. The macro participant (for testing purposes) is a simple mesh consisting of five cells, the set up and initialization of which works fine, however the micro participant returns the following error message:

```
Traceback (most recent call last):
  File "/home/precice/micromanager/micromanager/lib/python3.12/site-packages/micro_manager/micro_manager.py", line 659, in _solve_micro_simulations
    micro_sims_output[count] = sim.solve(micro_sims_input[count], dt)
                                         ~~~~~~~~~~~~~~~~ ^^^^^^^
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/precice/micromanager/micromanager/bin/micro-manager-precice", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/precice/micromanager/micromanager/lib/python3.12/site-packages/micro_manager/ __init__.py", line 42, in main
    manager.solve()
  File "/home/precice/micromanager/micromanager/lib/python3.12/site-packages/micro_manager/micro_manager.py", line 218, in solve
    micro_sims_output = micro_sim_solve(micro_sims_input, dt)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/precice/micromanager/micromanager/lib/python3.12/site-packages/micro_manager/micro_manager.py", line 672, in _solve_micro_simulations
    self._mesh_vertex_coords[count], micro_sims_input[count]
                                     ~~~~~~~~~~~~~~~~ ^^^^^^^
IndexError: list index out of range

```

I assume for some reason the number of micro simulations does not correspond to the number of macro coordinates or am I misinterpreting the error message? Do you have an idea what I might be doing wrong?

Do let me know if you need any more information.

Thanks and all the best,  
Dennis

---

<div class="post-metadata">

**Author:** ![IshaanDesai](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/ishaandesai/32/1048_2.png) [@IshaanDesai](https://precice.discourse.group/u/IshaanDesai)\
**Post date:** [April 25, 2025, 12:01pm UTC](https://precice.discourse.group/t/micro-manager-set-up/2458/4 "2025-04-25T12:01:11Z")

</div>

Which version of the Micro Manager are you using? And can you please check if you are correctly defining the `macro_domain_bounds` in the Micro Manager JSON config file?

---

<div class="post-metadata">

**Author:** ![dennis](https://avatars.discourse-cdn.com/v4/letter/d/e56c9b/32.png) [@dennis](https://precice.discourse.group/u/dennis)\
**Post date:** [April 25, 2025, 12:14pm UTC](https://precice.discourse.group/t/micro-manager-set-up/2458/5 "2025-04-25T12:14:07Z")

</div>

I’m using version 0.6.0. The `macro_domain_bounds` also corresponds to the dimensions of the macroscopic mesh.

---

<div class="post-metadata">

**Author:** ![IshaanDesai](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/ishaandesai/32/1048_2.png) [@IshaanDesai](https://precice.discourse.group/u/IshaanDesai)\
**Post date:** [April 25, 2025, 12:16pm UTC](https://precice.discourse.group/t/micro-manager-set-up/2458/6 "2025-04-25T12:16:29Z")

</div>

Okay. Can you please provide your JSON configuration file?

---

<div class="post-metadata">

**Author:** ![dennis](https://avatars.discourse-cdn.com/v4/letter/d/e56c9b/32.png) [@dennis](https://precice.discourse.group/u/dennis)\
**Post date:** [April 25, 2025, 12:18pm UTC](https://precice.discourse.group/t/micro-manager-set-up/2458/7 "2025-04-25T12:18:09Z")

</div>

Yes, of course:

```
{
    "micro_file_name": "micro-RTMSimpleFoam/micro_dummy",
    "coupling_params": {
        "precice_config_file_name": "./precice-config.xml",
        "macro_mesh_name": "macro-Mesh",
        "read_data_names": {},
        "write_data_names": {"k11": "scalar", "k22": "scalar", "k33": "scalar"}
    },
    "simulation_params": {
        "macro_domain_bounds": [0.0, 1.0, 0.0, 1.0, 0.0, 1.0],
        "micro_dt": 0.0001
    },
    "diagnostics": {
      "output_micro_sim_solve_time": "True"
    }
}

```

---

<div class="post-metadata">

**Author:** ![IshaanDesai](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/ishaandesai/32/1048_2.png) [@IshaanDesai](https://precice.discourse.group/u/IshaanDesai)\
**Post date:** [April 25, 2025, 12:36pm UTC](https://precice.discourse.group/t/micro-manager-set-up/2458/8 "2025-04-25T12:36:19Z")

</div>

Thanks! There are several issues here:

1. Are you sure that the `read_data_names` field should be empty? This essentially means that you are telling the Micro Manager that there is no macro data to be read from preCICE and passed to the micro simulations.
2. For Micro Manager v0.6.0, we moved from using dictionaries to using lists for `read_data_names` and `write_data_names`. So, `write_data_names` would be `["k11", "k22", "k33"]`.
3. Just to confirm, the `macro_domain_bounds` should have the minimum and maximum bounds of the macro domain in each axis (X, Y, and Z).

Can you please make the change and try again?

---

<div class="post-metadata">

**Author:** ![dennis](https://avatars.discourse-cdn.com/v4/letter/d/e56c9b/32.png) [@dennis](https://precice.discourse.group/u/dennis)\
**Post date:** [April 25, 2025, 12:47pm UTC](https://precice.discourse.group/t/micro-manager-set-up/2458/9 "2025-04-25T12:47:28Z")

</div>

Alright, thanks for your tips.

1. Yeah, for testing purposes I don’t pass any macro data yet
2. For `write_data_names` does that mean that I don’t need to define the variable type anymore?
3. Yeah, the `macro_domain_bounds` correspond to the minimum and maximum bounds of the domain.

I made the changes, but I still get the same error message unfortunately 😕

---

<div class="post-metadata">

**Author:** ![IshaanDesai](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/ishaandesai/32/1048_2.png) [@IshaanDesai](https://precice.discourse.group/u/IshaanDesai)\
**Post date:** [April 25, 2025, 12:49pm UTC](https://precice.discourse.group/t/micro-manager-set-up/2458/10 "2025-04-25T12:49:20Z")

</div>

> For `write_data_names` does that mean that I don’t need to define the variable type anymore?

Correct.

Let me have a look at the code and get back to you. The empty `read_data_names` could potentially be a problem.

---

<div class="post-metadata">

**Author:** ![dennis](https://avatars.discourse-cdn.com/v4/letter/d/e56c9b/32.png) [@dennis](https://precice.discourse.group/u/dennis)\
**Post date:** [April 25, 2025, 2:11pm UTC](https://precice.discourse.group/t/micro-manager-set-up/2458/11 "2025-04-25T14:11:10Z")

</div>

I tried coupling a dummy variable for the Micro-Manager to read. You are correct, the empty `read_data_names` is a problem. Thanks for you help!

---

<div class="post-metadata">

**Author:** ![IshaanDesai](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/ishaandesai/32/1048_2.png) [@IshaanDesai](https://precice.discourse.group/u/IshaanDesai)\
**Post date:** [April 25, 2025, 2:15pm UTC](https://precice.discourse.group/t/micro-manager-set-up/2458/12 "2025-04-25T14:15:41Z")

</div>

Okay, so my suspicion was correct! Does coupling a dummy variable in the read direction work for what you want to do?

In any case, a scenario where the Micro Manager only writes data should work. I will open an issue about this and fix it.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/precice/original/1X/67d2a5fa6f80e597e2267ff17fa8c1673cd11caa.svg) [@system](https://precice.discourse.group/u/system)\
**Post date:** [April 28, 2025, 2:16pm UTC](https://precice.discourse.group/t/micro-manager-set-up/2458/13 "2025-04-28T14:16:19Z")

</div>

Closed on April 28, 2025, 2:16pm UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
