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`
8 % a velocity field is used, which is computed from an
9 % elliptic problem
for the pressure by compute_pressure_gdl2() (some
10 % gdl-elements in a row, Neumann-0 and dirichlet conditions between
11 % 4 and 1
for the pressure, linear decreasing along the channel)
12 % (reasonable domain
'[0,1e-3] x [0,0.25e-3]')
15 % Bernard Haasdonk 4.4.2006
19 if ~isempty(glob) && size(glob,1) < size(glob,2)
20 warning('coordinates in variable glob are given row-wise, but expected them to be column-wise');
27 % determine affine_decomposition_mode as integer
28 decomp_mode = params.decomp_mode;
39 % load pressure from file and generate velocity field
40 p = load(fullfile(rbmatlabhome,'datafunc','data','gdl_pressure2.mat'),...
42 [ux, uy] = evaluate_gradient(X,Y,p.p,p.params);
44 % lin_flux = cellfun(@(X,Y)([-X*params.lambda, -Y*params.lambda]), ...
45 % ux, uy, 'UniformOutput', false);
47 lin_flux = [-ux*params.lambda, -Y*params.lambda];
53 elseif decomp_mode < 2
54 % inverse of maximum absolute velocity value
55 % correct up to a constant factor
56 lambda = max(max(lin_flux))^-1;
57 if ~isempty(lin_flux) % otherwise size 0/0 => 0/1 !!!!!
58 flux = [ lin_flux(:,1).* U(:), lin_flux(:,2).* U(:) ];
66 error(
'unknown decomp_mode');
function [ flux , lambda ] = conv_flux_gdl2(glob, U, params)
Function computing the convective flux of a convection problem.