1 function diffusivity = diffusivity_linear_gradient2(glob, params)
2 %
function diffusivity = diffusivity_linear_gradient2(glob, params)
4 %
function computing the diffusivity pointwise evaluation in the point
5 % sequences indicated by global coordinates in the columns of the matrix glob.
6 % It returns a gradient that increases linearly from model.diff_left to
7 % model.diff_right in X direction of the geometry.
9 % generated fields of diffusivity:
10 % epsilon: upper bound on diffusivity value
11 % K: vector with diffusivity values
15 if ~isempty(glob) && size(glob,1) < size(glob,2)
16 warning('coordinates in variable glob are given row-wise, but expected them to be column-wise');
22 decomp_mode = model.decomp_mode;
24 diffusivity.epsilon = 0;
26 temp_m = (model.diff_right-model.diff_left) / ...
27 (model.xrange(2) - model.xrange(1));
28 lin_grad = @(x) (x - model.xrange(1) );
31 elseif decomp_mode == 0
32 diffusivity.epsilon = max(model.diff_left, model.diff_right);
33 diffusivity.K = model.diff_left + (lin_grad(glob(:,1)) * temp_m);
34 elseif (decomp_mode == 1)
36 d.epsilon = max(model.diff_left, model.diff_right);
37 d.K = lin_grad(glob(:,1));
40 error(
'unknown decomp mode');