flopy.modpath.mp7particledata module

Support for MODPATH 7 particle release configurations. Contains the ParticleData, CellDataType, FaceDataType, and NodeParticleData classes.

class CellDataType(drape=0, columncelldivisions=3, rowcelldivisions=3, layercelldivisions=3)[source]

Bases: object

Cell data type class to create a MODPATH 7 particle location template for input style 2, 3, and 4 in cells (templatesubdivisiontype = 2).

Parameters:
  • drape (int) – Drape indicates how particles are treated when starting locations are specified for cells that are dry. If drape is 0, Particles are placed in the specified cell. If the cell is dry at the time of release, the status of the particle is set to unreleased and removed from the simulation. If drape is 1, particles are placed in the upper most active grid cell directly beneath the specified layer, row, column or node location (default is 0).

  • columncelldivisions (int) – Number of particles in a cell in the column (x-coordinate) direction (default is 3).

  • rowcelldivisions (int) – Number of particles in a cell in the row (y-coordinate) direction (default is 3).

  • layercelldivisions (int) – Number of particles in a cell in the layer (z-coordinate) direction (default is 3).

Examples

>>> import flopy
>>> cd = flopy.modpath.CellDataType()
write(f=None)[source]

Write the cell data template to a file.

Parameters:

f (fileobject) – Fileobject that is open with write access

class Extent(minx, maxx, miny, maxy, minz, maxz, xspan, yspan, zspan)

Bases: tuple

maxx

Alias for field number 1

maxy

Alias for field number 3

maxz

Alias for field number 5

minx

Alias for field number 0

miny

Alias for field number 2

minz

Alias for field number 4

xspan

Alias for field number 6

yspan

Alias for field number 7

zspan

Alias for field number 8

class FaceDataType(drape=0, verticaldivisions1=3, horizontaldivisions1=3, verticaldivisions2=3, horizontaldivisions2=3, verticaldivisions3=3, horizontaldivisions3=3, verticaldivisions4=3, horizontaldivisions4=3, rowdivisions5=3, columndivisions5=3, rowdivisions6=3, columndivisions6=3)[source]

Bases: object

Face data type class to create a MODPATH 7 particle location template for input style 2, 3, and 4 on cell faces (templatesubdivisiontype = 2).

Parameters:
  • drape (int) – Drape indicates how particles are treated when starting locations are specified for cells that are dry. If drape is 0, Particles are placed in the specified cell. If the cell is dry at the time of release, the status of the particle is set to unreleased and removed from the simulation. If drape is 1, particles are placed in the upper most active grid cell directly beneath the specified layer, row, column or node location (default is 0).

  • verticaldivisions1 (int) – The number of vertical subdivisions that define the two-dimensional array of particles on cell face 1 (default is 3).

  • horizontaldivisions1 (int) – The number of horizontal subdivisions that define the two-dimensional array of particles on cell face 1 (default is 3).

  • verticaldivisions2 (int) – The number of vertical subdivisions that define the two-dimensional array of particles on cell face 2 (default is 3).

  • horizontaldivisions2 (int) – The number of horizontal subdivisions that define the two-dimensional array of particles on cell face 2 (default is 3).

  • verticaldivisions3 (int) – The number of vertical subdivisions that define the two-dimensional array of particles on cell face 3 (default is 3).

  • horizontaldivisions3 (int) – The number of horizontal subdivisions that define the two-dimensional array of particles on cell face 3 (default is 3).

  • verticaldivisions4 (int) – The number of vertical subdivisions that define the two-dimensional array of particles on cell face 4 (default is 3).

  • horizontaldivisions4 (int) – The number of horizontal subdivisions that define the two-dimensional array of particles on cell face 4 (default is 3).

  • rowdivisions5 (int) – The number of row subdivisions that define the two-dimensional array of particles on the bottom cell face (face 5) (default is 3).

  • columndivisions5 (int) – The number of column subdivisions that define the two-dimensional array of particles on the bottom cell face (face 5) (default is 3).

  • rowdivisions6 (int) – The number of row subdivisions that define the two-dimensional array of particles on the top cell face (face 6) (default is 3).

  • columndivisions6 (int) – The number of column subdivisions that define the two-dimensional array of particles on the top cell face (face 6) (default is 3).

Examples

>>> import flopy
>>> fd = flopy.modpath.FaceDataType()
write(f=None)[source]
Parameters:

f (fileobject) – Fileobject that is open with write access

class LRCParticleData(subdivisiondata=None, lrcregions=None)[source]

Bases: object

MODPATH 7 particle release location template class for particle input style 2. Assigns particles to locations on cell faces (templatesubdivisiontype=1) and/or in cells (templatesubdivisiontype=2) for cells specified by (layer, row, column).

Parameters:
  • subdivisiondata (FaceDataType, CellDataType or array-like of such, optional) – Particle template(s) defining how particles are arranged within each cell. If None, defaults to CellDataType with 27 particles per cell (default is None).

  • lrcregions (array-like of array-like, optional) – 0-based regions (minlayer, minrow, mincolumn, maxlayer, maxrow, maxcolumn). If subdivisiondata is array-like, regions must be the same length. If None, particles are placed in the first model cell (default is None).

Examples

>>> import flopy
>>> pg = flopy.modpath.LRCParticleData(lrcregions=[[0, 0, 0, 3, 10, 10]])
to_coords(grid, localz=False) Iterator[tuple][source]

Compute global particle coordinates on the given grid.

Parameters:
Return type:

Generator of coordinate tuples (x, y, z)

to_prp(grid, localz=False) Iterator[tuple][source]

Convert particle data to PRT particle release point (PRP) package data entries for the given grid. A model grid is required because MODPATH supports several ways to specify particle release locations by cell ID and subdivision info or local coordinates, but PRT expects global coordinates.

Parameters:
Returns:

  • Generates PRT particle release point (PRP) package

  • data tuples (release point index, k, i, j, x, y, z)

write(f=None)[source]

Write the layer-row-column particle data template to a file.

Parameters:

f (fileobject) – Fileobject that is open with write access

class NodeParticleData(subdivisiondata=None, nodes=None)[source]

Bases: object

MODPATH 7 particle release location template class for particle input style 3. Assigns particles to locations on cell faces (templatesubdivisiontype=1) and/or in cells (templatesubdivisiontype=2) for cells specified by node number

Parameters:
  • subdivisiondata (FaceDataType, CellDataType array-like of such, optional) – Particle template(s) defining how particles are arranged within each cell. If None, defaults to CellDataType with 27 particles per cell (default is None).

  • nodes (int or array-like of ints, optional) – 0-based node numbers. If subdivisiondata is array-like, nodes must be array- like of the same length. If None, particles are placed in the first model cell (default is None).

Examples

>>> import flopy
>>> pg = flopy.modpath.NodeParticleData(nodes=[100, 101])
to_coords(grid, localz=False) Iterator[tuple][source]

Compute global particle coordinates on the given grid.

Parameters:
Return type:

Generator of coordinate tuples (x, y, z)

to_prp(grid, localz=False) Iterator[tuple][source]

Convert particle data to PRT particle release point (PRP) package data entries for the given grid. A model grid is required because MODPATH supports several ways to specify particle release locations by cell ID and subdivision info or local coordinates, but PRT expects global coordinates.

Parameters:
Returns:

  • Generator of PRT particle release point (PRP) package

  • data tuples (release point index, k, j, x, y, z)

write(f=None)[source]

Write the node particle data template to a file.

Parameters:

f (fileobject) – Fileobject that is open with write access

class ParticleData(partlocs=None, structured=False, particleids=None, localx=None, localy=None, localz=None, timeoffset=None, drape=None)[source]

Bases: object

Class to create the most basic particle data type (starting location input style 1). Input style 1 is the most general input style and provides the most flexibility in customizing starting locations.

Parameters:
  • partlocs (list/tuple of int, list/tuple of list/tuple, or np.ndarray) – Particle locations (zero-based) that are either layer, row, column locations or nodes.

  • structured (bool) – Boolean defining if a structured (True) or unstructured particle recarray will be created (default is False).

  • particleids (list, tuple, or np.ndarray) – Particle ids for the defined particle locations. If particleids is None, MODPATH 7 will define the particle ids to each particle location. If particleids is provided a particle id must be provided for each partloc (default is None).

  • localx (float, list, tuple, or np.ndarray) – Local x-location of the particle in the cell. If a single value is provided all particles will have the same localx position. If a list, tuple, or np.ndarray is provided a localx position must be provided for each partloc. If localx is None, a value of 0.5 (center of the cell) will be used (default is None).

  • localy (float, list, tuple, or np.ndarray) – Local y-location of the particle in the cell. If a single value is provided all particles will have the same localy position. If a list, tuple, or np.ndarray is provided a localy position must be provided for each partloc. If localy is None, a value of 0.5 (center of the cell) will be used (default is None).

  • localz (float, list, tuple, or np.ndarray) – Local z-location of the particle in the cell. If a single value is provided all particles will have the same localz position. If a list, tuple, or np.ndarray is provided a localz position must be provided for each partloc. If localy is None, a value of 0.5 (center of the cell) will be used (default is None).

  • timeoffset (float, list, tuple, or np.ndarray) – Timeoffset of the particle relative to the release time. If a single value is provided all particles will have the same timeoffset. If a list, tuple, or np.ndarray is provided a timeoffset must be provided for each partloc. If timeoffset is None, a value of 0. (equal to the release time) will be used (default is None).

  • drape (int, list, tuple, or np.ndarray) – Drape indicates how particles are treated when starting locations are specified for cells that are dry. If drape is 0, Particles are placed in the specified cell. If the cell is dry at the time of release, the status of the particle is set to unreleased and removed from the simulation. If drape is 1, particles are placed in the upper most active grid cell directly beneath the specified layer, row, column or node location. If a single value is provided all particles will have the same drape value. If a list, tuple, or np.ndarray is provided a drape value must be provided for each partloc. If drape is None, a value of 0 will be used (default is None).

Examples

>>> import flopy
>>> locs = [(0, 0, 0), (1, 0, 0), (2, 0, 0)]
>>> pd = flopy.modpath.ParticleData(locs, structured=True, drape=0,
...                                 localx=0.5, localy=0.5, localz=1)
to_coords(grid, localz=False) Iterator[tuple][source]

Compute particle coordinates on the given grid.

Parameters:
Return type:

Generates coordinate tuples (x, y, z)

to_prp(grid, localz=False) Iterator[tuple][source]

Convert particle data to PRT particle release point (PRP) package data entries for the given grid. A model grid is required because MODPATH supports several ways to specify particle release locations by cell ID and subdivision info or local coordinates, but PRT expects global coordinates.

Parameters:
Returns:

  • Generates PRT particle release point (PRP) package

  • data tuples (release point index, k, [i,] j, x, y, z.)

  • If the grid is not structured, i is omitted and j is

  • the within-layer cell index for vertex grids.

write(f=None)[source]

Write the particle data template to a file.

Parameters:

f (fileobject) – Fileobject that is open with write access

get_cell_release_points(subdivisiondata, cellid, extent) Iterator[tuple][source]

Get release points for MODPATH 7 input style 2, template subdivision type 2, i.e. cell (3D) subdivision, for the given cell with the given extent.

get_extent(grid, k=None, i=None, j=None, nn=None, localz=False) Extent[source]
get_face_release_points(subdivisiondata, cellid, extent) Iterator[tuple][source]

Get release points for MODPATH 7 input style 2, template subdivision style 1, i.e. face (2D) subdivision, for the given cell with the given extent.

get_release_points(subdivisiondata, grid, k=None, i=None, j=None, nn=None, localz=False) Iterator[tuple][source]

Get MODPATH 7 release point tuples for the given cell.

reversed_product(*iterables, repeat=1)[source]

Like itertools.product(), but left-most elements advance first.

Adapted from https://stackoverflow.com/a/32998481/6514033.