PerronNLDiffuse
(*args, **kwds)[source]¶Bases: landlab.core.model_component.Component
This component implements 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()
.
Construction:
PerronNLDiffuse(grid, nonlinear_diffusivity=None, S_crit=33.*np.pi/180.,
rock_density=2700., sed_density=2700.)
Parameters:  grid : RasterModelGrid
nonlinear_diffusivity : float, array or field name
S_crit : float (radians)
rock_density : float (kg*m**3)
sed_density : float (kg*m**3)


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
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.