ndiffusion.region_powers

ndiffusion.region_powers(density, volumes, regions, n_regions=None)[source]

Integrate a per-cell density over regions.

Parameters:
  • density (array-like) – (n_cells,) - typically power_density(), but any density works (a reaction rate gives a region reaction rate).

  • volumes (array-like) – (n_cells,) from cell_volumes().

  • regions (array-like of int) – Region id per cell: the material map for powers by material, or any other labeling (assembly, ring, …).

  • n_regions (int, optional) – Length of the result; defaults to max(regions) + 1.

Returns:

(n_regions,); entry r is the integral over cells labeled r.

Return type:

numpy.ndarray