landlab.components.marine_sediment_transport.simple_submarine_diffuser¶
- class SimpleSubmarineDiffuser[source]¶
Bases:
LinearDiffuser
Transport marine sediment using a water-depth-dependent diffusion model.
This component models sediment transport as a diffusion process with a coefficient that depends on water depth \(h\) as follows:
\[D(h) = D_0 f_1(h) f_2(h)\]Here \(D_0\) is the maximum value, corresponding to the input parameter
shallow_water_diffusivity
.The function \(f_1(h)\) describes the decrease in transport efficiency below the wave base depth \(h_w\). It is defined as unity for depth above the wave base, and as
\[f_1(h) = \exp( -(h - h_w) / h_w)\]for \(h > h_w\).
The function \(f_2(h)\) handles the transition in transport efficiency around the shoreline. If
tidal_range
, \(R_t\), is zero, then \(f_2\) is set to unity underwater (\(h \ge 0\)), and a tiny value above water (not zero, because that would cause a divide-by-zero error in the base class). If \(R_t > 0\), then a \(tanh\) function is used to model a smooth decrease in \(D\) from the low to high tide level:\[f_2(h) = (\tanh ( -h / R_t) + 1) / 2\]with an addition tiny value added to locations above water to avoid division by zero.
Examples
>>> from landlab import RasterModelGrid >>> from landlab.components import SimpleSubmarineDiffuser >>> grid = RasterModelGrid((3, 7), xy_spacing=100.0) >>> grid.set_closed_boundaries_at_grid_edges(False, True, False, True) >>> topo = grid.add_zeros("topographic__elevation", at="node") >>> topo[:] = -10.0 >>> topo[9:14] = [0.0, 10.0, 10.0, 5.0, 5.0] >>> ssd = SimpleSubmarineDiffuser(grid, tidal_range=0.0) >>> ssd.run_one_step(dt=5.0) >>> topo[8:13] array([-9.5, 0. , 9.5, 10. , 5. ]) >>> grid.at_node["sediment_deposit__thickness"][8:13] array([ 0.5, 0. , -0.5, 0. , 0. ])
- Parameters:
grid (ModelGrid (RasterModelGrid, HexModelGrid, etc.)) – A landlab grid.
sea_level (float, optional) – The current sea level (m) (default 0)
wave_base (float, optional) – Wave base (m) (default 60)
shallow_water_diffusivity (float, optional) – Diffusivity coefficient for shallow water (m2 / y) (default 100)
tidal_range (float, optional) – Tidal range (m) (default 2)
- __init__(grid, sea_level=0.0, wave_base=60.0, shallow_water_diffusivity=100.0, tidal_range=2.0, **kwds)[source]¶
- Parameters:
grid (ModelGrid (RasterModelGrid, HexModelGrid, etc.)) – A landlab grid.
sea_level (float, optional) – The current sea level (m) (default 0)
wave_base (float, optional) – Wave base (m) (default 60)
shallow_water_diffusivity (float, optional) – Diffusivity coefficient for shallow water (m2 / y) (default 100)
tidal_range (float, optional) – Tidal range (m) (default 2)
- static __new__(cls, *args, **kwds)¶
- calc_diffusion_coef()[source]¶
Calculate and store diffusion coefficient values.
- Returns:
k – Diffusion coefficient, m2/y
- Return type:
float array
- 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 = (('sea_level__elevation', 'Sea level elevation'), ('sediment_deposit__thickness', 'Thickness of deposition or erosion in latest time step'), ('topographic__elevation', 'Land surface topographic elevation'), ('water__depth', 'depth of water under current sea level'))¶
- depth_function(water_depth)[source]¶
Return weighting factor for transport.
If there is no tidal range, then the weight factor is 1 if at or below sea level, and 0 if above it. If there is a tidal range, then a tanh function is used to weight transport across mean sea level, so that there is some degree of transport for water depths within the tidal range (less above, more below). The nature of the tanh function is such that the transport is about 95% of its maximum value at a depth of 1.5x the mean tidal range, and 5% of its maximum value at a height of 1.5x the mean tidal range above mean sea level.
- Parameters:
water_depth (float array) – Depth of water relative to mean sea level (m) (can be negative)
- Returns:
df – Weight factor ranging from 0 to 1.
- Return type:
float array
- property fixed_grad_anchors¶
Fixed gradient anchors.
- property fixed_grad_nodes¶
Fixed gradient nodes.
- property fixed_grad_offsets¶
Fixed gradient offsets.
- 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 = ('sea_level__elevation', 'topographic__elevation')¶
- name = 'SimpleSubmarineDiffuser'¶
- optional_var_names = ()¶
- output_var_names = ('sediment_deposit__thickness', 'topographic__elevation', 'water__depth')¶
- property sea_level¶
- property shallow_water_diffusivity¶
- property shape¶
Return the grid shape attached to the component, if defined.
- property time¶
- property time_step¶
Returns internal time-step size (as a property).
- unit_agnostic = True¶
- units = (('sea_level__elevation', 'm'), ('sediment_deposit__thickness', 'm'), ('topographic__elevation', 'm'), ('water__depth', 'm'))¶
- updated_boundary_conditions()¶
Call if grid BCs are updated after component instantiation.
Sets fixed_grad_nodes, fixed_grad_anchors, & fixed_grad_offsets, such that:
value[fixed_grad_nodes] = value[fixed_grad_anchors] + offset
Examples
>>> from landlab import RasterModelGrid >>> import numpy as np >>> mg = RasterModelGrid((4, 5)) >>> z = mg.add_zeros("topographic__elevation", at="node") >>> z[mg.core_nodes] = 1.0 >>> ld = LinearDiffuser(mg, linear_diffusivity=1.0) >>> ld.fixed_grad_nodes.size == 0 True >>> ld.fixed_grad_anchors.size == 0 True >>> ld.fixed_grad_offsets.size == 0 True >>> mg.at_link["topographic__slope"] = mg.calc_grad_at_link( ... "topographic__elevation" ... ) >>> mg.status_at_node[mg.perimeter_nodes] = mg.BC_NODE_IS_FIXED_GRADIENT >>> ld.updated_boundary_conditions() >>> ld.fixed_grad_nodes array([ 1, 2, 3, 5, 9, 10, 14, 16, 17, 18]) >>> ld.fixed_grad_anchors array([ 6, 7, 8, 6, 8, 11, 13, 11, 12, 13]) >>> ld.fixed_grad_offsets array([-1., -1., -1., -1., -1., -1., -1., -1., -1., -1.]) >>> np.allclose( ... z[ld.fixed_grad_nodes], z[ld.fixed_grad_anchors] + ld.fixed_grad_offsets ... ) True
- 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 = (('sea_level__elevation', 'grid'), ('sediment_deposit__thickness', 'node'), ('topographic__elevation', 'node'), ('water__depth', '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.
- property wave_base¶