rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
conv_flux_linear.m
Go to the documentation of this file.
1 function [flux, lambda] = conv_flux_linear(glob,U,params)
2 %function [flux[, lambda]] = conv_flux_linear(glob,U,params)
3 % function computing the convective flux `f(u) = v u` of a convection
4 % problem.
5 %
6 % required fields of params:
7 % t : real time value in case of time-dependent flux
8 % velocity_ptr : pointer to function providing the velocity field `v`.
9 
10 % Bernard Haasdonk 4.4.2006
11 
12 % determine affine_decomposition_mode as integer
13 % glob column check
14 if params.debug
15  if ~isempty(glob) && size(glob,1) < size(glob,2)
16  warning('coordinates in variable glob are given row-wise, but expected them to be column-wise');
17  if params.debug > 2
18  keyboard;
19  end
20  end
21 end
22 decomp_mode = params.decomp_mode;
23 
24 vel = params.velocity_ptr(glob,params);
25 
26 if decomp_mode == 2 % i.e. 'coefficients'
27  flux = vel; % copy of coefficient vector from linear flux
28 elseif decomp_mode == 0 % i.e. 'none'
29  if ~isempty(vel) % otherwise size 0/0 => 0/1 !!!!!
30  flux = [vel(:,1).* U(:), vel(:,2).* U(:)];
31  lambda = 1/max(sqrt(vel(:,1).^2 + vel(:,2).^2));
32  else
33  flux = zeros(0,2);
34  lambda = 0;
35  end;
36 elseif decomp_mode == 1 % i.e. 'components'
37  flux = cell(size(vel));
38  Q = length(vel);
39  UU = [U(:),U(:)];
40  for q = 1:Q
41  flux{q}= vel{q}.*UU;
42  end;
43 end;
44 
function [ flux , lambda ] = conv_flux_linear(glob, U, params)
function computing the convective flux of a convection problem.