1 function diffusivity = diffusivity_richards_nonlinear(glob, ~, params)
2 %
function diffusivity = diffusivity_richards_nonlinear(glob, U, params)
4 %
function computing the nonlinear diffusivity tensor of a richards problem by
5 % pointwise evaluation in the point sequences indicated by global coordinates
6 % in the columns of the matrix glob.
7 % It returns a gradient tensor
for the Richards equation.
9 % required fields of params:
10 % k : scalar scaling factor
for diffusivity
11 % gravity : scalar modelling the physical gravity
12 % richards_perm_ptr :
function pointer
for permeability
function
13 % richards_retention_ptr :
function pointer evaluating the retention curve
14 % U : DoF vector of discrete solution
16 % generated fields of diffusivity:
17 % epsilon: upper bound on diffusivity value
18 % K: vector with diffusivity values
22 if ~isempty(glob) && size(glob,1) < size(glob,2)
23 warning('coordinates in variable glob are given row-wise, but expected them to be column-wise');
33 p_mu = spline_select(params);
34 U = U - params.gravity * Y.*(1+ppval(p_mu, X));
35 Kaval = params.k * real(params.richards_perm_ptr(U)) .* real(params.richards_retention_ptr(U));
36 diffusivity.K = Kaval;
37 diffusivity.epsilon = max(Kaval);
38 % Utemp = U' * params.k + 0.0004;
39 % diffusivity.K = spdiags(reshape([Utemp;zeros(1,vlen)],2*vlen,1),0,2*vlen,2*vlen);
40 % diffusivity.epsilon = max(Utemp);
42 decomp_mode = params.decomp_mode;
43 if decomp_mode>0 && respected_decomp_mode==0
44 error('function is nonlinear and does not support affine decomposition!');