1 function diff = diffusivity_tensor_richards(glob,U,params,callerid)
2 %
function diffusivity = diffusivity_tensor_richards(glob,U,params,callerid)
4 %
function computing the diffucivity tensor of a diffusion problem
5 % by pointwise evaluation in the point sequences indicated by X and
8 % The callerid needs to be set in
case the diffusivity tensor is cached. It
10 % call. That allows correct hashing.
12 % generated fields of diffusivity:
13 % epsilon: upper bound on diffusivity value
14 % K : diffusivity tensor, i.e. a sparse square matrix of size
18 % Bernard Haasdonk 11.4.2006
20 % determine affine_decomposition_mode as integer
23 if ~isempty(glob) && size(glob,1) < size(glob,2)
24 warning('coordinates in variable glob are given row-wise, but expected them to be column-wise');
30 decomp_mode = params.decomp_mode;
31 % flag indicating whether the computation respected the decomposition
33 if decomp_mode~=0 && ~isempty(intersect(params.mu_names,'hill_height'))
34 error('affine decomposition not implemented!!');
41 % row1 = [res1{1}, res1{2}];
42 % row2 = [res2{1}, res2{2}];
44 % vlen = size(row1,1);
45 % temp0 = reshape([ sum(row1 .* row1, 2), sum(row2 .* row2, 2) ]
',2*vlen,1);
46 % tempm1 = reshape([ sum(row2 .* row1, 2), zeros(vlen,1) ]', 2*vlen, 1);
47 % tempp1 = reshape([ zeros(vlen,1), sum(row1 .* row2, 2) ]
', 2*vlen, 1);
48 % temp1 = [ sum(row1 .* row1, 2), sum(row1 .* row2, 2) ];
49 % temp2 = [ sum(row2 .* row1, 2), sum(row2 .* row2, 2) ];
50 % tempD = spdiags([tempm1,temp0,tempp1],-1:1,2*vlen,2*vlen);
51 tempD = real(diffusivity_cached(glob,params,callerid));
53 % min(min(abs(atemp1 - temp1) < 1e-16))
54 % min(min(abs(atemp2 - temp2) < 1e-14))
57 % d.K1 = repmat(diff_k.K,1,2) .* temp1;
58 % d.K2 = repmat(diff_k.K,1,2) .* temp2;
61 % d.K = diff_k.K * tempD;
64 % d.K1 = params.k * temp1;
65 % d.K2 = params.k * temp2;
67 d.epsilon = max(max(d.K));
function [ P1res , P2res ] = inv_geo_trans_derivative(model, glob, P1derivates, P2derivates, callerid)
computes entries of a geometry transformation function's inverse transposed jacobian ...