rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
neumann_values_rightflow.m
1 function FNneu = neumann_values_rightflow(glob,U,normals,params)
2 %function FNneu = neumann_values_rightflow(glob,U,normals,params)
3 %
4 % function computing neuman-values by pointwise evaluation.
5 %
6 % glob: columnwise coordinate vectors of global points to be evaluated
7 % Uneu: columnwise U values in points in case of a u-dependent flux
8 % normals: Columnwise corresponding unit normal vectors
9 %
10 % 'rightflow': outflow to right, noflow to upper and lower
11 %
12 % Function supports affine decomposition, i.e. different operation modes
13 % guided by optional field decomp_mode in params. See also the
14 % contents.txt for general explanation
15 
16 % Bernard Haasdonk 3.9.2009
17 
18 % determine affine_decomposition_mode as integer
19 % glob column check
20 % normals column check
21 if params.debug
22  if ~isempty(normals) && size(glob,1) < size(glob,2)
23  warning('coordinates in variable normals are given row-wise, but expected them to be column-wise');
24  if params.debug > 2
25  keyboard;
26  end
27  end
28 end
29 if params.debug
30  if ~isempty(glob) && size(glob,1) < size(glob,2)
31  warning('coordinates in variable glob are given row-wise, but expected them to be column-wise');
32  if params.debug > 2
33  keyboard;
34  end
35  end
36 end
37 decomp_mode = params.decomp_mode;
38 
39 if decomp_mode < 2
40  i = find(glob(:,1)>params.xrange(2)-eps);
41 
42  % in case of filecaching == 2, the correct velocity file must
43  % be generated!!
44  if params.filecache_velocity_matrixfile_extract == 2;
45  params.velocity_matrixfile = ...
46  cache_velocity_matrixfile_extract(...
47  glob(i,1),glob(i,2),'outflow', params);
48  end;
49  Fneu = params.conv_flux_ptr(glob(i,:),U(i,:),params);
50 
51 end;
52 if decomp_mode == 0 % none
53 
54  FNneu = zeros(size(glob,1),1);
55  FNneu(i) = Fneu(:,1).*normals(i,1) + Fneu(:,2).*normals(i,2);
56 elseif decomp_mode == 1 % components
57  Q_Fneu = length(Fneu);
58  FNneu = cell(Q_Fneu,1);
59  FNneu{:} = zeros(size(glob,1),1);
60  for q = 1:Q_Fneu
61  FNneu{q}(i) = Fneu{q}(:,1).*normals(i,1) + Fneu{q}(:,2).*normals(i,2);
62  end;
63  % check dependency on xrange
64  if ismember('xrange',params.mu_names)
65  error('affine decomp with respect to mu_names not possible!');
66  end;
67 else % decomp_mode == 2 -> coefficients
68  Fneu = params.conv_flux_ptr([],[],params);
69  FNneu = Fneu; % simple identical coefficients!
70 end;
71 %| \docupdate