imod.mf6.Modflow6Simulation.create_partition_labels#

Modflow6Simulation.create_partition_labels(npartitions: int, weights: DataArray | UgridDataArray | None = None) DataArray | UgridDataArray[source]#

Returns a label array: a 2d array with a similar size to the top layer of idomain. Every array element is the partition number to which the column of gridblocks of idomain at that location belong. This is provided to imod.mf6.Modflow6Simulation.split() to partition the model.

Parameters:
  • npartitions (int) – The number of partitions to create.

  • weights (xarray.DataArray, xugrid.UgridDataArray, optional) – The weights to use for partitioning. The weights should be a 2d array with the same size as the top layer of idomain. The weights are used to determine the size of each partition. The weights should be positive integers. If not provided, active cells (idomain > 0) are summed across layers and passed on as weights. If None, the idomain is used to compute weights.

Returns:

An array with partition labels, with the same shape as the top layer of the idomain.

Return type:

xarray.DataArray or xu.UgridDataArray

Examples

Create a partition label array with 4 partitions.

>>> label_array = mf6_sim.create_partition_labels(n_partitions=4)

You can then use this label array to split the simulation:

>>> mf6_splitted = mf6_sim.split(label_array)

You can also provide weights to the partitioning, which will influence the size of each partition. For example, if you want to create a uniform partitioning, you can use:

>>> weights = xr.ones_like(idomain)
>>> label_array = mf6_sim.create_partition_labels(n_partitions=4, weights=weights)