## Finite Difference solution to nonlinear diffusion equation

Version 1.1.0.0 (196 KB) by
Numerical solution to nonlinear diffusion equation and creates movie of results

Updated 18 Jun 2015

Solves nonlinear diffusion equation which can be linearised as shown for the general nonlinear diffusion equation in Richtmyer & Morton . The approach is to linearise the pde and apply a Crank-Nicolson implicit finite difference scheme to solve the equation numerically.
Matlab run command
--------------------------

type:
IsoFreeSurfaceSolver

solves the pde:
-------------------

\frac{\partial h}{\partial t}=\frac{1}{12}\frac{\partial^2 h^4}{\partial x^2}

The pde has the application to isothermal viscous fluid flow spreading on a horizonatal substrate under gravity - Huppert . Note that PDE has been nondimensionlised.

Initial conditions:

t=0: h = (1 - x^2)_{+} + 10^-6 (has prewetting film)

The spatial domain is discretised taking account of symmetry at x = 0:

\frac{\partial h}{\partial x} = 0

and is also used to close the free surface model at the end of the discretised domain (x = xend) - assumes fluid won't reach this boundary.

The pde can be solved analytically using similarity equations as discussed by Barenblatt ; used below to validate numerical solution.

References
--------------

 "Difference Methods for initial value problems," R. D. Richtmyer and K. W. Morton, John Wiley and Sons, 1967.

 "The Propagation of two-dimensional and axisymmetric visous gravity currents over a rigid horizontal surface," H. E. Huppert, Journal of Fluid Mechanics, 1982.

 "On some unsteady motions of a liquid or gas in a porous medium, Russian journal Prikladnaya Matematika i Mekhanika, 1952.

### Cite As

Ahmos Sansom (2023). Finite Difference solution to nonlinear diffusion equation (https://www.mathworks.com/matlabcentral/fileexchange/27890-finite-difference-solution-to-nonlinear-diffusion-equation), MATLAB Central File Exchange. Retrieved .

##### MATLAB Release Compatibility
Created with R2015a
Compatible with any release
##### Platform Compatibility
Windows macOS Linux