micro-manager icon indicating copy to clipboard operation
micro-manager copied to clipboard

The `data` in adaptivity setting didn't work as expected

Open Fujikawas opened this issue 1 year ago • 2 comments

With the develop branch, I want to run the two-scale-heat-conduction tutorial case with less data sets involved in the adaptivity study. The original json file is here, I changed the simulation_params section to:

    "simulation_params": {
      "macro_domain_bounds": [0.0, 1.0, 0.0, 0.5],
      "adaptivity": "True",
      "adaptivity_settings": {
            "type": "global",
            "data": ["k_00", "concentration"],
            "history_param": 0.1,
            "coarsening_constant": 0.2,
            "refining_constant": 0.05,
            "every_implicit_iteration": "False",
            "similarity_measure": "L2rel"
        }
    },

to match the new format from commit e6641baf9bbe1a1672c436fb92c9b2ada2ef66fd and use less data for the adaptivity. It threw following error:

  File ".../two-scale-heat-conduction/micro-dumux/run_micro_manager.py", line 7, in <module>
    manager = MicroManager("micro-manager-config.json")
  File ".../python3.10/site-packages/micro_manager/micro_manager.py", line 128, in __init__
    self._initialize()
  File ".../python3.10/site-packages/micro_manager/micro_manager.py", line 483, in _initialize
    self._data_for_adaptivity[name][0] = initial_micro_output[name]
KeyError: 'k_11'

Fujikawas avatar May 07 '24 15:05 Fujikawas

The error probably occurs because "k_11" is set and returned in the initialize-method in nutils micro.py or dumux micro.cpp, respectively, leading to a mismatch as it is not expected to be initialized for the initial adaptivity computation. This can be solved by removing the line output_data["k_11"] = k[1][1] from the nutil micro.py (and correspondingly from the dumux micro.cpp). It is thus likely caused by a faulty microsimulation and not by a bug in the Micro Manager.

tjwsch avatar May 07 '24 18:05 tjwsch

This is indeed a problem which comes up when the initialize() method of the micro simulation does not return the correct quantities. Nevertheless, the error message can be better than what is seen right now. I will change it.

IshaanDesai avatar May 09 '24 17:05 IshaanDesai