3 %
function computing the convective flux `f(u)` of a convection problem.
5 % required fields of params:
6 % t: real time value in
case of time-dependent flux
7 % lambda : factor
for velocity computation: `v = - \lambda \nabla p` a velocity
8 % field is used, which is computed from an elliptic problem
for the
9 % pressure by compute_pressure_gdl2() (some gdl-elements in a row,
10 % Neumann-0 and dirichlet conditions between 4 and 1
for the pressure,
11 % linear decreasing along the channel) (reasonable domain
12 %
'[0,1e-3] x [0,0.25e-3]')
13 % velocity_matrixfile: filename of the mat-file storing the velocity field
15 % optional fields of params:
16 % filecache_velocity_matrixfile_extract: a
boolean value indicating whether a
17 % cached version of the velocity field exists.
20 % Bernard Haasdonk 4.4.2006
24 if ~isempty(glob) && size(glob,1) < size(glob,2)
25 warning('coordinates in variable glob are given row-wise, but expected them to be column-wise');
32 % determine affine_decomposition_mode as integer
33 decomp_mode = params.decomp_mode;
35 if decomp_mode == 2 % i.e. 'coefficients'
36 flux = 1; % factor one for single component
38 elseif decomp_mode < 2 % i.e. 'none' or 'components'
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% loading flux matrix.
41 % load V.X: list of X-Koordinaten
42 % load V.Y: list of Y-Koordinaten
43 % load V.Vy: list of Y-component of velocity
44 % load V.Vx: list of Y-component of velocity
45 % load V.lambda: lambda for CFL computation
47 fullfn = fullfile(rbmatlabhome,'datafunc','data',...
48 params.velocity_matrixfile);
50 if ~exist(fullfn,'file') && ~cache('exist',fullfn)
51 error(['warning: velocity_matrixfile not existing. ',...
52 'Call gen_velocity_matrixfile with suitable' ...
56 % the following file extraction can be expensive, so the
57 % extraction can additionally be cached.
59 if ~params.filecache_velocity_matrixfile_extract % expensive call
60 [flux_lin.Vx, flux_lin.Vy, lambda] = ...
61 velocity_matrixfile_extract(fullfn,glob(:,1),glob(:,2));
62 elseif params.filecache_velocity_matrixfile_extract==1
64 [flux_lin.Vx, flux_lin.Vy, lambda] = ...
66 fullfn,glob(:,1),glob(:,2));
67 else % mode 2, i.e assume, that velocityfilename is set correctly to
69 % V = load_cached(fullfn);
70 V = cache('load',fullfn);
71 % find integer indices such that V.X(j)==X(i) and V.Y(j) = Y(i)
72 % if whole flux-matrix is requested
73 if ~isequal(glob(:,1),V.X(:)) || ~isequal(glob(:,2),V.Y(:))
74 error('matrixfile does not fit to requested points!');
80 % flux_lin.Vy = NaN*ones(size(X));
81 % flux_lin.Vx(i) = V.Vx(j);
82 % flux_lin.Vy(i) = V.Vy(j);
86 flux = [ flux_lin.Vx.*U(:), flux_lin.Vy.*U(:) ];
88 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end of loading flux matrix.
89 if decomp_mode == 1 % put single matrix into cell array
93 error(
'unknown decomp_mode');
function varargout = filecache_function(funcptr, varargin)
function used for file-caching other function calls.
function [ flux , lambda ] = conv_flux_velocity_matrixfile(glob, U, params)
function computing the convective flux of a convection problem.