landlab.components.fracture_grid.fracture_grid

Create 2D grid with randomly generated fractures.

Created: September 2013 by Greg Tucker Last significant modification: conversion to proper component 7/2019 GT

class FractureGridGenerator[source]

Bases: Component

Create a 2D grid with randomly generated fractures.

The grid contains the value 1 where fractures (one cell wide) exist, and 0 elsewhere. The idea is to use this for simulations based on weathering and erosion of, and/or flow within, fracture networks.

Examples

>>> from landlab import RasterModelGrid
>>> grid = RasterModelGrid((5, 5))
>>> fg = FractureGridGenerator(grid=grid, frac_spacing=3)
>>> fg.run_one_step()
>>> grid.at_node["fracture_at_node"].reshape((5, 5))
array([[1, 0, 0, 1, 0],
       [0, 1, 1, 1, 1],
       [0, 0, 0, 1, 1],
       [0, 0, 0, 1, 1],
       [0, 0, 0, 1, 0]], dtype=int8)

Notes

Potential improvements:

  • Fractures could be defined by links rather than nodes (i.e., return a

    link array with a code indicating whether the link crosses a fracture or not)

  • Fractures could have a finite length rather than extending all the way

    across the grid

  • Use of starting position along either x or y axis makes fracture net

    somewhat asymmetric. One would need a different algorithm to make it fully (statistically) symmetric.

References

Required Software Citation(s) Specific to this Component

None Listed

Additional References

None Listed

Initialize the FractureGridGenerator.

Parameters:
  • frac_spacing (int, optional) – Average spacing of fractures (in grid cells) (default = 10)

  • seed (int, optional) – Seed used for random number generator (default = 0)

__init__(grid, frac_spacing=10.0, seed=0)[source]

Initialize the FractureGridGenerator.

Parameters:
  • frac_spacing (int, optional) – Average spacing of fractures (in grid cells) (default = 10)

  • seed (int, optional) – Seed used for random number generator (default = 0)

static __new__(cls, *args, **kwds)
cite_as = ''
property coords

Return the coordinates of nodes on grid attached to the component.

property current_time

Current time.

Some components may keep track of the current time. In this case, the current_time attribute is incremented. Otherwise it is set to None.

Return type:

current_time

definitions = (('fracture_at_node', 'presence (1) or absence (0) of fracture'),)
classmethod from_path(grid, path)

Create a component from an input file.

Parameters:
  • grid (ModelGrid) – A landlab grid.

  • path (str or file_like) – Path to a parameter file, contents of a parameter file, or a file-like object.

Returns:

A newly-created component.

Return type:

Component

property grid

Return the grid attached to the component.

initialize_optional_output_fields()

Create fields for a component based on its optional field outputs, if declared in _optional_var_names.

This method will create new fields (without overwrite) for any fields output by the component as optional. New fields are initialized to zero. New fields are created as arrays of floats, unless the component also contains the specifying property _var_type.

initialize_output_fields(values_per_element=None)

Create fields for a component based on its input and output var names.

This method will create new fields (without overwrite) for any fields output by, but not supplied to, the component. New fields are initialized to zero. Ignores optional fields. New fields are created as arrays of floats, unless the component specifies the variable type.

Parameters:

values_per_element (int (optional)) – On occasion, it is necessary to create a field that is of size (n_grid_elements, values_per_element) instead of the default size (n_grid_elements,). Use this keyword argument to acomplish this task.

input_var_names = ()
make_frac_grid_hex(frac_spacing)[source]

Create a hex grid that contains a network of random fractures.

Creates a grid containing a network of random fractures, which are represented as 1’s embedded in a grid of 0’s. The grid is stored in the “fracture_at_node” field.

Parameters:

frac_spacing (int) – Average spacing of fractures (in # of grid-cell widths)

make_frac_grid_raster(frac_spacing)[source]

Create a raster grid that contains a network of random fractures.

Creates a grid containing a network of random fractures, which are represented as 1’s embedded in a grid of 0’s. The grid is stored in the “fracture_at_node” field.

Parameters:

frac_spacing (int) – Average spacing of fractures (in grid cells)

name = 'FractureGridGenerator'
optional_var_names = ()
output_var_names = ('fracture_at_node',)
run_one_step()[source]

Run FractureGridGenerator and create a random fracture grid.

property shape

Return the grid shape attached to the component, if defined.

unit_agnostic = True
units = (('fracture_at_node', '-'),)
classmethod var_definition(name)

Get a description of a particular field.

Parameters:

name (str) – A field name.

Returns:

A description of each field.

Return type:

tuple of (name, *description*)

classmethod var_help(name)

Print a help message for a particular field.

Parameters:

name (str) – A field name.

classmethod var_loc(name)

Location where a particular variable is defined.

Parameters:

name (str) – A field name.

Returns:

The location (‘node’, ‘link’, etc.) where a variable is defined.

Return type:

str

var_mapping = (('fracture_at_node', 'node'),)
classmethod var_type(name)

Returns the dtype of a field (float, int, bool, str…).

Parameters:

name (str) – A field name.

Returns:

The dtype of the field.

Return type:

dtype

classmethod var_units(name)

Get the units of a particular field.

Parameters:

name (str) – A field name.

Returns:

Units for the given field.

Return type:

str