landlab.components.network_sediment_transporter.bed_parcel_initializers¶
Landlab components to initialize river bed sediment “parcels”, represented as
items in a landlab DataRecord
, in each link in a river network (represented
by a landlab NetworkModelGrid
). The different BedParcelInitializers allow
the user to define the median grain size on a given link several different ways.
Code author: Eric Hutton, Allison Pfeiffer, Muneer Ahammad, and Jon Czuba
- class BedParcelInitializerArea[source]¶
Bases:
BedParcelInitializerBase
Create a landlab
DataRecord
to represent parcels of sediment on a river network.The function takes a coefficient and exponent in a grain size-drainage area power law scaling relationship, as well as channel attribute (drainage_area, channel_width, reach_length, channel_slope) fields attached to the
NetworkModelGrid
.This function currently estimates median parcel grain size at a link using a power-law scaling relationship between drainage area and median grain size (\(d_{50} = c A^n\)), assuming a lognormal parcel grain size distribution.
Code author: Eric Hutton, Allison Pfeiffer, Muneer Ahammad
- Parameters:
grid (ModelGrid) – landlab
ModelGrid
to place sediment parcels on.time (float, optional) – The initial time to add to the record.
drainage_area_coefficient (float, optional) – Coefficient in a power law grain size-drainage area scaling relationship.
drainage_area_exponent (float, optional) – Exponent in a power law grain size-drainage area scaling relationship.
rho_sediment (float, optional) – Sediment grain density [kg / m^3].
rho_water (float, optional) – Density of water [kg / m^3].
gravity (float, optional) – Acceleration due to gravity [m / s^2].
D84_D50 (float, optional) – Ratio of D84:D50, used to set lognormal distribution of grain size.
sed_thickness (float, optional) – Sediment thickness in multiples of d84.
abrasion_rate (float, optional) – Abrasion rate of parcels during transport [1 / m].
median_number_of_starting_parcels (int, optional) – Median number of parcels in a link.
extra_parcel_attributes (str or list of str, optional) – Name of user-defined parcel attribute to be added to parcel data record, which will be returned as an empty parcel attribute.
Examples
>>> from landlab import NetworkModelGrid >>> from landlab.components.network_sediment_transporter import ( ... BedParcelInitializerArea, ... )
>>> y_of_node = (0, 100, 200, 200, 300, 400, 400, 125) >>> x_of_node = (0, 0, 100, -50, -100, 50, -150, -100) >>> nodes_at_link = ((1, 0), (2, 1), (1, 7), (3, 1), (3, 4), (4, 5), (4, 6))
>>> grid = NetworkModelGrid((y_of_node, x_of_node), nodes_at_link)
>>> _ = grid.add_full("channel_width", 1.0, at="link") # m >>> _ = grid.add_full("channel_slope", 0.01, at="link") # m / m >>> _ = grid.add_full("reach_length", 100.0, at="link") # m >>> _ = grid.add_full("drainage_area", 100.0, at="link")
>>> initialize_parcels = BedParcelInitializerArea( ... grid, drainage_area_coefficient=0.1, drainage_area_exponent=0.3 ... ) >>> parcels = initialize_parcels()
- __init__(grid, time=0.0, drainage_area_coefficient=None, drainage_area_exponent=None, **kwds)[source]¶
- 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 = (('drainage_area_coefficient', 'Coefficient in a power law grain size-drainage area scaling relationship'), ('drainage_area_exponent', 'Exponent in a power law grain size-drainage area scaling relationship.'), ('time', 'The initial time to add to the record'))¶
- classmethod from_path(grid, path)¶
Create a component from an input file.
- 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 = ('drainage_area_coefficient', 'drainage_area_exponent')¶
- name = 'BedParcelInitializerArea'¶
- optional_var_names = ('time',)¶
- output_var_names = ()¶
- property shape¶
Return the grid shape attached to the component, if defined.
- unit_agnostic = False¶
- units = (('drainage_area_coefficient', '--'), ('drainage_area_exponent', '--'), ('time', 's'))¶
- 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.
- var_mapping = (('drainage_area_coefficient', 'link'), ('drainage_area_exponent', 'link'), ('time', 'link'))¶
- class BedParcelInitializerBase[source]¶
Bases:
Component
- __init__(grid, time=0.0, tau_c_50=0.04, rho_sediment=2650.0, rho_water=1000.0, gravity=scipy.constants.g, D84_D50=2.1, sed_thickness=2, abrasion_rate=0.0, median_number_of_starting_parcels=100, extra_parcel_attributes=None, rng=None)[source]¶
- 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 = ()¶
- classmethod from_path(grid, path)¶
Create a component from an input file.
- 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 = ()¶
- name = None¶
- optional_var_names = ()¶
- output_var_names = ()¶
- property shape¶
Return the grid shape attached to the component, if defined.
- unit_agnostic = None¶
- units = ()¶
- 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.
- var_mapping = ()¶
- class BedParcelInitializerDepth[source]¶
Bases:
BedParcelInitializerBase
Create a landlab
DataRecord
to represent parcels of sediment on a river network.The function takes dominant flow depth for each link as input, as well as channel geometry (channel_width, reach_length, channel_slope) fields attached to the
NetworkModelGrid
.This function currently estimates median parcel grain size at a link using the formative Shields stress (as in Pfeiffer et al., 2017), assuming a lognormal parcel grain size distribution.
Code author: Eric Hutton, Allison Pfeiffer, Muneer Ahammad
- Parameters:
grid (ModelGrid) – landlab
ModelGrid
to place sediment parcels on.time (float, optional) – The initial time to add to the record.
flow_depth_at_link (float, optional) – Dominant/formative flow depth at each link in the network.
tau_c_multiplier (float, optional) – Coefficient to relate critical and dominant/bankfull/formative Shields stress. Dominant/formative/bankfull Shields stress is calculated as
multiplier * critical
.tau_c_50 (float, optional) – Critical Shields stress for d50 at dominant discharge for all links, used to calculate median parcel grain size
rho_sediment (float, optional) – Sediment grain density [kg / m^3].
rho_water (float, optional) – Density of water [kg / m^3].
gravity (float, optional) – Acceleration due to gravity [m / s^2].
D84_D50 (float, optional) – Ratio of D84:D50, used to set lognormal distribution of grain size.
sed_thickness (float, optional) – Sediment thickness in multiples of d84.
abrasion_rate (float, optional) – Abrasion rate of parcels during transport [1 / m].
median_number_of_starting_parcels (int, optional) – Median number of parcels in a link.
extra_parcel_attributes (str or list of str, optional) – Name of user-defined parcel attribute to be added to parcel data record, which will be returned as an empty parcel attribute.
Examples
>>> from landlab import NetworkModelGrid >>> from landlab.components.network_sediment_transporter import ( ... BedParcelInitializerDepth, ... )
>>> y_of_node = (0, 100, 200, 200, 300, 400, 400, 125) >>> x_of_node = (0, 0, 100, -50, -100, 50, -150, -100) >>> nodes_at_link = ((1, 0), (2, 1), (1, 7), (3, 1), (3, 4), (4, 5), (4, 6)) >>> grid = NetworkModelGrid((y_of_node, x_of_node), nodes_at_link) >>> _ = grid.add_full("channel_width", 1.0, at="link") # m >>> _ = grid.add_full("channel_slope", 0.01, at="link") # m / m >>> _ = grid.add_full("reach_length", 100.0, at="link") # m
>>> depth = np.full(grid.number_of_links, 1.0) # m >>> initialize_parcels = BedParcelInitializerDepth(grid, flow_depth_at_link=depth) >>> parcels = initialize_parcels()
- 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 = (('flow_depth_at_link', 'Dominant/formative flow depth at each link in the network'),)¶
- classmethod from_path(grid, path)¶
Create a component from an input file.
- 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 = ('flow_depth_at_link',)¶
- name = 'BedParcelInitializerDepth'¶
- optional_var_names = ()¶
- output_var_names = ()¶
- property shape¶
Return the grid shape attached to the component, if defined.
- unit_agnostic = False¶
- units = (('flow_depth_at_link', 'm'),)¶
- 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.
- var_mapping = (('flow_depth_at_link', 'link'),)¶
- class BedParcelInitializerDischarge[source]¶
Bases:
BedParcelInitializerBase
Create a landlab
DataRecord
to represent parcels of sediment on a river network.The function takes discharge data for each link as input, as well as channel geometry (
channel_width
,reach_length
,channel_slope
) fields attached to theNetworkModelGrid
.This function currently estimates median parcel grain size at a link according to Snyder et al. (2013), assuming a lognormal parcel grain size distribution.
Code author: Eric Hutton, Allison Pfeiffer, Muneer Ahammad
- Parameters:
grid (NetworkModelGrid) – landlab
NetworkModelGrid
to place sediment parcels on.time (float, optional) – The initial time to add to the record.
discharge_at_link (float) – Dominant/formative discharge at each link in the network [m^3 / s].
mannings_n (float, optional) – Manning’s n value for all links, used to calculate median parcel grain size at a link.
tau_c_50 (float, optional) – Critical Shields stress for d50 at dominant discharge for all links, used to calculate median parcel grain size.
rho_sediment (float, optional) – Sediment grain density [kg / m^3].
rho_water (float, optional) – Density of water [kg / m^3].
gravity (float, optional) – Acceleration due to gravity [m / s^2].
D84_D50 (float, optional) – Ratio of D84:D50, used to set lognormal distribution of grain size.
sed_thickness (float, optional) – Sediment thickness in multiples of d84.
abrasion_rate (float, optional) – Abrasion rate of parcels during transport [1/m].
median_number_of_starting_parcels (int, optional) – Median number of parcels in a link.
extra_parcel_attributes (str or list of str, optional) – Name of user-defined parcel attribute to be added to parcel data record, which will be returned as an empty parcel attribute.
Examples
>>> from landlab import NetworkModelGrid >>> from landlab.components.network_sediment_transporter import ( ... BedParcelInitializerDischarge, ... )
>>> y_of_node = (0, 100, 200, 200, 300, 400, 400, 125) >>> x_of_node = (0, 0, 100, -50, -100, 50, -150, -100) >>> nodes_at_link = ((1, 0), (2, 1), (1, 7), (3, 1), (3, 4), (4, 5), (4, 6))
>>> grid = NetworkModelGrid((y_of_node, x_of_node), nodes_at_link)
>>> _ = grid.add_full("channel_width", 1.0, at="link") # m >>> _ = grid.add_full("channel_slope", 0.01, at="link") # m / m >>> _ = grid.add_full("reach_length", 100.0, at="link") # m
>>> discharge = np.full(grid.number_of_links, 10.0) # m^3 / s >>> initialize_parcels = BedParcelInitializerDischarge( ... grid, discharge_at_link=discharge ... ) >>> parcels = initialize_parcels()
- 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 = (('discharge_at_link', 'Dominant/formative discharge at each link in the network'),)¶
- classmethod from_path(grid, path)¶
Create a component from an input file.
- 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 = ('discharge_at_link',)¶
- name = 'BedParcelInitializerDischarge'¶
- optional_var_names = ()¶
- output_var_names = ()¶
- property shape¶
Return the grid shape attached to the component, if defined.
- unit_agnostic = False¶
- units = (('discharge_at_link', 'm^3 / s'),)¶
- 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.
- var_mapping = (('discharge_at_link', 'link'),)¶
- class BedParcelInitializerUserD50[source]¶
Bases:
BedParcelInitializerBase
Create a landlab
DataRecord
to represent parcels of sediment on a river network.The function takes either a scalar value or an array (of of length, number_of_links) to assign the median grain size for parcels on each link in the network grid.
This function creates a lognormal grain size distribution for the parcels in the link.
Code author: Eric Hutton, Allison Pfeiffer, Muneer Ahammad
- Parameters:
grid (ModelGrid) – landlab
ModelGrid
to place sediment parcels on.time (float, optional) – The initial time to add to the record.
user_d50 (float, optional) – Either an array of d50 (of length number_of_links) or a scalar to be applied to all links in the network.
rho_sediment (float, optional) – Sediment grain density [kg / m^3].
rho_water (float, optional) – Density of water [kg / m^3].
gravity (float, optional) – Acceleration due to gravity [m / s^2].
D84_D50 (float, optional) – Ratio of D84:D50, used to set lognormal distribution of grain size.
sed_thickness (float, optional) – Sediment thickness in multiples of d84.
abrasion_rate (float, optional) – Abrasion rate of parcels during transport [1 / m].
median_number_of_starting_parcels (int, optional) – Median number of parcels in a link.
extra_parcel_attributes (str or list of str, optional) – Name of user-defined parcel attribute to be added to parcel data record, which will be returned as an empty parcel attribute.
Examples
>>> from landlab import NetworkModelGrid >>> from landlab.components.network_sediment_transporter import ( ... BedParcelInitializerUserD50, ... )
>>> y_of_node = (0, 100, 200, 200, 300, 400, 400, 125) >>> x_of_node = (0, 0, 100, -50, -100, 50, -150, -100) >>> nodes_at_link = ((1, 0), (2, 1), (1, 7), (3, 1), (3, 4), (4, 5), (4, 6))
>>> grid = NetworkModelGrid((y_of_node, x_of_node), nodes_at_link)
>>> _ = grid.add_full("channel_width", 1.0, at="link") # m >>> _ = grid.add_full("channel_slope", 0.01, at="link") # m / m >>> _ = grid.add_full("reach_length", 100.0, at="link") # m
>>> initialize_parcels = BedParcelInitializerUserD50(grid, user_d50=0.05) >>> parcels = initialize_parcels()
- 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 = (('time', 'The initial time to add to the record'), ('user_d50', 'Median grain size of the bed sediment in each link'))¶
- classmethod from_path(grid, path)¶
Create a component from an input file.
- 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 = ('user_d50',)¶
- name = 'BedParcelInitializerUserD50'¶
- optional_var_names = ('time',)¶
- output_var_names = ()¶
- property shape¶
Return the grid shape attached to the component, if defined.
- unit_agnostic = False¶
- units = (('time', 's'), ('user_d50', 'm'))¶
- 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.
- var_mapping = (('time', 'link'), ('user_d50', 'link'))¶
- calc_d50_dArea_scaling(drainage_area, a, n)[source]¶
Calculate median grain size via power law scaling relationship with drainage area.
- Returns:
d50.
- Return type:
ndarray of float
Examples
>>> from numpy.testing import assert_almost_equal
>>> drainage_area = 10 >>> drainage_area_coefficient = 1 >>> drainage_area_exponent = -0.1
>>> expected_value = drainage_area_coefficient * ( ... drainage_area**drainage_area_exponent ... ) >>> print(np.round(expected_value, decimals=3)) 0.794 >>> assert_almost_equal(calc_d50_dArea_scaling(10, 1, -0.1), expected_value)
- calc_d50_depth(slope, flow_depth, tau_c_multiplier, rho_water, rho_sediment, tau_c_50)[source]¶
Calculate median grain size via dominant flow depth according to Pfeiffer et al. (2017).
- Returns:
d50.
- Return type:
ndarray of float
Examples
>>> from numpy.testing import assert_almost_equal
>>> slope = 0.01 >>> depth = 1 >>> tau_c_multiplier = 1 >>> rho_w = 1000 >>> rho_s = 3000 >>> tau_c_50 = 0.05
>>> expected_value = (rho_w * depth * slope) / ( ... (rho_s - rho_w) * tau_c_50 * tau_c_multiplier ... ) >>> print(np.round(expected_value, decimals=3)) 0.1 >>> assert_almost_equal( ... calc_d50_depth(0.01, 1, 1, 1000, 3000, 0.05), expected_value ... )
- calc_d50_discharge(width, slope, discharge, mannings_n, gravity, rho_water, rho_sediment, tau_c_50)[source]¶
Calculate median grain size via dominant discharge and channel width according to Snyder et al. (2013)
- Returns:
d50.
- Return type:
ndarray of float
Examples
>>> from numpy.testing import assert_almost_equal
>>> w = 20 >>> S = 0.01 >>> Q = 100 >>> n = 0.05 >>> g = 9.81 >>> rho_w = 1000 >>> rho_s = 3000 >>> tau_c_50 = 0.05
>>> expected_value = ( ... rho_w * g * n ** (3 / 5) * Q ** (3 / 5) * w ** (-3 / 5) * S ** (7 / 10) ... ) / ((rho_s - rho_w) * g * tau_c_50) >>> print(np.round(expected_value, decimals=3)) 0.173 >>> assert_almost_equal( ... calc_d50_discharge(20, 0.01, 100, 0.05, 9.81, 1000, 3000, 0.05), ... expected_value, ... )