Micro Manager set up

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

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.

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

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?

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

Okay. Can you please provide your JSON configuration file?

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"
    }
}

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?

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 :confused:

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.

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!

1 Like

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.

1 Like

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