From 5ec8978ded0d1c441fb5b4cf963b82b35a918915 Mon Sep 17 00:00:00 2001 From: Baptiste Mouginot Date: Wed, 24 Jul 2024 06:35:48 +0200 Subject: [PATCH] tmp commit --- openmc/cell.py | 1 + openmc/geometry.py | 1 + openmc/model/model.py | 15 +++++++++------ openmc/universe.py | 6 ++++++ 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/openmc/cell.py b/openmc/cell.py index f4773067c7e..636cd7a7968 100644 --- a/openmc/cell.py +++ b/openmc/cell.py @@ -364,6 +364,7 @@ def add_volume_information(self, volume_calc): Results from a stochastic volume calculation """ + print("FILL_TYPE", self.fill_type) if volume_calc.domain_type == 'cell': if self.id in volume_calc.volumes: self._volume = volume_calc.volumes[self.id].n diff --git a/openmc/geometry.py b/openmc/geometry.py index a92ce12bb59..fc0c721bc5c 100644 --- a/openmc/geometry.py +++ b/openmc/geometry.py @@ -102,6 +102,7 @@ def add_volume_information(self, volume_calc): if volume_calc.domain_type == 'cell': for cell in self.get_all_cells().values(): if cell.id in volume_calc.volumes: + print("found CELL ID", cell.id) cell.add_volume_information(volume_calc) elif volume_calc.domain_type == 'material': for material in self.get_all_materials().values(): diff --git a/openmc/model/model.py b/openmc/model/model.py index 0e8c8c3f303..d79812e6516 100644 --- a/openmc/model/model.py +++ b/openmc/model/model.py @@ -1062,18 +1062,19 @@ def differentiate_mats(self, # Get material in the DAG-verses for dag_verse in self.geometry.get_all_dag_universes().values(): for mat_name in dag_verse.material_names: - dag_mats_n_inst[mat] = dag_mats_n_inst.get(mat, 0) + dag_verse.num_instances + dag_mats_n_inst[mat_name] = dag_mats_n_inst.get(mat_name, 0) + dag_verse.num_instances + # Account for the multiplicity of the dag-verses materials + for mat in self.materials: + if mat.name in dag_mats_n_inst: + mat._num_instances += dag_mats_n_inst[mat.name] + + # Extract all depletable materials which have multiple instances distribmats = set( [mat for mat in self.materials if (mat.depletable or not depletable_only) and mat.num_instances > 1]) - - # Account for the multiplicity of the dag-verses materials - for mat in self.materials: - if mat.name in dag_mats_n_inst: - mat._num_instances += dag_mats_n_inst[mat.name] if diff_volume_method == 'divide equally': for mat in distribmats: @@ -1112,6 +1113,8 @@ def differentiate_mats(self, if mat.depletable or not depletable_only: mats_clones = [mat.clone() for _ in range( dag_verse.num_instances)] + # if diff_volume_method == 'divide equally': + for i, mat_clone in enumerate(mats_clones): mat_clone.name += "_" + str(dag_verse.id) + "_" + str(i) dag_verse_mats.append(mat_clone) diff --git a/openmc/universe.py b/openmc/universe.py index 5af12a00326..85a1d3066da 100644 --- a/openmc/universe.py +++ b/openmc/universe.py @@ -876,6 +876,12 @@ def auto_mat_ids(self, val): cv.check_type('DAGMC automatic material ids', val, bool) self._auto_mat_ids = val + @property + def material_assignment(self): + dagmc_file_contents = h5py.File(self.filename) + material_tags_hex = dagmc_file_contents['/tstt/tags/NAME'].get( + 'values') + @property def material_names(self): dagmc_file_contents = h5py.File(self.filename)