rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
diffusivity_linear_gradient2.m
1 function diffusivity = diffusivity_linear_gradient2(glob, params)
2 % function diffusivity = diffusivity_linear_gradient2(glob, params)
3 %
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.
8 %
9 % generated fields of diffusivity:
10 % epsilon: upper bound on diffusivity value
11 % K: vector with diffusivity values
12 
13 % glob column check
14 if params.debug
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');
17  if params.debug > 2
18  keyboard;
19  end
20  end
21 end
22 decomp_mode = model.decomp_mode;
23 diffusivity = [];
24 diffusivity.epsilon = 0;
25 
26 temp_m = (model.diff_right-model.diff_left) / ...
27  (model.xrange(2) - model.xrange(1));
28 lin_grad = @(x) (x - model.xrange(1) );
29 if decomp_mode == 2
30  diffusivity = temp_m;
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)
35  d = [];
36  d.epsilon = max(model.diff_left, model.diff_right);
37  d.K = lin_grad(glob(:,1));
38  diffusivity = {d};
39 else
40  error('unknown decomp mode');
41 end
42 %| \docupdate