PerronNLDiffuse
(self, grid, nonlinear_diffusivity=None, S_crit=0.5759586531581288, rock_density=2700.0, sed_density=2700.0, **kwds)[source]¶Bases: landlab.core.model_component.Component
Nonlinear diffusion, following Perron (2011).
This module uses Taylor Perron’s implicit (2011) method to solve the nonlinear hillslope diffusion equation across a rectangular, regular grid for a single timestep. Note it works with the mass flux implicitly, and thus does not actually calculate it. Grid must be at least 5x5.
Boundary condition handling assumes each edge uses the same BC for each of its nodes. This component cannot yet handle looped boundary conditions, but all others should be fine.
This component has KNOWN STABILITY ISSUES which will be resolved in a future release; use at your own risk.
The primary method of this class is run_one_step
.
Examples
>>> from landlab.components import PerronNLDiffuse
>>> from landlab import RasterModelGrid
>>> import numpy as np
>>> mg = RasterModelGrid((5, 5))
>>> z = mg.add_zeros('node', 'topographic__elevation')
>>> nl = PerronNLDiffuse(mg, nonlinear_diffusivity=1.)
>>> dt = 100.
>>> nt = 20
>>> uplift_rate = 0.001
>>> for i in range(nt):
... z[mg.core_nodes] += uplift_rate*dt
... nl.run_one_step(dt)
>>> z_target = np.array(
... [ 0. , 0. , 0. , 0. , 0. ,
... 0. , 0.00778637, 0.0075553 , 0.00778637, 0. ,
... 0. , 0.0075553 , 0.0078053 , 0.0075553 , 0. ,
... 0. , 0.00778637, 0.0075553 , 0.00778637, 0. ,
... 0. , 0. , 0. , 0. , 0. ])
>>> np.allclose(z, z_target)
True
grid (RasterModelGrid) – A Landlab raster grid
nonlinear_diffusivity (float, array or field name) – The nonlinear diffusivity
S_crit (float (radians)) – The critical hillslope angle
rock_density (float (kg*m**-3)) – The density of intact rock
sed_density (float (kg*m**-3)) – The density of the mobile (sediment) layer
diffuse
(grid_in, elapsed_time, num_uplift_implicit_comps=1)[source]¶This is the “old style” run method of the class, superceded by
run_one_step
.
Takes grid_in, the model grid, and elapsed_time, the
total model time elapsed so far.
grid_in must contain the field to diffuse, which defaults to ‘topographic__elevation’. This can be overridden with the values_to_diffuse property in the input file.
See the class docstring for a list of the other properties necessary in the input file for this component to run.
Note that the implicit nature of this component requires it to incorporate uplift into its execution in order to stay stable. If you only have one module that requires this, do not add uplift manually in your loop; this method will include uplift automatically.
If more than one of your components has this requirement, set num_uplift_implicit_comps to the total number of components that do.
input_timestep
(timestep_in)[source]¶Allows the user to set a dynamic (evolving) timestep manually as part of a run loop.