rbmatlab 0.10.01
datafunc/diffusivity/diffusivity_exponential.m
00001 function diffusivity = diffusivity_exponential(glob, U, params)
00002 % function diffusivity = diffusivity_exponential(glob, U, params)
00003 %
00004 % function computing an exponential nonlinear diffusivity
00005 % ``k(x,u) = k_0 + m u^p ``.
00006 %
00007 % parameters:
00008 %      U                      : solution at points in 'glob'
00009 %
00010 % required fields of params:
00011 %      diff_k0                : constant part `k_0 \in [0.1,0.5]`
00012 %      diff_m                 : steepness factor of curve `m \in [0, 0.5]`.
00013 %      diff_p                 : exponent `p \in [1/100, 100]`
00014 %
00015 % See also diffusivity_exponential_derivative().
00016 %
00017 % generated fields of diffusivity:
00018 %     epsilon: upper bound on diffusivity value
00019 %     K: vector with diffusivity values
00020 
00021 % glob column check
00022 if params.debug
00023   if ~isempty(glob) && size(glob,1) < size(glob,2)
00024     warning('coordinates in variable glob are given row-wise, but expected them to be column-wise');
00025     if params.debug > 2
00026       keyboard;
00027     end
00028   end
00029 end
00030 
00031 diffusivity.K = params.diff_k0;
00032 if params.diff_m ~= 0
00033   diffusivity.K = diffusivity.K + params.diff_m * real(real(U).^params.diff_p);
00034 end
00035 
00036 diffusivity.epsilon = max(diffusivity.K);
00037 
00038 if params.debug
00039   if ( params.diff_m ~= 0 && params.diff_p < 1 && min(U) - eps < 0 )
00040                                     %(max(U)+eps > 1 || min(U) - eps < 0 ) )
00041     error('U is outside admissable bounds (>0)');
00042   end
00043   if ( max(abs(imag(U))) > 1e-6 )
00044     error('U has non-trivial imaginary addend.')
00045   end
00046 end
00047 
00048 if params.decomp_mode>0
00049   error('function is nonlinear and does not support affine decomposition!');
00050 end
00051 
 All Classes Namespaces Files Functions Variables