# Source code for landlab.components.nonlinear_diffusion.Perron_nl_diffuse

import numpy as np
import scipy.sparse as sparse
import scipy.sparse.linalg as linalg

from landlab import Component

# Things to add: 1. Explicit stability check.
# 2. Implicit handling of scenarios where kappa*dt exceeds critical step -
#    subdivide dt automatically.

[docs]class PerronNLDiffuse(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 :func:`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("topographic__elevation", at="node") >>> 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 References ---------- **Required Software Citation(s) Specific to this Component** None Listed **Additional References** Perron, J. (2011). Numerical methods for nonlinear hillslope transport laws. Journal of Geophysical Research 116(F2), 23 - 13. https://dx.doi.org/10.1029/2010jf001801 """ _name = "PerronNLDiffuse" _unit_agnostic = True _info = { "topographic__elevation": { "dtype": float, "intent": "inout", "optional": False, "units": "m", "mapping": "node", "doc": "Land surface topographic elevation", } }