You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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 ?
The text was updated successfully, but these errors were encountered:
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 onlycell.fill
.openmc/openmc/model/model.py
Lines 1049 to 1060 in 57816e6
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 ?
Therefore implementation should be:
(I know the example of implementation if the the best but it explains the best changes in the targeted code)
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
As you implemented it, @jon-proximafusion, do you know what was the intended behaviour ?
The text was updated successfully, but these errors were encountered: