Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions openmc/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ def get_homogenized_materials(
model: openmc.Model,
n_samples: int | tuple[int, int, int] = 10_000,
include_void: bool = True,
material_volumes: MeshMaterialVolumes | None = None,
**kwargs
) -> list[openmc.Material]:
"""Generate homogenized materials over each element in a mesh.
Expand All @@ -305,16 +306,23 @@ def get_homogenized_materials(
the x, y, and z dimensions.
include_void : bool, optional
Whether homogenization should include voids.
material_volumes : MeshMaterialVolumes, optional
Previously computed mesh material volumes to use for homogenization.
If not provided, they will be computed by calling
:meth:`material_volumes`.
**kwargs
Keyword-arguments passed to :meth:`MeshBase.material_volumes`.
Keyword-arguments passed to :meth:`material_volumes`.

Returns
-------
list of openmc.Material
Homogenized material in each mesh element

"""
vols = self.material_volumes(model, n_samples, **kwargs)
if material_volumes is None:
vols = self.material_volumes(model, n_samples, **kwargs)
else:
vols = material_volumes
mat_volume_by_element = [vols.by_element(i) for i in range(vols.num_elements)]

# Create homogenized material for each element
Expand Down Expand Up @@ -424,7 +432,6 @@ def material_volumes(

# Restore original tallies
model.tallies = original_tallies

return volumes


Expand Down