rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
init_values_transformed_blobs.m
1 function U0 = init_values_transformed_blobs(glob,params)
2 %function U0 = init_values_transformed_blobs(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 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.
9 %
10 % required fields in params
11 % c_init: constant for homogeneous initial data to be returned
12 % blob_height: addend to c_init for the maximum concentration of the blobs
13 %
14 % in 'coefficient' mode the model_data structure is empty
15 
16 % Martin Drohmann 23.9.2009
17 
18 % glob column check
19 if params.debug
20  if ~isempty(glob) && size(glob,1) < size(glob,2)
21  warning('coordinates in variable glob are given row-wise, but expected them to be column-wise');
22  if params.debug > 2
23  keyboard;
24  end
25  end
26 end
27 decomp_mode = params.decomp_mode;
28 
29 if any(ismember(fieldnames(params), 'blob_height'))
30  h = params.blob_height;
31 else
32  h = 0.15;
33 end
34 
35 if decomp_mode == 2
36  U0 = [1./(1:7),1] .* [ h, h, h, h, h, h, h, params.c_init];
37 else
38  X = glob(:,1);
39  Y = glob(:,2);
40  B{1} = ((X(:) - 0.5).^2 +(Y(:)-0.7).^2);
41  B{2} = ((X(:) - 0.8).^2 +(Y(:)-0.9).^2);
42  B{3} = ((X(:) - 0.8).^2 +(Y(:)-0.2).^2);
43  B{4} = ((X(:) - 0.2).^2 +(Y(:)-0.2).^2);
44  B{5} = ((X(:) - 0.2).^2 +(Y(:)-0.9).^2);
45  B{6} = ((X(:) - 0.4).^2 +(Y(:)-0.4).^2);
46  B{7} = ((X(:) - 0.6).^2 +(Y(:)-0.6).^2);
47 
48  I=cell(1,7);
49  % p(mu) = mu*(1-x)
50  % p_mu = spline_select(params);
51  for i=1:7
52  I{i} = (B{i} < 0.1.^2);
53  end
54  if decomp_mode == 0
55  U0 = params.c_init * ones(length(X),1);
56  for i = 1:7
57  U0 = U0 + 1/i .* h .* exp(-B{i}) .* I{i};
58  end
59  elseif decomp_mode == 1
60  U0 = cell(1,8);
61  U0{1} = I{1} .* exp(-B{1});
62  for i = 2:7
63  U0{i} = I{i} .* exp(-B{i});
64  end
65  U0{8} = ones(length(X),1);
66  else
67  error(['decomp_mode number ' params.decomp_mode, ' is unknown.']);
68  end
69 end
70 %| \docupdate