rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
diffusivity_exponential_derivative.m
1 function diffusivity = diffusivity_exponential_derivative(glob, U, params)
2 % function diffusivity = diffusivity_exponential_derivative(glob, U, params)
3 %
4 % function computing derivative of an exponential nonlinear diffusivity with
5 % respect to `u`. ``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().
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 if(params.diff_p < 1 && any(U<0))
32  error(['some values of U are too small for derivative for small', ...
33  'exponents. This leads to infinite values']);
34 end
35 diffusivity.K = params.diff_p * params.diff_m ...
36  * real(real(U) .^(params.diff_p - 1));
37 
38 diffusivity.epsilon = max(diffusivity.K);
39 
40 if params.debug
41  if ( params.diff_m ~= 0 && params.diff_p < 1 && min(U) - eps < 0 )
42  %(max(U)+eps > 1 || min(U) - eps < 0 ) )
43  error('U is outside admissable bounds [0,1]');
44  end
45  if ( max(abs(imag(U))) > 1e-6 )
46  error('U has non-trivial imaginary addend.')
47  end
48 end
49 
50 if params.decomp_mode>0
51  error('function is nonlinear and does not support affine decomposition!');
52 end
53