rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
init_values_blobs.m
1 function U0 = init_values_blobs(glob,params)
2 %function U0 = init_values_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 % u_0 = beta*exp(-gamma*((x-0.25).^2+(y-0.5).^2))* Xi(B_r) ...
7 % + (1-beta)*exp(-gamma*((x-0.25).^2+(y-0.7).^2))* Xi(B_r)
8 % required fields:
9 % radius : radius of blob-cutoff circle
10 % gamma : spread of initial-value gaussian
11 % beta : value between 0 and 1 weighting two gauss-blobs
12 % in 'coefficient' mode the model_data structure is empty
13 
14 % Martin Drohmann 23.9.2009
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 
26 decomp_mode = params.decomp_mode;
27 
28 if decomp_mode == 2
29  U0 = [params.beta, 1-params.beta];
30 else
31  X = glob(:,1);
32  Y = glob(:,2);
33 
34  B1 = ((X(:)-0.25).^2+(Y(:)-0.5).^2);
35  B2 = ((X(:)-0.25).^2+(Y(:)-0.7).^2);
36  I1 = (B1<params.radius.^2);
37  I2 = (B2<params.radius.^2);
38  if decomp_mode == 0
39  U0 = params.beta*exp(-params.gamma*B1).*I1 ...
40  + (1-params.beta)* exp(-params.gamma*B2).*I2;
41  elseif decomp_mode == 1
42  if ismember('gamma',params.mu_names) || ...
43  ismember('radius',params.mu_names)
44  error('affine decomp with respect to mu_names not possible!');
45  end;
46  % two components
47  U0{1} = exp(-params.gamma*B1).*I1;
48  U0{2} = exp(-params.gamma*B2).*I2;
49  end
50 end
51 %| \docupdate