# OverlandFlow: Model shallow water flow over topography using the numerical approximation of de Almeida¶

Landlab component that simulates overland flow.

This component simulates overland flow using the 2-D numerical model of shallow-water flow over topography using the de Almeida et al., 2012 algorithm for storage-cell inundation modeling.

## Examples¶

>>> import numpy as np
>>> from landlab import RasterModelGrid
>>> from landlab.components.overland_flow import OverlandFlow


Create a grid on which to calculate overland flow.

>>> grid = RasterModelGrid((4, 5))


The grid will need some data to provide the overland flow component. To check the names of the fields that provide input to the overland flow component use the input_var_names class property.

>>> OverlandFlow.input_var_names
('surface_water__depth', 'topographic__elevation')


Create fields of data for each of these input variables.

>>> grid.at_node['topographic__elevation'] = np.array([
...     0., 0., 0., 0., 0.,
...     1., 1., 1., 1., 1.,
...     2., 2., 2., 2., 2.,
...     3., 3., 3., 3., 3.])
>>> grid.at_node['surface_water__depth'] = np.array([
...     0. , 0. , 0. , 0. , 0. ,
...     0. , 0. , 0. , 0. , 0. ,
...     0. , 0. , 0. , 0. , 0. ,
...     0.1, 0.1, 0.1, 0.1, 0.1])


Instantiate the OverlandFlow component to work on this grid, and run it.

>>> of = OverlandFlow(grid, steep_slopes=True)
>>> of.run_one_step()


After calculating the overland flow, new fields have been added to the grid. Use the output_var_names property to see the names of the fields that have been changed.

>>> of.output_var_names


The surface_water__depth field is defined at nodes.

>>> of.var_loc('surface_water__depth')
'node'
>>> grid.at_node['surface_water__depth']
array([  1.00000000e-05,   1.00000000e-05,   1.00000000e-05,
1.00000000e-05,   1.00000000e-05,   1.00000000e-05,
1.00000000e-05,   1.00000000e-05,   1.00000000e-05,
1.00000000e-05,   1.00000000e-05,   2.00100000e-02,
2.00100000e-02,   2.00100000e-02,   1.00000000e-05,
1.00010000e-01,   1.00010000e-01,   1.00010000e-01,
1.00010000e-01,   1.00010000e-01])


The surface_water__discharge field is defined at links. Because our initial topography was a dipping plane, there is no water discharge in the horizontal direction, only toward the bottom of the grid.

>>> of.var_loc('surface_water__discharge')
True
True


>>> of.var_loc('water_surface__gradient')
array([ 0. ,  0. ,  0. ,  0. ,
0. ,  1. ,  1. ,  1. ,  0. ,
0. ,  0. ,  0. ,  0. ,
0. ,  1. ,  1. ,  1. ,  0. ,
0. ,  0. ,  0. ,  0. ,
0. ,  1.1,  1.1,  1.1,  0. ,
0. ,  0. ,  0. ,  0. ])

class OverlandFlow(self, grid, default_fixed_links=False, h_init=1e-05, alpha=0.7, mannings_n=0.03, g=9.81, theta=0.8, rainfall_intensity=0.0, steep_slopes=False, **kwds)[source]

Simulate overland flow using de Almeida approximations.

Landlab component that simulates overland flow using the de Almeida et al., 2012 approximations of the 1D shallow water equations to be used for 2D flood inundation modeling.

This component calculates discharge, depth and shear stress after some precipitation event across any raster grid. Default input file is named “overland_flow_input.txt’ and is contained in the landlab.components.overland_flow folder.

The primary method of this class is run_one_step().

Create an overland flow component.

Parameters: grid : RasterModelGrid A landlab grid. h_init : float, optional Thicknes of initial thin layer of water to prevent divide by zero errors (m). alpha : float, optional Time step coeffcient, described in Bates et al., 2010 and de Almeida et al., 2012. mannings_n : float, optional Manning’s roughness coefficient. g : float, optional Acceleration due to gravity (m/s^2). theta : float, optional Weighting factor from de Almeida et al., 2012. rainfall_intensity : float, optional Rainfall intensity.
calc_time_step()[source]

Calculate time step.

Adaptive time stepper from Bates et al., 2010 and de Almeida et al., 2012

discharge_mapper(input_discharge, convert_to_volume=False)[source]

Maps discharge value from links onto nodes.

This method takes the discharge values on links and determines the links that are flowing INTO a given node. The fluxes moving INTO a given node are summed.

This method ignores all flow moving OUT of a given node.

This takes values from the OverlandFlow component (by default) in units of [L^2/T]. If the convert_to_cms flag is raised as True, this method converts discharge to units [L^3/T] - as of Aug 2016, only operates for square RasterModelGrid instances.

The output array is of length grid.number_of_nodes and can be used with the Landlab imshow_grid plotter.

Returns a numpy array (discharge_vals)

overland_flow(dt=None)[source]

Generate overland flow across a grid.

For one time step, this generates ‘overland flow’ across a given grid by calculating discharge at each node.

Using the depth slope product, shear stress is calculated at every node.

Outputs water depth, discharge and shear stress values through time at every point in the input grid.

run_one_step(dt=None)[source]

Generate overland flow across a grid.

For one time step, this generates ‘overland flow’ across a given grid by calculating discharge at each node.

Using the depth slope product, shear stress is calculated at every node.

Outputs water depth, discharge and shear stress values through time at every point in the input grid.

set_up_neighbor_arrays()[source]

Create and initialize link neighbor arrays.

Set up arrays of neighboring horizontal and vertical links that are needed for the de Almeida solution.

Specialized link ID function used to ID the active links that neighbor fixed links in the vertical and horizontal directions.

If the user wants to assign fixed gradients or values to the fixed links dynamically, this function identifies the nearest active_link neighbor.

Each fixed link can either have 0 or 1 active neighbor. This function finds if and where that active neighbor is and stores those IDs in an array.

Parameters: grid : RasterModelGrid A landlab grid. ndarray of int, shape (*, ) Flat array of links.

Examples

>>> from landlab.grid.structured_quad.links import neighbors_at_link
>>> from landlab import RasterModelGrid

>>> from landlab import RasterModelGrid, FIXED_GRADIENT_BOUNDARY

>>> grid = RasterModelGrid((4, 5))
>>> grid.status_at_node
array([2, 2, 2, 2, 2,
2, 0, 0, 0, 1,
2, 0, 0, 0, 1,
2, 1, 1, 1, 1], dtype=uint8)

>>> grid.fixed_links
array([ 5,  6,  7,  9, 18])
array([10, 11, 12, 14, 15, 16, 19, 20, 21, 23, 24, 25])

>>> find_active_neighbors_for_fixed_links(grid)
array([14, 15, 16, 10, 19])

>>> rmg = RasterModelGrid((4, 7))

>>> rmg.at_node['topographic__elevation'] = rmg.zeros(at='node')

>>> rmg.set_fixed_link_boundaries_at_grid_edges(True, True, True, True)
array([20, 21, 22, 23, 24, 14, 17, 27, 30, 20, 21, 22, 23, 24])


# OverlandFlowBates: Model shallow water flow over topography using the numerical approximation of Bates¶

generate_overland_flow.py

This component simulates overland flow using the 2-D numerical model of shallow-water flow over topography using the Bates et al. (2010) algorithm for storage-cell inundation modeling.

Written by Jordan Adams, based on code written by Greg Tucker.

Last updated: April 21, 2016

class OverlandFlowBates(grid, h_init=1e-05, alpha=0.7, mannings_n=0.03, g=9.81, rainfall_intensity=0.0, **kwds)[source]

Simulate overland flow using Bates et al. (2010).

Landlab component that simulates overland flow using the Bates et al., (2010) approximations of the 1D shallow water equations to be used for 2D flood inundation modeling.

This component calculates discharge, depth and shear stress after some precipitation event across any raster grid. Default input file is named “overland_flow_input.txt’ and is contained in the landlab.components.overland_flow folder.

Parameters: grid : RasterGridModel A grid. input_file : str Contains necessary and optional inputs. If not given, default input file is used. Manning’s n is required. Storm duration is needed if rainfall_duration is not passed in the initialization Rainfall intensity is needed if rainfall_intensity is not passed in the initialization Model run time can be provided in initialization. If not it is set to the storm duration h_init : float, optional Some initial depth in the channels. Default = 0.001 m g : float, optional Gravitational acceleration, $$m / s^2$$ alpha : float, optional Non-dimensional time step factor from Bates et al., (2010) rho : integer, optional Density of water, $$kg / m^3$$ ten_thirds : float, optional Precalculated value of $$10 / 3$$ which is used in the implicit shallow water equation.

Examples

>>> DEM_name = 'DEM_name.asc'

calc_time_step()[source]
overland_flow(dt=None, **kwds)[source]