rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
init_values_wave.m
1 function U0 = init_values_wave(glob,params)
2 %function U0 = init_values_wave(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 constructs a wave of values between 0 and c_init
7 % c_init* 0.5 * (sin(freq_x * x + freq_y * y) + 1)
8 %
9 % required fields in params:
10 % c_init : maximum value in field
11 % freq_x : frequency in x-direction
12 % freq_y : frequency in y-direction
13 %
14 % in 'coefficient' mode the model_data structure is empty
15 
16 % glob column check
17 if params.debug
18  if ~isempty(glob) && size(glob,1) < size(glob,2)
19  warning('coordinates in variable glob are given row-wise, but expected them to be column-wise');
20  if params.debug > 2
21  keyboard;
22  end
23  end
24 end
25 if nargin ~= 2
26  error('wrong number of parameters!');
27 end;
28 decomp_mode = params.decomp_mode;
29 
30 if decomp_mode == 0
31  U0 = params.c_init * 0.5 * (sin(params.freq_x * glob(:,1) + ...
32  params.freq_y * glob(:,2) ) + 1 );
33 elseif decomp_mode == 1
34  % single component independent of mu_names
35  if ismember('freq_x',params.mu_names) || ...
36  ismember('freq.y',params.mu_names)
37  error('affine decomp with respect to mu_names not possible!');
38  end;
39  U0 = {0.5 * (sin(params.freq_x * glob(:,1) + ...
40  params.freq_y * glob(:,2) ) + 1 )};
41 elseif decomp_mode == 2
42  U0 = params.c_init;
43 else
44  error(['decomp_mode number ', params.decomp_mode, ' is unknown.']);
45 end;
46 
47 %| \docupdate