rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
init_values_homogeneous.m
1 function U0 = init_values_homogeneous(glob,params)
2 %function U0 = init_values_homogeneous(glob,params)
3 %
4 % function constructing the initial values of the convection diffusion
5 % problem in the specified global points glob and parameters.
6 % It returns a constant function scaled by a scalar params.c_init.
7 %
8 % required fields in params
9 % c_init: constant for homogeneous initial data to be returned
10 %
11 % in 'coefficient' mode the model_data structure is empty
12 
13 % Bernard Haasdonk 22.7.2006
14 
15 % glob column check
16 if params.debug
17  if ~isempty(glob) && size(glob,1) < size(glob,2)
18  warning('coordinates in variable glob are given row-wise, but expected them to be column-wise');
19  if params.debug > 2
20  keyboard;
21  end
22  end
23 end
24 if nargin ~= 2
25  error('wrong number of parameters!');
26 end;
27 
28 % affine decomposition is supported by init_data, so automatically
29 % satisfied.
30 
31 decomp_mode = params.decomp_mode;
32 
33 if decomp_mode == 2
34  U0 = params.c_init;
35 elseif decomp_mode == 0
36  U0 = params.c_init * ones(length(glob),1);
37 elseif decomp_mode == 1
38  U0 = { ones(length(glob),1) };
39 else
40  error(['decomp_mode number ', params.decomp_mode, ' is unknown.']);
41 end;
42 %| \docupdate