1 function U0 = init_values_bars(glob,params)
2 %
function U0 = init_values_bars(glob,params)
4 %
function constructing the initial values of the convection diffusion
5 % problem in the specified global points glob and parameters.
6 % It returns an initial data
function that is mosly homogeneous with several
7 % (seven) blob like structures of higher concentration that drops exponentially
8 % away from their centres.
10 % required fields in params
11 % c_init: constant
for homogeneous initial data to be returned
13 % in
'coefficient' mode the model_data structure is empty
15 % Martin Drohmann 23.9.2009
19 if ~isempty(glob) && size(glob,1) < size(glob,2)
20 warning('coordinates in variable glob are given row-wise, but expected them to be column-wise');
26 decomp_mode = params.decomp_mode;
28 if ~isfield(params, 'bars_width')
29 params.bars_width = 0.10;
33 U0 = [params.c_init, [1, 1/2, 1/3, 1/4, 1/5]*0.5];
37 offset1 = 1.1-params.bars_width/2;
38 offset2 = 1.1+params.bars_width/2;
40 U0 = params.c_init * ones(length(X),1);
41 Uleft = zeros(size(X));
43 % U0 = U0 + 0.5/i*(X(:) > -0.123+0.2*i & X(:) < -0.077+0.2*i & Y(:) < 0.5);
44 Uleft = Uleft + 0.5/i*(X > offset1-0.2*i & X < offset2-0.2*i & Y > 0.5 & X > 0.5) ...
45 + 0.5/(6-i)*(X > offset1-0.2*i & X < offset2-0.2*i & Y < 0.5 & X > 0.5);
46 % U0 = U0 + 0.5/i*(X(:) > 1.075-0.2*i & X(:) < 1.125-0.2*i & Y(:) > 0.5);
47 % U0 = U0 + 0.5/(6-i)*(X(:) > 1.075-0.2*i & X(:) < 1.125-0.2*i & Y(:) < 0.5);
49 ysize = size(Uleft, 2);
50 xsize = size(Uleft, 1);
52 Uright(xsize:-1:1, ysize:-1:1) = Uleft;
53 U0 = U0 + Uleft(:) + Uright(:) + 0.5/3 * (X==0.5);
54 elseif decomp_mode == 1
56 U0{1} = ones(length(X),1);
60 Uleft{i} = zeros(size(X));
63 Uleft{i} = Uleft{i} + ...
64 (X > offset1-0.2*i & X < offset2-0.2*i & Y > 0.5 & X > 0.5);
65 Uleft{6-i} = Uleft{6-i} + ...
66 (X > offset1-0.2*i & X < offset2-0.2*i & Y < 0.5 & X > 0.5);
68 ysize = size(Uleft{1}, 2);
69 xsize = size(Uleft{1}, 1);
71 Uright{i}(xsize:-1:1, ysize:-1:1) = Uleft{i};
74 U0{i+1} = Uleft{i}(:) + Uright{i}(:);
76 U0{4} = U0{4} + 0.5/3 * (X==0.5);
78 error([
'decomp_mode number ' decomp_mode,
' is unknown.']);