flopy.mf6.utils.model_splitter module

class Mf6Splitter(sim, modelname=None)[source]

Bases: object

A class for splitting a single model into a multi-model simulation

Parameters:
  • sim (flopy.mf6.MFSimulation) –

  • modelname (str, None) – name of model to split

load_node_mapping(sim, filename)[source]

Method to load a saved json node mapping file and populate mapping dictionaries for reconstructing arrays and recarrays

Parameters:
  • sim (flopy.mf6.MFSimulation) – MFSimulation instance with split models

  • filename (str, Path) – JSON file name

property new_simulation

Returns the new simulation object after model splitting

optimize_splitting_mask(nparts)[source]

Method to create a splitting array with a balanced number of active cells per model. This method uses the program METIS and pymetis to create the subsetting array

Parameters:

nparts (int) –

Return type:

np.ndarray

property original_modelgrid

Method to return the original model’s modelgrid object. This is used for re-assembling the split models when analyzing output

recarray_bc_array(recarray, pkgtype=None, color='c')[source]

Method to take a reconstructed recarray and create a plottable boundary condition location array from it.

Parameters:
  • recarray (np.recarray) –

  • pkgtype (str) – optional package type. used to apply flopy’s default color to package

Returns:

tuple

Return type:

numpy array and a dict of matplotlib kwargs

reconstruct_array(arrays)[source]

Method to reconstruct model output arrays into a single array with the dimensions of the original model

arraysdict

dictionary of model number and the associated array

Return type:

np.ndarray of original model shape

reconstruct_recarray(recarrays)[source]

Method to reconstruct model recarrays into a single recarray that represents the original model data

Parameters:

recarrays (dict) – dictionary of model number and recarray

Return type:

np.recarray

property reversed_node_map

original node}}

Type:

Returns a lookup table of {model number

Type:

{model node

save_node_mapping(filename)[source]

Method to save the Mf6Splitter’s node mapping to file for use in reconstructing arrays

Parameters:

filename (str, Path) – JSON file name

Return type:

None

split_model(array)[source]

User method to split a model based on an array

Parameters:

array (np.ndarray) – integer array of new model numbers. Array must either be of dimension (NROW, NCOL), (NCPL), or (NNODES for unstructured grid models).

Return type:

MFSimulation object

switch_models(modelname, remap_nodes=False)[source]

Method to switch which model within a simulation that is being split. Models must be congruent. Ex. GWF model followed by a GWT model. If the models are not congruent remap_nodes must be set to True.

Parameters:
  • modelname (str) – model name to switch to

  • remap_nodes (bool) – boolean flag to force the class to remap the node look up table. This is used when models do not overlap (ex. two separate GWF models). Exchanges between original models are not preserved currently.

Return type:

None