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

create_multi_model_exchanges(mname0, mname1)[source]

Method to create multi-model exchange packages, e.g., GWF-GWT

Parameters:
  • mname0 (str) – model name of first model in exchange

  • mname1 (str) – model name of second model in exchange

Return type:

None

static load_node_mapping(filename)[source]

Method that loads and instantiate a Mf6Splitter object from hdf5 file. Once Mf6Splitter has been instantiated, it can be used to reconstruct arrays and recarrays of output data

Parameters:

filename (str) – hdf5 file name

Return type:

Mf6Splitter object

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) – HDF5 file name

  • hdf5 (bool) – flag to save as a hdf5 binary file

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

split_multi_model(array)[source]

Method to split integrated models such as GWF-GWT or GWF-GWE models. Note: this method will not work to split multiple connected GWF models

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