differentiate_depletable_mats "cell match" option
Description
Working on #3056, I had to modify the model.differentiate_depletable_mats() method.
Right now when using the model.differentiate_depletable_mats("cell match)
if a depletable materials (that has multiple instance) is filling a cell with multiple instances, a clone of this material is created for each of the cell instances, but only the last clone is used a the only cell.fill.
https://github.com/openmc-dev/openmc/blob/57816e6b8cf23ed0e9b020b72752ed6aeb9501dd/openmc/model/model.py#L1049-L1060
As a clone is created for each instance of the cell, but only the last one is actually used, (with @pshriwise) we were wondering what is the indented behaviour ?
- fill each cell instance with a different mat.clone() ? Therefore implementation should be:
if diff_volume_method == 'divide equally':
cell.fill = [mat.clone() for _ in range(cell.num_instances)]
elif diff_volume_method == 'match cell':
+ cell.fill = [mat.clone() for _ in range(cell.num_instances)]
- for _ in range(cell.num_instances):
+ for i in range(cell.num_instances):
- cell.fill = mat.clone()
if not cell.volume:
raise ValueError(
f"Volume of cell ID={cell.id} not specified. "
"Set volumes of cells prior to using "
"diff_volume_method='match cell'."
)
+ cell.fill[i].volume = cell.volume/cell.num_instances
- cell.fill.volume = cell.volume
(I know the example of implementation if the the best but it explains the best changes in the targeted code)
- No material differentiation between the different cell instances ? In that case implementation should be:
if diff_volume_method == 'divide equally':
cell.fill = [mat.clone() for _ in range(cell.num_instances)]
elif diff_volume_method == 'match cell':
- for _ in range(cell.num_instances):
cell.fill = mat.clone()
if not cell.volume:
raise ValueError(
f"Volume of cell ID={cell.id} not specified. "
"Set volumes of cells prior to using "
"diff_volume_method='match cell'."
)
cell.fill.volume = cell.volume
- something else ?
As you implemented it, @jon-proximafusion, do you know what was the intended behaviour ?