Tips & Tricks

Codes and more that we use often

January 27, 2020 by

Soil Hydraulic Functions in Matlab

Water Retention Functions

The van Genuchten (1980) model is the most widely used water retention curve function:

\[\Theta = \left( 1 +(\alpha \psi)^n\right)^{-m}\]

where the effective saturation is defined as:

\[\Theta = \frac{(\theta - \theta_{r})}{ (\theta_{s} - \theta_{r})}\]

The hydraulic conductivity function is defined using Mualem Model.

The hydraulic capacity function.

The following function takes a scalr or vector of u as input: test

function [q,k,c] = Mualem_vanGenuchten(x,u,qr,por,a,n,ks)
mu = 0.5;
m  = 1-1/n;

UZ = u<0;

Q  = (1-UZ)*1   +   UZ .* ((1+(-a.*u).^n).^(-m));

q  = qr+(por-qr)*Q;
k  = ks*(Q.^mu).*(1-(1-Q.^(1/m)).^m).^2 ;
c  = (1-UZ)*0+ UZ.*(((por-qr)*n*m*a.*(-a.*u).^(n-1))./((1+(-a.*u).^n).^(m+1)));

end