Skip to content

Commit

Permalink
tmp commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Baptiste Mouginot committed Jul 24, 2024
1 parent 93c72d9 commit 5ec8978
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions openmc/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions openmc/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
15 changes: 9 additions & 6 deletions openmc/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions openmc/universe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5ec8978

Please sign in to comment.