rbmatlab  1.13.10
 All Classes Namespaces Files Functions Variables Groups Pages
diffusivity_exponential.m
1 function diffusivity = diffusivity_exponential(glob, U, params)
2 % function diffusivity = diffusivity_exponential(glob, U, params)
3 %
4 % function computing an exponential nonlinear diffusivity
5 % ``k(x,u) = k_0 + m u^p ``.
6 %
7 % parameters:
8 % U : solution at points in 'glob'
9 %
10 % required fields of params:
11 % diff_k0 : constant part `k_0 \in [0.1,0.5]`
12 % diff_m : steepness factor of curve `m \in [0, 0.5]`.
13 % diff_p : exponent `p \in [1/100, 100]`
14 %
15 % See also diffusivity_exponential_derivative().
16 %
17 % generated fields of diffusivity:
18 % epsilon: upper bound on diffusivity value
19 % K: vector with diffusivity values
20 
21 % glob column check
22 if params.debug
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');
25  if params.debug > 2
26  keyboard;
27  end
28  end
29 end
30 
31 diffusivity.K = params.diff_k0;
32 if params.diff_m ~= 0
33  diffusivity.K = diffusivity.K + params.diff_m * real(real(U).^params.diff_p);
34 end
35 
36 diffusivity.epsilon = max(diffusivity.K);
37 
38 if params.debug
39  if ( params.diff_m ~= 0 && params.diff_p < 1 && min(U) - eps < 0 )
40  %(max(U)+eps > 1 || min(U) - eps < 0 ) )
41  error('U is outside admissable bounds (>0)');
42  end
43  if ( max(abs(imag(U))) > 1e-6 )
44  error('U has non-trivial imaginary addend.')
45  end
46 end
47 
48 if params.decomp_mode>0
49  error('function is nonlinear and does not support affine decomposition!');
50 end
51