@@ -287,6 +287,7 @@ def get_homogenized_materials(
287287 model : openmc .Model ,
288288 n_samples : int | tuple [int , int , int ] = 10_000 ,
289289 include_void : bool = True ,
290+ material_volumes : MeshMaterialVolumes | None = None ,
290291 ** kwargs
291292 ) -> list [openmc .Material ]:
292293 """Generate homogenized materials over each element in a mesh.
@@ -305,16 +306,23 @@ def get_homogenized_materials(
305306 the x, y, and z dimensions.
306307 include_void : bool, optional
307308 Whether homogenization should include voids.
309+ material_volumes : MeshMaterialVolumes, optional
310+ Previously computed mesh material volumes to use for homogenization.
311+ If not provided, they will be computed by calling
312+ :meth:`material_volumes`.
308313 **kwargs
309- Keyword-arguments passed to :meth:`MeshBase. material_volumes`.
314+ Keyword-arguments passed to :meth:`material_volumes`.
310315
311316 Returns
312317 -------
313318 list of openmc.Material
314319 Homogenized material in each mesh element
315320
316321 """
317- vols = self .material_volumes (model , n_samples , ** kwargs )
322+ if material_volumes is None :
323+ vols = self .material_volumes (model , n_samples , ** kwargs )
324+ else :
325+ vols = material_volumes
318326 mat_volume_by_element = [vols .by_element (i ) for i in range (vols .num_elements )]
319327
320328 # Create homogenized material for each element
@@ -424,7 +432,6 @@ def material_volumes(
424432
425433 # Restore original tallies
426434 model .tallies = original_tallies
427-
428435 return volumes
429436
430437
0 commit comments